@elliemae/pui-cli 6.0.0-beta.29 → 6.0.0-beta.32

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.
@@ -4,9 +4,7 @@ const { exec, logError, logSuccess } = require('./utils');
4
4
  const { CI = false } = process.env;
5
5
 
6
6
  async function test(commandOptions) {
7
- await exec(
8
- `cross-env FORCE_COLOR=true NODE_OPTIONS=--experimental-vm-modules NODE_ENV=test jest ${commandOptions}`,
9
- );
7
+ await exec(`cross-env FORCE_COLOR=true NODE_ENV=test jest ${commandOptions}`);
10
8
  }
11
9
 
12
10
  // eslint-disable-next-line max-statements
@@ -0,0 +1,103 @@
1
+ const { exit } = require('yargs');
2
+ const { dirname, join } = require('path');
3
+ const { spawnSync } = require('child_process');
4
+ const fs = require('fs');
5
+ const { logInfo, logError } = require('./utils');
6
+
7
+ const randomChars = () => Math.random().toString(36).slice(2);
8
+
9
+ const resolveFromModule = (moduleName, ...paths) => {
10
+ const modulePath = dirname(require.resolve(`${moduleName}/package.json`));
11
+ return join(modulePath, ...paths);
12
+ };
13
+
14
+ const resolveFromRoot = (...paths) => join(process.cwd(), ...paths);
15
+
16
+ const validateTypescript = async () => {
17
+ const args = process.argv.slice(2);
18
+ const argsProjectIndex = args.findIndex((arg) =>
19
+ ['-p', '--project'].includes(arg),
20
+ );
21
+ const argsProjectValue =
22
+ argsProjectIndex !== -1 ? args[argsProjectIndex + 1] : undefined;
23
+
24
+ const files = args.filter((file) => /\.(ts|tsx)$/.test(file));
25
+ if (files.length === 0) {
26
+ process.exit(0);
27
+ }
28
+
29
+ const remainingArgsToForward = args
30
+ .slice()
31
+ .filter((arg) => !files.includes(arg));
32
+
33
+ if (argsProjectIndex !== -1) {
34
+ remainingArgsToForward.splice(argsProjectIndex, 2);
35
+ }
36
+
37
+ // Load existing config
38
+ const tsconfigPath = argsProjectValue || resolveFromRoot('tsconfig.json');
39
+ const tsconfigContent = fs.readFileSync(tsconfigPath).toString();
40
+ // Use 'eval' to read the JSON as regular JavaScript syntax so that comments are allowed
41
+ // eslint-disable-next-line prefer-const
42
+ let tsconfig = {};
43
+ // eslint-disable-next-line no-eval
44
+ eval(`tsconfig = ${tsconfigContent}`);
45
+
46
+ // Write a temp config file
47
+ const tmpTsconfigPath = resolveFromRoot(`tsconfig.${randomChars()}.json`);
48
+ const tmpTsconfig = {
49
+ ...tsconfig,
50
+ compilerOptions: {
51
+ ...tsconfig.compilerOptions,
52
+ skipLibCheck: true,
53
+ },
54
+ files,
55
+ include: ['shared/typings'],
56
+ };
57
+ fs.writeFileSync(tmpTsconfigPath, JSON.stringify(tmpTsconfig, null, 2));
58
+
59
+ // Type-check our files
60
+ const { status } = spawnSync(
61
+ resolveFromModule(
62
+ 'typescript',
63
+ `../.bin/tsc${process.platform === 'win32' ? '.cmd' : ''}`,
64
+ ),
65
+ ['-p', tmpTsconfigPath, ...remainingArgsToForward],
66
+ { stdio: 'inherit' },
67
+ );
68
+
69
+ // Delete temp config file
70
+ fs.unlinkSync(tmpTsconfigPath);
71
+
72
+ process.exit(status);
73
+ };
74
+
75
+ async function handler(argv) {
76
+ try {
77
+ await validateTypescript(argv.p);
78
+ logInfo('Typescript validation started');
79
+ } catch (err) {
80
+ logError('Typescript validation failed', err);
81
+ exit(-1, err);
82
+ }
83
+ }
84
+
85
+ exports.command = 'tsc [options]';
86
+
87
+ exports.describe = 'validate typescript code';
88
+
89
+ exports.builder = {
90
+ project: {
91
+ alias: 'p',
92
+ type: 'boolean',
93
+ default: false,
94
+ },
95
+ docs: {
96
+ type: 'boolean',
97
+ default: false,
98
+ },
99
+ };
100
+
101
+ exports.handler = handler;
102
+
103
+ exports.validateTypescript = validateTypescript;
@@ -1,5 +1,7 @@
1
1
  module.exports = {
2
- '*.{ts,tsx}': ['tsc-files --noEmit --emitDeclarationOnly false'],
2
+ '*.{ts,tsx}': [
3
+ 'node @elliemae/pui-cli/lib/typescript/tsc-files --noEmit --emitDeclarationOnly false',
4
+ ],
3
5
  '*.{js,ts,jsx,tsx}': [
4
6
  'npm run lint:fix',
5
7
  'npm run test:staged',
@@ -95,7 +95,7 @@ const jestConfig = {
95
95
  // ],
96
96
  // },
97
97
  transformIgnorePatterns: [
98
- 'node_modules/(?!(@elliemae/pui-cli|lodash-es|react-select|react-dates)/)',
98
+ 'node_modules/(?!(.*@elliemae/pui-cli|lodash-es|react-select|react-dates)/)',
99
99
  ],
100
100
  globals: {
101
101
  APP_CONFIG: getAppConfig(),
@@ -0,0 +1,61 @@
1
+ const { spawnSync } = require('child_process');
2
+ const fs = require('fs');
3
+
4
+ const { randomChars, resolveFromModule, resolveFromRoot } = require('./utils');
5
+
6
+ const args = process.argv.slice(2);
7
+ const argsProjectIndex = args.findIndex((arg) =>
8
+ ['-p', '--project'].includes(arg),
9
+ );
10
+ const argsProjectValue =
11
+ argsProjectIndex !== -1 ? args[argsProjectIndex + 1] : undefined;
12
+
13
+ const files = args.filter((file) => /\.(ts|tsx)$/.test(file));
14
+ if (files.length === 0) {
15
+ process.exit(0);
16
+ }
17
+
18
+ const remainingArgsToForward = args
19
+ .slice()
20
+ .filter((arg) => !files.includes(arg));
21
+
22
+ if (argsProjectIndex !== -1) {
23
+ remainingArgsToForward.splice(argsProjectIndex, 2);
24
+ }
25
+
26
+ // Load existing config
27
+ const tsconfigPath = argsProjectValue || resolveFromRoot('tsconfig.json');
28
+ const tsconfigContent = fs.readFileSync(tsconfigPath).toString();
29
+ // Use 'eval' to read the JSON as regular JavaScript syntax so that comments are allowed
30
+ // eslint-disable-next-line prefer-const
31
+ let tsconfig = {};
32
+ // eslint-disable-next-line no-eval
33
+ eval(`tsconfig = ${tsconfigContent}`);
34
+
35
+ // Write a temp config file
36
+ const tmpTsconfigPath = resolveFromRoot(`tsconfig.${randomChars()}.json`);
37
+ const tmpTsconfig = {
38
+ ...tsconfig,
39
+ compilerOptions: {
40
+ ...tsconfig.compilerOptions,
41
+ skipLibCheck: true,
42
+ },
43
+ files,
44
+ include: ['app', 'lib'],
45
+ };
46
+ fs.writeFileSync(tmpTsconfigPath, JSON.stringify(tmpTsconfig, null, 2));
47
+
48
+ // 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
+ );
57
+
58
+ // Delete temp config file
59
+ fs.unlinkSync(tmpTsconfigPath);
60
+
61
+ process.exit(status);
@@ -0,0 +1,16 @@
1
+ const { dirname, join } = require('path');
2
+
3
+ const randomChars = () => Math.random().toString(36).slice(2);
4
+
5
+ const resolveFromModule = (moduleName, ...paths) => {
6
+ const modulePath = dirname(require.resolve(`${moduleName}/package.json`));
7
+ return join(modulePath, ...paths);
8
+ };
9
+
10
+ const resolveFromRoot = (...paths) => join(process.cwd(), ...paths);
11
+
12
+ module.exports = {
13
+ randomChars,
14
+ resolveFromModule,
15
+ resolveFromRoot,
16
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elliemae/pui-cli",
3
- "version": "6.0.0-beta.29",
3
+ "version": "6.0.0-beta.32",
4
4
  "private": false,
5
5
  "description": "ICE MT UI Platform CLI",
6
6
  "sideEffects": false,
@@ -47,24 +47,24 @@
47
47
  "indent": 4
48
48
  },
49
49
  "dependencies": {
50
- "@babel/cli": "~7.16.0",
51
- "@babel/core": "~7.16.5",
50
+ "@babel/cli": "~7.16.7",
51
+ "@babel/core": "~7.16.7",
52
52
  "@babel/eslint-parser": "~7.16.5",
53
- "@babel/node": "~7.16.5",
54
- "@babel/plugin-proposal-class-properties": "~7.16.5",
55
- "@babel/plugin-proposal-export-default-from": "~7.16.5",
53
+ "@babel/node": "~7.16.7",
54
+ "@babel/plugin-proposal-class-properties": "~7.16.7",
55
+ "@babel/plugin-proposal-export-default-from": "~7.16.7",
56
56
  "@babel/plugin-syntax-dynamic-import": "~7.8.3",
57
- "@babel/plugin-transform-modules-commonjs": "~7.16.5",
58
- "@babel/plugin-transform-react-constant-elements": "~7.16.5",
59
- "@babel/plugin-transform-react-inline-elements": "~7.16.5",
60
- "@babel/plugin-transform-react-jsx-source": "~7.16.5",
61
- "@babel/plugin-transform-runtime": "~7.16.5",
62
- "@babel/preset-env": "~7.16.5",
63
- "@babel/preset-react": "~7.16.5",
64
- "@babel/preset-typescript": "~7.16.5",
65
- "@babel/runtime": "~7.16.5",
66
- "@commitlint/cli": "~15.0.0",
67
- "@commitlint/config-conventional": "~15.0.0",
57
+ "@babel/plugin-transform-modules-commonjs": "~7.16.7",
58
+ "@babel/plugin-transform-react-constant-elements": "~7.16.7",
59
+ "@babel/plugin-transform-react-inline-elements": "~7.16.7",
60
+ "@babel/plugin-transform-react-jsx-source": "~7.16.7",
61
+ "@babel/plugin-transform-runtime": "~7.16.7",
62
+ "@babel/preset-env": "~7.16.7",
63
+ "@babel/preset-react": "~7.16.7",
64
+ "@babel/preset-typescript": "~7.16.7",
65
+ "@babel/runtime": "~7.16.7",
66
+ "@commitlint/cli": "~16.0.1",
67
+ "@commitlint/config-conventional": "~16.0.0",
68
68
  "@elliemae/browserslist-config-elliemae": "~1.2.1",
69
69
  "@pmmmwh/react-refresh-webpack-plugin": "~0.5.4",
70
70
  "@semantic-release/changelog": "~6.0.1",
@@ -83,18 +83,18 @@
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.122",
86
+ "@swc/core": "~1.2.124",
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
- "@types/jest": "~27.0.3",
92
- "@types/node": "~17.0.4",
91
+ "@types/jest": "~27.4.0",
92
+ "@types/node": "~17.0.6",
93
93
  "@types/rimraf": "~3.0.2",
94
94
  "@types/testing-library__jest-dom": "~5.14.2",
95
- "@typescript-eslint/eslint-plugin": "~5.8.0",
96
- "@typescript-eslint/parser": "~5.8.0",
97
- "autoprefixer": "~10.4.0",
95
+ "@typescript-eslint/eslint-plugin": "~5.8.1",
96
+ "@typescript-eslint/parser": "~5.8.1",
97
+ "autoprefixer": "~10.4.1",
98
98
  "axe-core": "~4.3.5",
99
99
  "babel-loader": "~8.2.3",
100
100
  "babel-plugin-add-import-extension": "1.5.1",
@@ -129,11 +129,11 @@
129
129
  "dotenv-webpack": "~7.0.3",
130
130
  "duplicate-package-checker-webpack-plugin": "~3.0.0",
131
131
  "enhanced-resolve": "~5.8.3",
132
- "esbuild": "~0.14.8",
132
+ "esbuild": "~0.14.10",
133
133
  "esbuild-jest": "~0.5.0",
134
134
  "esbuild-loader": "~2.18.0",
135
135
  "esbuild-plugin-svgr": "~1.0.0",
136
- "eslint": "~8.5.0",
136
+ "eslint": "~8.6.0",
137
137
  "eslint-config-airbnb": "~18.2.1",
138
138
  "eslint-config-airbnb-base": "~15.0.0",
139
139
  "eslint-config-airbnb-typescript": "~15.0.0",
@@ -145,8 +145,8 @@
145
145
  "eslint-plugin-compat": "~3.13.0",
146
146
  "eslint-plugin-eslint-comments": "~3.2.0",
147
147
  "eslint-plugin-import": "~2.25.3",
148
- "eslint-plugin-jest": "~25.3.0",
149
- "eslint-plugin-jsdoc": "~37.4.0",
148
+ "eslint-plugin-jest": "~25.3.3",
149
+ "eslint-plugin-jsdoc": "~37.5.0",
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",
@@ -189,7 +189,7 @@
189
189
  "nodemon": "~2.0.15",
190
190
  "npm-check-updates": "12.0.5",
191
191
  "null-loader": "~4.0.1",
192
- "pino": "~7.6.1",
192
+ "pino": "~7.6.2",
193
193
  "pino-pretty": "~7.3.0",
194
194
  "pinst": "~2.1.6",
195
195
  "plop": "~3.0.5",
@@ -216,7 +216,7 @@
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.12",
219
+ "storybook-builder-vite": "~0.1.13",
220
220
  "storybook-addon-turbo-build": "~1.0.1",
221
221
  "storybook-react-router": "~1.0.8",
222
222
  "style-loader": "~3.3.1",
@@ -239,7 +239,7 @@
239
239
  "update-notifier": "~5.1.0",
240
240
  "url-loader": "~4.1.1",
241
241
  "uuid": "~8.3.2",
242
- "vite": "~2.7.6",
242
+ "vite": "~2.7.10",
243
243
  "webpack": "~5.65.0",
244
244
  "webpack-bundle-analyzer": "~4.5.0",
245
245
  "webpack-cli": "~4.9.1",