@enact/cli 6.1.1 → 7.0.0-alpha.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
@@ -1,3 +1,17 @@
1
+ ## 7.0.0-alpha.1 (July 24, 2024)
2
+
3
+ * Updated the minimum version of Node to `18.12.0`.
4
+ * Updated all dependencies to the latest including `webpack-dev-server` version 5 and `@testing-library/react` version 15.
5
+
6
+ ### pack
7
+
8
+ * Updated `css-loader` to 7.x and changed `css-loader` options to restore 6.x behavior.
9
+ * Added `--no-animation` option to build without effects such as animation and shadow.
10
+
11
+ ## 6.1.2 (March 13, 2024)
12
+
13
+ * Updated docs to cover the latest commands of `enact pack`.
14
+
1
15
  ## 6.1.1 (March 5, 2024)
2
16
 
3
17
  * Updated dependencies.
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(' <commana-separated-values> Locale list');
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/');
@@ -49,6 +49,7 @@ function displayHelp() {
49
49
  console.log(' (requires V8_MKSNAPSHOT set)');
50
50
  console.log(' -m, --meta JSON to override package.json enact metadata');
51
51
  console.log(' -c, --custom-skin Build with a custom skin');
52
+ console.log(' --no-animation Build without effects such as animation and shadow');
52
53
  console.log(' --stats Output bundle analysis file');
53
54
  console.log(' --verbose Verbose log build details');
54
55
  console.log(' -v, --version Display version information');
@@ -63,7 +64,6 @@ function displayHelp() {
63
64
  --externals-public Remote public path to the external framework for use injecting into HTML
64
65
  --externals-polyfill Flag whether to use external polyfill (or include in framework build)
65
66
  --ilib-additional-path Specify iLib additional resources path
66
- --no-animation Build without effects such as animation and shadow
67
67
  */
68
68
  process.exit(0);
69
69
  }
package/commands/serve.js CHANGED
@@ -95,12 +95,17 @@ function hotDevServer(config, fastRefresh) {
95
95
  }
96
96
 
97
97
  function devServerConfig(host, port, protocol, publicPath, proxy, allowedHost) {
98
- let https = false;
98
+ let server = {
99
+ type: 'http'
100
+ };
99
101
  const {SSL_CRT_FILE, SSL_KEY_FILE} = process.env;
100
102
  if (protocol === 'https' && [SSL_CRT_FILE, SSL_KEY_FILE].every(f => f && fs.existsSync(f))) {
101
- https = {
102
- cert: fs.readFileSync(SSL_CRT_FILE),
103
- key: fs.readFileSync(SSL_KEY_FILE)
103
+ server = {
104
+ type: 'https',
105
+ options: {
106
+ cert: fs.readFileSync(SSL_CRT_FILE),
107
+ key: fs.readFileSync(SSL_KEY_FILE)
108
+ }
104
109
  };
105
110
  }
106
111
  const disableFirewall = !proxy || process.env.DANGEROUSLY_DISABLE_HOST_CHECK === 'true';
@@ -126,7 +131,7 @@ function devServerConfig(host, port, protocol, publicPath, proxy, allowedHost) {
126
131
  // want to allow setting the allowedHosts manually for more complex setups
127
132
  allowedHosts: disableFirewall ? 'all' : [allowedHost],
128
133
  // Enable HTTPS if the HTTPS environment variable is set to 'true'
129
- https,
134
+ server,
130
135
  host,
131
136
  port,
132
137
  // Allow cross-origin HTTP requests
@@ -296,7 +301,7 @@ function serve(config, host, port, open) {
296
301
 
297
302
  ['SIGINT', 'SIGTERM'].forEach(sig => {
298
303
  process.on(sig, () => {
299
- devServer.close();
304
+ devServer.stopCallback(() => {});
300
305
  process.exit();
301
306
  });
302
307
  });
@@ -304,7 +309,7 @@ function serve(config, host, port, open) {
304
309
  if (process.env.CI !== 'true') {
305
310
  // Gracefully exit when stdin ends
306
311
  process.stdin.on('end', () => {
307
- devServer.close();
312
+ devServer.stopCallback(() => {});
308
313
  process.exit();
309
314
  });
310
315
  }
package/config/dotenv.js CHANGED
@@ -22,7 +22,7 @@ module.exports = {
22
22
  .map(env => path.join(context, env))
23
23
  .forEach(env => {
24
24
  if (fs.existsSync(env)) {
25
- expand(dotenv.config({path: env}));
25
+ expand(dotenv.config({path: env, processEnv: {}}));
26
26
  }
27
27
  });
28
28
  }
@@ -99,11 +99,22 @@ module.exports = function (
99
99
  // from them won't be in the main CSS file.
100
100
  // When INLINE_STYLES env var is set, instead of MiniCssExtractPlugin, uses
101
101
  // `style` loader to dynamically inline CSS in style tags at runtime.
102
+ const mergedCssLoaderOptions = {
103
+ ...cssLoaderOptions,
104
+ modules: {
105
+ ...cssLoaderOptions.modules,
106
+ // Options to restore 6.x behavior:
107
+ // https://github.com/webpack-contrib/css-loader/blob/master/CHANGELOG.md#700-2024-04-04
108
+ namedExport: false,
109
+ exportLocalsConvention: 'as-is'
110
+ }
111
+ };
112
+
102
113
  const loaders = [
103
114
  process.env.INLINE_STYLES ? require.resolve('style-loader') : MiniCssExtractPlugin.loader,
104
115
  {
105
116
  loader: require.resolve('css-loader'),
106
- options: Object.assign({sourceMap: shouldUseSourceMap}, cssLoaderOptions, {
117
+ options: Object.assign({sourceMap: shouldUseSourceMap}, mergedCssLoaderOptions, {
107
118
  url: {
108
119
  filter: url => {
109
120
  // Don't handle absolute path urls
@@ -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
- <comma-separated-values> Locale list
18
- <JSON-filepath> - Read locales from JSON file
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,19 @@ 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
29
+ --no-animation Build without effects such as animation and shadow
27
30
  --stats Output bundle analysis file
31
+ --verbose Verbose log build details
32
+ -v, --version Display version information
33
+ -h, --help Display help information
28
34
 
29
35
  ```
30
36
  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
37
 
32
38
  ## Production Mode
33
- By default, projects will build in development mode. When you're 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.
39
+ 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
40
 
35
41
  ## Browser Support & Polyfills
36
42
  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:
@@ -219,6 +225,10 @@ my-app/
219
225
  webos-meta/
220
226
  ```
221
227
 
228
+ ## Build without Effects
229
+
230
+ To accommodate devices with lower performance, the Enact CLI offers the `--no-animation` option. This option disables animations and graphical effects, including shadows. When activated, it sets the `ENACT_PACK_NO_ANIMATION` environment variable. This variable allows UI libraries like Sandstone to conditionally disable effects. Additionally, you can leverage this variable in your application to achieve the same outcome. Thus, you can develop an app devoid of these effects and do so without modifying your codebase.
231
+
222
232
  ## Caching
223
233
 
224
234
  For supporting better [`caching`](https://webpack.js.org/guides/caching/), Enact CLI provides `--content-hash` option to add a unique hash to each output file name based on the content of an asset.
@@ -249,3 +259,25 @@ Similar to the [`enact serve`](./serving-apps.md) command, the watcher will buil
249
259
 
250
260
  ## Stats Analysis
251
261
  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.
262
+
263
+ ## Override Metadata
264
+ 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).
265
+ You can use the `--meta` flag to input a JSON string that overrides the `enact` metadata in package.json.
266
+
267
+ Here's an example of how to use the `--meta` flag:
268
+
269
+ ```bash
270
+ enact pack --meta='{"title":"myapp"}'
271
+ ```
272
+
273
+ This command has the same effect as adding the following to your package.json:
274
+
275
+ ```json
276
+ {
277
+ ...
278
+ "enact": {
279
+ "title": "myapp"
280
+ }
281
+ ...
282
+ }
283
+ ```
@@ -21,7 +21,7 @@ Enact CLI uses [http-proxy-middleware](https://github.com/chimurai/http-proxy-mi
21
21
  This feature can be configured in the project's **package.json** within the `enact` object's `proxy` property.
22
22
 
23
23
  For example:
24
- ```js
24
+ ```json
25
25
  {
26
26
  ...
27
27
  "enact": {
@@ -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
- ```js
41
+ ```json
42
42
  {
43
43
  ...
44
44
  "enact": {