@elliemae/pui-cli 6.0.0-beta.35 → 6.0.0-beta.39

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.
@@ -24,10 +24,15 @@ exports.logSuccess = (...args) => console.log(chalk.green(...args));
24
24
  exports.logError = console.error;
25
25
 
26
26
  const readPackageLock = async () => {
27
- const appPkgLockFile = path.join(process.cwd(), 'package-lock.json');
28
- const pkgLockJSON = await readFile(appPkgLockFile, 'utf8');
29
- const { dependencies } = JSON.parse(pkgLockJSON);
30
- return (moduleName) => dependencies[moduleName]?.version || '';
27
+ try {
28
+ const appPkgLockFile = path.join(process.cwd(), 'package-lock.json');
29
+ const pkgLockJSON = await readFile(appPkgLockFile, 'utf8');
30
+ const { dependencies } = JSON.parse(pkgLockJSON);
31
+ return (moduleName) => dependencies[moduleName]?.version || '';
32
+ } catch (err) {
33
+ console.warn('Package lock file not found');
34
+ return () => '';
35
+ }
31
36
  };
32
37
 
33
38
  const getSupportedBrowsers = async () => {
@@ -0,0 +1,61 @@
1
+ const { exit } = require('yargs');
2
+ const { exec, logError, logSuccess } = require('./utils');
3
+
4
+ const { CI = false } = process.env;
5
+
6
+ async function test(commandOptions) {
7
+ await exec(`cross-env FORCE_COLOR=true vitest ${commandOptions}`);
8
+ }
9
+
10
+ // eslint-disable-next-line max-statements
11
+ async function handler(argv) {
12
+ let commandOptions = '--coverage';
13
+ if (argv.fix) commandOptions = '-u';
14
+ else if (argv.watch) commandOptions = '--watch';
15
+ if (argv.p) commandOptions += ' --passWithNoTests';
16
+ if (argv.r) commandOptions += ' --related';
17
+ if (argv.s) commandOptions += ' --silent';
18
+ try {
19
+ if (CI) {
20
+ await exec('rimraf ./reports');
21
+ }
22
+
23
+ // eslint-disable-next-line jest/valid-title, jest/no-disabled-tests, jest/expect-expect
24
+ await test(commandOptions);
25
+ logSuccess('Unit test execution completed');
26
+ } catch (err) {
27
+ logError('Unit test execution failed', err);
28
+ exit(-1, err);
29
+ return -1;
30
+ }
31
+ return 0;
32
+ }
33
+
34
+ exports.command = 'vitest [options]';
35
+
36
+ exports.describe = 'unit tests application code using vitest';
37
+
38
+ exports.builder = {
39
+ fix: {
40
+ alias: 'f',
41
+ type: 'boolean',
42
+ },
43
+ watch: {
44
+ alias: 'w',
45
+ type: 'boolean',
46
+ },
47
+ passWithNoTests: {
48
+ alias: 'p',
49
+ type: 'boolean',
50
+ },
51
+ related: {
52
+ alias: 'r',
53
+ type: 'boolean',
54
+ },
55
+ silent: {
56
+ alias: 's',
57
+ type: 'boolean',
58
+ },
59
+ };
60
+
61
+ exports.handler = handler;
@@ -4,6 +4,7 @@ const webpackConfig = require('../../webpack/webpack.prod.babel');
4
4
 
5
5
  exports.baseExtends = [
6
6
  'plugin:eslint-comments/recommended',
7
+ 'plugin:import/recommended',
7
8
  'plugin:prettier/recommended',
8
9
  'plugin:jest/recommended',
9
10
  'plugin:jsdoc/recommended',
@@ -12,7 +13,8 @@ exports.baseExtends = [
12
13
  'plugin:storybook/recommended',
13
14
  ];
14
15
 
15
- const basePlugins = ['testing-library', 'jest', 'jsdoc', 'wdio'];
16
+ const basePlugins = ['testing-library', 'jest', 'jsdoc', 'wdio', 'import'];
17
+ exports.basePlugins = basePlugins;
16
18
 
17
19
  exports.baseOverrides = [
18
20
  {
@@ -1,7 +1,8 @@
1
- const { baseExtends } = require('../common');
1
+ const { baseExtends, basePlugins } = require('../common');
2
2
 
3
3
  exports.tsBaseExtends = [
4
4
  'plugin:@typescript-eslint/recommended',
5
+ 'plugin:import/typescript',
5
6
  'plugin:@typescript-eslint/recommended-requiring-type-checking',
6
7
  ].concat(baseExtends);
7
8
 
@@ -24,6 +25,7 @@ exports.tsBaseRules = {
24
25
  exports.tsBaseConfig = {
25
26
  files: ['*.ts', '*.tsx'],
26
27
  parser: '@typescript-eslint/parser',
28
+ plugins: ['@typescript-eslint'].concat(basePlugins),
27
29
  parserOptions: {
28
30
  tsconfigRootDir: process.cwd(),
29
31
  project: 'tsconfig.json',
@@ -34,5 +36,8 @@ exports.tsBaseConfig = {
34
36
  alwaysTryTypes: true,
35
37
  },
36
38
  },
39
+ 'import/parsers': {
40
+ '@typescript-eslint/parser': ['.ts', '.tsx'],
41
+ },
37
42
  },
38
43
  };
@@ -4,7 +4,7 @@ const { tsBaseExtends, tsBaseRules, tsBaseConfig } = require('./common');
4
4
 
5
5
  exports.tsConfig = {
6
6
  ...tsBaseConfig,
7
- extends: ['airbnb-typescript/base'].concat(tsBaseExtends),
7
+ extends: ['airbnb-base', 'airbnb-typescript/base'].concat(tsBaseExtends),
8
8
  rules: {
9
9
  ...baseRules,
10
10
  ...tsBaseRules,
@@ -4,7 +4,12 @@ const { tsBaseExtends, tsBaseRules, tsBaseConfig } = require('./common');
4
4
 
5
5
  exports.tsReactConfig = {
6
6
  ...tsBaseConfig,
7
- extends: ['airbnb-typescript'].concat(tsBaseExtends),
7
+ extends: [
8
+ 'airbnb',
9
+ 'airbnb/hooks',
10
+ 'plugin:redux-saga/recommended',
11
+ 'airbnb-typescript',
12
+ ].concat(tsBaseExtends),
8
13
  rules: {
9
14
  ...baseRules,
10
15
  ...tsBaseRules,
@@ -3,11 +3,17 @@
3
3
  */
4
4
  export default () => {
5
5
  Object.defineProperty(window, 'matchMedia', {
6
- value: () => ({
6
+ writable: true,
7
+ value: jest.fn().mockImplementation((query) => ({
7
8
  matches: false,
8
- addListener: () => {},
9
- removeListener: () => {},
10
- }),
9
+ media: query,
10
+ onchange: null,
11
+ addListener: jest.fn(), // Deprecated
12
+ removeListener: jest.fn(), // Deprecated
13
+ addEventListener: jest.fn(),
14
+ removeEventListener: jest.fn(),
15
+ dispatchEvent: jest.fn(),
16
+ })),
11
17
  });
12
18
 
13
19
  Object.defineProperty(window, 'getComputedStyle', {
@@ -0,0 +1,8 @@
1
+ /// <reference types="vitest" />
2
+ import { defineConfig } from 'vite';
3
+
4
+ export default defineConfig({
5
+ test: {
6
+ environment: 'jsdom',
7
+ },
8
+ });
@@ -72,6 +72,7 @@ const devConfig = {
72
72
 
73
73
  // Add development plugins
74
74
  plugins: [
75
+ new webpack.ProgressPlugin(),
75
76
  new webpack.HotModuleReplacementPlugin(), // Tell webpack we want hot reloading
76
77
  new ReactRefreshWebpackPlugin({
77
78
  overlay: {
@@ -79,6 +80,7 @@ const devConfig = {
79
80
  },
80
81
  }),
81
82
  new HtmlWebpackPlugin({
83
+ scriptLoading: 'module',
82
84
  inject: !isAppLoaderEnabled(), // Inject all files that are generated by webpack, e.g. bundle.js
83
85
  template: !isAppLoaderEnabled()
84
86
  ? 'app/index.html'
@@ -28,6 +28,7 @@ module.exports = require('./webpack.lib.base.babel')({
28
28
  // Add development plugins
29
29
  plugins: [
30
30
  new HtmlWebpackPlugin({
31
+ scriptLoading: 'module',
31
32
  inject: true, // Inject all files that are generated by webpack, e.g. bundle.js
32
33
  template: 'lib/index.pug',
33
34
  filename: 'index.html',
@@ -39,6 +39,7 @@ module.exports = require('./webpack.lib.base.babel')({
39
39
  plugins: [
40
40
  // Minify and optimize the index.html
41
41
  new HtmlWebpackPlugin({
42
+ scriptLoading: 'module',
42
43
  template: 'lib/index.pug',
43
44
  filename: 'index.html',
44
45
  libraryName,
@@ -102,6 +102,7 @@ const {
102
102
  encwLoaderScriptPath,
103
103
  } = getPaths();
104
104
  const htmlWebpackPlugin = new HtmlWebpackPlugin({
105
+ scriptLoading: 'module',
105
106
  filename: '../index.html',
106
107
  inject: !isAppLoaderEnabled(),
107
108
  template: !isAppLoaderEnabled()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elliemae/pui-cli",
3
- "version": "6.0.0-beta.35",
3
+ "version": "6.0.0-beta.39",
4
4
  "private": false,
5
5
  "description": "ICE MT UI Platform CLI",
6
6
  "sideEffects": false,
@@ -89,7 +89,7 @@
89
89
  "@testing-library/react": "~12.1.2",
90
90
  "@testing-library/react-hooks": "~7.0.2",
91
91
  "@types/jest": "~27.4.0",
92
- "@types/node": "~17.0.7",
92
+ "@types/node": "~17.0.8",
93
93
  "@types/rimraf": "~3.0.2",
94
94
  "@types/testing-library__jest-dom": "~5.14.2",
95
95
  "@typescript-eslint/eslint-plugin": "~5.9.0",
@@ -156,10 +156,10 @@
156
156
  "eslint-plugin-storybook": "~0.5.5",
157
157
  "eslint-plugin-testing-library": "~5.0.1",
158
158
  "eslint-plugin-wdio": "~7.4.2",
159
- "express-static-gzip": "~2.1.1",
160
159
  "execa": "~5.1.1",
161
160
  "express": "~4.17.2",
162
161
  "express-pino-logger": "~7.0.0",
162
+ "express-static-gzip": "~2.1.1",
163
163
  "favicons": "~6.2.2",
164
164
  "favicons-webpack-plugin": "~5.0.2",
165
165
  "file-loader": "~6.2.0",
@@ -173,7 +173,7 @@
173
173
  "imports-loader": "~3.1.1",
174
174
  "ip": "~1.1.5",
175
175
  "jest-axe": "~5.0.1",
176
- "jest-cli": "~27.4.5",
176
+ "jest-cli": "~27.4.7",
177
177
  "jest-sonar-reporter": "~2.0.0",
178
178
  "jest-styled-components": "~7.0.8",
179
179
  "jscodeshift": "~0.13.0",
@@ -194,12 +194,12 @@
194
194
  "pinst": "~2.1.6",
195
195
  "plop": "~3.0.5",
196
196
  "postcss": "~8.4.5",
197
- "postcss-jsx": "~0.36.4",
198
197
  "postcss-html": "~1.3.0",
199
- "postcss-markdown": "~1.2.0",
200
- "postcss-syntax": "~0.36.2",
198
+ "postcss-jsx": "~0.36.4",
201
199
  "postcss-loader": "~6.2.1",
200
+ "postcss-markdown": "~1.2.0",
202
201
  "postcss-preset-env": "~7.2.0",
202
+ "postcss-syntax": "~0.36.2",
203
203
  "prettier": "~2.5.1",
204
204
  "pug": "~3.0.2",
205
205
  "pug-loader": "~2.4.0",
@@ -216,8 +216,8 @@
216
216
  "semantic-release": "~18.0.1",
217
217
  "shelljs": "~0.8.4",
218
218
  "slackify-markdown": "~4.3.1",
219
- "storybook-builder-vite": "~0.1.13",
220
219
  "storybook-addon-turbo-build": "~1.0.1",
220
+ "storybook-builder-vite": "~0.1.13",
221
221
  "storybook-react-router": "~1.0.8",
222
222
  "style-loader": "~3.3.1",
223
223
  "stylelint": "~14.2.0",
@@ -240,6 +240,7 @@
240
240
  "url-loader": "~4.1.1",
241
241
  "uuid": "~8.3.2",
242
242
  "vite": "~2.7.10",
243
+ "vitest": "~0.0.133",
243
244
  "webpack": "~5.65.0",
244
245
  "webpack-bundle-analyzer": "~4.5.0",
245
246
  "webpack-cli": "~4.9.1",