@elliemae/pui-cli 9.0.0-alpha.12 → 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.
Files changed (151) hide show
  1. package/README.md +4 -3
  2. package/build/docs/404.html +4 -4
  3. package/build/docs/api/functions/loadRoutes/index.html +9 -9
  4. package/build/docs/api/index.html +8 -8
  5. package/build/docs/api/type-aliases/LIB_NAME/index.html +5 -5
  6. package/build/docs/api/variables/babelConfig/index.html +5 -28
  7. package/build/docs/api/variables/commitlintConfig/index.html +5 -8
  8. package/build/docs/api/variables/eslintFlatBaseConfig/index.html +6 -6
  9. package/build/docs/api/variables/eslintFlatBaseConfigStrict/index.html +6 -6
  10. package/build/docs/api/variables/eslintFlatConfig/index.html +6 -6
  11. package/build/docs/api/variables/eslintFlatConfigStrict/index.html +6 -6
  12. package/build/docs/api/variables/jestConfig/index.html +86 -86
  13. package/build/docs/api/variables/jestNodeConfig/index.html +86 -86
  14. package/build/docs/api/variables/lintStagedConfig/index.html +22 -12
  15. package/build/docs/api/variables/prettierConfig/index.html +5 -18
  16. package/build/docs/api/variables/stylelintConfig/index.html +5 -5
  17. package/build/docs/api/variables/vitestConfig/index.html +5 -5
  18. package/build/docs/assets/css/{styles.74603f39.css → styles.3cba4e67.css} +1 -1
  19. package/build/docs/assets/js/04ee7372.c6c3d513.js +1 -0
  20. package/build/docs/assets/js/0551d4dd.a6b1d9fa.js +1 -0
  21. package/build/docs/assets/js/0a1d0315.43980061.js +1 -0
  22. package/build/docs/assets/js/13097d8d.4ac8ef79.js +1 -0
  23. package/build/docs/assets/js/{16b7bc88.c3779e27.js → 16b7bc88.2ac57556.js} +1 -1
  24. package/build/docs/assets/js/{17896441.84339068.js → 17896441.705d85a0.js} +1 -1
  25. package/build/docs/assets/js/{1b9df811.aaa95da1.js → 1b9df811.ec75cfdc.js} +1 -1
  26. package/build/docs/assets/js/{232a0286.33b2782b.js → 232a0286.6f749ae5.js} +1 -1
  27. package/build/docs/assets/js/{2399.cc5803e0.js → 2399.5d123cba.js} +1 -1
  28. package/build/docs/assets/js/{37d86055.47211796.js → 37d86055.1e73f036.js} +1 -1
  29. package/build/docs/assets/js/3992.b9b54f94.js +2 -0
  30. package/build/docs/assets/js/{4fb6949f.69e375e4.js → 4fb6949f.13bde4a8.js} +1 -1
  31. package/build/docs/assets/js/5befad71.96f04f67.js +1 -0
  32. package/build/docs/assets/js/5d5f1db0.e7607cd2.js +1 -0
  33. package/build/docs/assets/js/5e8c322a.0b86bf5a.js +1 -0
  34. package/build/docs/assets/js/5e95c892.de377e27.js +1 -0
  35. package/build/docs/assets/js/{5fb3c522.da5628e8.js → 5fb3c522.3ec831ee.js} +1 -1
  36. package/build/docs/assets/js/6bd11e52.c61bfcd5.js +1 -0
  37. package/build/docs/assets/js/6e96545e.1b545333.js +1 -0
  38. package/build/docs/assets/js/{71f6d02b.cfd98385.js → 71f6d02b.4b381360.js} +1 -1
  39. package/build/docs/assets/js/{6704.2615a5c6.js → 7843.f4b19776.js} +1 -1
  40. package/build/docs/assets/js/80e87108.8c451f49.js +1 -0
  41. package/build/docs/assets/js/{8585.3cb09ff7.js → 8585.e2298db3.js} +1 -1
  42. package/build/docs/assets/js/{a7bd4aaa.30ffad02.js → a7bd4aaa.aceac89c.js} +1 -1
  43. package/build/docs/assets/js/a94703ab.248144c2.js +1 -0
  44. package/build/docs/assets/js/b7b585d8.7d50f3f6.js +1 -0
  45. package/build/docs/assets/js/{bde5209a.f5bca8b2.js → bde5209a.480cc8d8.js} +1 -1
  46. package/build/docs/assets/js/c377a04b.c6b6b394.js +1 -0
  47. package/build/docs/assets/js/{dfd75424.51c4e2cb.js → dfd75424.459da76b.js} +1 -1
  48. package/build/docs/assets/js/f736c962.ab424879.js +1 -0
  49. package/build/docs/assets/js/main.3ae939d4.js +2 -0
  50. package/build/docs/assets/js/runtime~main.9ecf1839.js +1 -0
  51. package/build/docs/eslint-rules-migration/index.html +39 -39
  52. package/build/docs/index.html +70 -71
  53. package/build/docs/pui-cli-9-migration/index.html +163 -99
  54. package/build/docs/sitemap.xml +1 -1
  55. package/build/docs/ssl-certificate-setup/index.html +23 -23
  56. package/build/docs/stylelint-migration/index.html +19 -21
  57. package/build/docs/usage-guide/index.html +90 -90
  58. package/dist/cjs/babel.config.js +124 -0
  59. package/dist/cjs/index.js +5 -9
  60. package/dist/cjs/lint-config/commitlint/export.mjs +1 -0
  61. package/dist/cjs/lint-config/commitlint.config.mjs +6 -0
  62. package/dist/cjs/lint-config/eslint/common.cjs +8 -1
  63. package/dist/cjs/lint-config/eslint/flat/rules.mjs +1 -0
  64. package/dist/cjs/lint-config/lint-staged.config.js +17 -5
  65. package/dist/cjs/lint-config/prettier/export.mjs +1 -0
  66. package/dist/cjs/lint-config/{prettier.config.cjs → prettier.config.mjs} +4 -1
  67. package/dist/cjs/skills/migrate-storybook-out-of-cjs/SKILL.md +89 -35
  68. package/dist/cjs/skills/migrate-to-pui-cli-9/SKILL.md +126 -38
  69. package/dist/cjs/testing/{jest.config.cjs → jest.config.mjs} +9 -5
  70. package/dist/{esm/testing/jest.node.config.cjs → cjs/testing/jest.node.config.mjs} +3 -2
  71. package/dist/esm/babel.config.js +94 -0
  72. package/dist/esm/index.js +5 -9
  73. package/dist/esm/lint-config/commitlint/export.mjs +1 -0
  74. package/dist/esm/lint-config/commitlint.config.mjs +6 -0
  75. package/dist/esm/lint-config/eslint/common.cjs +8 -1
  76. package/dist/esm/lint-config/eslint/flat/rules.mjs +1 -0
  77. package/dist/esm/lint-config/lint-staged.config.js +17 -5
  78. package/dist/esm/lint-config/prettier/export.mjs +1 -0
  79. package/{lib/lint-config/prettier.config.cjs → dist/esm/lint-config/prettier.config.mjs} +4 -1
  80. package/dist/esm/skills/migrate-storybook-out-of-cjs/SKILL.md +89 -35
  81. package/dist/esm/skills/migrate-to-pui-cli-9/SKILL.md +126 -38
  82. package/dist/esm/testing/{jest.config.cjs → jest.config.mjs} +9 -5
  83. package/dist/{cjs/testing/jest.node.config.cjs → esm/testing/jest.node.config.mjs} +3 -2
  84. package/dist/types/lib/babel.config.d.ts +3 -0
  85. package/dist/types/lib/index.d.ts +5 -9
  86. package/dist/types/lib/lint-config/commitlint/export.d.mts +1 -0
  87. package/dist/types/lib/lint-config/commitlint.config.d.mts +3 -0
  88. package/dist/types/lib/lint-config/eslint/common.d.cts +8 -2
  89. package/dist/types/lib/lint-config/eslint/non-react.d.cts +8 -1
  90. package/dist/types/lib/lint-config/eslint/react.d.cts +8 -1
  91. package/dist/types/lib/lint-config/eslint/typescript/non-react.d.cts +8 -1
  92. package/dist/types/lib/lint-config/eslint/typescript/react.d.cts +8 -1
  93. package/dist/types/lib/lint-config/lint-staged.config.d.ts +2 -2
  94. package/dist/types/lib/lint-config/prettier/export.d.mts +1 -0
  95. package/dist/types/lib/lint-config/prettier.config.d.mts +3 -0
  96. package/dist/types/lib/utils.d.cts +1 -1
  97. package/dist/types/lib/utils.d.ts +1 -1
  98. package/dist/types/tsconfig.tsbuildinfo +1 -1
  99. package/lib/lint-config/commitlint/export.mjs +1 -0
  100. package/lib/lint-config/commitlint.config.mjs +6 -0
  101. package/lib/lint-config/eslint/common.cjs +8 -1
  102. package/lib/lint-config/eslint/flat/rules.mjs +1 -0
  103. package/lib/lint-config/lint-staged.config.js +20 -5
  104. package/lib/lint-config/prettier/export.mjs +1 -0
  105. package/{dist/esm/lint-config/prettier.config.cjs → lib/lint-config/prettier.config.mjs} +4 -1
  106. package/lib/skills/migrate-storybook-out-of-cjs/SKILL.md +89 -35
  107. package/lib/skills/migrate-to-pui-cli-9/SKILL.md +126 -38
  108. package/lib/testing/jest.config.mjs +124 -0
  109. package/lib/testing/jest.node.config.mjs +9 -0
  110. package/package.json +38 -22
  111. package/build/docs/api/variables/eslintBaseConfig/index.html +0 -132
  112. package/build/docs/api/variables/eslintConfig/index.html +0 -180
  113. package/build/docs/assets/js/04ee7372.2852111b.js +0 -1
  114. package/build/docs/assets/js/0551d4dd.ebb18f4f.js +0 -1
  115. package/build/docs/assets/js/0a1d0315.fc8f91a7.js +0 -1
  116. package/build/docs/assets/js/13097d8d.7877421c.js +0 -1
  117. package/build/docs/assets/js/3992.0ac29b2f.js +0 -2
  118. package/build/docs/assets/js/5befad71.5f19afb5.js +0 -1
  119. package/build/docs/assets/js/5d5f1db0.c5aa5afa.js +0 -1
  120. package/build/docs/assets/js/5e8c322a.ef3b894b.js +0 -1
  121. package/build/docs/assets/js/5e95c892.f550b901.js +0 -1
  122. package/build/docs/assets/js/6bd11e52.08b95209.js +0 -1
  123. package/build/docs/assets/js/6e96545e.30c1b801.js +0 -1
  124. package/build/docs/assets/js/80e87108.f9507b95.js +0 -1
  125. package/build/docs/assets/js/a94703ab.f1796514.js +0 -1
  126. package/build/docs/assets/js/b7b585d8.6d53e73f.js +0 -1
  127. package/build/docs/assets/js/b8ac1d98.62684003.js +0 -1
  128. package/build/docs/assets/js/c377a04b.0f8625c6.js +0 -1
  129. package/build/docs/assets/js/e5f79924.c793a74d.js +0 -1
  130. package/build/docs/assets/js/f736c962.dbd0d004.js +0 -1
  131. package/build/docs/assets/js/main.d5acb4ca.js +0 -2
  132. package/build/docs/assets/js/runtime~main.4f7cd700.js +0 -1
  133. package/dist/cjs/babel.config.cjs +0 -97
  134. package/dist/cjs/index.cjs +0 -35
  135. package/dist/cjs/lint-config/commitlint.config.cjs +0 -1
  136. package/dist/cjs/lint-config/stylelint.config.cjs +0 -3
  137. package/dist/esm/babel.config.cjs +0 -97
  138. package/dist/esm/index.cjs +0 -35
  139. package/dist/esm/lint-config/commitlint.config.cjs +0 -1
  140. package/dist/esm/lint-config/stylelint.config.cjs +0 -3
  141. package/dist/types/lib/babel.config.d.cts +0 -59
  142. package/dist/types/lib/index.d.cts +0 -13
  143. package/dist/types/lib/lint-config/commitlint.config.d.cts +0 -4
  144. package/dist/types/lib/lint-config/prettier.config.d.cts +0 -8
  145. package/dist/types/lib/lint-config/stylelint.config.d.cts +0 -2
  146. package/lib/lint-config/commitlint.config.cjs +0 -1
  147. package/lib/lint-config/stylelint.config.cjs +0 -3
  148. /package/build/docs/assets/js/{3992.0ac29b2f.js.LICENSE.txt → 3992.b9b54f94.js.LICENSE.txt} +0 -0
  149. /package/build/docs/assets/js/{main.d5acb4ca.js.LICENSE.txt → main.3ae939d4.js.LICENSE.txt} +0 -0
  150. /package/dist/types/lib/testing/{jest.config.d.cts → jest.config.d.mts} +0 -0
  151. /package/dist/types/lib/testing/{jest.node.config.d.cts → jest.node.config.d.mts} +0 -0
