@elliemae/pui-cli 6.5.1 → 6.5.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.
@@ -5,15 +5,13 @@ const { isTypeScriptEnabled } = require('../typescript/util');
5
5
  async function lintCSS(fix = false) {
6
6
  const fixIssues = fix ? '--fix' : '';
7
7
  await exec(
8
- `stylelint ./{lib,app}/**/*.{js,jsx,ts,tsx} ${fixIssues} --color --allowEmptyInput --ignore-pattern /dist/**/*`,
8
+ `stylelint ./{lib,app}/**/*.{js,jsx,ts,tsx} ${fixIssues} --color --allowEmptyInput`,
9
9
  );
10
10
  }
11
11
 
12
12
  async function lintJS(fix = false) {
13
13
  const fixIssues = fix ? '--fix' : '';
14
- await exec(
15
- `eslint --color ${fixIssues} --ignore-pattern '/dist/**/*' --ignore-pattern '/build/**/*' .`,
16
- );
14
+ await exec(`eslint --color ${fixIssues} .`);
17
15
  }
18
16
 
19
17
  async function handler(argv) {
@@ -147,4 +147,14 @@ exports.baseConfig = {
147
147
  },
148
148
  },
149
149
  },
150
+ ignorePatterns: [
151
+ '/build/**/*',
152
+ '/dist/**/*',
153
+ '/reports/**/*',
154
+ '/coverage/**/*',
155
+ '/demo/**/*',
156
+ '/docs/**/*',
157
+ '/temp/**/*',
158
+ '**/vendor/*.js',
159
+ ],
150
160
  };
