@enact/cli 5.0.0-alpha.2 → 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.
@@ -0,0 +1,28 @@
1
+ ### Checklist
2
+
3
+ * [ ] I have read and understand the [contribution guide](http://enactjs.com/docs/developer-guide/contributing/)
4
+ * [ ] A [CHANGELOG entry](http://enactjs.com/docs/developer-guide/contributing/changelogs/) is included
5
+ * [ ] At least one test case is included for this feature or bug fix
6
+ * [ ] Documentation was added or is not needed
7
+ * [ ] This is an API breaking change
8
+
9
+ ### Issue Resolved / Feature Added
10
+ [//]: # (Describe the issue resolved or feature added by this pull request)
11
+
12
+
13
+ ### Resolution
14
+ [//]: # (Does the code work as intended?)
15
+ [//]: # (What is the impact of this change and *why* was it made?)
16
+
17
+
18
+ ### Additional Considerations
19
+ [//]: # (How should the change be tested?)
20
+ [//]: # (Are there any outstanding questions?)
21
+ [//]: # (Were any side-effects caused by the change?)
22
+
23
+
24
+ ### Links
25
+ [//]: # (Related issues, references)
26
+
27
+
28
+ ### Comments
package/CHANGELOG.md CHANGED
@@ -1,3 +1,41 @@
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)
19
+
20
+ ### pack
21
+
22
+ * Fixed `enact pack` fails on windows by excluding unnecessary file emitting from `html-webpack-plugin`.
23
+
24
+ ### test
25
+
26
+ * Fixed `enact test` fails on windows by modifying glob patterns.
27
+ * Removed `enzyme` and related modules.
28
+
29
+ ## 5.0.0-alpha.3 (April 22, 2022)
30
+
31
+ ### lint
32
+
33
+ * Fixed `enact lint` is not working on node 16 by moving ESLint plugins to dependencies.
34
+
35
+ ### test
36
+
37
+ * Fixed `--watch` option is not working by fixing the version of `jest-watch-typeahead` to `0.6.5`.
38
+
1
39
  ## 5.0.0-alpha.2 (April 15, 2022)
2
40
 
3
41
  ### create, template
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
  ...
package/commands/test.js CHANGED
@@ -151,11 +151,6 @@ function assignOverrides(config) {
151
151
  function api(args = []) {
152
152
  const config = require('../config/jest/jest.config');
153
153
 
154
- // Notify users that Enzyme is deprecated and will be removed in Enact CLI 5.0.0.
155
- console.warn(
156
- "\nWarning: 'enzyme' support is deprecated and will be removed in Enact CLI 5.0.0. Consider using '@testing-library/react' instead."
157
- );
158
-
159
154
  // @TODO: readd dotenv parse support
160
155
 
161
156
  // Watch unless on CI, in coverage mode, or explicitly running all tests
@@ -67,7 +67,7 @@ module.exports = {
67
67
  setupFilesAfterEnv: [require.resolve('./setupTests'), userSetupFile].filter(Boolean),
68
68
  testMatch: [
69
69
  '<rootDir>/**/__tests__/**/*.{js,jsx,ts,tsx}',
70
- '<rootDir>/**/?(*.)+(spec|test).[jt]s?(x)',
70
+ '<rootDir>/**/*.+(spec|test).{js,jsx,ts,tsx}',
71
71
  '<rootDir>/**/*-specs.{js,jsx,ts,tsx}'
72
72
  ],
73
73
  testPathIgnorePatterns: ignorePatterns,
@@ -85,10 +85,8 @@ module.exports = {
85
85
  ],
86
86
  moduleNameMapper: {
87
87
  '^.+\\.module\\.(css|less)$': require.resolve('identity-obj-proxy'),
88
- '^enzyme$': require.resolve('enzyme'),
89
88
  '^@testing-library/jest-dom$': require.resolve('@testing-library/jest-dom'),
90
89
  '^@testing-library/react$': require.resolve('@testing-library/react'),
91
- '^@testing-library/react-hooks$': require.resolve('@testing-library/react-hooks'),
92
90
  '^@testing-library/user-event$': require.resolve('@testing-library/user-event'),
93
91
  '^react$': require.resolve('react'),
94
92
  // Backward compatibility for new iLib location with old Enact
@@ -1,8 +1,6 @@
1
1
  /* eslint-env jest */
2
2
  const fs = require('fs');
3
3
  const path = require('path');
4
- const enzyme = require('enzyme');
5
- const Adapter = require('@wojtekmaj/enzyme-adapter-react-17');
6
4
  const {packageRoot} = require('@enact/dev-utils');
7
5
 
8
6
  const filters = [
@@ -46,10 +44,6 @@ afterEach(() => {
46
44
  expect(actual).toHaveLength(expected);
47
45
  });
48
46
 
49
- // Configure Enzyme to use React16 adapter.
50
-
51
- enzyme.configure({adapter: new Adapter()});
52
-
53
47
  // Set initial resolution to VGA, similar to PhantomJS.
54
48
  // Will ideally want to use a more modern resolution later.
55
49
 
@@ -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
@@ -354,7 +356,7 @@ module.exports = function (env, ilibAdditionalResourcesPath) {
354
356
  // by webpacks internal loaders.
355
357
  // Exclude `ejs` HTML templating language as that's handled by
356
358
  // the HtmlWebpackPlugin.
357
- exclude: [/\.(js|mjs|jsx|ts|tsx)$/, /\.html$/, /\.ejs$/, /\.json$/],
359
+ exclude: [/^$/, /\.(js|mjs|jsx|ts|tsx)$/, /\.html$/, /\.ejs$/, /\.json$/],
358
360
  type: 'asset/resource'
359
361
  }
360
362
  // ** STOP ** Are you adding a new loader?
@@ -33,7 +33,7 @@ By default, projects will build in development mode. When you're code is ready f
33
33
  ## Browser Support & Polyfills
34
34
  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:
35
35
 
36
- * >1%
36
+ * \>1%
37
37
  * last 2 versions
38
38
  * last 5 Chrome versions
39
39
  * last 5 Firefox versions
@@ -105,7 +105,7 @@ npm install --save typescript @types/react @types/react-dom @types/jest
105
105
  Optionally, [ESLint](https://eslint.org) can be installed globally or locally and configured within a project to enable linting support within the `enact lint` command.
106
106
 
107
107
  ## Isomorphic Support & Prerendering
108
- By using the isomorphic code layout option, your project bundle will be outputted in a versatile universal code format allowing potential usage outside the browser. The Enact CLI takes advantage of this mode by additionally generating an HTML output of your project and embedding it directly with the resulting **index.html**. By default, isomorphic mode will attempt to prerender only `en-US`, however with the `--locales` option, a wade variety of locales can be specified and prerendered. More details on isomorphic support and its limitations can be found [here](./isomorphic-support.md).
108
+ By using the isomorphic code layout option, your project bundle will be outputted in a versatile universal code format allowing potential usage outside the browser. The Enact CLI takes advantage of this mode by additionally generating an HTML output of your project and embedding it directly with the resulting **index.html**. By default, isomorphic mode will attempt to prerender only `en-US`, however with the `--locales` option, a wide variety of locales can be specified and prerendered. More details on isomorphic support and its limitations can be found [here](./isomorphic-support.md).
109
109
 
110
110
  ## V8 Snapshot Generation
111
111
  The v8 snapshot blob creation feature is highly experimental and temperamental depending on your code. It is considered an extension of the isomorphic code layout, bringing along all the same requirements. Given the highly-specific nature of a v8 snapshot blob being tied to particular versions of Chrome/Chromium/Electron/etc., developers must provide their own copy of the `mksnapshot` binary and have its filepath set to the `V8_MKSNAPSHOT` environment variable.
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)
@@ -18,9 +18,3 @@ All releases are published, with the default (and `latest` tag) being the curren
18
18
  ### Linux Notes
19
19
 
20
20
  When installing under Linux, it may be necessary to prefix the install command with `sudo`.
21
- Additionally, if you receive an error when the install process attempts to install PhantomJS, try
22
- the following:
23
-
24
- ```bash
25
- sudo npm install -g --unsafe-perm @enact/cli
26
- ```
@@ -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
  ...
@@ -15,7 +15,6 @@ order: 7
15
15
  The `enact test` command (aliased as `npm run test`) will activate a [Jest](https://jestjs.io/) test runner on all discovered *-specs.js files. All the complicated configuration is hidden away within Enact CLI to avoid any confusion or additional difficulty in testing source code.
16
16
 
17
17
  Internally Enact CLI supports [React Testing Library](https://testing-library.com/docs/react-testing-library/intro) out of the box, so there's no need to install them locally on your project. Simply import/require it within specs files and it'll be there. You will want to familiarize yourself with React Testing Library's utilities in order to write more complex tests.
18
- Enzyme support is deprecated and will be removed in a future major release.
19
18
 
20
19
  To create a test please create a ***-specs.js** file in the folder of the component you wish to test.
21
20