@enact/cli 6.1.1 → 6.1.3
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 +8 -0
- package/commands/pack.js +5 -2
- package/config/webpack.config.js +14 -2
- package/docs/building-apps.md +31 -4
- package/docs/serving-apps.md +1 -1
- package/docs/starting-a-new-app.md +1 -1
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/commands/pack.js
CHANGED
|
@@ -38,7 +38,7 @@ function displayHelp() {
|
|
|
38
38
|
console.log(' -i, --isomorphic Use isomorphic code layout');
|
|
39
39
|
console.log(' (includes prerendering)');
|
|
40
40
|
console.log(' -l, --locales Locales for isomorphic mode; one of:');
|
|
41
|
-
console.log(' <
|
|
41
|
+
console.log(' <comma-separated-values> Locale list');
|
|
42
42
|
console.log(' <JSON-filepath> - Read locales from JSON file');
|
|
43
43
|
console.log(' "none" - Disable locale-specific handling');
|
|
44
44
|
console.log(' "used" - Detect locales used within ./resources/');
|
|
@@ -58,6 +58,7 @@ function displayHelp() {
|
|
|
58
58
|
Private Options:
|
|
59
59
|
--entry Specify an override entrypoint
|
|
60
60
|
--no-minify Will skip minification during production build
|
|
61
|
+
--no-split-css Will not split CSS into separate files
|
|
61
62
|
--framework Builds the @enact/*, react, and react-dom into an external framework
|
|
62
63
|
--externals Specify a local directory path to the standalone external framework
|
|
63
64
|
--externals-public Remote public path to the external framework for use injecting into HTML
|
|
@@ -258,6 +259,7 @@ function api(opts = {}) {
|
|
|
258
259
|
opts['content-hash'],
|
|
259
260
|
opts.isomorphic,
|
|
260
261
|
!opts.animation,
|
|
262
|
+
!opts['split-css'],
|
|
261
263
|
opts.framework,
|
|
262
264
|
opts['ilib-additional-path']
|
|
263
265
|
);
|
|
@@ -289,6 +291,7 @@ function cli(args) {
|
|
|
289
291
|
'content-hash',
|
|
290
292
|
'custom-skin',
|
|
291
293
|
'minify',
|
|
294
|
+
'split-css',
|
|
292
295
|
'framework',
|
|
293
296
|
'externals-corejs',
|
|
294
297
|
'stats',
|
|
@@ -301,7 +304,7 @@ function cli(args) {
|
|
|
301
304
|
'help'
|
|
302
305
|
],
|
|
303
306
|
string: ['externals', 'externals-public', 'locales', 'entry', 'ilib-additional-path', 'output', 'meta'],
|
|
304
|
-
default: {minify: true, animation: true},
|
|
307
|
+
default: {minify: true, 'split-css': true, animation: true},
|
|
305
308
|
alias: {
|
|
306
309
|
o: 'output',
|
|
307
310
|
p: 'production',
|
package/config/webpack.config.js
CHANGED
|
@@ -45,6 +45,7 @@ module.exports = function (
|
|
|
45
45
|
contentHash = false,
|
|
46
46
|
isomorphic = false,
|
|
47
47
|
noAnimation = false,
|
|
48
|
+
noSplitCSS = false,
|
|
48
49
|
framework = false,
|
|
49
50
|
ilibAdditionalResourcesPath
|
|
50
51
|
) {
|
|
@@ -451,7 +452,17 @@ module.exports = function (
|
|
|
451
452
|
parallel: true
|
|
452
453
|
}),
|
|
453
454
|
new CssMinimizerPlugin()
|
|
454
|
-
]
|
|
455
|
+
],
|
|
456
|
+
splitChunks: noSplitCSS && {
|
|
457
|
+
cacheGroups: {
|
|
458
|
+
styles: {
|
|
459
|
+
name: 'main',
|
|
460
|
+
type: 'css/mini-extract',
|
|
461
|
+
chunks: 'all',
|
|
462
|
+
enforce: true
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
}
|
|
455
466
|
},
|
|
456
467
|
plugins: [
|
|
457
468
|
// Generates an `index.html` file with the js and css tags injected.
|
|
@@ -495,7 +506,8 @@ module.exports = function (
|
|
|
495
506
|
!process.env.INLINE_STYLES &&
|
|
496
507
|
new MiniCssExtractPlugin({
|
|
497
508
|
filename: contentHash ? '[name].[contenthash].css' : '[name].css',
|
|
498
|
-
chunkFilename: contentHash ? 'chunk.[name].[contenthash].css' : 'chunk.[name].css'
|
|
509
|
+
chunkFilename: contentHash ? 'chunk.[name].[contenthash].css' : 'chunk.[name].css',
|
|
510
|
+
ignoreOrder: noSplitCSS
|
|
499
511
|
}),
|
|
500
512
|
// Webpack5 removed node polyfills but we need this to run screenshot tests
|
|
501
513
|
new NodePolyfillPlugin(),
|
package/docs/building-apps.md
CHANGED
|
@@ -8,14 +8,15 @@ order: 4
|
|
|
8
8
|
enact pack [options]
|
|
9
9
|
|
|
10
10
|
Options
|
|
11
|
+
-o, --output Specify an output directory
|
|
11
12
|
--content-hash Add a unique hash to output file names based on the content of an asset
|
|
13
|
+
-w, --watch Rebuild on file changes
|
|
12
14
|
-p, --production Build in production mode
|
|
13
15
|
-i, --isomorphic Use isomorphic code layout
|
|
14
16
|
(includes prerendering)
|
|
15
|
-
-w, --watch Rebuild on file changes
|
|
16
17
|
-l, --locales Locales for isomorphic mode; one of:
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
[comma-separated-values] Locale list
|
|
19
|
+
[JSON-filepath] - Read locales from JSON file
|
|
19
20
|
"none" - Disable locale-specific handling
|
|
20
21
|
"used" - Detect locales used within ./resources/
|
|
21
22
|
"tv" - Locales supported on webOS TV
|
|
@@ -23,14 +24,18 @@ order: 4
|
|
|
23
24
|
"all" - All locales that iLib supports
|
|
24
25
|
-s, --snapshot Generate V8 snapshot blob
|
|
25
26
|
(requires V8_MKSNAPSHOT set)
|
|
27
|
+
-m, --meta JSON to override package.json enact metadata
|
|
26
28
|
-c, --custom-skin Build with a custom skin
|
|
27
29
|
--stats Output bundle analysis file
|
|
30
|
+
--verbose Verbose log build details
|
|
31
|
+
-v, --version Display version information
|
|
32
|
+
-h, --help Display help information
|
|
28
33
|
|
|
29
34
|
```
|
|
30
35
|
Run within an Enact project's source code, the `enact pack` command (aliased as `npm run pack` or `npm run pack-p` for production) will process and bundle the js, css, and asset files into the `./dist` directory. An **index.html** file will be dynamically generated.
|
|
31
36
|
|
|
32
37
|
## Production Mode
|
|
33
|
-
By default, projects will build in development mode. When
|
|
38
|
+
By default, projects will build in development mode. When your code is ready for deployment you can build in production mode. Production mode will minify the source code and remove dead code, along with numerous other minor code optimization strategies.
|
|
34
39
|
|
|
35
40
|
## Browser Support & Polyfills
|
|
36
41
|
The Enact CLI is designed to be compatible with a wide array of browsers and devices. [Browserslist standard](https://github.com/browserslist/browserslist) is used to handle targeting, with Enact's defaults being:
|
|
@@ -249,3 +254,25 @@ Similar to the [`enact serve`](./serving-apps.md) command, the watcher will buil
|
|
|
249
254
|
|
|
250
255
|
## Stats Analysis
|
|
251
256
|
The Bundle analysis file option uses the popular [webpack-bundle-analyzer](https://github.com/webpack-contrib/webpack-bundle-analyzer) to create a visual representation of the project build to **stats.html**, showing the full module hierarchy arranged by output size. This can be very useful in determining where bloat is coming from or finding dependencies that may have been included by mistake.
|
|
257
|
+
|
|
258
|
+
## Override Metadata
|
|
259
|
+
The @enact/cli tool inspects the `enact` object in the project's package.json for [customization options](./starting-a-new-app.md#enact-project-settings).
|
|
260
|
+
You can use the `--meta` flag to input a JSON string that overrides the `enact` metadata in package.json.
|
|
261
|
+
|
|
262
|
+
Here's an example of how to use the `--meta` flag:
|
|
263
|
+
|
|
264
|
+
```bash
|
|
265
|
+
enact pack --meta='{"title":"myapp"}'
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
This command has the same effect as adding the following to your package.json:
|
|
269
|
+
|
|
270
|
+
```json
|
|
271
|
+
{
|
|
272
|
+
...
|
|
273
|
+
"enact": {
|
|
274
|
+
"title": "myapp"
|
|
275
|
+
}
|
|
276
|
+
...
|
|
277
|
+
}
|
|
278
|
+
```
|
package/docs/serving-apps.md
CHANGED
|
@@ -38,7 +38,7 @@ The @enact/cli tool will check the project's **package.json** looking for an opt
|
|
|
38
38
|
* `proxy` _[string]_ - Proxy target during project `serve` to be used within the [http-proxy-middleware](https://github.com/chimurai/http-proxy-middleware).
|
|
39
39
|
|
|
40
40
|
For example:
|
|
41
|
-
```
|
|
41
|
+
```json
|
|
42
42
|
{
|
|
43
43
|
...
|
|
44
44
|
"enact": {
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@enact/cli",
|
|
3
|
-
"version": "6.1.
|
|
3
|
+
"version": "6.1.3",
|
|
4
4
|
"lockfileVersion": 2,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@enact/cli",
|
|
9
|
-
"version": "6.1.
|
|
9
|
+
"version": "6.1.3",
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@babel/plugin-transform-modules-commonjs": "^7.23.3",
|