@nebula.js/cli-build 2.3.1 → 2.6.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 +20 -0
- package/lib/build.js +25 -1
- package/lib/resolveNative.js +28 -0
- package/package.json +2 -2
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.6.1](https://github.com/qlik-oss/nebula.js/compare/v2.6.0...v2.6.1) (2022-02-25)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @nebula.js/cli-build
|
|
9
|
+
|
|
10
|
+
# [2.5.0](https://github.com/qlik-oss/nebula.js/compare/v2.4.1...v2.5.0) (2022-02-15)
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
- change carbon to reactNative ([#762](https://github.com/qlik-oss/nebula.js/issues/762)) ([4aeaa5a](https://github.com/qlik-oss/nebula.js/commit/4aeaa5aa96a51492fa3c5755957fed563bba1a80))
|
|
15
|
+
|
|
16
|
+
## [2.4.1](https://github.com/qlik-oss/nebula.js/compare/v2.4.0...v2.4.1) (2022-02-10)
|
|
17
|
+
|
|
18
|
+
**Note:** Version bump only for package @nebula.js/cli-build
|
|
19
|
+
|
|
20
|
+
# [2.4.0](https://github.com/qlik-oss/nebula.js/compare/v2.3.1...v2.4.0) (2022-02-10)
|
|
21
|
+
|
|
22
|
+
### Features
|
|
23
|
+
|
|
24
|
+
- add --carbon flag to build react-native supernova packages ([#749](https://github.com/qlik-oss/nebula.js/issues/749)) ([369844d](https://github.com/qlik-oss/nebula.js/commit/369844d722f7fa8873674d9320d7f047065211da))
|
|
25
|
+
|
|
6
26
|
## [2.3.1](https://github.com/qlik-oss/nebula.js/compare/v2.3.0...v2.3.1) (2021-12-09)
|
|
7
27
|
|
|
8
28
|
### Bug Fixes
|
package/lib/build.js
CHANGED
|
@@ -2,6 +2,7 @@ const path = require('path');
|
|
|
2
2
|
const chalk = require('chalk');
|
|
3
3
|
const readline = require('readline');
|
|
4
4
|
|
|
5
|
+
const fs = require('fs');
|
|
5
6
|
const extend = require('extend');
|
|
6
7
|
const yargs = require('yargs');
|
|
7
8
|
const rollup = require('rollup');
|
|
@@ -18,6 +19,7 @@ const commonjs = require('@rollup/plugin-commonjs');
|
|
|
18
19
|
const babelPreset = require('@babel/preset-env');
|
|
19
20
|
|
|
20
21
|
const { terser } = require('rollup-plugin-terser');
|
|
22
|
+
const resolveNative = require('./resolveNative');
|
|
21
23
|
|
|
22
24
|
const initConfig = require('./init-config');
|
|
23
25
|
|
|
@@ -28,6 +30,22 @@ const resolveReplacementStrings = (replacementStrings) => {
|
|
|
28
30
|
return replacementStrings;
|
|
29
31
|
};
|
|
30
32
|
|
|
33
|
+
const setupReactnative = (argv) => {
|
|
34
|
+
const { reactNative } = argv;
|
|
35
|
+
let reactNativePath;
|
|
36
|
+
if (reactNative) {
|
|
37
|
+
reactNativePath = argv.reactNativePath || './react-native';
|
|
38
|
+
if (!fs.existsSync(`${reactNativePath}/package.json`)) {
|
|
39
|
+
// eslint-disable-next-line no-console
|
|
40
|
+
console.warn(
|
|
41
|
+
`WARNING: No ${reactNativePath}/package.json was found. If you really intended to build a react-native version of this package, please provide one.\nOther wise, to supress this warning, omitt the --reactNative flag.`
|
|
42
|
+
);
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return { reactNative, reactNativePath };
|
|
47
|
+
};
|
|
48
|
+
|
|
31
49
|
const config = ({
|
|
32
50
|
mode = 'production',
|
|
33
51
|
format = 'umd',
|
|
@@ -36,13 +54,17 @@ const config = ({
|
|
|
36
54
|
core,
|
|
37
55
|
} = {}) => {
|
|
38
56
|
const CWD = argv.cwd || cwd;
|
|
57
|
+
const { reactNative, reactNativePath } = setupReactnative(argv);
|
|
39
58
|
let dir = CWD;
|
|
40
59
|
let pkg = require(path.resolve(CWD, 'package.json')); // eslint-disable-line
|
|
41
60
|
const corePkg = core ? require(path.resolve(core, 'package.json')) : null; // eslint-disable-line
|
|
61
|
+
pkg = reactNative ? require(path.resolve(reactNativePath, 'package.json')) : pkg; // eslint-disable-line
|
|
42
62
|
const { name, version, license, author } = pkg;
|
|
43
63
|
const { sourcemap, replacementStrings = {}, typescript } = argv;
|
|
44
64
|
|
|
45
|
-
if (
|
|
65
|
+
if (reactNative) {
|
|
66
|
+
dir = `${dir}/${reactNativePath}`;
|
|
67
|
+
} else if (corePkg) {
|
|
46
68
|
pkg = corePkg;
|
|
47
69
|
dir = core;
|
|
48
70
|
}
|
|
@@ -72,6 +94,7 @@ const config = ({
|
|
|
72
94
|
|
|
73
95
|
// stardust should always be external
|
|
74
96
|
if (!peers['@nebula.js/stardust']) {
|
|
97
|
+
// eslint-disable-next-line no-console
|
|
75
98
|
console.warn('@nebula.js/stardust should be specified as a peer dependency');
|
|
76
99
|
} else if (external.indexOf('@nebula.js/stardust') === -1) {
|
|
77
100
|
external.push('@nebula.js/stardust');
|
|
@@ -82,6 +105,7 @@ const config = ({
|
|
|
82
105
|
input: path.resolve(CWD, 'src/index'),
|
|
83
106
|
external,
|
|
84
107
|
plugins: [
|
|
108
|
+
resolveNative({ reactNative }),
|
|
85
109
|
replace({
|
|
86
110
|
'process.env.NODE_ENV': JSON.stringify(mode === 'development' ? 'development' : 'production'),
|
|
87
111
|
preventAssignment: true,
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
const path = require('path');
|
|
2
|
+
const fs = require('fs');
|
|
3
|
+
// this plugin will check if there is a corresponding .native file for the input file and output the contents of the native file
|
|
4
|
+
// This plugin should be loaded first.
|
|
5
|
+
|
|
6
|
+
module.exports = ({ reactNative }) => ({
|
|
7
|
+
async load(id) {
|
|
8
|
+
if (!reactNative) {
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
11
|
+
if (id) {
|
|
12
|
+
const parsed = path.parse(id);
|
|
13
|
+
if (parsed) {
|
|
14
|
+
if (parsed.name.length > 0) {
|
|
15
|
+
const nativeTest = `${parsed.dir}/${parsed.name}.native${parsed.ext}`;
|
|
16
|
+
try {
|
|
17
|
+
if (fs.existsSync(nativeTest)) {
|
|
18
|
+
return fs.readFileSync(nativeTest, { encoding: 'utf8', flag: 'r' });
|
|
19
|
+
}
|
|
20
|
+
} catch (err) {
|
|
21
|
+
console.log('there was a problem reading the file', nativeTest, err);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return null;
|
|
27
|
+
},
|
|
28
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nebula.js/cli-build",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.6.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "QlikTech International AB",
|
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
"tslib": "*",
|
|
45
45
|
"typescript": ">=4.5.2"
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "c06af7d8139127521baf8229406db290d7ee0b17"
|
|
48
48
|
}
|