@@ -0,0 +1,124 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var babel_config_exports = {};
30
+ __export(babel_config_exports, {
31
+ babelConfig: () => babelConfig,
32
+ default: () => babel_config_default
33
+ });
34
+ module.exports = __toCommonJS(babel_config_exports);
35
+ var import_node_fs = __toESM(require("node:fs"), 1);
36
+ var import_node_path = __toESM(require("node:path"), 1);
37
+ const isApp = () => import_node_fs.default.existsSync(import_node_path.default.join(process.cwd(), "app"));
38
+ const nodeEnvPreset = {
39
+ modules: process.env.ES_MODULES === "false" ? "commonjs" : false,
40
+ targets: {
41
+ node: "current"
42
+ }
43
+ };
44
+ const webEnvPreset = {
45
+ modules: process.env.ES_MODULES === "false" ? "commonjs" : false,
46
+ useBuiltIns: "usage",
47
+ corejs: { version: "3.36", proposals: true }
48
+ };
49
+ const presetEnvOptions = process.env.TARGET_ENV === "node" ? nodeEnvPreset : webEnvPreset;
50
+ const config = {
51
+ ignore: [/\/core-js/],
52
+ sourceType: "unambiguous",
53
+ presets: [
54
+ ["@babel/preset-env", presetEnvOptions],
55
+ ["@babel/preset-react", { runtime: "automatic" }],
56
+ "@babel/preset-typescript"
57
+ ],
58
+ plugins: [
59
+ [
60
+ "babel-plugin-module-resolver",
61
+ {
62
+ alias: {
63
+ "@": isApp() ? "./app" : "./lib"
64
+ },
65
+ stripExtensions: []
66
+ }
67
+ ],
68
+ ["babel-plugin-styled-components", { displayName: true }],
69
+ ["@babel/plugin-transform-runtime", { regenerator: true }],
70
+ "@babel/plugin-proposal-class-properties",
71
+ "@babel/plugin-transform-private-methods",
72
+ "@babel/plugin-transform-private-property-in-object",
73
+ "@babel/plugin-syntax-dynamic-import",
74
+ "@babel/plugin-proposal-export-default-from",
75
+ "lodash",
76
+ "date-fns"
77
+ ],
78
+ env: {
79
+ development: {
80
+ plugins: [
81
+ ["babel-plugin-styled-components", { displayName: true }],
82
+ "@babel/plugin-transform-react-jsx-source"
83
+ ]
84
+ },
85
+ production: {
86
+ plugins: [
87
+ ["babel-plugin-styled-components", { displayName: false, pure: true }],
88
+ ["transform-remove-console", { exclude: ["error", "warn"] }],
89
+ "transform-react-remove-prop-types",
90
+ "@babel/plugin-transform-react-inline-elements",
91
+ "@babel/plugin-transform-react-constant-elements"
92
+ ]
93
+ },
94
+ test: {
95
+ plugins: [
96
+ ["babel-plugin-styled-components", { displayName: true }],
97
+ "@babel/plugin-transform-modules-commonjs",
98
+ "dynamic-import-node",
99
+ [
100
+ "babel-plugin-transform-strip-block",
101
+ {
102
+ requireDirective: true,
103
+ identifiers: [{ start: "block:start", end: "block:end" }]
104
+ }
105
+ ],
106
+ "babel-plugin-import-remove-resource-query"
107
+ ]
108
+ }
109
+ }
110
+ };
111
+ if (process.env.STORYBOOK_BUILD !== "true" && process.env.TARGET_ENV !== "node") {
112
+ config.env?.development?.plugins?.push?.("react-refresh/babel");
113
+ }
114
+ if (process.env.ES_MODULES === "false") {
115
+ config.plugins?.push?.([
116
+ "babel-plugin-transform-strip-block",
117
+ {
118
+ requireDirective: true,
119
+ identifiers: [{ start: "block:start", end: "block:end" }]
120
+ }
121
+ ]);
122
+ }
123
+ const babelConfig = config;
124
+ var babel_config_default = babelConfig;
package/dist/cjs/index.js CHANGED
@@ -20,8 +20,6 @@ var index_exports = {};
20
20
  __export(index_exports, {
21
21
  babelConfig: () => import_babel_config.babelConfig,
22
22
  commitlintConfig: () => import_commitlint_config.commitlintConfig,
23
- eslintBaseConfig: () => import_non_react.esConfig,
24
- eslintConfig: () => import_react.esReactConfig,
25
23
  eslintFlatBaseConfig: () => import_non_react_export.eslintFlatBaseConfig,
26
24
  eslintFlatBaseConfigStrict: () => import_non_react_export.eslintFlatBaseConfigStrict,
27
25
  eslintFlatConfig: () => import_react_export.eslintFlatConfig,
@@ -35,16 +33,14 @@ __export(index_exports, {
35
33
  vitestConfig: () => import_vitest_config.vitestConfig
36
34
  });
37
35
  module.exports = __toCommonJS(index_exports);
38
- var import_babel_config = require("./babel.config.cjs");
36
+ var import_babel_config = require("./babel.config.js");
39
37
  var import_non_react_export = require("./lint-config/eslint/flat/non-react-export.mjs");
40
38
  var import_react_export = require("./lint-config/eslint/flat/react-export.mjs");
41
- var import_non_react = require("./lint-config/eslint/non-react.cjs");
42
- var import_react = require("./lint-config/eslint/react.cjs");
43
39
  var import_export = require("./lint-config/stylelint/export.mjs");
44
- var import_prettier_config = require("./lint-config/prettier.config.cjs");
45
- var import_commitlint_config = require("./lint-config/commitlint.config.cjs");
46
- var import_jest_config = require("./testing/jest.config.cjs");
40
+ var import_prettier_config = require("./lint-config/prettier.config.mjs");
41
+ var import_commitlint_config = require("./lint-config/commitlint.config.mjs");
42
+ var import_jest_config = require("./testing/jest.config.mjs");
47
43
  var import_vitest_config = require("./testing/vitest.config.js");
48
- var import_jest_node_config = require("./testing/jest.node.config.cjs");
44
+ var import_jest_node_config = require("./testing/jest.node.config.mjs");
49
45
  var import_lint_staged_config = require("./lint-config/lint-staged.config.js");
50
46
  var import_appRoutes = require("./server/appRoutes.js");
@@ -0,0 +1 @@
1
+ export { commitlintConfig, default } from '../commitlint.config.mjs';
@@ -0,0 +1,6 @@
1
+ /** @type {import('@commitlint/types').UserConfig} */
2
+ export const commitlintConfig = {
3
+ extends: ['@commitlint/config-conventional'],
4
+ };
5
+
6
+ export default commitlintConfig;
@@ -1,5 +1,12 @@
1
1
 
2
- const prettierOptions = require("../prettier.config.cjs");
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 = [
@@ -182,4 +182,5 @@ export const ignorePatterns = [
182
182
  '**/.scannerwork/**',
183
183
  '**/stats.json',
184
184
  '**/jsconfig.json',
185
+ './babel.config.ts',
185
186
  ];
@@ -34,11 +34,23 @@ module.exports = __toCommonJS(lint_staged_config_exports);
34
34
  var import_node_path = __toESM(require("node:path"), 1);
35
35
  var import_node_fs = __toESM(require("node:fs"), 1);
36
36
  const npmClient = import_node_fs.default.existsSync(import_node_path.default.join(process.cwd(), "pnpm-lock.yaml")) ? "pnpm" : "npm";
37
+ const filterRootBabelConfig = (files) => files.filter(
38
+ (file) => import_node_path.default.relative(process.cwd(), file) !== "babel.config.ts"
39
+ );
40
+ const filterTscheckFiles = filterRootBabelConfig;
37
41
  const lintStagedConfig = {
38
42
  "*.{js,ts,jsx,tsx,md,mdx,html,css,json}": ["prettier --write"],
39
- "*.{ts,tsx}": [`${npmClient} run tscheck`],
40
- "*.{js,ts,jsx,tsx}": [
41
- `${npmClient} run lint:fix`,
42
- `${npmClient} run test:staged`
43
- ]
43
+ "*.{ts,tsx}": (files) => {
44
+ const filesToCheck = filterTscheckFiles(files);
45
+ if (!filesToCheck.length) return [];
46
+ return [`${npmClient} run tscheck -- ${filesToCheck.join(" ")}`];
47
+ },
48
+ "*.{js,ts,jsx,tsx}": (files) => {
49
+ const filesToLint = filterRootBabelConfig(files);
50
+ if (!filesToLint.length) return [];
51
+ return [
52
+ `${npmClient} run lint:fix -- ${filesToLint.join(" ")}`,
53
+ `${npmClient} run test:staged -- ${filesToLint.join(" ")}`
54
+ ];
55
+ }
44
56
  };
@@ -0,0 +1 @@
1
+ export { prettierConfig, default } from '../prettier.config.mjs';
@@ -1,4 +1,5 @@
1
- exports.prettierConfig = {
1
+ /** @type {import('prettier').Config} */
2
+ export const prettierConfig = {
2
3
  printWidth: 80,
3
4
  tabWidth: 2,
4
5
  useTabs: false,
@@ -6,3 +7,5 @@ exports.prettierConfig = {
6
7
  singleQuote: true,
7
8
  trailingComma: 'all',
8
9
  };
10
+
11
+ export default prettierConfig;
@@ -3,12 +3,12 @@ name: migrate-storybook-out-of-cjs
3
3
  description: >-
4
4
  Migrate PUI Storybook from CJS wrappers and @elliemae/pui-app-sdk/storybook/cjs/* to ESM
5
5
  (.storybook/*.mjs) and @elliemae/pui-app-sdk/storybook/* imports. Use when upgrading Storybook
6
- 10 with pui-cli 9, replacing require() in .storybook/main.js, removing storybook/cjs/main or
7
- storybook/cjs/middleware, deleting .storybook/middleware.js, or converting preview/manager/theme
8
- to ESM.
6
+ 10 with pui-cli 9, bumping to latest pui-app-sdk, replacing require() in .storybook/main.js,
7
+ removing storybook/cjs/main or storybook/cjs/middleware, deleting .storybook/middleware.js,
8
+ or converting preview/manager/theme to ESM.
9
9
  ---
10
10
 
11
- # Migrate Storybook out of CJS
11
+ # Migrate Storybook out of CJS (Storybook 10 + latest pui-app-sdk)
12
12
 
13
13
  Moves consumer repos from legacy CommonJS Storybook wrappers (`require('@elliemae/pui-app-sdk/storybook/cjs/...')`) to ESM (`.storybook/*.mjs` + `@elliemae/pui-app-sdk/storybook/*`).
14
14
 
@@ -21,28 +21,56 @@ For the full pui-cli 9 upgrade (Node 24, ESLint 10, etc.), install `migrate-to-p
21
21
  - `.storybook/main.js` uses `require('@elliemae/pui-app-sdk/storybook/cjs/main')`
22
22
  - `.storybook/middleware.js` exists or imports `storybook/cjs/middleware`
23
23
  - Storybook fails after bumping pui-app-sdk with “Cannot find module …/storybook/cjs/…”
24
+ - Storybook fails with `Cannot find module '…/dist/esm/utils/storybook/main.js'` (app-sdk not built)
24
25
  - Moving from Storybook 6 CJS config to Storybook 10 ESM config with pui-cli
25
26
 
26
- ## What changed
27
+ ## pui-app-sdk changes (latest Storybook 10 train)
27
28
 
28
- | Topic | Before (CJS / SB6) | After (ESM / SB10) |
29
- | ----------------- | ------------------------------------------ | ---------------------------------------------------------------- |
30
- | Consumer config | `.storybook/main.js` | `.storybook/main.mjs` |
31
- | Shared import | `@elliemae/pui-app-sdk/storybook/cjs/main` | `@elliemae/pui-app-sdk/storybook/main` |
32
- | Export name | `getConfig()` (CJS default) | **`getStorybookConfig()`** (named export) |
33
- | API mocks | `.storybook/middleware.js` | Built into pui-cli Storybook dev server |
34
- | Preview / manager | `.storybook/preview.js`, `manager.js` | `.storybook/preview.mjs`, `manager.mjs` (when using ESM imports) |
35
- | CLI | `start-storybook` / `build-storybook` | `pui-cli storybook` → `storybook dev` / `storybook build` |
36
- | Addons | Installed in consumer `package.json` | Bundled in pui-cli; resolved via pui-app-sdk |
29
+ | Topic | Before | After |
30
+ | --------------- | ----------------------------------------------- | ------------------------------------------------------------------------------------ |
31
+ | Import path | `@elliemae/pui-app-sdk/storybook/cjs/main` | `@elliemae/pui-app-sdk/storybook/main` |
32
+ | Export name | `getConfig()` | **`getStorybookConfig(viteBuilder?)`** |
33
+ | Published files | CJS under `storybook/cjs/` | TypeScript in repo; **`dist/esm\|cjs/utils/storybook/*`** at runtime |
34
+ | Shared modules | `cjs/main`, `cjs/webpack`, … | `main`, `preview`, `manager`, `theme`, `webpack`, `vite`, `middleware` (deprecated) |
35
+ | app-sdk dogfood | CJS + SB6 webpack hacks in `.storybook/main.js` | **`.storybook/*.ts`** → `../lib/utils/storybook/*` (source; not package self-import) |
36
+
37
+ Consumers **must** import compiled dist (`@elliemae/pui-app-sdk/storybook/*`). After a local `file:` link, run **`pnpm run build`** in app-sdk before Storybook.
38
+
39
+ ## What changed (consumers)
40
+
41
+ | Topic | Before (CJS / SB6) | After (ESM / SB10) |
42
+ | ----------------- | ------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------ |
43
+ | Consumer config | `.storybook/main.js` | `.storybook/main.mjs` |
44
+ | Shared import | `@elliemae/pui-app-sdk/storybook/cjs/main` | `@elliemae/pui-app-sdk/storybook/main` |
45
+ | Export name | `getConfig()` (CJS default) | **`getStorybookConfig()`** (named export) |
46
+ | API mocks | `.storybook/middleware.js` | Built into pui-cli Storybook dev server |
47
+ | Preview / manager | `.storybook/preview.js`, `manager.js` | `.storybook/preview.mjs`, `manager.mjs` (when using ESM imports) |
48
+ | CLI | `start-storybook` / `build-storybook` | `pui-cli storybook` → `storybook dev` / `storybook build` |
49
+ | Addons | Installed in consumer `package.json` | Bundled in pui-cli; referenced by package name in app-sdk config |
50
+ | MDX docs | `*.stories.mdx` | Docs-only pages: **`*.mdx`** + `@storybook/addon-docs/blocks` |
51
+ | Babel (Storybook) | SWC / ad-hoc overrides | `@storybook/addon-webpack5-compiler-babel` + project **`babel.config.ts`** → pui-cli `babelConfig` (includes private class fields/methods) |
37
52
 
38
53
  ## Pre-flight
39
54
 
40
55
  1. Bump `@elliemae/pui-cli@9` and `@elliemae/pui-app-sdk@*` together.
41
- 2. Run `pnpm install`. If using a local `file:` link to pui-app-sdk, reinstall after rebuilding app-sdk so workspace `node_modules` picks up fresh dist.
56
+ 2. Run `pnpm install`. If using a local `file:` link to pui-app-sdk, **`pnpm run build`** in app-sdk, then reinstall in the consumer so `dist/` storybook exports exist.
42
57
  3. Confirm the repo uses `pui-cli storybook` (not raw `start-storybook` scripts).
58
+ 4. Consumer **`babel.config.ts`** should re-export pui-cli only — migrate from `babel.config.cjs` if present. **Do not** add `@babel/plugin-transform-private-methods` locally (included in pui-cli 9).
43
59
 
44
60
  ## Migration steps
45
61
 
62
+ ### Step 0 — Babel config (if not done in `migrate-to-pui-cli-9`)
63
+
64
+ Replace `babel.config.cjs` with `babel.config.ts`:
65
+
66
+ ```typescript
67
+ import { babelConfig } from '@elliemae/pui-cli';
68
+
69
+ export default babelConfig;
70
+ ```
71
+
72
+ Delete `babel.config.cjs`. Do **not** add private-method Babel plugins locally.
73
+
46
74
  ### Step 1 — Replace `.storybook/main.js`
47
75
 
48
76
  Delete `main.js`. Create `.storybook/main.mjs`:
@@ -53,7 +81,9 @@ import { getStorybookConfig } from '@elliemae/pui-app-sdk/storybook/main';
53
81
  export default getStorybookConfig();
54
82
  ```
55
83
 
56
- **Do not** use `getConfig` or `require('…/storybook/cjs/main')` those paths and names are removed.
84
+ **Do not** use `getConfig`, `require('…/storybook/cjs/main')`, or import storybook from app-sdk before dist is built.
85
+
86
+ Optional Vite builder (experimental): `export default getStorybookConfig(true);`
57
87
 
58
88
  ### Step 2 — Remove middleware
59
89
 
@@ -76,7 +106,7 @@ export {
76
106
  } from '@elliemae/pui-app-sdk/storybook/preview';
77
107
  ```
78
108
 
79
- **Preview with local theme** (see `pui-react-boilerplate`, `pui-app-sdk`):
109
+ **Preview with local theme** (see `pui-react-boilerplate`):
80
110
 
81
111
  ```javascript
82
112
  // .storybook/preview.mjs
@@ -92,23 +122,40 @@ const parameters = getParameters(theme);
92
122
  export { decorators, parameters, loaders };
93
123
  ```
94
124
 
95
- **Manager / theme** — convert `manager.js` → `manager.mjs`, `theme.js` → `theme.mjs` when they use `import`/`export`:
125
+ **Manager / theme** — convert `manager.js` → `manager.mjs`, `theme.js` → `theme.mjs` when customized:
96
126
 
97
127
  ```javascript
98
128
  // .storybook/manager.mjs
99
- export { managerConfig } from '@elliemae/pui-app-sdk/storybook/manager';
129
+ import { initSBManager } from '@elliemae/pui-app-sdk/storybook/manager';
130
+ import { theme } from './theme.mjs';
131
+
132
+ initSBManager(theme);
100
133
  ```
101
134
 
102
135
  ```javascript
103
136
  // .storybook/theme.mjs
104
- export { theme } from '@elliemae/pui-app-sdk/storybook/theme';
137
+ export const theme = {
138
+ brandTitle: 'My App',
139
+ brandUrl: 'https://example.com',
140
+ };
105
141
  ```
106
142
 
107
143
  Keep `.storybook/preview-head.html` unchanged.
108
144
 
109
145
  Delete obsolete `.js` duplicates after creating `.mjs` files (`preview.js`, `manager.js`, `theme.js`, `middleware.js`).
110
146
 
111
- ### Step 4 — Monorepo lib packages (no `app/` directory)
147
+ ### Step 4 — MDX docs (Storybook 10 / MDX3)
148
+
149
+ - Docs-only pages: rename **`intro.stories.mdx`** → **`intro.mdx`** (avoid `.stories.mdx` unless the file exports CSF stories).
150
+ - Import Meta from **`@storybook/addon-docs/blocks`**:
151
+
152
+ ```mdx
153
+ import { Meta } from '@storybook/addon-docs/blocks';
154
+
155
+ <Meta title="Getting Started/Introduction" />
156
+ ```
157
+
158
+ ### Step 5 — Monorepo lib packages (no `app/` directory)
112
159
 
113
160
  pui-app-sdk omits `../app/**` story globs when no `app/` folder exists. If globs still fail, filter explicitly in `main.mjs`:
114
161
 
@@ -123,13 +170,13 @@ export default config;
123
170
 
124
171
  Pilot: `pui-mono-repo-boilerplate/libs/foo`.
125
172
 
126
- ### Step 5 — Stories and types
173
+ ### Step 6 — Stories and types
127
174
 
128
175
  - Prefer CSF3 and `@storybook/react-webpack5` types where TypeScript fails.
129
176
  - Remove Storybook 6 webpack alias workarounds (MDX pinning, react-select hacks) unless a story still breaks after upgrade.
130
- - Consumers do **not** install `@storybook/addon-*` separately — addons resolve from pui-cli via pui-app-sdk.
177
+ - Consumers do **not** install `@storybook/addon-*` separately — addons resolve from pui-cli via NODE_PATH.
131
178
 
132
- ### Step 6 — ESLint
179
+ ### Step 7 — ESLint
133
180
 
134
181
  Ensure `.storybook/**` is linted. After pui-cli 9 ESLint flat config migration, run `pnpm exec pui-cli lint` on story files.
135
182
 
@@ -144,29 +191,35 @@ pnpm exec pui-cli lint
144
191
 
145
192
  Checklist:
146
193
 
194
+ - [ ] `babel.config.ts` re-exports pui-cli; no `babel.config.cjs`
147
195
  - [ ] No `require('@elliemae/pui-app-sdk/storybook/cjs/…')` anywhere
148
196
  - [ ] `.storybook/main.mjs` exists; `main.js` removed
149
197
  - [ ] `.storybook/middleware.js` removed (if it existed)
198
+ - [ ] app-sdk dist built when using local link
150
199
  - [ ] Story dev server starts; mock API routes work without middleware file
151
200
  - [ ] Static build succeeds
152
201
 
153
202
  ## Troubleshooting
154
203
 
155
- | Symptom | Fix |
156
- | -------------------------------------------- | ------------------------------------------------------------------------------------- |
157
- | `Cannot find module '…/storybook/cjs/main'` | Migrate to `@elliemae/pui-app-sdk/storybook/main` in `main.mjs` |
158
- | `getConfig is not a function` | Use named import **`getStorybookConfig`**, not `getConfig` |
159
- | `Can't resolve './app'` in lib-only package | Use conditional globs in app-sdk or filter `config.stories` in `main.mjs` |
160
- | `Failed to load native binding` / SWC errors | Rebuild pui-app-sdk; reinstall workspace; Babel compiler addon is bundled via pui-cli |
161
- | “Using default Webpack5 setup” (no Babel) | Refresh pnpm install after bumping `file:` pui-cli / pui-app-sdk links |
162
- | API mocks missing | Delete middleware file; use `pui-cli storybook` (not legacy CLI) |
163
- | Stale app-sdk in monorepo | `pnpm install --ignore-scripts` after rebuilding linked packages |
204
+ | Symptom | Fix |
205
+ | --------------------------------------------------------- | ------------------------------------------------------------------------------------ |
206
+ | `Cannot find module '…/storybook/cjs/main'` | Migrate to `@elliemae/pui-app-sdk/storybook/main` in `main.mjs` |
207
+ | `Cannot find module '…/dist/esm/utils/storybook/main.js'` | Run `pnpm run build` in app-sdk; or install published app-sdk alpha |
208
+ | `getConfig is not a function` | Use named import **`getStorybookConfig`**, not `getConfig` |
209
+ | `Can't resolve './app'` in lib-only package | Use conditional globs in app-sdk or filter `config.stories` in `main.mjs` |
210
+ | `Class private methods are not enabled` | Upgrade pui-cli 9; remove duplicate Babel plugins from consumer Babel config |
211
+ | Babel cannot load `babel.config.ts` | Confirm Node 24; migrate from `babel.config.cjs` per `migrate-to-pui-cli-9` Phase 2b |
212
+ | `Unable to index …stories.mdx` | Rename docs-only file to `.mdx`; fix `<Meta>` import |
213
+ | `Failed to load native binding` / SWC errors | Reinstall deps; pui-cli uses Babel compiler addon, not SWC |
214
+ | “Using default Webpack5 setup” (no Babel) | Refresh pnpm install after bumping pui-cli / pui-app-sdk |
215
+ | API mocks missing | Delete middleware file; use `pui-cli storybook` (not legacy CLI) |
216
+ | Stale app-sdk in monorepo | Rebuild linked app-sdk; `pnpm install` in consumer |
164
217
 
165
218
  ## Reference repos
166
219
 
167
- - `pui-react-boilerplate` — app with `app/` stories
220
+ - `pui-react-boilerplate` — app with `app/` stories; `.storybook/*.mjs` + package imports
168
221
  - `pui-mono-repo-boilerplate/libs/foo` — lib-only package
169
- - `pui-app-sdk/.storybook/` — dogfood ESM wrappers
222
+ - `pui-app-sdk/.storybook/` — dogfood **`.storybook/*.ts`** with relative `../lib/utils/storybook/*` imports
170
223
 
171
224
  Full guide: [pui-cli 9 migration — Storybook 10](https://docs.pui.mortgagetech.q1.ice.com/cli/pui-cli-9-migration) (`docs/pui-cli-9-migration.md` in pui-cli).
172
225
 
@@ -186,3 +239,4 @@ Skills are copied to `.cursor/skills/`, `.claude/skills/`, and `.github/skills/`
186
239
  - Production Webpack build config — Storybook migration is dev/docs tooling only
187
240
  - Business logic in stories unless types or CSF3 require it
188
241
  - Do not re-add `@storybook/*` addon packages to consumer `package.json` unless pui-cli docs explicitly require an exception
242
+ - Do not add private-method Babel plugins to consumer Babel config when using pui-cli 9 shared config