@elliemae/pui-cli 9.0.0-alpha.11 → 9.0.0-alpha.13
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.
- package/README.md +6 -4
- package/build/docs/404.html +4 -4
- package/build/docs/api/functions/loadRoutes/index.html +9 -9
- package/build/docs/api/index.html +8 -8
- package/build/docs/api/type-aliases/LIB_NAME/index.html +5 -5
- package/build/docs/api/variables/babelConfig/index.html +5 -28
- package/build/docs/api/variables/commitlintConfig/index.html +5 -8
- package/build/docs/api/variables/eslintFlatBaseConfig/index.html +6 -6
- package/build/docs/api/variables/eslintFlatBaseConfigStrict/index.html +6 -6
- package/build/docs/api/variables/eslintFlatConfig/index.html +6 -6
- package/build/docs/api/variables/eslintFlatConfigStrict/index.html +6 -6
- package/build/docs/api/variables/jestConfig/index.html +86 -86
- package/build/docs/api/variables/jestNodeConfig/index.html +86 -86
- package/build/docs/api/variables/lintStagedConfig/index.html +22 -12
- package/build/docs/api/variables/prettierConfig/index.html +5 -18
- package/build/docs/api/variables/stylelintConfig/index.html +5 -5
- package/build/docs/api/variables/vitestConfig/index.html +5 -5
- package/build/docs/assets/css/{styles.74603f39.css → styles.3cba4e67.css} +1 -1
- package/build/docs/assets/js/04ee7372.c6c3d513.js +1 -0
- package/build/docs/assets/js/0551d4dd.a6b1d9fa.js +1 -0
- package/build/docs/assets/js/0a1d0315.43980061.js +1 -0
- package/build/docs/assets/js/13097d8d.4ac8ef79.js +1 -0
- package/build/docs/assets/js/{16b7bc88.c3779e27.js → 16b7bc88.2ac57556.js} +1 -1
- package/build/docs/assets/js/{17896441.84339068.js → 17896441.705d85a0.js} +1 -1
- package/build/docs/assets/js/{1b9df811.aaa95da1.js → 1b9df811.ec75cfdc.js} +1 -1
- package/build/docs/assets/js/{232a0286.33b2782b.js → 232a0286.6f749ae5.js} +1 -1
- package/build/docs/assets/js/{2399.cc5803e0.js → 2399.5d123cba.js} +1 -1
- package/build/docs/assets/js/{37d86055.47211796.js → 37d86055.1e73f036.js} +1 -1
- package/build/docs/assets/js/3992.b9b54f94.js +2 -0
- package/build/docs/assets/js/4fb6949f.13bde4a8.js +1 -0
- package/build/docs/assets/js/5befad71.96f04f67.js +1 -0
- package/build/docs/assets/js/5d5f1db0.e7607cd2.js +1 -0
- package/build/docs/assets/js/5e8c322a.0b86bf5a.js +1 -0
- package/build/docs/assets/js/5e95c892.de377e27.js +1 -0
- package/build/docs/assets/js/{5fb3c522.da5628e8.js → 5fb3c522.3ec831ee.js} +1 -1
- package/build/docs/assets/js/6bd11e52.c61bfcd5.js +1 -0
- package/build/docs/assets/js/6e96545e.1b545333.js +1 -0
- package/build/docs/assets/js/{71f6d02b.cfd98385.js → 71f6d02b.4b381360.js} +1 -1
- package/build/docs/assets/js/{6704.2615a5c6.js → 7843.f4b19776.js} +1 -1
- package/build/docs/assets/js/80e87108.8c451f49.js +1 -0
- package/build/docs/assets/js/{8585.3cb09ff7.js → 8585.e2298db3.js} +1 -1
- package/build/docs/assets/js/{a7bd4aaa.30ffad02.js → a7bd4aaa.aceac89c.js} +1 -1
- package/build/docs/assets/js/a94703ab.248144c2.js +1 -0
- package/build/docs/assets/js/b7b585d8.7d50f3f6.js +1 -0
- package/build/docs/assets/js/{bde5209a.f5bca8b2.js → bde5209a.480cc8d8.js} +1 -1
- package/build/docs/assets/js/c377a04b.c6b6b394.js +1 -0
- package/build/docs/assets/js/{dfd75424.51c4e2cb.js → dfd75424.459da76b.js} +1 -1
- package/build/docs/assets/js/f736c962.ab424879.js +1 -0
- package/build/docs/assets/js/main.3ae939d4.js +2 -0
- package/build/docs/assets/js/runtime~main.9ecf1839.js +1 -0
- package/build/docs/eslint-rules-migration/index.html +43 -43
- package/build/docs/index.html +70 -71
- package/build/docs/pui-cli-9-migration/index.html +191 -70
- package/build/docs/sitemap.xml +1 -1
- package/build/docs/ssl-certificate-setup/index.html +23 -23
- package/build/docs/stylelint-migration/index.html +19 -21
- package/build/docs/usage-guide/index.html +91 -91
- package/dist/cjs/babel.config.js +124 -0
- package/dist/cjs/commands/storybook.js +33 -4
- package/dist/cjs/index.js +5 -9
- package/dist/cjs/lint-config/commitlint/export.mjs +1 -0
- package/dist/cjs/lint-config/commitlint.config.mjs +6 -0
- package/dist/cjs/lint-config/eslint/common.cjs +8 -1
- package/dist/cjs/lint-config/eslint/flat/compat.mjs +5 -5
- package/dist/cjs/lint-config/eslint/flat/rules.mjs +1 -0
- package/dist/cjs/lint-config/lint-staged.config.js +17 -5
- package/dist/cjs/lint-config/prettier/export.mjs +1 -0
- package/dist/cjs/lint-config/{prettier.config.cjs → prettier.config.mjs} +4 -1
- package/dist/cjs/skills/migrate-storybook-out-of-cjs/SKILL.md +242 -0
- package/dist/cjs/skills/migrate-to-pui-cli-9/SKILL.md +188 -25
- package/dist/cjs/testing/{jest.config.cjs → jest.config.mjs} +14 -6
- package/dist/{esm/testing/jest.node.config.cjs → cjs/testing/jest.node.config.mjs} +3 -2
- package/dist/cjs/testing/setup-textencoder.cjs +4 -0
- package/dist/cjs/webpack/webpack.storybook.js +62 -0
- package/dist/esm/babel.config.js +94 -0
- package/dist/esm/commands/storybook.js +22 -4
- package/dist/esm/index.js +5 -9
- package/dist/esm/lint-config/commitlint/export.mjs +1 -0
- package/dist/esm/lint-config/commitlint.config.mjs +6 -0
- package/dist/esm/lint-config/eslint/common.cjs +8 -1
- package/dist/esm/lint-config/eslint/flat/compat.mjs +5 -5
- package/dist/esm/lint-config/eslint/flat/rules.mjs +1 -0
- package/dist/esm/lint-config/lint-staged.config.js +17 -5
- package/dist/esm/lint-config/prettier/export.mjs +1 -0
- package/{lib/lint-config/prettier.config.cjs → dist/esm/lint-config/prettier.config.mjs} +4 -1
- package/dist/esm/skills/migrate-storybook-out-of-cjs/SKILL.md +242 -0
- package/dist/esm/skills/migrate-to-pui-cli-9/SKILL.md +188 -25
- package/dist/esm/testing/{jest.config.cjs → jest.config.mjs} +14 -6
- package/dist/{cjs/testing/jest.node.config.cjs → esm/testing/jest.node.config.mjs} +3 -2
- package/dist/esm/testing/setup-textencoder.cjs +4 -0
- package/dist/esm/webpack/webpack.storybook.js +61 -0
- package/dist/types/lib/babel.config.d.ts +3 -0
- package/dist/types/lib/commands/storybook.d.ts +1 -0
- package/dist/types/lib/index.d.ts +5 -9
- package/dist/types/lib/lint-config/commitlint/export.d.mts +1 -0
- package/dist/types/lib/lint-config/commitlint.config.d.mts +3 -0
- package/dist/types/lib/lint-config/eslint/common.d.cts +8 -2
- package/dist/types/lib/lint-config/eslint/flat/compat.d.mts +1 -1
- package/dist/types/lib/lint-config/eslint/non-react.d.cts +8 -1
- package/dist/types/lib/lint-config/eslint/react.d.cts +8 -1
- package/dist/types/lib/lint-config/eslint/typescript/non-react.d.cts +8 -1
- package/dist/types/lib/lint-config/eslint/typescript/react.d.cts +8 -1
- package/dist/types/lib/lint-config/lint-staged.config.d.ts +2 -2
- package/dist/types/lib/lint-config/prettier/export.d.mts +1 -0
- package/dist/types/lib/lint-config/prettier.config.d.mts +3 -0
- package/dist/types/lib/testing/setup-textencoder.d.cts +1 -0
- package/dist/types/lib/utils.d.cts +1 -1
- package/dist/types/lib/utils.d.ts +1 -1
- package/dist/types/lib/webpack/webpack.storybook.d.ts +2 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/lib/lint-config/commitlint/export.mjs +1 -0
- package/lib/lint-config/commitlint.config.mjs +6 -0
- package/lib/lint-config/eslint/common.cjs +8 -1
- package/lib/lint-config/eslint/flat/compat.mjs +5 -5
- package/lib/lint-config/eslint/flat/rules.mjs +1 -0
- package/lib/lint-config/lint-staged.config.js +20 -5
- package/lib/lint-config/prettier/export.mjs +1 -0
- package/{dist/esm/lint-config/prettier.config.cjs → lib/lint-config/prettier.config.mjs} +4 -1
- package/lib/skills/migrate-storybook-out-of-cjs/SKILL.md +242 -0
- package/lib/skills/migrate-to-pui-cli-9/SKILL.md +188 -25
- package/lib/testing/jest.config.mjs +124 -0
- package/lib/testing/jest.node.config.mjs +9 -0
- package/package.json +46 -36
- package/build/docs/api/variables/eslintBaseConfig/index.html +0 -132
- package/build/docs/api/variables/eslintConfig/index.html +0 -180
- package/build/docs/assets/js/04ee7372.eaa386ed.js +0 -1
- package/build/docs/assets/js/0551d4dd.ebb18f4f.js +0 -1
- package/build/docs/assets/js/0a1d0315.fc8f91a7.js +0 -1
- package/build/docs/assets/js/13097d8d.af480dfd.js +0 -1
- package/build/docs/assets/js/3992.0ac29b2f.js +0 -2
- package/build/docs/assets/js/4fb6949f.369cc1b9.js +0 -1
- package/build/docs/assets/js/5befad71.5f19afb5.js +0 -1
- package/build/docs/assets/js/5d5f1db0.c5aa5afa.js +0 -1
- package/build/docs/assets/js/5e8c322a.ef3b894b.js +0 -1
- package/build/docs/assets/js/5e95c892.f550b901.js +0 -1
- package/build/docs/assets/js/6bd11e52.08b95209.js +0 -1
- package/build/docs/assets/js/6e96545e.30c1b801.js +0 -1
- package/build/docs/assets/js/80e87108.f9507b95.js +0 -1
- package/build/docs/assets/js/a94703ab.f1796514.js +0 -1
- package/build/docs/assets/js/b7b585d8.6d53e73f.js +0 -1
- package/build/docs/assets/js/b8ac1d98.62684003.js +0 -1
- package/build/docs/assets/js/c377a04b.0f8625c6.js +0 -1
- package/build/docs/assets/js/e5f79924.c793a74d.js +0 -1
- package/build/docs/assets/js/f736c962.dbd0d004.js +0 -1
- package/build/docs/assets/js/main.7f815b7e.js +0 -2
- package/build/docs/assets/js/runtime~main.f7c5bef0.js +0 -1
- package/dist/cjs/babel.config.cjs +0 -97
- package/dist/cjs/index.cjs +0 -35
- package/dist/cjs/lint-config/commitlint.config.cjs +0 -1
- package/dist/cjs/lint-config/stylelint.config.cjs +0 -3
- package/dist/esm/babel.config.cjs +0 -97
- package/dist/esm/index.cjs +0 -35
- package/dist/esm/lint-config/commitlint.config.cjs +0 -1
- package/dist/esm/lint-config/stylelint.config.cjs +0 -3
- package/dist/types/lib/babel.config.d.cts +0 -59
- package/dist/types/lib/index.d.cts +0 -13
- package/dist/types/lib/lint-config/commitlint.config.d.cts +0 -4
- package/dist/types/lib/lint-config/prettier.config.d.cts +0 -8
- package/dist/types/lib/lint-config/stylelint.config.d.cts +0 -2
- package/lib/lint-config/commitlint.config.cjs +0 -1
- package/lib/lint-config/stylelint.config.cjs +0 -3
- /package/build/docs/assets/js/{3992.0ac29b2f.js.LICENSE.txt → 3992.b9b54f94.js.LICENSE.txt} +0 -0
- /package/build/docs/assets/js/{main.7f815b7e.js.LICENSE.txt → main.3ae939d4.js.LICENSE.txt} +0 -0
- /package/dist/types/lib/testing/{jest.config.d.cts → jest.config.d.mts} +0 -0
- /package/dist/types/lib/testing/{jest.node.config.d.cts → jest.node.config.d.mts} +0 -0
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
name: migrate-to-pui-cli-9
|
|
3
3
|
description: >-
|
|
4
4
|
Migrate a PUI app or library to pui-cli 9 (Node 24, pnpm 11, ESLint 10 flat config, Stylelint 17,
|
|
5
|
-
Husky 9, Vitest 4, semantic-release 25, Lerna 9, Nx 22). Use when upgrading @elliemae/pui-cli,
|
|
6
|
-
migrating from .eslintrc.cjs to eslint.config.mjs, release.config.cjs to release.config.mjs,
|
|
5
|
+
Husky 9, Vitest 4, Jest 30, semantic-release 25, Lerna 9, Nx 22). Use when upgrading @elliemae/pui-cli,
|
|
6
|
+
migrating from .eslintrc.cjs to eslint.config.mjs, jest.config.cjs to jest.config.mjs, release.config.cjs to release.config.mjs,
|
|
7
|
+
babel.config.cjs to babel.config.ts, prettier.config.cjs / commitlint.config.cjs to .mjs subpath imports (pui-cli 9 is ESM-only),
|
|
7
8
|
upgrading Husky 8 hooks, fixing Vitest 4 / coverage-v8 breakages, migrating monorepo nx.json from
|
|
8
|
-
@nrwl/workspace to nx 22,
|
|
9
|
-
stay on Webpack.
|
|
9
|
+
@nrwl/workspace to nx 22, moving shamefully-hoist from .npmrc to pnpm-workspace.yaml for pnpm 11,
|
|
10
|
+
or adopting shared configs from pui-cli. App/library production builds stay on Webpack.
|
|
10
11
|
---
|
|
11
12
|
|
|
12
13
|
# Migrate to pui-cli 9
|
|
@@ -35,9 +36,46 @@ pnpm install
|
|
|
35
36
|
|
|
36
37
|
1. Update `.node-version` to `24` if needed.
|
|
37
38
|
2. Ensure CI Jenkins/docker images use Node 24.
|
|
38
|
-
3. Upgrade pnpm to 11
|
|
39
|
+
3. Upgrade pnpm to 11 — set `engines.pnpm` to `>=11` in root `package.json` (do not pin an exact version in `packageManager`; customers may use any pnpm 11 minor/patch).
|
|
39
40
|
4. Run `pnpm install`, `pnpm test`, `pnpm run build` — fix any Node/pnpm breakages only.
|
|
40
41
|
|
|
42
|
+
### Phase 1b — pnpm 11 hoisting (`pnpm-workspace.yaml`)
|
|
43
|
+
|
|
44
|
+
**Required for every repo** (apps, libs, monorepos). pnpm 11 ignores hoist settings in `.npmrc`.
|
|
45
|
+
|
|
46
|
+
1. **Keep org hoisting policy** — set `shamefullyHoist: true` in `pnpm-workspace.yaml` (same as legacy `shamefully-hoist=true`). Do not switch to isolated/no-hoist; PUI apps use `@elliemae/app-react-dependencies` and pui-cli webpack `getAlias()` expects deps at repo root `node_modules/`.
|
|
47
|
+
|
|
48
|
+
2. **Create or update `pnpm-workspace.yaml`** at the repo root. Move settings out of `.npmrc` using camelCase:
|
|
49
|
+
|
|
50
|
+
| `.npmrc` (ignored by pnpm 11) | `pnpm-workspace.yaml` |
|
|
51
|
+
| --------------------------------- | ----------------------------- |
|
|
52
|
+
| `shamefully-hoist=true` | `shamefullyHoist: true` |
|
|
53
|
+
| `public-hoist-pattern[]=…` | `publicHoistPattern: [ "…" ]` |
|
|
54
|
+
| `strict-peer-dependencies` | `strictPeerDependencies` |
|
|
55
|
+
| `auto-install-peers` | `autoInstallPeers` |
|
|
56
|
+
| `package.json` `"pnpm".overrides` | top-level `overrides:` |
|
|
57
|
+
|
|
58
|
+
3. **Single-package repo** — include `packages: ['.']`. Reference: `pui-react-boilerplate/pnpm-workspace.yaml`.
|
|
59
|
+
|
|
60
|
+
4. **Monorepo** — include `packages: ["libs/*", "apps/*"]`. Optional explicit `publicHoistPattern` for webpack alias targets: `esbuild-loader`, `@elliemae/*`, `styled-components`, `history`, `lodash`. Reference: `pui-microfe/pnpm-workspace.yaml`.
|
|
61
|
+
|
|
62
|
+
5. **Migrate `allowBuilds`** — replace `onlyBuiltDependencies` / placeholder `allowBuilds` entries with `true` for packages that need postinstall scripts (`@swc/core`, `esbuild`, `nx`, etc.). Fix `ERR_PNPM_IGNORED_BUILDS`.
|
|
63
|
+
|
|
64
|
+
6. **Trim `.npmrc`** — keep auth/registry only (for example `legacy-peer-deps=true`).
|
|
65
|
+
|
|
66
|
+
7. **Clean reinstall and verify:**
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
rm -rf node_modules libs/*/node_modules # if monorepo
|
|
70
|
+
SKIP_POST_INSTALL_BUILD=1 pnpm install --no-frozen-lockfile
|
|
71
|
+
grep publicHoistPattern node_modules/.modules.yaml # must NOT be []
|
|
72
|
+
pnpm run build
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
**Symptoms if skipped:** `Can't resolve 'esbuild-loader'` / `styled-components` / `@elliemae/pui-theme` during webpack; `publicHoistPattern: []` in `.modules.yaml`.
|
|
76
|
+
|
|
77
|
+
See migration guide section **1b. Migrate pnpm hoisting to `pnpm-workspace.yaml`**.
|
|
78
|
+
|
|
41
79
|
### Phase 2 — Bump pui-cli
|
|
42
80
|
|
|
43
81
|
```bash
|
|
@@ -46,6 +84,52 @@ pnpm add -D @elliemae/pui-cli@9
|
|
|
46
84
|
|
|
47
85
|
Re-run install and smoke-test build/test without ESLint changes yet if the bump is large.
|
|
48
86
|
|
|
87
|
+
### Phase 2b — Babel config (`babel.config.ts`)
|
|
88
|
+
|
|
89
|
+
pui-cli 9 requires Node 24, which natively loads TypeScript config files. Babel 7.28+ (shipped with pui-cli 9) supports **`babel.config.ts`** without extra loaders.
|
|
90
|
+
|
|
91
|
+
1. Replace root `babel.config.cjs` with `babel.config.ts`:
|
|
92
|
+
|
|
93
|
+
```typescript
|
|
94
|
+
import { babelConfig } from '@elliemae/pui-cli';
|
|
95
|
+
|
|
96
|
+
export default babelConfig;
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
2. Delete `babel.config.cjs`. Repeat for monorepo packages that have their own Babel file (for example `libs/foo/babel.config.cjs`).
|
|
100
|
+
|
|
101
|
+
3. **Do not** add `@babel/plugin-transform-private-methods` or `@babel/plugin-transform-private-property-in-object` locally — pui-cli 9 includes them in shared `babelConfig` (Storybook and app-sdk private class syntax).
|
|
102
|
+
|
|
103
|
+
4. Verify: `pnpm run build`; if the repo uses Storybook, `pnpm exec pui-cli storybook -b`.
|
|
104
|
+
|
|
105
|
+
See migration guide section **2b. Migrate Babel config to TypeScript**.
|
|
106
|
+
|
|
107
|
+
### Phase 2c — Prettier and Commitlint (`.mjs`)
|
|
108
|
+
|
|
109
|
+
pui-cli 9 ships shared Prettier and Commitlint configs as ESM. Migrate root configs from `.cjs` to `.mjs` using subpath exports (same pattern as Stylelint and Jest).
|
|
110
|
+
|
|
111
|
+
1. Replace `prettier.config.cjs` with `prettier.config.mjs`:
|
|
112
|
+
|
|
113
|
+
```javascript
|
|
114
|
+
import { prettierConfig } from '@elliemae/pui-cli/prettier';
|
|
115
|
+
|
|
116
|
+
export default prettierConfig;
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
2. Replace `commitlint.config.cjs` with `commitlint.config.mjs`:
|
|
120
|
+
|
|
121
|
+
```javascript
|
|
122
|
+
import { commitlintConfig } from '@elliemae/pui-cli/commitlint';
|
|
123
|
+
|
|
124
|
+
export default commitlintConfig;
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
3. Delete the old `.cjs` files. **`require('@elliemae/pui-cli')` is removed in pui-cli 9** — use ESM subpath imports only.
|
|
128
|
+
|
|
129
|
+
4. Verify: `pnpm exec prettier --check .`; test a commit through Husky if commitlint is enabled.
|
|
130
|
+
|
|
131
|
+
See migration guide section **2c. Migrate Prettier and Commitlint configs to ESM**.
|
|
132
|
+
|
|
49
133
|
### Phase 3 — ESLint 10 flat config
|
|
50
134
|
|
|
51
135
|
**React apps and libraries:**
|
|
@@ -153,12 +237,43 @@ Reference hooks: [pui-cli/.husky](https://git.elliemae.io/platform-ui/pui-cli/tr
|
|
|
153
237
|
|
|
154
238
|
### Phase 6 — Stylelint 17 (if CSS / styled-components)
|
|
155
239
|
|
|
156
|
-
1. Simplify `stylelint.config.
|
|
157
|
-
2.
|
|
158
|
-
3. Run `pnpm exec pui-cli lint` (CSS pass).
|
|
240
|
+
1. Simplify or migrate to `stylelint.config.mjs` importing `@elliemae/pui-cli/stylelint` — remove `stylelint-config-styled-components` workarounds.
|
|
241
|
+
2. Run `pnpm exec pui-cli lint` (CSS pass).
|
|
159
242
|
|
|
160
243
|
See [stylelint-migration.md](https://docs.pui.mortgagetech.q1.ice.com/cli/stylelint-migration) in pui-cli docs.
|
|
161
244
|
|
|
245
|
+
### Phase 6b — Jest 30 (if using `pui-cli test`)
|
|
246
|
+
|
|
247
|
+
Skip if the repo uses Vitest (`pui-cli vitest`) only.
|
|
248
|
+
|
|
249
|
+
1. Replace `jest.config.cjs` with `jest.config.mjs`:
|
|
250
|
+
|
|
251
|
+
```javascript
|
|
252
|
+
import { jestConfig } from '@elliemae/pui-cli';
|
|
253
|
+
|
|
254
|
+
delete jestConfig.moduleNameMapper['@elliemae/pui-diagnostics'];
|
|
255
|
+
|
|
256
|
+
export default jestConfig;
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
Delete `jest.config.cjs` after creating `jest.config.mjs`.
|
|
260
|
+
|
|
261
|
+
2. Align local Jest devDependencies with pui-cli 9:
|
|
262
|
+
|
|
263
|
+
```bash
|
|
264
|
+
pnpm add -D jest-cli@30 jest-environment-jsdom@30 @types/jest@30 jest-watch-typeahead@3
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
3. Search for deprecated matcher aliases (`toBeCalled`, `toReturn`, `toThrowError`, etc.) and update to canonical names (`toHaveBeenCalled`, `toHaveReturned`, `toThrow`). Use `eslint-plugin-jest` `no-alias-methods` autofix when available.
|
|
268
|
+
|
|
269
|
+
4. Regenerate snapshots if needed: `pnpm exec pui-cli test --fix` or `jest -u`.
|
|
270
|
+
|
|
271
|
+
5. Run `pnpm exec pui-cli test`.
|
|
272
|
+
|
|
273
|
+
**Do not** replace `setupFiles` wholesale — spread pui-cli defaults when adding repo-specific setup. Remove any local `jest-textencoder-setup.cjs` (built into shared `jestConfig`).
|
|
274
|
+
|
|
275
|
+
See migration guide section **Jest 30 (`pui-cli test`)**.
|
|
276
|
+
|
|
162
277
|
### Phase 7 — Vitest 4 (if using `pui-cli vitest`)
|
|
163
278
|
|
|
164
279
|
Skip if the repo uses Jest (`pui-cli test`) only.
|
|
@@ -243,11 +358,12 @@ pnpm exec lerna --version # 9.x
|
|
|
243
358
|
- Remove `tasksRunnerOptions`; move cacheable targets to `"cache": true` in `targetDefaults`
|
|
244
359
|
- Optional: `pnpm exec nx migrate latest && pnpm exec nx migrate --run-migrations`
|
|
245
360
|
|
|
246
|
-
4. Lerna 9: stop using `lerna bootstrap` / `lerna add` / `lerna link` — use pnpm workspaces.
|
|
361
|
+
4. Lerna 9: stop using `lerna bootstrap` / `lerna add` / `lerna link` — use pnpm workspaces. Remove `"useWorkspaces": true` from `lerna.json` (Lerna 9 errors with `ECONFIGWORKSPACES` if present). Keep `"npmClient": "pnpm"` so Lerna reads `pnpm-workspace.yaml`. Optional: `pnpm exec lerna repair`. `pui-cli version` unchanged.
|
|
247
362
|
|
|
248
363
|
5. Smoke-test:
|
|
249
364
|
|
|
250
365
|
```bash
|
|
366
|
+
pnpm exec lerna list
|
|
251
367
|
pnpm exec nx run-many --target=build --all --parallel
|
|
252
368
|
pnpm exec nx affected --target=lint --uncommitted
|
|
253
369
|
pnpm exec pui-cli lint
|
|
@@ -255,8 +371,40 @@ pnpm exec pui-cli lint
|
|
|
255
371
|
|
|
256
372
|
See [pui-cli 9 migration guide](https://docs.pui.mortgagetech.q1.ice.com/cli/pui-cli-9-migration) — **Lerna 9 and Nx 22** section for the full `nx.json` template.
|
|
257
373
|
|
|
374
|
+
### Phase 11 — Storybook 10 + latest pui-app-sdk
|
|
375
|
+
|
|
376
|
+
Applies when the repo uses `pui-cli storybook`. Requires pui-cli 9 **and** a matching **pui-app-sdk** release on the same train (`storybook/cjs/*` removed; shared config is TypeScript in app-sdk, consumed from **compiled dist**).
|
|
377
|
+
|
|
378
|
+
Install the dedicated skill for agents:
|
|
379
|
+
|
|
380
|
+
```bash
|
|
381
|
+
pnpm exec pui-cli skills install migrate-storybook-out-of-cjs --target all
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
Follow **`migrate-storybook-out-of-cjs`** for the full CJS → ESM playbook. Summary:
|
|
385
|
+
|
|
386
|
+
1. Bump `@elliemae/pui-cli@9` and `@elliemae/pui-app-sdk@*` together; reinstall (rebuild app-sdk if using a `file:` link).
|
|
387
|
+
2. Replace `.storybook/main.js` with `.storybook/main.mjs` importing **`getStorybookConfig`** from `@elliemae/pui-app-sdk/storybook/main` (not `getConfig` or `storybook/cjs/main`).
|
|
388
|
+
3. Delete `.storybook/middleware.js`; migrate `preview` / `manager` / `theme` to `.mjs` when customized.
|
|
389
|
+
4. Rename docs-only **`*.stories.mdx`** → **`*.mdx`**; use `@storybook/addon-docs/blocks` for `<Meta>` (MDX3).
|
|
390
|
+
5. Update stories to CSF3 where types fail; remove SB6 webpack alias workarounds unless still required.
|
|
391
|
+
6. Migrate consumer **`babel.config.cjs` → `babel.config.ts`** (re-export pui-cli `babelConfig`) — see Phase 2b; **do not** duplicate private-method Babel plugins (pui-cli 9 includes them for Storybook).
|
|
392
|
+
|
|
393
|
+
Verify:
|
|
394
|
+
|
|
395
|
+
```bash
|
|
396
|
+
pnpm exec pui-cli storybook
|
|
397
|
+
pnpm exec pui-cli storybook -b
|
|
398
|
+
pnpm exec pui-cli lint
|
|
399
|
+
```
|
|
400
|
+
|
|
401
|
+
See [pui-cli 9 migration guide — Storybook 10](https://docs.pui.mortgagetech.q1.ice.com/cli/pui-cli-9-migration) for pui-app-sdk export changes, dist build requirement, and troubleshooting.
|
|
402
|
+
|
|
258
403
|
### Phase 10 — Verify
|
|
259
404
|
|
|
405
|
+
- [ ] `babel.config.ts` re-exports pui-cli `babelConfig`; `babel.config.cjs` removed
|
|
406
|
+
- [ ] `prettier.config.mjs` and `commitlint.config.mjs` import subpath exports; legacy `.cjs` removed
|
|
407
|
+
- [ ] `shamefullyHoist` in `pnpm-workspace.yaml` (not `.npmrc`); `publicHoistPattern` not `[]` in `.modules.yaml`
|
|
260
408
|
- [ ] `pnpm exec pui-cli lint` — 0 errors
|
|
261
409
|
- [ ] `pnpm exec pui-cli tscheck --files`
|
|
262
410
|
- [ ] `pnpm test` (or `pui-cli vitest` if applicable)
|
|
@@ -267,21 +415,35 @@ See [pui-cli 9 migration guide](https://docs.pui.mortgagetech.q1.ice.com/cli/pui
|
|
|
267
415
|
|
|
268
416
|
## Common lint fixes after upgrade
|
|
269
417
|
|
|
270
|
-
| Symptom
|
|
271
|
-
|
|
|
272
|
-
| `import-x/no-unresolved`
|
|
273
|
-
| `@typescript-eslint/no-explicit-any`
|
|
274
|
-
| `@typescript-eslint/no-unused-vars`
|
|
275
|
-
| Stale `eslint-disable` comments
|
|
276
|
-
| Test/fixture files flagged
|
|
277
|
-
| `.d.ts` files
|
|
278
|
-
| Cannot find module `vite` in tscheck
|
|
279
|
-
| Vitest `optimizer.web` unknown
|
|
280
|
-
| Coverage fails after upgrade
|
|
281
|
-
| `release.config.cjs` extends fails
|
|
282
|
-
| `nx` fails after pui-cli 9 bump
|
|
283
|
-
| `lerna bootstrap` / `add` / `link`
|
|
284
|
-
|
|
|
418
|
+
| Symptom | Fix |
|
|
419
|
+
| ----------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
420
|
+
| `import-x/no-unresolved` | Use `import type` for type-only imports |
|
|
421
|
+
| `@typescript-eslint/no-explicit-any` | Type the value or add targeted override (warn) during transition |
|
|
422
|
+
| `@typescript-eslint/no-unused-vars` | Remove or prefix with `_` |
|
|
423
|
+
| Stale `eslint-disable` comments | Remove disables for rules no longer in config |
|
|
424
|
+
| Test/fixture files flagged | Shared config includes `lib/**/tests/**` globs — ensure pui-cli 9.0.0+ |
|
|
425
|
+
| `.d.ts` files | pui-cli turns off `no-explicit-any` for `**/*.d.ts` |
|
|
426
|
+
| Cannot find module `vite` in tscheck | Set `moduleResolution: "bundler"` or extend pui-cli 9 tsconfig |
|
|
427
|
+
| Vitest `optimizer.web` unknown | Rename to `test.deps.optimizer.client` (Vitest 4) |
|
|
428
|
+
| Coverage fails after upgrade | Remove `@vitest/coverage-c8`; use `@vitest/coverage-v8@4` |
|
|
429
|
+
| `release.config.cjs` extends fails | Migrate to `release.config.mjs`; requires semantic-release 22+ (pui-cli 9 ships 25) |
|
|
430
|
+
| `nx` fails after pui-cli 9 bump | Migrate `nx.json` off `@nrwl/*`; use `targetDefaults` not `targetDependencies` |
|
|
431
|
+
| `lerna bootstrap` / `add` / `link` | Removed in lerna 9 — use `pnpm` workspaces and `pnpm add --filter` |
|
|
432
|
+
| `ECONFIGWORKSPACES` / `useWorkspaces` has been removed | Delete `"useWorkspaces": true` from `lerna.json`; keep `"npmClient": "pnpm"`; run `pnpm exec lerna list` to verify |
|
|
433
|
+
| Stale `@nrwl/workspace` in lockfile | Remove direct `@nrwl/*` pins; rely on pui-cli's `nx` + `@nx/workspace` |
|
|
434
|
+
| `Can't resolve 'esbuild-loader'` | Move `shamefullyHoist: true` to `pnpm-workspace.yaml`; clean reinstall |
|
|
435
|
+
| `Can't resolve 'styled-components'` / `@elliemae/pui-theme` | Same — hoisting ignored if still only in `.npmrc` |
|
|
436
|
+
| `publicHoistPattern: []` in `.modules.yaml` | Migrate hoist settings from `.npmrc` to `pnpm-workspace.yaml` |
|
|
437
|
+
| `ERR_PNPM_IGNORED_BUILDS` | Set real `allowBuilds` in `pnpm-workspace.yaml` or run `pnpm approve-builds` |
|
|
438
|
+
| `husky: command not found` on prepare | `shamefullyHoist` + `publicHoistPattern: [husky]` or direct root `devDependency` |
|
|
439
|
+
| Storybook fails after pui-cli 9 bump | Migrate `.storybook/main.js` → `main.mjs`; import `getStorybookConfig` from `@elliemae/pui-app-sdk/storybook/main`; build app-sdk if using `file:` link |
|
|
440
|
+
| `Class private methods are not enabled` (Storybook build) | Upgrade pui-cli 9 (private-method Babel plugins in shared `babelConfig`); remove duplicate plugins from consumer Babel config |
|
|
441
|
+
| Babel cannot load `babel.config.ts` | Confirm Node 24 (`.node-version`, CI); pui-cli 9 requires Node 24 for native TS config loading |
|
|
442
|
+
| `Failed to load native binding` / SWC errors | pui-cli removes SWC from Storybook webpack; reinstall deps; Babel compiler addon uses pui-cli `babelConfig` |
|
|
443
|
+
| `middleware.js` ignored / API mocks missing | Delete middleware file; pui-cli Storybook dev server loads routes automatically |
|
|
444
|
+
| Jest `TextEncoder is not defined` | Built into pui-cli `jestConfig` — remove repo `jest-textencoder-setup.cjs`; keep `delete moduleNameMapper['@elliemae/pui-diagnostics']` only if using real package |
|
|
445
|
+
| `require('@elliemae/pui-cli')` fails / `ERR_REQUIRE_ESM` | pui-cli 9 is ESM-only — migrate configs to `.mjs`/`.ts` and use subpath imports (`@elliemae/pui-cli/eslint`, `/prettier`, `/jest`, etc.) |
|
|
446
|
+
| Jest fails after pui-cli 9 bump | Migrate `jest.config.cjs` → `jest.config.mjs`; align `jest-cli@30`, `jest-environment-jsdom@30`, `@types/jest@30`, `jest-watch-typeahead@3`; fix deprecated matcher aliases; regenerate snapshots |
|
|
285
447
|
|
|
286
448
|
Full rule comparison: [eslint-rules-migration.md](https://docs.pui.mortgagetech.q1.ice.com/cli/eslint-rules-migration) (also at `docs/eslint-rules-migration.md` in pui-cli).
|
|
287
449
|
|
|
@@ -299,7 +461,8 @@ Skills are copied to `.cursor/skills/`, `.claude/skills/`, and `.github/skills/`
|
|
|
299
461
|
|
|
300
462
|
- Application business logic — migration is tooling/config only
|
|
301
463
|
- Webpack/babel production build config — pui-cli 9 does not migrate apps to Vite for bundling
|
|
302
|
-
- Prettier / commitlint
|
|
464
|
+
- Prettier / commitlint preset values — migrate config **format** to `.mjs` when touching those files; do not change shared rule/preset content unless pui-cli 9 bumps them
|
|
465
|
+
- **Org hoisting policy** — keep `shamefullyHoist: true`; do not remove hoisting or duplicate webpack deps in root `package.json` as a workaround
|
|
303
466
|
|
|
304
467
|
## Additional resources
|
|
305
468
|
|
|
@@ -1,15 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { createRequire } from 'node:module';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
import normalizePath from 'normalize-path';
|
|
5
|
+
|
|
6
|
+
const require = createRequire(import.meta.url);
|
|
7
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
8
|
+
|
|
3
9
|
const { getAppConfig, basePath } = require('../utils.cjs');
|
|
4
10
|
const { swcrcConfig } = require('../transpile/swcrc.config.cjs');
|
|
5
11
|
const { findMonoRepoRoot } = require('../monorepo/utils.cjs');
|
|
6
12
|
|
|
7
13
|
let isReactModule = true;
|
|
8
14
|
try {
|
|
9
|
-
|
|
10
15
|
require('react');
|
|
11
16
|
require('styled-components');
|
|
12
|
-
|
|
13
17
|
} catch {
|
|
14
18
|
isReactModule = false;
|
|
15
19
|
}
|
|
@@ -80,7 +84,11 @@ const jestConfig = {
|
|
|
80
84
|
},
|
|
81
85
|
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
|
|
82
86
|
setupFilesAfterEnv: [path.resolve(__dirname, './setup-tests.js')],
|
|
83
|
-
setupFiles: [
|
|
87
|
+
setupFiles: [
|
|
88
|
+
path.resolve(__dirname, './setup-textencoder.cjs'),
|
|
89
|
+
'raf/polyfill',
|
|
90
|
+
'whatwg-fetch',
|
|
91
|
+
],
|
|
84
92
|
testRegex: '(app|lib).*/tests/.*\\.test\\.[jt]sx?$',
|
|
85
93
|
snapshotSerializers: [],
|
|
86
94
|
testResultsProcessor: 'jest-sonar-reporter',
|
|
@@ -113,4 +121,4 @@ if (isReactModule && jestConfig.setupFilesAfterEnv)
|
|
|
113
121
|
path.resolve(__dirname, './setup-react-env.js'),
|
|
114
122
|
);
|
|
115
123
|
|
|
116
|
-
|
|
124
|
+
export { jestConfig };
|
|
@@ -29,15 +29,28 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
29
29
|
var webpack_storybook_exports = {};
|
|
30
30
|
__export(webpack_storybook_exports, {
|
|
31
31
|
managerWebpack: () => managerWebpack,
|
|
32
|
+
resolveStorybookAddon: () => resolveStorybookAddon,
|
|
32
33
|
webpackFinal: () => webpackFinal
|
|
33
34
|
});
|
|
34
35
|
module.exports = __toCommonJS(webpack_storybook_exports);
|
|
36
|
+
var import_node_module = require("node:module");
|
|
37
|
+
var import_node_url = require("node:url");
|
|
35
38
|
var import_webpack = __toESM(require("webpack"), 1);
|
|
36
39
|
var import_mini_css_extract_plugin = __toESM(require("mini-css-extract-plugin"), 1);
|
|
37
40
|
var import_copy_webpack_plugin = __toESM(require("copy-webpack-plugin"), 1);
|
|
38
41
|
var import_resolve_typescript_plugin = __toESM(require("resolve-typescript-plugin"), 1);
|
|
39
42
|
var import_helpers = require("./helpers.js");
|
|
43
|
+
var import_appRoutes = require("../server/appRoutes.js");
|
|
40
44
|
var import_utils = require("../utils.js");
|
|
45
|
+
const import_meta = {};
|
|
46
|
+
const puiCliRequire = (0, import_node_module.createRequire)((0, import_node_url.fileURLToPath)(import_meta.url));
|
|
47
|
+
const resolveStorybookAddon = (addonName) => {
|
|
48
|
+
try {
|
|
49
|
+
return puiCliRequire.resolve(addonName);
|
|
50
|
+
} catch {
|
|
51
|
+
return addonName;
|
|
52
|
+
}
|
|
53
|
+
};
|
|
41
54
|
const IS_APP = (0, import_utils.isApp)();
|
|
42
55
|
const CWD = process.cwd();
|
|
43
56
|
const getAdditionalPlugins = () => [
|
|
@@ -84,12 +97,50 @@ const getModuleRules = () => [
|
|
|
84
97
|
type: "asset/resource"
|
|
85
98
|
}
|
|
86
99
|
];
|
|
100
|
+
const setupStorybookMiddlewares = (middlewares, devServer) => {
|
|
101
|
+
if (devServer.app) {
|
|
102
|
+
(0, import_appRoutes.loadRoutes)(devServer.app).catch((err) => {
|
|
103
|
+
console.error(err);
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
return middlewares;
|
|
107
|
+
};
|
|
108
|
+
const usesSwcLoader = (rule) => {
|
|
109
|
+
if (typeof rule.loader === "string" && rule.loader.includes("swc-loader")) {
|
|
110
|
+
return true;
|
|
111
|
+
}
|
|
112
|
+
const uses = Array.isArray(rule.use) ? rule.use : rule.use ? [rule.use] : [];
|
|
113
|
+
return uses.some((useEntry) => {
|
|
114
|
+
const loader = typeof useEntry === "string" ? useEntry : useEntry.loader;
|
|
115
|
+
return loader?.includes("swc-loader");
|
|
116
|
+
});
|
|
117
|
+
};
|
|
118
|
+
const removeSwcLoaderRules = (rules = []) => rules.filter((rule) => !usesSwcLoader(rule)).map((rule) => {
|
|
119
|
+
if (rule.oneOf) {
|
|
120
|
+
return {
|
|
121
|
+
...rule,
|
|
122
|
+
oneOf: removeSwcLoaderRules(rule.oneOf)
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
if (rule.rules) {
|
|
126
|
+
return {
|
|
127
|
+
...rule,
|
|
128
|
+
rules: removeSwcLoaderRules(rule.rules)
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
return rule;
|
|
132
|
+
});
|
|
87
133
|
const webpackFinal = (config, { configType }) => {
|
|
88
134
|
const isProd = configType === "PRODUCTION";
|
|
89
135
|
const fileLoaderRule = config?.module?.rules?.find?.(
|
|
90
136
|
(rule) => rule.test?.test?.(".svg")
|
|
91
137
|
);
|
|
92
138
|
if (fileLoaderRule) fileLoaderRule.exclude = /\.svg$/i;
|
|
139
|
+
if (config.module?.rules) {
|
|
140
|
+
config.module.rules = removeSwcLoaderRules(
|
|
141
|
+
config.module.rules
|
|
142
|
+
);
|
|
143
|
+
}
|
|
93
144
|
config?.module?.rules?.unshift(...getModuleRules());
|
|
94
145
|
config?.plugins?.push(...getAdditionalPlugins());
|
|
95
146
|
if (isProd) {
|
|
@@ -118,6 +169,17 @@ const webpackFinal = (config, { configType }) => {
|
|
|
118
169
|
config.externals["@elliemae/pui-diagnostics"] = "emuiDiagnostics";
|
|
119
170
|
config.externals["@elliemae/pui-logrocket"] = "emuiLogrocket";
|
|
120
171
|
}
|
|
172
|
+
if (!isProd) {
|
|
173
|
+
const existingDevServer = config.devServer ?? {};
|
|
174
|
+
const existingSetupMiddlewares = existingDevServer.setupMiddlewares;
|
|
175
|
+
config.devServer = {
|
|
176
|
+
...existingDevServer,
|
|
177
|
+
setupMiddlewares: (middlewares, devServer) => {
|
|
178
|
+
const nextMiddlewares = typeof existingSetupMiddlewares === "function" ? existingSetupMiddlewares(middlewares, devServer) : middlewares;
|
|
179
|
+
return setupStorybookMiddlewares(nextMiddlewares, devServer);
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
}
|
|
121
183
|
return config;
|
|
122
184
|
};
|
|
123
185
|
const managerWebpack = (config) => {
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
const isApp = () => fs.existsSync(path.join(process.cwd(), "app"));
|
|
4
|
+
const nodeEnvPreset = {
|
|
5
|
+
modules: process.env.ES_MODULES === "false" ? "commonjs" : false,
|
|
6
|
+
targets: {
|
|
7
|
+
node: "current"
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
const webEnvPreset = {
|
|
11
|
+
modules: process.env.ES_MODULES === "false" ? "commonjs" : false,
|
|
12
|
+
useBuiltIns: "usage",
|
|
13
|
+
corejs: { version: "3.36", proposals: true }
|
|
14
|
+
};
|
|
15
|
+
const presetEnvOptions = process.env.TARGET_ENV === "node" ? nodeEnvPreset : webEnvPreset;
|
|
16
|
+
const config = {
|
|
17
|
+
ignore: [/\/core-js/],
|
|
18
|
+
sourceType: "unambiguous",
|
|
19
|
+
presets: [
|
|
20
|
+
["@babel/preset-env", presetEnvOptions],
|
|
21
|
+
["@babel/preset-react", { runtime: "automatic" }],
|
|
22
|
+
"@babel/preset-typescript"
|
|
23
|
+
],
|
|
24
|
+
plugins: [
|
|
25
|
+
[
|
|
26
|
+
"babel-plugin-module-resolver",
|
|
27
|
+
{
|
|
28
|
+
alias: {
|
|
29
|
+
"@": isApp() ? "./app" : "./lib"
|
|
30
|
+
},
|
|
31
|
+
stripExtensions: []
|
|
32
|
+
}
|
|
33
|
+
],
|
|
34
|
+
["babel-plugin-styled-components", { displayName: true }],
|
|
35
|
+
["@babel/plugin-transform-runtime", { regenerator: true }],
|
|
36
|
+
"@babel/plugin-proposal-class-properties",
|
|
37
|
+
"@babel/plugin-transform-private-methods",
|
|
38
|
+
"@babel/plugin-transform-private-property-in-object",
|
|
39
|
+
"@babel/plugin-syntax-dynamic-import",
|
|
40
|
+
"@babel/plugin-proposal-export-default-from",
|
|
41
|
+
"lodash",
|
|
42
|
+
"date-fns"
|
|
43
|
+
],
|
|
44
|
+
env: {
|
|
45
|
+
development: {
|
|
46
|
+
plugins: [
|
|
47
|
+
["babel-plugin-styled-components", { displayName: true }],
|
|
48
|
+
"@babel/plugin-transform-react-jsx-source"
|
|
49
|
+
]
|
|
50
|
+
},
|
|
51
|
+
production: {
|
|
52
|
+
plugins: [
|
|
53
|
+
["babel-plugin-styled-components", { displayName: false, pure: true }],
|
|
54
|
+
["transform-remove-console", { exclude: ["error", "warn"] }],
|
|
55
|
+
"transform-react-remove-prop-types",
|
|
56
|
+
"@babel/plugin-transform-react-inline-elements",
|
|
57
|
+
"@babel/plugin-transform-react-constant-elements"
|
|
58
|
+
]
|
|
59
|
+
},
|
|
60
|
+
test: {
|
|
61
|
+
plugins: [
|
|
62
|
+
["babel-plugin-styled-components", { displayName: true }],
|
|
63
|
+
"@babel/plugin-transform-modules-commonjs",
|
|
64
|
+
"dynamic-import-node",
|
|
65
|
+
[
|
|
66
|
+
"babel-plugin-transform-strip-block",
|
|
67
|
+
{
|
|
68
|
+
requireDirective: true,
|
|
69
|
+
identifiers: [{ start: "block:start", end: "block:end" }]
|
|
70
|
+
}
|
|
71
|
+
],
|
|
72
|
+
"babel-plugin-import-remove-resource-query"
|
|
73
|
+
]
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
if (process.env.STORYBOOK_BUILD !== "true" && process.env.TARGET_ENV !== "node") {
|
|
78
|
+
config.env?.development?.plugins?.push?.("react-refresh/babel");
|
|
79
|
+
}
|
|
80
|
+
if (process.env.ES_MODULES === "false") {
|
|
81
|
+
config.plugins?.push?.([
|
|
82
|
+
"babel-plugin-transform-strip-block",
|
|
83
|
+
{
|
|
84
|
+
requireDirective: true,
|
|
85
|
+
identifiers: [{ start: "block:start", end: "block:end" }]
|
|
86
|
+
}
|
|
87
|
+
]);
|
|
88
|
+
}
|
|
89
|
+
const babelConfig = config;
|
|
90
|
+
var babel_config_default = babelConfig;
|
|
91
|
+
export {
|
|
92
|
+
babelConfig,
|
|
93
|
+
babel_config_default as default
|
|
94
|
+
};
|
|
@@ -1,13 +1,27 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { fileURLToPath } from "node:url";
|
|
1
3
|
import { exec, logInfo, logError, logSuccess } from "./utils.js";
|
|
4
|
+
const DEFAULT_PORT = 11e3;
|
|
5
|
+
const puiCliRoot = path.resolve(
|
|
6
|
+
path.dirname(fileURLToPath(import.meta.url)),
|
|
7
|
+
"../../.."
|
|
8
|
+
);
|
|
9
|
+
const storybookBin = path.join(puiCliRoot, "node_modules/.bin/storybook");
|
|
10
|
+
const crossEnvBin = path.join(puiCliRoot, "node_modules/.bin/cross-env");
|
|
11
|
+
const puiCliNodeModules = path.join(puiCliRoot, "node_modules");
|
|
12
|
+
const getStorybookEnv = () => {
|
|
13
|
+
const nodePath = [puiCliNodeModules, process.env.NODE_PATH].filter(Boolean).join(path.delimiter);
|
|
14
|
+
return `NODE_PATH="${nodePath}"`;
|
|
15
|
+
};
|
|
2
16
|
const buildStoryBook = async (outputDir = "demo", isDoc = false) => {
|
|
3
17
|
const additionalParams = isDoc ? `--docs -o ${outputDir}/docs` : `-o ${outputDir}`;
|
|
4
18
|
await exec(
|
|
5
|
-
`
|
|
19
|
+
`"${crossEnvBin}" ${getStorybookEnv()} NODE_ENV=production "${storybookBin}" build --quiet ${additionalParams}`
|
|
6
20
|
);
|
|
7
21
|
};
|
|
8
|
-
const startStoryBook = async (isDoc = false) => {
|
|
22
|
+
const startStoryBook = async (isDoc = false, port = DEFAULT_PORT) => {
|
|
9
23
|
await exec(
|
|
10
|
-
`
|
|
24
|
+
`"${crossEnvBin}" ${getStorybookEnv()} NODE_ENV=development STORYBOOK_BUILD=true "${storybookBin}" dev ${isDoc ? "--docs" : ""} -p ${port} --quiet`
|
|
11
25
|
);
|
|
12
26
|
};
|
|
13
27
|
const cmdArgs = {
|
|
@@ -24,13 +38,17 @@ const cmdArgs = {
|
|
|
24
38
|
string: true,
|
|
25
39
|
alias: "o",
|
|
26
40
|
default: "demo"
|
|
41
|
+
},
|
|
42
|
+
port: {
|
|
43
|
+
number: true,
|
|
44
|
+
default: DEFAULT_PORT
|
|
27
45
|
}
|
|
28
46
|
};
|
|
29
47
|
const storybookCmd = {
|
|
30
48
|
handler: async (argv) => {
|
|
31
49
|
try {
|
|
32
50
|
if (!argv.build) {
|
|
33
|
-
await startStoryBook(argv.docs);
|
|
51
|
+
await startStoryBook(argv.docs, argv.port);
|
|
34
52
|
logInfo("Storybook started");
|
|
35
53
|
} else {
|
|
36
54
|
await buildStoryBook(argv.output, argv.docs);
|
package/dist/esm/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { babelConfig } from "./babel.config.
|
|
1
|
+
import { babelConfig } from "./babel.config.js";
|
|
2
2
|
import {
|
|
3
3
|
eslintFlatBaseConfig,
|
|
4
4
|
eslintFlatBaseConfigStrict
|
|
@@ -7,21 +7,17 @@ import {
|
|
|
7
7
|
eslintFlatConfig,
|
|
8
8
|
eslintFlatConfigStrict
|
|
9
9
|
} from "./lint-config/eslint/flat/react-export.mjs";
|
|
10
|
-
import { esConfig } from "./lint-config/eslint/non-react.cjs";
|
|
11
|
-
import { esReactConfig } from "./lint-config/eslint/react.cjs";
|
|
12
10
|
import { stylelintConfig } from "./lint-config/stylelint/export.mjs";
|
|
13
|
-
import { prettierConfig } from "./lint-config/prettier.config.
|
|
14
|
-
import { commitlintConfig } from "./lint-config/commitlint.config.
|
|
15
|
-
import { jestConfig } from "./testing/jest.config.
|
|
11
|
+
import { prettierConfig } from "./lint-config/prettier.config.mjs";
|
|
12
|
+
import { commitlintConfig } from "./lint-config/commitlint.config.mjs";
|
|
13
|
+
import { jestConfig } from "./testing/jest.config.mjs";
|
|
16
14
|
import { vitestConfig } from "./testing/vitest.config.js";
|
|
17
|
-
import { jestNodeConfig } from "./testing/jest.node.config.
|
|
15
|
+
import { jestNodeConfig } from "./testing/jest.node.config.mjs";
|
|
18
16
|
import { lintStagedConfig } from "./lint-config/lint-staged.config.js";
|
|
19
17
|
import { loadRoutes } from "./server/appRoutes.js";
|
|
20
18
|
export {
|
|
21
19
|
babelConfig,
|
|
22
20
|
commitlintConfig,
|
|
23
|
-
esConfig as eslintBaseConfig,
|
|
24
|
-
esReactConfig as eslintConfig,
|
|
25
21
|
eslintFlatBaseConfig,
|
|
26
22
|
eslintFlatBaseConfigStrict,
|
|
27
23
|
eslintFlatConfig,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { commitlintConfig, default } from '../commitlint.config.mjs';
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
|
|
2
|
-
const prettierOptions =
|
|
2
|
+
const prettierOptions = {
|
|
3
|
+
printWidth: 80,
|
|
4
|
+
tabWidth: 2,
|
|
5
|
+
useTabs: false,
|
|
6
|
+
semi: true,
|
|
7
|
+
singleQuote: true,
|
|
8
|
+
trailingComma: 'all',
|
|
9
|
+
};
|
|
3
10
|
// const webpackConfig = require('../../webpack/webpack.prod.babel');
|
|
4
11
|
|
|
5
12
|
exports.baseExtends = [
|