@enact/cli 5.0.0-alpha.4 → 5.0.0-alpha.5

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,4 +1,21 @@
1
- ## 5.0.0-alpha.3 (April 28, 2022)
1
+ ## 5.0.0-alpha.5 (May 31, 2022)
2
+
3
+ * Updated the `lockfileVersion` of npm-shrinkwrap file to v2.
4
+ * Updated to the latest `eslint-config-enact`, `eslint-plugin-enact`, and `@enact/dev-utils` dependency releases.
5
+
6
+ ### create, template
7
+
8
+ * Updated `@enact/template-sandstone` dependency.
9
+
10
+ ### lint
11
+
12
+ * Updated Enact ESLint config to `4.1.0` including replacing deprecated modules and updated lint rules.
13
+
14
+ ### test
15
+
16
+ * Replaced `@testing-library/react-hooks` to `@testing-library/react` for React 18 support.
17
+
18
+ ## 5.0.0-alpha.4 (April 28, 2022)
2
19
 
3
20
  ### pack
4
21
 
package/README.md CHANGED
@@ -68,6 +68,7 @@ The @enact/cli tool will check the project's **package.json** looking for an opt
68
68
  * `ri` _[object]_ - Resolution independence options to be forwarded to the [LESS plugin](https://github.com/enactjs/less-plugin-resolution-independence). By default, will use any preset for a specified theme or fallback to sandstone.
69
69
  * `screenTypes` _[array|string]_ - Array of 1 or more screentype definitions to be used with prerender HTML initialization. Can alternatively reference a json filepath to read for screentype definitions. By default, will use any preset for a specified theme or fallback to sandstone.
70
70
  * `nodeBuiltins` _[object]_ - Configuration settings for polyfilling NodeJS built-ins. See `node` [webpack option](https://webpack.js.org/configuration/node/).
71
+ * `resolveFallback` _[object]_ - Configuration settings for redirecting module requests when normal resolving fails. See `resolve.fallback` [webpack option](https://webpack.js.org/configuration/resolve/#resolvefallback).
71
72
  * `externalStartup` _[boolean]_ - Flag whether to externalize the startup/update js that is normally inlined within prerendered app HTML output.
72
73
  * `forceCSSModules` _[boolean]_ - Flag whether to force all LESS/CSS to be processed in a modular context (not just the `*.module.css` and `*.module.less` files).
73
74
  * `deep` _[string|array]_ - 1 or more JavaScript conditions that, when met, indicate deeplinking and any prerender should be discarded.
@@ -81,10 +82,10 @@ For example:
81
82
  ...
82
83
  "enact": {
83
84
  "theme": "sandstone",
84
- "nodeBuiltins": {
85
- fs: 'empty',
86
- net: 'empty',
87
- tls: 'empty'
85
+ "resolveFallback": {
86
+ fs: false,
87
+ net: false,
88
+ tls: false
88
89
  }
89
90
  }
90
91
  ...
@@ -87,7 +87,6 @@ module.exports = {
87
87
  '^.+\\.module\\.(css|less)$': require.resolve('identity-obj-proxy'),
88
88
  '^@testing-library/jest-dom$': require.resolve('@testing-library/jest-dom'),
89
89
  '^@testing-library/react$': require.resolve('@testing-library/react'),
90
- '^@testing-library/react-hooks$': require.resolve('@testing-library/react-hooks'),
91
90
  '^@testing-library/user-event$': require.resolve('@testing-library/user-event'),
92
91
  '^react$': require.resolve('react'),
93
92
  // Backward compatibility for new iLib location with old Enact
@@ -258,7 +258,9 @@ module.exports = function (env, ilibAdditionalResourcesPath) {
258
258
  // and old apps referencing old iLib location with new Enact
259
259
  alias: fs.existsSync(path.join(app.context, 'node_modules', '@enact', 'i18n', 'ilib'))
260
260
  ? Object.assign({ilib: '@enact/i18n/ilib'}, app.alias)
261
- : Object.assign({'@enact/i18n/ilib': 'ilib'}, app.alias)
261
+ : Object.assign({'@enact/i18n/ilib': 'ilib'}, app.alias),
262
+ // Optional configuration for redirecting module requests.
263
+ fallback: app.resolveFallback
262
264
  },
263
265
  // @remove-on-eject-begin
264
266
  // Resolve loaders (webpack plugins for CSS, images, transpilation) from the
package/docs/index.md CHANGED
@@ -16,3 +16,4 @@ The following sections describe its installation and usage:
16
16
  * [Ejecting Apps](./ejecting-apps.md)
17
17
  * [Template Management](./template-management.md)
18
18
  * [Developing a Custom Template](./developing-a-template.md)
19
+ * [Measuring Performance](./measuring-performance.md)
@@ -0,0 +1,64 @@
1
+ ---
2
+ title: Measuring Performance
3
+ order: 11
4
+ ---
5
+ By default, an app generated from `enact create` with Enact CLI includes a performance relayer that allows you to measure and analyze
6
+ the performance of your application using different metrics.
7
+
8
+ To measure any of the supported metrics, you only need to pass a function into the `reportWebVitals`
9
+ function in `index.js`:
10
+
11
+ ```js
12
+ reportWebVitals(console.log);
13
+ ```
14
+
15
+ This function is fired when the final values for any of the metrics have finished calculating on the
16
+ page. You can use it to log any of the results to the console or send to a particular endpoint.
17
+
18
+ ## Web Vitals
19
+
20
+ [Web Vitals](https://web.dev/vitals/) are a set of useful metrics that aim to capture the user
21
+ experience of a web page. In Create React App, a third-party library is used to measure these
22
+ metrics ([web-vitals](https://github.com/GoogleChrome/web-vitals)).
23
+
24
+ To understand more about the object returned to the function when a metric value is calculated,
25
+ refer to the [documentation](https://github.com/GoogleChrome/web-vitals/#types). The [Browser
26
+ Support](https://github.com/GoogleChrome/web-vitals/#browser-support) section also explains which browsers are supported.
27
+
28
+ ## Sending results to analytics
29
+
30
+ With the `reportWebVitals` function, you can send any of results to an analytics endpoint to measure and track real user performance on your site. For example:
31
+
32
+ ```js
33
+ function sendToAnalytics(metric) {
34
+ const body = JSON.stringify(metric);
35
+ const url = 'https://example.com/analytics';
36
+
37
+ // Use `navigator.sendBeacon()` if available, falling back to `fetch()`
38
+ if (navigator.sendBeacon) {
39
+ navigator.sendBeacon(url, body);
40
+ } else {
41
+ fetch(url, { body, method: 'POST', keepalive: true });
42
+ }
43
+ }
44
+
45
+ reportWebVitals(sendToAnalytics);
46
+ ```
47
+
48
+ > **Note:** If you use Google Analytics, use the `id` value to make it easier to construct metric distributions manually (to calculate percentiles, etc…).
49
+ >
50
+ > ```js
51
+ > function sendToAnalytics({ id, name, value }) {
52
+ > ga('send', 'event', {
53
+ > eventCategory: 'Web Vitals',
54
+ > eventAction: name,
55
+ > eventValue: Math.round(name === 'CLS' ? value * 1000 : value), // values must be integers
56
+ > eventLabel: id, // id unique to current page load
57
+ > nonInteraction: true, // avoids affecting bounce rate
58
+ > });
59
+ > }
60
+ >
61
+ > reportWebVitals(sendToAnalytics);
62
+ > ```
63
+ >
64
+ > Read more about sending results to Google Analytics [here](https://github.com/GoogleChrome/web-vitals#send-the-results-to-google-analytics).
@@ -29,6 +29,7 @@ The @enact/cli tool will check the project's **package.json** looking for an opt
29
29
  * `ri` _[object]_ - Resolution independence options to be forwarded to the [LESS plugin](https://github.com/enactjs/less-plugin-resolution-independence). By default, will use any preset for a specified theme or fallback to sandstone.
30
30
  * `screenTypes` _[array|string]_ - Array of 1 or more screentype definitions to be used with prerender HTML initialization. Can alternatively reference a json filepath to read for screentype definitions. By default, will use any preset for a specified theme or fallback to sandstone.
31
31
  * `nodeBuiltins` _[object]_ - Configuration settings for polyfilling NodeJS built-ins. See `node` [webpack option](https://webpack.js.org/configuration/node/).
32
+ * `resolveFallback` _[object]_ - Configuration settings for redirecting module requests when normal resolving fails. See `resolve.fallback` [webpack option](https://webpack.js.org/configuration/resolve/#resolvefallback).
32
33
  * `externalStartup` _[boolean]_ - Flag whether to externalize the startup/update js that is normally inlined within prerendered app HTML output.
33
34
  * `forceCSSModules` _[boolean]_ - Flag whether to force all LESS/CSS to be processed in a modular context (not just the `*.module.css` and `*.module.less` files).
34
35
  * `deep` _[string|array]_ - 1 or more JavaScript conditions that, when met, indicate deeplinking and any prerender should be discarded.
@@ -41,10 +42,10 @@ For example:
41
42
  ...
42
43
  "enact": {
43
44
  "theme": "sandstone",
44
- "nodeBuiltins": {
45
- fs: 'empty',
46
- net: 'empty',
47
- tls: 'empty'
45
+ "resolveFallback": {
46
+ fs: false,
47
+ net: false,
48
+ tls: false
48
49
  }
49
50
  }
50
51
  ...