@@ -1,4 +1,15 @@
1
1
  module.exports = {
2
+ ignoreFiles: [
3
+ '/dist/**/*',
4
+ '/coverage/**/*',
5
+ '/build/**/*',
6
+ '/reports/**/*',
7
+ '/temp/**/*',
8
+ '/docs/**/*',
9
+ '/demo/**/*',
10
+ '/node_modules/**/*',
11
+ '/vendor/**/*',
12
+ ],
2
13
  customSyntax: '@stylelint/postcss-css-in-js',
3
14
  extends: [
4
15
  'stylelint-config-recommended',
@@ -0,0 +1,15 @@
1
+ const path = require('path');
2
+ const { sync: findUp } = require('find-up');
3
+
4
+ const WORKSPACE_DIR_ENV_VAR = 'NPM_CONFIG_WORKSPACE_DIR';
5
+ const WORKSPACE_MANIFEST_FILENAME = 'pnpm-workspace.yaml';
6
+
7
+ exports.findPnpmWorkspaceDir = (cwd) => {
8
+ const workspaceManifestDirEnvVar =
9
+ process.env[WORKSPACE_DIR_ENV_VAR] ??
10
+ process.env[WORKSPACE_DIR_ENV_VAR.toLowerCase()];
11
+ const workspaceManifestLocation = workspaceManifestDirEnvVar
12
+ ? path.join(workspaceManifestDirEnvVar, 'pnpm-workspace.yaml')
13
+ : findUp([WORKSPACE_MANIFEST_FILENAME, 'pnpm-workspace.yml'], { cwd });
14
+ return workspaceManifestLocation && path.dirname(workspaceManifestLocation);
15
+ };
@@ -1,9 +1,8 @@
1
1
  const path = require('path');
2
+ const normalizePath = require('normalize-path');
2
3
  const { getAppConfig, getAssetPath } = require('../webpack/helpers');
3
4
  const swcrcConfig = require('../transpile/swcrc.config.js');
4
-
5
- const name = '@elliemae/pui-cli';
6
- const rootDir = path.join('<rootDir>', 'node_modules', name);
5
+ const { findPnpmWorkspaceDir } = require('../monorepo/utils');
7
6
 
8
7
  let isReactModule = true;
9
8
  try {
@@ -15,19 +14,16 @@ try {
15
14
  isReactModule = false;
16
15
  }
17
16
 
18
- const getRootDir = () => {
19
- try {
20
- // eslint-disable-next-line global-require
21
- const { name: consumerName } = require(path.join(
22
- process.cwd(),
23
- 'package.json',
24
- ));
25
- return consumerName === name ? '<rootDir>' : rootDir;
26
- } catch (ex) {
27
- // eslint-disable-next-line no-console
28
- console.log(ex);
29
- return '<rootDir>';
30
- }
17
+ const getMockFilePath = (fileName) =>
18
+ normalizePath(path.resolve(__dirname, './mocks', fileName));
19
+
20
+ const getNodeModulesPath = (fileName) => {
21
+ const monorepoRoot = findPnpmWorkspaceDir(process.cwd());
22
+ return normalizePath(
23
+ monorepoRoot
24
+ ? path.join(monorepoRoot, 'node_modules', fileName)
25
+ : `<rootDir>/node_modules/${fileName}`,
26
+ );
31
27
  };
32
28
 
33
29
  const jestConfig = {
@@ -59,23 +55,25 @@ const jestConfig = {
59
55
  coverageReporters: ['lcov', 'html', 'text-summary'],
60
56
  moduleDirectories: ['node_modules', 'app', 'lib'],
61
57
  moduleNameMapper: {
62
- '.*\\webpack-hmr(.[t|j]s)?$': `${getRootDir()}/lib/testing/mocks/webpack-hmr.js`,
63
- '.*\\.(css|scss)$': `${getRootDir()}/lib/testing/mocks/cssModule.js`,
64
- '.*\\.(jpg|jpeg|png|gif|eot|otf|webp|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga|ico)$': `${getRootDir()}/lib/testing/mocks/image.js`,
65
- '.*\\.svg$': `${getRootDir()}/lib/testing/mocks/svg.js`,
66
- '.*\\.(html)$': `${getRootDir()}/lib/testing/mocks/html.js`,
67
- '^lodash-es$': 'lodash',
68
- '@elliemae/pui-user-monitoring': `${getRootDir()}/lib/testing/mocks/pui-user-monitoring.js`,
69
- '@elliemae/pui-app-loader': `${getRootDir()}/lib/testing/mocks/pui-app-loader.js`,
70
- '@elliemae/pui-diagnostics': `${getRootDir()}/lib/testing/mocks/pui-diagnostics.js`,
71
- 'react-spring/web': '<rootDir>/node_modules/react-spring/web.cjs.js',
72
- 'react-spring/renderprops':
73
- '<rootDir>/node_modules/react-spring/renderprops.cjs.js',
74
- 'styled-components':
75
- '<rootDir>/node_modules/styled-components/dist/styled-components.cjs.js',
58
+ '.*\\webpack-hmr(.[t|j]s)?$': getMockFilePath('webpack-hmr.js'),
59
+ '.*\\.(css|scss)$': getMockFilePath('cssModule.js'),
60
+ '.*\\.(jpg|jpeg|png|gif|eot|otf|webp|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga|ico)$':
61
+ getMockFilePath('image.js'),
62
+ '.*\\.svg$': getMockFilePath('svg.js'),
63
+ '.*\\.(html)$': getMockFilePath('html.js'),
64
+ '@elliemae/pui-user-monitoring': getMockFilePath('pui-user-monitoring.js'),
65
+ '@elliemae/pui-app-loader': getMockFilePath('webpack-hmr.js'),
66
+ '@elliemae/pui-diagnostics': getMockFilePath('pui-app-loader.js'),
67
+ 'react-spring/web': getNodeModulesPath('react-spring/web.cjs.js'),
68
+ 'react-spring/renderprops': getNodeModulesPath(
69
+ 'react-spring/renderprops.cjs.js',
70
+ ),
71
+ 'styled-components': getNodeModulesPath(
72
+ 'styled-components/dist/styled-components.cjs.js',
73
+ ),
76
74
  },
77
75
  moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
78
- setupFilesAfterEnv: [`${getRootDir()}/lib/testing/setup-tests.js`],
76
+ setupFilesAfterEnv: [path.resolve(__dirname, './setup-tests.js')],
79
77
  setupFiles: ['raf/polyfill', 'whatwg-fetch'],
80
78
  testRegex: '(app|lib).*/tests/.*\\.test\\.[jt]sx?$',
81
79
  snapshotSerializers: [],
@@ -97,7 +95,7 @@ const jestConfig = {
97
95
 
98
96
  if (isReactModule && jestConfig.setupFilesAfterEnv)
99
97
  jestConfig.setupFilesAfterEnv.push(
100
- `${getRootDir()}/lib/testing/setup-react-env.js`,
98
+ path.resolve(__dirname, './setup-react-env.js'),
101
99
  );
102
100
 
103
101
  exports.jestConfig = jestConfig;
@@ -4,6 +4,7 @@ const fs = require('fs');
4
4
  const _ = require('lodash');
5
5
  const CompressionPlugin = require('compression-webpack-plugin');
6
6
  const zlib = require('zlib');
7
+ const { findPnpmWorkspaceDir } = require('../monorepo/utils');
7
8
 
8
9
  let pathSep = path.sep;
9
10
  if (pathSep === '\\')
@@ -66,8 +67,9 @@ const mapToFolder = (dependencies, folder) =>
66
67
  {},
67
68
  );
68
69
 
69
- const getAlias = () =>
70
- mapToFolder(
70
+ const getAlias = () => {
71
+ const monorepoRoot = findPnpmWorkspaceDir(process.cwd()) || '';
72
+ return mapToFolder(
71
73
  [
72
74
  '@babel/runtime',
73
75
  'react',
@@ -85,8 +87,9 @@ const getAlias = () =>
85
87
  '@elliemae/pui-app-sdk$',
86
88
  '@elliemae/pui-theme$',
87
89
  ],
88
- './node_modules',
90
+ path.join(monorepoRoot, './node_modules'),
89
91
  );
92
+ };
90
93
 
91
94
  const modulesToTranspile = [
92
95
  '@elliemae/pui-*',
@@ -1,10 +1,6 @@
1
1
  /* eslint-disable max-lines */
2
2
  const path = require('path');
3
- const {
4
- EnvironmentPlugin,
5
- DefinePlugin,
6
- NormalModuleReplacementPlugin,
7
- } = require('webpack');
3
+ const { EnvironmentPlugin, DefinePlugin } = require('webpack');
8
4
  const {
9
5
  optimize: { LimitChunkCountPlugin },
10
6
  ProgressPlugin,
@@ -14,6 +10,7 @@ const CopyWebpackPlugin = require('copy-webpack-plugin');
14
10
  const PostcssPresetEnv = require('postcss-preset-env');
15
11
  const DuplicatePackageCheckerPlugin = require('duplicate-package-checker-webpack-plugin');
16
12
  const MomentLocalesPlugin = require('moment-locales-webpack-plugin');
13
+ const ResolveTypeScriptPlugin = require('resolve-typescript-plugin');
17
14
  const browserslistToEsbuild = require('browserslist-to-esbuild');
18
15
 
19
16
  const {
@@ -68,9 +65,6 @@ const plugins = [
68
65
  maxChunks: 1,
69
66
  }),
70
67
  new MomentLocalesPlugin({ localesToKeep: ['es-us'] }),
71
- new NormalModuleReplacementPlugin(/\.js$/, function (resource) {
72
- resource.request = resource.request.replace('.js', '');
73
- }),
74
68
  new ProgressPlugin(),
75
69
  ];
76
70
 
@@ -192,6 +186,7 @@ module.exports = (options) => ({
192
186
  ...getAlias(),
193
187
  ...((options.resolve || {}).alias || {}),
194
188
  },
189
+ plugins: [new ResolveTypeScriptPlugin({})],
195
190
  },
196
191
  externals: {
197
192
  '@elliemae/pui-user-monitoring': 'emuiUserMonitoring',
@@ -1,10 +1,7 @@
1
- const {
2
- DefinePlugin,
3
- EnvironmentPlugin,
4
- NormalModuleReplacementPlugin,
5
- } = require('webpack');
1
+ const { DefinePlugin, EnvironmentPlugin } = require('webpack');
6
2
  const MiniCssExtractPlugin = require('mini-css-extract-plugin');
7
3
  const CopyWebpackPlugin = require('copy-webpack-plugin');
4
+ const ResolveTypeScriptPlugin = require('resolve-typescript-plugin');
8
5
  const {
9
6
  getAppConfig,
10
7
  isApp,
@@ -45,9 +42,6 @@ const getAdditionalPlugins = () => [
45
42
  },
46
43
  ],
47
44
  }),
48
- new NormalModuleReplacementPlugin(/\.js$/, function (resource) {
49
- resource.request = resource.request.replace('.js', '');
50
- }),
51
45
  ];
52
46
 
53
47
  const getModuleRules = () => [
@@ -78,6 +72,10 @@ exports.webpackFinal = async (config, { configType }) => {
78
72
  config.resolve.alias = { ...config.resolve.alias, ...getAlias() };
79
73
  config.resolve.fallback = { ...config.resolve.fallback, crypto: false };
80
74
  config.resolve.extensions.push('.svg');
75
+ config.resolve.plugins = [
76
+ ...(config.resolve.plugins || []),
77
+ new ResolveTypeScriptPlugin({}),
78
+ ];
81
79
  config.externals = config.externals || {};
82
80
  config.externals['@elliemae/pui-user-monitoring'] = 'emuiUserMonitoring';
83
81
  config.externals['@elliemae/pui-app-loader'] = 'emuiAppLoader';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elliemae/pui-cli",
3
- "version": "6.5.1",
3
+ "version": "6.5.5",
4
4
  "private": false,
5
5
  "description": "ICE MT UI Platform CLI",
6
6
  "sideEffects": false,
@@ -71,20 +71,20 @@
71
71
  "@semantic-release/changelog": "~6.0.1",
72
72
  "@semantic-release/exec": "~6.0.3",
73
73
  "@semantic-release/git": "~10.0.1",
74
- "@storybook/addon-a11y": "~6.4.18",
75
- "@storybook/addon-essentials": "~6.4.18",
74
+ "@storybook/addon-a11y": "~6.4.19",
75
+ "@storybook/addon-essentials": "~6.4.19",
76
76
  "@storybook/addon-events": "~6.2.9",
77
- "@storybook/addon-interactions": "~6.4.18",
78
- "@storybook/addon-links": "~6.4.18",
79
- "@storybook/addon-storysource": "~6.4.18",
80
- "@storybook/builder-webpack5": "~6.4.18",
81
- "@storybook/manager-webpack5": "~6.4.18",
82
- "@storybook/react": "~6.4.18",
83
- "@storybook/theming": "~6.4.18",
77
+ "@storybook/addon-interactions": "~6.4.19",
78
+ "@storybook/addon-links": "~6.4.19",
79
+ "@storybook/addon-storysource": "~6.4.19",
80
+ "@storybook/builder-webpack5": "~6.4.19",
81
+ "@storybook/manager-webpack5": "~6.4.19",
82
+ "@storybook/react": "~6.4.19",
83
+ "@storybook/theming": "~6.4.19",
84
84
  "@stylelint/postcss-css-in-js": "~0.37.2",
85
85
  "@svgr/webpack": "~6.2.1",
86
86
  "@swc/cli": "~0.1.55",
87
- "@swc/core": "~1.2.138",
87
+ "@swc/core": "~1.2.139",
88
88
  "@swc/jest": "~0.2.17",
89
89
  "@testing-library/jest-dom": "~5.16.2",
90
90
  "@testing-library/react": "~12.1.2",
@@ -132,7 +132,7 @@
132
132
  "esbuild": "~0.14.21",
133
133
  "esbuild-loader": "~2.18.0",
134
134
  "esbuild-plugin-svgr": "~1.0.0",
135
- "eslint": "~8.8.0",
135
+ "eslint": "~8.9.0",
136
136
  "eslint-config-airbnb": "~19.0.4",
137
137
  "eslint-config-airbnb-base": "~15.0.0",
138
138
  "eslint-config-airbnb-typescript": "~16.1.0",
@@ -145,7 +145,7 @@
145
145
  "eslint-plugin-eslint-comments": "~3.2.0",
146
146
  "eslint-plugin-import": "~2.25.4",
147
147
  "eslint-plugin-jest": "~26.1.0",
148
- "eslint-plugin-jsdoc": "~37.8.2",
148
+ "eslint-plugin-jsdoc": "~37.9.1",
149
149
  "eslint-plugin-jsx-a11y": "~6.5.1",
150
150
  "eslint-plugin-mdx": "~1.16.0",
151
151
  "eslint-plugin-prettier": "~4.0.0",
@@ -161,6 +161,7 @@
161
161
  "express-static-gzip": "~2.1.4",
162
162
  "favicons": "~6.2.2",
163
163
  "favicons-webpack-plugin": "~5.0.2",
164
+ "find-up": "~5.0.0",
164
165
  "happy-dom": "~2.31.1",
165
166
  "helmet-csp": "~3.4.0",
166
167
  "html-webpack-plugin": "~5.5.0",
@@ -184,6 +185,7 @@
184
185
  "node-gyp": "~8.4.1",
185
186
  "node-plop": "~0.30.0",
186
187
  "nodemon": "~2.0.15",
188
+ "normalize-path": "~3.0.0",
187
189
  "npm-check-updates": "12.3.0",
188
190
  "null-loader": "~4.0.1",
189
191
  "pino": "~7.6.5",
@@ -195,7 +197,7 @@
195
197
  "postcss-jsx": "~0.36.4",
196
198
  "postcss-loader": "~6.2.1",
197
199
  "postcss-markdown": "~1.2.0",
198
- "postcss-preset-env": "~7.3.1",
200
+ "postcss-preset-env": "~7.3.2",
199
201
  "postcss-syntax": "~0.36.2",
200
202
  "prettier": "~2.5.1",
201
203
  "pug": "~3.0.2",
@@ -227,7 +229,7 @@
227
229
  "url-loader": "~4.1.1",
228
230
  "uuid": "~8.3.2",
229
231
  "vite": "~2.8.1",
230
- "vitest": "~0.3.2",
232
+ "vitest": "~0.3.4",
231
233
  "webpack": "~5.65.0",
232
234
  "webpack-bundle-analyzer": "~4.5.0",
233
235
  "webpack-cli": "~4.9.2",