Skip to content

Commit af65a43

Browse files
authored
Output library assets in /lib/ paths (#2002)
1 parent 57e66a7 commit af65a43

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+144
-163
lines changed

.circleci/config.yml

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ jobs:
3737
root: '.'
3838
paths:
3939
- packages/*/dist
40+
- packages/*/lib
4041
- packages/*/src/generated
4142

4243
lint:

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ yarn-error.log
2020
# Blueprint
2121
build
2222
dist
23+
lib
2324
generated
2425
coverage
2526
/docs

packages/core/karma.conf.js

+2-9
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,6 @@ module.exports = function (config) {
2424
});
2525
config.set(baseConfig);
2626
config.set({
27-
webpack: Object.assign({}, baseConfig.webpack, {
28-
entry: {
29-
core: [
30-
path.resolve(__dirname, "test/index.ts"),
31-
path.resolve(__dirname, "dist/blueprint.css"),
32-
],
33-
},
34-
}),
35-
})
27+
// overrides here
28+
});
3629
};

packages/core/package.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22
"name": "@blueprintjs/core",
33
"version": "1.35.0",
44
"description": "Core styles & components",
5-
"main": "dist/index.js",
6-
"module": "dist/esm/index.js",
7-
"typings": "dist/esm/index.d.ts",
8-
"style": "dist/blueprint.css",
5+
"main": "lib/cjs/index.js",
6+
"module": "lib/esm/index.js",
7+
"typings": "lib/esm/index.d.ts",
8+
"style": "lib/css/blueprint.css",
99
"unpkg": "dist/core.bundle.js",
1010
"scripts": {
1111
"compile": "npm-run-all -p 'compile:*'",
1212
"compile:esm": "tsc -p ./src",
1313
"compile:cjs": "tsc -p ./src/tsconfig.cjs.json",
1414
"compile:css": "sass-compile ./src",
15-
"clean": "rm -rf dist/*",
15+
"clean": "rm -rf dist/* && rm -rf lib/*",
1616
"dev": "npm-run-all -p 'compile:esm -- --watch' 'compile:css -- --watch'",
1717
"dist": "npm-run-all -s 'dist:*'",
1818
"dist:bundle": "NODE_ENV=production webpack",

packages/core/src/docs/variables.md

+7-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,13 @@
33
Available for use with Sass and Less.
44

55
```css.scss
6-
@import "path/to/@blueprintjs/core/dist/variables";
6+
// Sass
7+
@import "path/to/@blueprintjs/core/lib/scss/variables";
8+
```
9+
10+
```css.less
11+
// Less
12+
@import "path/to/@blueprintjs/core/lib/less/variables";
713
```
814

915
The Sass `$` convention is used in this documentation for consistency with the original source code.

packages/core/src/tsconfig.cjs.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
"extends": "./tsconfig",
33
"compilerOptions": {
44
"module": "commonjs",
5-
"outDir": "../dist"
5+
"outDir": "../lib/cjs"
66
}
77
}

packages/core/src/tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"extends": "../../../config/tsconfig.base",
33
"compilerOptions": {
4-
"outDir": "../dist/esm"
4+
"outDir": "../lib/esm"
55
}
66
}

packages/core/test/isotest.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55

66
const { generateIsomorphicTests } = require("@blueprintjs/test-commons");
77
const React = require("react");
8-
// TODO: get this to work with require("@std/esm")(module)("../dist/esm")
9-
const Core = require("../dist");
8+
// TODO: get this to work with require("@std/esm")(module)("../lib/esm")
9+
const Core = require("../lib/cjs");
1010

1111
const tooltipContent = { content: React.createElement("h1", {}, "content") };
1212
const customProps = {

packages/datetime/karma.conf.js

+4-10
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,15 @@
44

55
const { createKarmaConfig } = require("@blueprintjs/karma-build-scripts");
66
const path = require("path");
7+
const coreManifest = require("../core/package.json");
8+
const packageManifest = require("./package.json");
79

810
module.exports = function (config) {
911
const baseConfig = createKarmaConfig({
1012
dirname: __dirname,
1113
});
1214
config.set(baseConfig);
1315
config.set({
14-
webpack: Object.assign({}, baseConfig.webpack, {
15-
entry: {
16-
datetime: [
17-
path.resolve(__dirname, "test/index.ts"),
18-
path.resolve(__dirname, "../core/dist/blueprint.css"),
19-
path.resolve(__dirname, "dist/blueprint-datetime.css"),
20-
],
21-
},
22-
}),
23-
})
16+
// overrides here
17+
});
2418
};

packages/datetime/package.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22
"name": "@blueprintjs/datetime",
33
"version": "1.25.1",
44
"description": "Components for interacting with dates and times",
5-
"main": "dist/index.js",
6-
"module": "dist/esm/index.js",
7-
"typings": "dist/esm/index.d.ts",
8-
"style": "dist/blueprint-datetime.css",
5+
"main": "lib/cjs/index.js",
6+
"module": "lib/esm/index.js",
7+
"typings": "lib/esm/index.d.ts",
8+
"style": "lib/css/blueprint-datetime.css",
99
"unpkg": "dist/datetime.bundle.js",
1010
"scripts": {
1111
"compile": "npm-run-all -p 'compile:*'",
1212
"compile:esm": "tsc -p ./src",
1313
"compile:cjs": "tsc -p ./src/tsconfig.cjs.json",
1414
"compile:css": "sass-compile ./src",
15-
"clean": "rm -rf dist/*",
15+
"clean": "rm -rf dist/* && rm -rf lib/*",
1616
"dev": "npm-run-all -p 'compile:esm -- --watch' 'compile:css -- --watch'",
1717
"dist": "npm-run-all -s 'dist:*'",
1818
"dist:bundle": "NODE_ENV=production webpack",

packages/datetime/src/tsconfig.cjs.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
"extends": "./tsconfig",
33
"compilerOptions": {
44
"module": "commonjs",
5-
"outDir": "../dist"
5+
"outDir": "../lib/cjs"
66
}
77
}

packages/datetime/src/tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"extends": "../../../config/tsconfig.base",
33
"compilerOptions": {
4-
"outDir": "../dist/esm"
4+
"outDir": "../lib/esm"
55
}
66
}

packages/datetime/test/isotest.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
const { generateIsomorphicTests } = require("@blueprintjs/test-commons");
77
const React = require("react");
8-
const DateTime = require("../dist");
8+
const DateTime = require("../lib/cjs");
99

1010
describe("DateTime isomorphic rendering", () => {
1111
generateIsomorphicTests(

packages/docs-app/src/blueprint.md

+11-8
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ Blueprint as well. Some Blueprint components use the following ES2015 features:
8181
...
8282
<!-- include dependencies manually -->
8383
<link href="path/to/node_modules/normalize.css/normalize.css" rel="stylesheet" />
84-
<link href="path/to/node_modules/@blueprintjs/core/dist/blueprint.css" rel="stylesheet" />
84+
<link href="path/to/node_modules/@blueprintjs/core/lib/css/blueprint.css" rel="stylesheet" />
8585
...
8686
</head>
8787
...
@@ -101,7 +101,8 @@ Blueprint supports the venerable [unpkg CDN](https://unpkg.com). Each package pr
101101
library on the `Blueprint` global variable: `Blueprint.Core`, `Blueprint.Datetime`, etc.
102102

103103
These bundles _do not include_ external dependencies; your application will need to ensure that
104-
`normalize.css`, `React`, `classnames`, and `Tether` are available at runtime.
104+
`normalize.css`, `react`, `react-dom`, `react-transition-group`, `classnames`, `popper.js`, and
105+
`react-popper`are available at runtime.
105106

106107
```html
107108
<!DOCTYPE html>
@@ -110,16 +111,18 @@ These bundles _do not include_ external dependencies; your application will need
110111
<meta charset="utf-8">
111112
<meta name="viewport" content="width=device-width">
112113
<title>Blueprint Starter Kit</title>
113-
<link href="https://unpkg.com/normalize.css@^4.1.1" rel="stylesheet" />
114-
<link href="https://unpkg.com/@blueprintjs/core@^1.11.0/dist/blueprint.css" rel="stylesheet" />
114+
<link href="https://unpkg.com/normalize.css@^7.0.0" rel="stylesheet" />
115+
<link href="https://unpkg.com/@blueprintjs/core@^2.0.0/lib/css/blueprint.css" rel="stylesheet" />
115116
</head>
116117
<body>
117118
<script src="https://unpkg.com/classnames@^2.2"></script>
118119
<script src="https://unpkg.com/dom4@^1.8"></script>
119-
<script src="https://unpkg.com/tether@^1.4"></script>
120-
<script src="https://unpkg.com/react@^15.3.1/dist/react-with-addons.min.js"></script>
121-
<script src="https://unpkg.com/react-dom@^15.3.1/dist/react-dom.min.js"></script>
122-
<script src="https://unpkg.com/@blueprintjs/core@^1.11.0"></script>
120+
<script src="https://unpkg.com/react@^16.2.0/umd/react.production.min.js"></script>
121+
<script src="https://unpkg.com/react-dom@^16.2.0/umd/react-dom.production.min.js"></script>
122+
<script src="https://unpkg.com/react-transition-group@^2.2.1/dist/react-transition-group.min.js"></script>
123+
<script src="https://unpkg.com/popper.js@^1.12.6/dist/umd/popper.js"></script>
124+
<script src="https://unpkg.com/react-popper@~0.7.4/dist/react-popper.min.js"></script>
125+
<script src="https://unpkg.com/@blueprintjs/core@^2.0.0"></script>
123126

124127
<div id="btn"></div>
125128
<script>

packages/docs-app/src/examples/datetime-examples/timePickerExample.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { PrecisionSelect } from "./common/precisionSelect";
1111

1212
import { TimePicker, TimePickerPrecision } from "@blueprintjs/datetime";
1313
// tslint:disable-next-line:no-submodule-imports
14-
import { getDefaultMaxTime, getDefaultMinTime } from "@blueprintjs/datetime/dist/esm/timePicker";
14+
import { getDefaultMaxTime, getDefaultMinTime } from "@blueprintjs/datetime/lib/esm/timePicker";
1515

1616
export interface ITimePickerExampleState {
1717
precision?: TimePickerPrecision;

packages/docs-app/src/index.scss

+8-8
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@
44
@import "~normalize.css/normalize.css";
55

66
// import these first because they're the base layer
7-
@import "~@blueprintjs/core/dist/blueprint.css";
8-
@import "~@blueprintjs/datetime/dist/blueprint-datetime.css";
9-
@import "~@blueprintjs/icons/dist/blueprint-icons.css";
10-
@import "~@blueprintjs/labs/dist/blueprint-labs.css";
11-
@import "~@blueprintjs/select/dist/blueprint-select.css";
12-
@import "~@blueprintjs/table/dist/table.css";
13-
@import "~@blueprintjs/timezone/dist/blueprint-timezone.css";
7+
@import "~@blueprintjs/core/lib/css/blueprint.css";
8+
@import "~@blueprintjs/datetime/lib/css/blueprint-datetime.css";
9+
@import "~@blueprintjs/icons/lib/css/blueprint-icons.css";
10+
@import "~@blueprintjs/labs/lib/css/blueprint-labs.css";
11+
@import "~@blueprintjs/select/lib/css/blueprint-select.css";
12+
@import "~@blueprintjs/table/lib/css/table.css";
13+
@import "~@blueprintjs/timezone/lib/css/blueprint-timezone.css";
1414

1515
// then the docs theme styles
16-
@import "~@blueprintjs/docs-theme/dist/docs-theme.css";
16+
@import "~@blueprintjs/docs-theme/lib/css/docs-theme.css";
1717
@import "~@blueprintjs/docs-theme/src/styles/variables";
1818

1919
// then our own styles

packages/docs-theme/package.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22
"name": "@blueprintjs/docs-theme",
33
"version": "1.3.0",
44
"description": "Blueprint theme for documentalist",
5-
"main": "dist/index.js",
6-
"module": "dist/esm/index.js",
7-
"typings": "dist/esm/index.d.ts",
8-
"style": "dist/docs-theme.css",
5+
"main": "lib/cjs/index.js",
6+
"module": "lib/esm/index.js",
7+
"typings": "lib/esm/index.d.ts",
8+
"style": "lib/css/docs-theme.css",
99
"unpkg": "dist/docs-theme.bundle.js",
1010
"scripts": {
1111
"compile": "npm-run-all -p 'compile:*'",
1212
"compile:esm": "tsc -p ./src",
1313
"compile:cjs": "tsc -p ./src/tsconfig.cjs.json",
1414
"compile:css": "sass-compile ./src",
15-
"clean": "rm -rf dist/*",
15+
"clean": "rm -rf dist/* && rm -rf lib/*",
1616
"dev": "npm-run-all -p 'compile:esm -- --watch' 'compile:css -- --watch'",
1717
"dist": "npm-run-all -s 'dist:*'",
1818
"dist:bundle": "NODE_ENV=production webpack",

packages/docs-theme/src/tsconfig.cjs.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
"extends": "./tsconfig",
33
"compilerOptions": {
44
"module": "commonjs",
5-
"outDir": "../dist"
5+
"outDir": "../lib/cjs"
66
}
77
}

packages/docs-theme/src/tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"extends": "../../../config/tsconfig.base",
33
"compilerOptions": {
4-
"outDir": "../dist/esm"
4+
"outDir": "../lib/esm"
55
}
66
}

packages/icons/package.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@
22
"name": "@blueprintjs/icons",
33
"version": "1.0.0",
44
"description": "Components, fonts, icons, and css files for creating and displaying icons.",
5-
"main": "dist/index.js",
6-
"module": "dist/esm/index.js",
7-
"typings": "dist/esm/index.d.ts",
8-
"style": "dist/blueprint-icons.css",
5+
"main": "lib/cjs/index.js",
6+
"module": "lib/esm/index.js",
7+
"typings": "lib/esm/index.d.ts",
8+
"style": "lib/css/blueprint-icons.css",
99
"unpkg": "dist/icons.bundle.js",
1010
"scripts": {
1111
"compile": "npm-run-all -s 'compile:pre' -p 'compile:*'",
1212
"compile:pre": "generate-icons-source",
1313
"compile:esm": "tsc -p ./src",
1414
"compile:cjs": "tsc -p ./src/tsconfig.cjs.json",
1515
"compile:css": "sass-compile ./src",
16-
"clean": "rm -rf dist/*",
16+
"clean": "rm -rf dist/* && rm -rf lib/*",
1717
"dev": "npm-run-all -p 'compile:esm -- --watch' 'compile:css -- --watch'",
1818
"dist": "npm-run-all -s 'dist:*'",
1919
"dist:bundle": "NODE_ENV=production webpack",

packages/icons/src/_font-imports.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
@import "font-face";
55

6-
$icon-font-path: "../resources/icons" !default;
6+
$icon-font-path: "../../resources/icons" !default;
77
$icon-font-formats: eot woff ttf !default;
88

99
@include font-face("Icons16", "#{$icon-font-path}/icons-16", $file-formats: $icon-font-formats);

packages/icons/src/tsconfig.cjs.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
"extends": "./tsconfig",
33
"compilerOptions": {
44
"module": "commonjs",
5-
"outDir": "../dist"
5+
"outDir": "../lib/cjs"
66
}
77
}

packages/icons/src/tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"extends": "../../../config/tsconfig.base",
33
"compilerOptions": {
4-
"outDir": "../dist/esm"
4+
"outDir": "../lib/esm"
55
}
66
}

packages/icons/test/isotest.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
const { generateIsomorphicTests } = require("@blueprintjs/test-commons");
77
const React = require("react");
8-
const Icons = require("../dist");
8+
const Icons = require("../lib/cjs");
99

1010
describe("Icons isomorphic rendering", () => {
1111
generateIsomorphicTests(

packages/karma-build-scripts/createKarmaConfig.js

+13-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44

55
const path = require("path");
66
const webpack = require("webpack");
7-
const webpackConfig = require("./webpack.karma.config");
7+
const coreManifest = require("../core/package.json");
8+
const webpackBuildScripts = require("@blueprintjs/webpack-build-scripts");
89

910
const COVERAGE_PERCENT = 80;
1011
const COVERAGE_PERCENT_HIGH = 90;
@@ -16,6 +17,8 @@ const KARMA_SERVER_PORT = 9876;
1617
* @param coverageOverrides { [glob: string]: object }
1718
*/
1819
module.exports = function createKarmaConfig({ dirname, coverageExcludes, coverageOverrides }) {
20+
const packageManifest = require(`${dirname}/package.json`);
21+
1922
return {
2023
basePath: dirname,
2124
browserNoActivityTimeout: 100000,
@@ -57,7 +60,8 @@ module.exports = function createKarmaConfig({ dirname, coverageExcludes, coverag
5760
pattern: path.join(dirname, "resources/**/*"),
5861
watched: false,
5962
},
60-
path.join(dirname, "dist/**/*.css"),
63+
path.join(dirname, `../core/${coreManifest.style}`),
64+
path.join(dirname, packageManifest.style),
6165
path.join(dirname, "test/index.ts"),
6266
],
6367
frameworks: ["mocha", "chai", "phantomjs-shim", "sinon"],
@@ -71,7 +75,13 @@ module.exports = function createKarmaConfig({ dirname, coverageExcludes, coverag
7175
},
7276
reporters: ["mocha", "coverage"],
7377
singleRun: true,
74-
webpack: webpackConfig,
78+
webpack: Object.assign({}, webpackBuildScripts.karmaConfig, {
79+
entry: {
80+
testIndex: [
81+
path.resolve(dirname, "test/index.ts"),
82+
],
83+
},
84+
}),
7585
webpackMiddleware: {
7686
noInfo: true,
7787
stats: {

packages/karma-build-scripts/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"test": "exit 0"
77
},
88
"dependencies": {
9+
"@blueprintjs/webpack-build-scripts": "^0.3.0",
910
"istanbul-instrumenter-loader": "^3.0.0",
1011
"karma": "^1.7.1",
1112
"karma-chai": "^0.1.0",

0 commit comments

Comments
 (0)