@nebula.js/cli-build 2.0.0-beta.1 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/README.md +13 -1
- package/lib/build.js +10 -3
- package/lib/init-config.js +5 -0
- package/package.json +17 -12
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,24 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [2.3.0](https://github.com/qlik-oss/nebula.js/compare/v2.2.0...v2.3.0) (2021-12-06)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @nebula.js/cli-build
|
|
9
|
+
|
|
10
|
+
# [2.2.0](https://github.com/qlik-oss/nebula.js/compare/v2.1.0...v2.2.0) (2021-11-17)
|
|
11
|
+
|
|
12
|
+
**Note:** Version bump only for package @nebula.js/cli-build
|
|
13
|
+
|
|
14
|
+
# [2.1.0](https://github.com/qlik-oss/nebula.js/compare/v2.0.0...v2.1.0) (2021-10-20)
|
|
15
|
+
|
|
16
|
+
### Features
|
|
17
|
+
|
|
18
|
+
- **build:** add typescript support in build ([#683](https://github.com/qlik-oss/nebula.js/issues/683)) ([f8c7201](https://github.com/qlik-oss/nebula.js/commit/f8c7201149d7f80f875a029a79b4d739e924dcc8))
|
|
19
|
+
|
|
20
|
+
# [2.0.0](https://github.com/qlik-oss/nebula.js/compare/v2.0.0-beta.1...v2.0.0) (2021-09-30)
|
|
21
|
+
|
|
22
|
+
**Note:** Version bump only for package @nebula.js/cli-build
|
|
23
|
+
|
|
6
24
|
# [2.0.0-beta.1](https://github.com/qlik-oss/nebula.js/compare/v1.7.0...v2.0.0-beta.1) (2021-09-21)
|
|
7
25
|
|
|
8
26
|
### Features
|
package/README.md
CHANGED
|
@@ -24,6 +24,7 @@ Options:
|
|
|
24
24
|
--mode Explicitly set mode
|
|
25
25
|
[string] [choices: "production", "development"]
|
|
26
26
|
--core Set a core build target [string] [default: "core"]
|
|
27
|
+
--typescript Enable typescript bundling [boolean] [default: false]
|
|
27
28
|
```
|
|
28
29
|
|
|
29
30
|
## Example
|
|
@@ -42,6 +43,7 @@ In the config file, build properties:
|
|
|
42
43
|
- Sourcemap
|
|
43
44
|
- Mode
|
|
44
45
|
- Core
|
|
46
|
+
- Typescript
|
|
45
47
|
|
|
46
48
|
The following code in a config file demonstrates an example to set the nebula build configuration.
|
|
47
49
|
|
|
@@ -61,6 +63,7 @@ module.exports = {
|
|
|
61
63
|
sourcemap,
|
|
62
64
|
mode,
|
|
63
65
|
core: 'core',
|
|
66
|
+
typescript: true,
|
|
64
67
|
},
|
|
65
68
|
};
|
|
66
69
|
```
|
|
@@ -106,7 +109,7 @@ nebula build --mode production
|
|
|
106
109
|
|
|
107
110
|
You can export only the esm bundle by adding --core parameter.
|
|
108
111
|
|
|
109
|
-
To
|
|
112
|
+
To achieve that, you need to add a package.json file in the `/core` directory.
|
|
110
113
|
In the package.json file, a `module` field which specifies the output file
|
|
111
114
|
from the build is required:
|
|
112
115
|
|
|
@@ -138,3 +141,12 @@ Tips:
|
|
|
138
141
|
In the package.json file, the main field makes sure that Node users using require
|
|
139
142
|
can be served the umd version. The module field is a common convention to designate
|
|
140
143
|
how to import an esm version of your code.
|
|
144
|
+
|
|
145
|
+
### Typescript
|
|
146
|
+
|
|
147
|
+
With this option you can enable typescript bundling of your code. Add a `tsconfig.json`
|
|
148
|
+
file to configure typescript to your own preferences.
|
|
149
|
+
|
|
150
|
+
```sh
|
|
151
|
+
nebula build --typescript
|
|
152
|
+
```
|
package/lib/build.js
CHANGED
|
@@ -10,6 +10,7 @@ const postcss = require('rollup-plugin-postcss');
|
|
|
10
10
|
const replace = require('@rollup/plugin-replace');
|
|
11
11
|
const sourcemaps = require('rollup-plugin-sourcemaps');
|
|
12
12
|
const jsxPlugin = require('@babel/plugin-transform-react-jsx');
|
|
13
|
+
const typescriptPlugin = require('@rollup/plugin-typescript');
|
|
13
14
|
const json = require('@rollup/plugin-json');
|
|
14
15
|
const { nodeResolve } = require('@rollup/plugin-node-resolve');
|
|
15
16
|
const commonjs = require('@rollup/plugin-commonjs');
|
|
@@ -39,7 +40,7 @@ const config = ({
|
|
|
39
40
|
let pkg = require(path.resolve(CWD, 'package.json')); // eslint-disable-line
|
|
40
41
|
const corePkg = core ? require(path.resolve(core, 'package.json')) : null; // eslint-disable-line
|
|
41
42
|
const { name, version, license, author } = pkg;
|
|
42
|
-
const { sourcemap, replacementStrings = {} } = argv;
|
|
43
|
+
const { sourcemap, replacementStrings = {}, typescript } = argv;
|
|
43
44
|
|
|
44
45
|
if (corePkg) {
|
|
45
46
|
pkg = corePkg;
|
|
@@ -54,6 +55,10 @@ const config = ({
|
|
|
54
55
|
|
|
55
56
|
const auth = typeof author === 'object' ? `${author.name} <${author.email}>` : author || '';
|
|
56
57
|
const moduleName = name.split('/').reverse()[0];
|
|
58
|
+
const extensions = ['.mjs', '.js', '.jsx', '.json', '.node'];
|
|
59
|
+
if (typescript) {
|
|
60
|
+
extensions.push('.tsx', '.ts');
|
|
61
|
+
}
|
|
57
62
|
|
|
58
63
|
const banner = `/*
|
|
59
64
|
* ${name} v${version}
|
|
@@ -83,20 +88,21 @@ const config = ({
|
|
|
83
88
|
...resolveReplacementStrings(replacementStrings),
|
|
84
89
|
}),
|
|
85
90
|
nodeResolve({
|
|
86
|
-
extensions
|
|
91
|
+
extensions,
|
|
87
92
|
}),
|
|
88
93
|
commonjs(),
|
|
89
94
|
json(),
|
|
90
95
|
babel({
|
|
91
96
|
babelrc: false,
|
|
92
97
|
inputSourceMap: false, // without this you get wrong source maps, but I don't know why
|
|
98
|
+
extensions,
|
|
93
99
|
presets: [
|
|
94
100
|
[
|
|
95
101
|
babelPreset,
|
|
96
102
|
{
|
|
97
103
|
modules: false,
|
|
98
104
|
targets: {
|
|
99
|
-
browsers: ['
|
|
105
|
+
browsers: ['chrome 62'],
|
|
100
106
|
},
|
|
101
107
|
},
|
|
102
108
|
],
|
|
@@ -105,6 +111,7 @@ const config = ({
|
|
|
105
111
|
}),
|
|
106
112
|
sourcemaps(),
|
|
107
113
|
postcss({}),
|
|
114
|
+
...[typescript ? typescriptPlugin() : false],
|
|
108
115
|
...[
|
|
109
116
|
mode === 'production'
|
|
110
117
|
? terser({
|
package/lib/init-config.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nebula.js/cli-build",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "QlikTech International AB",
|
|
@@ -21,23 +21,28 @@
|
|
|
21
21
|
"lint": "eslint src"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@babel/cli": "7.
|
|
25
|
-
"@babel/core": "7.
|
|
26
|
-
"@babel/plugin-transform-react-jsx": "7.
|
|
27
|
-
"@babel/preset-env": "7.
|
|
28
|
-
"@rollup/plugin-commonjs": "
|
|
24
|
+
"@babel/cli": "7.16.0",
|
|
25
|
+
"@babel/core": "7.16.0",
|
|
26
|
+
"@babel/plugin-transform-react-jsx": "7.16.0",
|
|
27
|
+
"@babel/preset-env": "7.16.4",
|
|
28
|
+
"@rollup/plugin-commonjs": "21.0.1",
|
|
29
29
|
"@rollup/plugin-json": "4.1.0",
|
|
30
|
-
"@rollup/plugin-node-resolve": "13.0.
|
|
30
|
+
"@rollup/plugin-node-resolve": "13.0.6",
|
|
31
31
|
"@rollup/plugin-replace": "3.0.0",
|
|
32
|
+
"@rollup/plugin-typescript": "8.3.0",
|
|
32
33
|
"chalk": "4.1.2",
|
|
33
34
|
"extend": "3.0.2",
|
|
34
|
-
"postcss": "^8.
|
|
35
|
-
"rollup": "2.
|
|
35
|
+
"postcss": "^8.4.4",
|
|
36
|
+
"rollup": "2.60.2",
|
|
36
37
|
"rollup-plugin-babel": "4.4.0",
|
|
37
|
-
"rollup-plugin-postcss": "4.0.
|
|
38
|
+
"rollup-plugin-postcss": "4.0.2",
|
|
38
39
|
"rollup-plugin-sourcemaps": "0.6.3",
|
|
39
40
|
"rollup-plugin-terser": "7.0.2",
|
|
40
|
-
"yargs": "17.
|
|
41
|
+
"yargs": "17.3.0"
|
|
41
42
|
},
|
|
42
|
-
"
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"tslib": "*",
|
|
45
|
+
"typescript": ">=4.5.2"
|
|
46
|
+
},
|
|
47
|
+
"gitHead": "db408ff3d6013a4558dbb9be24ae1188c1e78d44"
|
|
43
48
|
}
|