@elliemae/pui-cli 6.0.0-beta.34 → 6.0.0-beta.38

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 () => {
@@ -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', {
@@ -1,7 +1,8 @@
1
- const { spawnSync } = require('child_process');
1
+ const execa = require('execa');
2
2
  const fs = require('fs');
3
+ const path = require('path');
3
4
 
4
- const { randomChars, resolveFromModule, resolveFromRoot } = require('./utils');
5
+ const { randomChars, resolveFromRoot } = require('./utils');
5
6
 
6
7
  const args = process.argv.slice(2);
7
8
  const argsProjectIndex = args.findIndex((arg) =>
@@ -46,16 +47,20 @@ const tmpTsconfig = {
46
47
  fs.writeFileSync(tmpTsconfigPath, JSON.stringify(tmpTsconfig, null, 2));
47
48
 
48
49
  // Type-check our files
49
- const { status } = spawnSync(
50
- resolveFromModule(
51
- 'typescript',
52
- `../.bin/tsc${process.platform === 'win32' ? '.cmd' : ''}`,
53
- ),
54
- ['-p', tmpTsconfigPath, ...remainingArgsToForward],
55
- { stdio: 'inherit' },
56
- );
50
+ let status = 0;
51
+ try {
52
+ execa.sync(
53
+ path.resolve(
54
+ process.cwd(),
55
+ `./node_modules/.bin/tsc${process.platform === 'win32' ? '.cmd' : ''}`,
56
+ ),
57
+ ['-p', tmpTsconfigPath, ...remainingArgsToForward],
58
+ { stdio: 'inherit' },
59
+ );
60
+ } catch (ex) {
61
+ status = ex.exitCode;
62
+ }
57
63
 
58
64
  // Delete temp config file
59
65
  fs.unlinkSync(tmpTsconfigPath);
60
-
61
66
  process.exit(status);
@@ -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.34",
3
+ "version": "6.0.0-beta.38",
4
4
  "private": false,
5
5
  "description": "ICE MT UI Platform CLI",
6
6
  "sideEffects": false,
@@ -83,17 +83,17 @@
83
83
  "@stylelint/postcss-css-in-js": "~0.37.2",
84
84
  "@svgr/webpack": "~6.1.2",
85
85
  "@swc/cli": "~0.1.55",
86
- "@swc/core": "~1.2.125",
86
+ "@swc/core": "~1.2.126",
87
87
  "@swc/jest": "~0.2.15",
88
88
  "@testing-library/jest-dom": "~5.16.1",
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.6",
92
+ "@types/node": "~17.0.8",
93
93
  "@types/rimraf": "~3.0.2",
94
94
  "@types/testing-library__jest-dom": "~5.14.2",
95
- "@typescript-eslint/eslint-plugin": "~5.8.1",
96
- "@typescript-eslint/parser": "~5.8.1",
95
+ "@typescript-eslint/eslint-plugin": "~5.9.0",
96
+ "@typescript-eslint/parser": "~5.9.0",
97
97
  "autoprefixer": "~10.4.1",
98
98
  "axe-core": "~4.3.5",
99
99
  "babel-loader": "~8.2.3",
@@ -146,7 +146,7 @@
146
146
  "eslint-plugin-eslint-comments": "~3.2.0",
147
147
  "eslint-plugin-import": "~2.25.4",
148
148
  "eslint-plugin-jest": "~25.3.4",
149
- "eslint-plugin-jsdoc": "~37.5.0",
149
+ "eslint-plugin-jsdoc": "~37.5.1",
150
150
  "eslint-plugin-jsx-a11y": "~6.5.1",
151
151
  "eslint-plugin-mdx": "~1.16.0",
152
152
  "eslint-plugin-prettier": "~4.0.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.6",
177
177
  "jest-sonar-reporter": "~2.0.0",
178
178
  "jest-styled-components": "~7.0.8",
179
179
  "jscodeshift": "~0.13.0",