@nebula.js/cli-build 2.0.0 → 2.3.1

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 CHANGED
@@ -3,6 +3,26 @@
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.1](https://github.com/qlik-oss/nebula.js/compare/v2.3.0...v2.3.1) (2021-12-09)
7
+
8
+ ### Bug Fixes
9
+
10
+ - **cli-build:** mitigate problem with require inside try catch blocks ([#729](https://github.com/qlik-oss/nebula.js/issues/729)) ([05abf73](https://github.com/qlik-oss/nebula.js/commit/05abf7384df2831ed32719ac22faf3f25ed6ef5c))
11
+
12
+ # [2.3.0](https://github.com/qlik-oss/nebula.js/compare/v2.2.0...v2.3.0) (2021-12-06)
13
+
14
+ **Note:** Version bump only for package @nebula.js/cli-build
15
+
16
+ # [2.2.0](https://github.com/qlik-oss/nebula.js/compare/v2.1.0...v2.2.0) (2021-11-17)
17
+
18
+ **Note:** Version bump only for package @nebula.js/cli-build
19
+
20
+ # [2.1.0](https://github.com/qlik-oss/nebula.js/compare/v2.0.0...v2.1.0) (2021-10-20)
21
+
22
+ ### Features
23
+
24
+ - **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))
25
+
6
26
  # [2.0.0](https://github.com/qlik-oss/nebula.js/compare/v2.0.0-beta.1...v2.0.0) (2021-09-30)
7
27
 
8
28
  **Note:** Version bump only for package @nebula.js/cli-build
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 achive that, you need to add a package.json file in the `/core` directory.
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,23 @@ const config = ({
83
88
  ...resolveReplacementStrings(replacementStrings),
84
89
  }),
85
90
  nodeResolve({
86
- extensions: ['.mjs', '.js', '.jsx', '.json', '.node'],
91
+ extensions,
92
+ }),
93
+ commonjs({
94
+ ignoreTryCatch: false, // Avoids problems with require() inside try catch (https://github.com/rollup/plugins/issues/1004)
87
95
  }),
88
- commonjs(),
89
96
  json(),
90
97
  babel({
91
98
  babelrc: false,
92
99
  inputSourceMap: false, // without this you get wrong source maps, but I don't know why
100
+ extensions,
93
101
  presets: [
94
102
  [
95
103
  babelPreset,
96
104
  {
97
105
  modules: false,
98
106
  targets: {
99
- browsers: ['ie 11', 'chrome 47'],
107
+ browsers: ['chrome 62'],
100
108
  },
101
109
  },
102
110
  ],
@@ -105,6 +113,7 @@ const config = ({
105
113
  }),
106
114
  sourcemaps(),
107
115
  postcss({}),
116
+ ...[typescript ? typescriptPlugin() : false],
108
117
  ...[
109
118
  mode === 'production'
110
119
  ? terser({
@@ -33,6 +33,11 @@ const options = {
33
33
  type: 'string',
34
34
  default: undefined,
35
35
  },
36
+ typescript: {
37
+ description: 'Enable typescript parsing',
38
+ type: 'boolean',
39
+ default: false,
40
+ },
36
41
  };
37
42
 
38
43
  module.exports = (yargs) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nebula.js/cli-build",
3
- "version": "2.0.0",
3
+ "version": "2.3.1",
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.14.8",
25
- "@babel/core": "7.15.0",
26
- "@babel/plugin-transform-react-jsx": "7.14.9",
27
- "@babel/preset-env": "7.15.0",
28
- "@rollup/plugin-commonjs": "20.0.0",
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.4",
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.3.6",
35
- "rollup": "2.56.3",
35
+ "postcss": "^8.4.4",
36
+ "rollup": "2.60.2",
36
37
  "rollup-plugin-babel": "4.4.0",
37
- "rollup-plugin-postcss": "4.0.1",
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.1.1"
41
+ "yargs": "17.3.0"
41
42
  },
42
- "gitHead": "9d06a875064fe1b73c1f4a4cedae515bee4b64d1"
43
+ "devDependencies": {
44
+ "tslib": "*",
45
+ "typescript": ">=4.5.2"
46
+ },
47
+ "gitHead": "2dbe30df1ecb7a89551892891474c1b46ab73977"
43
48
  }