create-o2s-app 4.1.8 → 4.1.10

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 (37) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/dist/scaffold/cleanup.d.ts.map +1 -1
  3. package/dist/scaffold/clone.d.ts.map +1 -1
  4. package/dist/scaffold/clone.js +2 -2
  5. package/dist/scaffold/generate-env.d.ts.map +1 -1
  6. package/dist/scaffold/index.d.ts.map +1 -1
  7. package/dist/scaffold/index.js +2 -0
  8. package/dist/scaffold/install.d.ts.map +1 -1
  9. package/dist/scaffold/transform-app-config.d.ts.map +1 -1
  10. package/dist/scaffold/transform-app-config.js +1 -1
  11. package/dist/scaffold/transform-app-module.d.ts.map +1 -1
  12. package/dist/scaffold/transform-apps-package-json.d.ts.map +1 -1
  13. package/dist/scaffold/transform-integration-configs.d.ts.map +1 -1
  14. package/dist/scaffold/transform-integration-configs.js +62 -21
  15. package/dist/scaffold/transform-package-json.d.ts.map +1 -1
  16. package/dist/scaffold/transform-page-model.d.ts.map +1 -1
  17. package/dist/scaffold/transform-render-blocks.d.ts.map +1 -1
  18. package/dist/scaffold/transform-storybook-config.d.ts +2 -0
  19. package/dist/scaffold/transform-storybook-config.d.ts.map +1 -0
  20. package/dist/scaffold/transform-storybook-config.js +55 -0
  21. package/dist/utils/block-discovery.d.ts.map +1 -1
  22. package/dist/utils/integration-discovery.d.ts.map +1 -1
  23. package/dist/utils/logger.d.ts.map +1 -1
  24. package/dist/utils/logger.js +1 -1
  25. package/dist/wizard/env-prompts.d.ts.map +1 -1
  26. package/dist/wizard/index.d.ts.map +1 -1
  27. package/dist/wizard/prompts.d.ts +1 -1
  28. package/dist/wizard/prompts.d.ts.map +1 -1
  29. package/dist/wizard/templates.d.ts.map +1 -1
  30. package/package.json +10 -10
  31. package/src/scaffold/clone.ts +1 -1
  32. package/src/scaffold/index.ts +2 -0
  33. package/src/scaffold/transform-app-config.ts +3 -1
  34. package/src/scaffold/transform-integration-configs.ts +69 -21
  35. package/src/scaffold/transform-storybook-config.ts +24 -0
  36. package/src/utils/logger.ts +2 -2
  37. package/tsconfig.json +1 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,42 @@
1
1
  # create-o2s-app
2
2
 
3
+ ## 4.1.10
4
+
5
+ ### Patch Changes
6
+
7
+ - 5905e9d: chore(deps): update dependencies
8
+ - 5905e9d: chore(deps): update dependencies
9
+ - 78f7a66: chore(deps): update storybook to 10.6.7, vite to 8.3.8, turbo to 2.11.13, @vitejs/plugin-react to 6.3.0, commander to 15.1.0, simple-git to 4.1.0, fs-extra to 11.4.1
10
+ - 5905e9d: chore(deps): update dependencies
11
+ - 78f7a66: chore(deps): update prettier to 3.10.1
12
+ - 5905e9d: chore(deps): update dependencies
13
+ - 5905e9d: chore(deps): update dependencies
14
+ - 5905e9d: chore(deps): update dependencies
15
+ - 5905e9d: chore(deps): update dependencies
16
+ - 5905e9d: chore(deps): update dependencies
17
+ - Updated dependencies [78f7a66]
18
+ - Updated dependencies [78f7a66]
19
+ - @o2s/telemetry@1.2.4
20
+
21
+ ## 4.1.9
22
+
23
+ ### Patch Changes
24
+
25
+ - 1a520c8: chore: dependency update pass
26
+
27
+ Update dependencies across the monorepo. Highlights: NestJS 12 (Express 5),
28
+ TypeScript 6 for type-checking/lint with native TypeScript 7 compiling the
29
+ package builds, Vite 8, Docusaurus 3.10, Storybook 10.6, @medusajs 2.20,
30
+ redis 6, surveyjs (core + react-ui) 3, and assorted minor/patch bumps. No
31
+ public package API changed; peer ranges were bumped to match (notably
32
+ @nestjs/* to ^12).
33
+
34
+ - Updated dependencies [cb50455]
35
+ - Updated dependencies [681d153]
36
+ - Updated dependencies [1a520c8]
37
+ - Updated dependencies [cb50455]
38
+ - @o2s/telemetry@1.2.3
39
+
3
40
  ## 4.1.8
4
41
 
5
42
  ### Patch Changes
@@ -1 +1 @@
1
- {"version":3,"file":"cleanup.d.ts","sourceRoot":"","sources":["../../src/scaffold/cleanup.ts"],"names":[],"mappings":"AAuCA,eAAO,MAAM,cAAc,GAAU,YAAY,MAAM,KAAG,OAAO,CAAC,IAAI,CAkBrE,CAAC"}
1
+ {"version":3,"file":"cleanup.d.ts","sourceRoot":"","sources":["../../src/scaffold/cleanup.ts"],"names":[],"mappings":"AAuCA,eAAO,MAAM,cAAc,eAAsB,MAAM,KAAG,OAAO,CAAC,IAAI,CAkBrE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"clone.d.ts","sourceRoot":"","sources":["../../src/scaffold/clone.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,eAAe,QAAa,OAAO,CAAC,MAAM,CA6BtD,CAAC;AAEF,eAAO,MAAM,cAAc,GAAU,SAAS,MAAM,KAAG,OAAO,CAAC,IAAI,CAQlE,CAAC"}
1
+ {"version":3,"file":"clone.d.ts","sourceRoot":"","sources":["../../src/scaffold/clone.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,eAAe,QAAa,OAAO,CAAC,MAAM,CA6BtD,CAAC;AAEF,eAAO,MAAM,cAAc,YAAmB,MAAM,KAAG,OAAO,CAAC,IAAI,CAQlE,CAAC"}
@@ -42,7 +42,7 @@ const cli_progress_1 = __importDefault(require("cli-progress"));
42
42
  const fs = __importStar(require("fs-extra"));
43
43
  const os = __importStar(require("os"));
44
44
  const path = __importStar(require("path"));
45
- const simple_git_1 = __importDefault(require("simple-git"));
45
+ const simple_git_1 = require("simple-git");
46
46
  const cloneRepository = async () => {
47
47
  const tempDir = path.join(os.tmpdir(), `openselfservice-${Date.now()}`);
48
48
  await fs.ensureDir(tempDir);
@@ -51,7 +51,7 @@ const cloneRepository = async () => {
51
51
  const bar = new cli_progress_1.default.SingleBar({}, cli_progress_1.default.Presets.shades_classic);
52
52
  bar.start(100, 0);
53
53
  try {
54
- const git = (0, simple_git_1.default)({
54
+ const git = (0, simple_git_1.simpleGit)({
55
55
  progress({ progress }) {
56
56
  bar.update(Math.round(progress));
57
57
  },
@@ -1 +1 @@
1
- {"version":3,"file":"generate-env.d.ts","sourceRoot":"","sources":["../../src/scaffold/generate-env.ts"],"names":[],"mappings":"AA2BA,eAAO,MAAM,gBAAgB,GACzB,YAAY,MAAM,EAClB,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC/B,sBAAsB,MAAM,EAAE,KAC/B,OAAO,CAAC,IAAI,CAYd,CAAC"}
1
+ {"version":3,"file":"generate-env.d.ts","sourceRoot":"","sources":["../../src/scaffold/generate-env.ts"],"names":[],"mappings":"AA2BA,eAAO,MAAM,gBAAgB,eACb,MAAM,WACT,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,wBACT,MAAM,EAAE,KAC/B,OAAO,CAAC,IAAI,CAYd,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/scaffold/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAyCzC,eAAO,MAAM,QAAQ,GACjB,SAAS,MAAM,EACf,SAAS,aAAa,EACtB,qBAAmB,EACnB,YAAY,MAAM,KACnB,OAAO,CAAC;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,gBAAgB,EAAE,MAAM,EAAE,CAAA;CAAE,CAqD3D,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/scaffold/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AA0CzC,eAAO,MAAM,QAAQ,YACR,MAAM,WACN,aAAa,qCAEV,MAAM,KACnB,OAAO,CAAC;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,gBAAgB,EAAE,MAAM,EAAE,CAAA;CAAE,CAsD3D,CAAC"}
@@ -45,6 +45,7 @@ const transform_integration_configs_1 = require("./transform-integration-configs
45
45
  const transform_package_json_1 = require("./transform-package-json");
46
46
  const transform_page_model_1 = require("./transform-page-model");
47
47
  const transform_render_blocks_1 = require("./transform-render-blocks");
48
+ const transform_storybook_config_1 = require("./transform-storybook-config");
48
49
  const fs = __importStar(require("fs-extra"));
49
50
  const path = __importStar(require("path"));
50
51
  const readIntegrationVersions = async (projectDir, selectedIntegrations) => {
@@ -83,6 +84,7 @@ const scaffold = async (tempDir, answers, skipInstall = false, directory) => {
83
84
  (0, transform_render_blocks_1.transformRenderBlocks)(targetDir, selectedBlocks),
84
85
  (0, transform_page_model_1.transformPageModel)(targetDir, selectedBlocks),
85
86
  (0, transform_apps_package_json_1.transformAppsPackageJson)(targetDir, selectedBlocks, selectedIntegrations),
87
+ (0, transform_storybook_config_1.transformStorybookConfig)(targetDir),
86
88
  ]);
87
89
  // Step 5: Clean up root package.json (remove workspace entries for deleted dirs)
88
90
  await (0, transform_package_json_1.transformRootPackageJson)(targetDir);
@@ -1 +1 @@
1
- {"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../src/scaffold/install.ts"],"names":[],"mappings":"AAKA;;;;;;;;GAQG;AACH,eAAO,MAAM,gBAAgB,GAAU,YAAY,MAAM,EAAE,sBAAsB,MAAM,EAAE,KAAG,OAAO,CAAC,IAAI,CAkDvG,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAU,YAAY,MAAM,EAAE,sBAAsB,MAAM,EAAE,KAAG,OAAO,CAAC,IAAI,CAsB1G,CAAC"}
1
+ {"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../src/scaffold/install.ts"],"names":[],"mappings":"AAKA;;;;;;;;GAQG;AACH,eAAO,MAAM,gBAAgB,eAAsB,MAAM,wBAAwB,MAAM,EAAE,KAAG,OAAO,CAAC,IAAI,CAkDvG,CAAC;AAEF,eAAO,MAAM,mBAAmB,eAAsB,MAAM,wBAAwB,MAAM,EAAE,KAAG,OAAO,CAAC,IAAI,CAsB1G,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"transform-app-config.d.ts","sourceRoot":"","sources":["../../src/scaffold/transform-app-config.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,uBAAuB,GAAI,kBAAkB,MAAM,EAAE,KAAG,IAiBpE,CAAC"}
1
+ {"version":3,"file":"transform-app-config.d.ts","sourceRoot":"","sources":["../../src/scaffold/transform-app-config.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,uBAAuB,qBAAsB,MAAM,EAAE,KAAG,IAmBpE,CAAC"}
@@ -21,7 +21,7 @@ const warnUnconfiguredModules = (uncoveredModules) => {
21
21
  console.warn();
22
22
  console.warn(kleur_1.default.red('These modules still reference @o2s/integrations.mocked which was not included in your project.'));
23
23
  console.warn(kleur_1.default.red('The project build will fail until you configure these modules manually.'));
24
- console.warn('To fix: update packages/configs/integrations/src/models/<module>.ts to use your integration.');
24
+ console.warn('To fix: update packages/configs/integrations/src/config.ts to assign an integration for these domains.');
25
25
  console.warn();
26
26
  };
27
27
  exports.warnUnconfiguredModules = warnUnconfiguredModules;
@@ -1 +1 @@
1
- {"version":3,"file":"transform-app-module.d.ts","sourceRoot":"","sources":["../../src/scaffold/transform-app-module.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,kBAAkB,GAAU,YAAY,MAAM,EAAE,oBAAoB,MAAM,EAAE,KAAG,OAAO,CAAC,IAAI,CAsCvG,CAAC"}
1
+ {"version":3,"file":"transform-app-module.d.ts","sourceRoot":"","sources":["../../src/scaffold/transform-app-module.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,kBAAkB,eAAsB,MAAM,sBAAsB,MAAM,EAAE,KAAG,OAAO,CAAC,IAAI,CAsCvG,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"transform-apps-package-json.d.ts","sourceRoot":"","sources":["../../src/scaffold/transform-apps-package-json.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,wBAAwB,GACjC,YAAY,MAAM,EAClB,oBAAoB,MAAM,EAAE,EAC5B,0BAA0B,MAAM,EAAE,KACnC,OAAO,CAAC,IAAI,CAuCd,CAAC"}
1
+ {"version":3,"file":"transform-apps-package-json.d.ts","sourceRoot":"","sources":["../../src/scaffold/transform-apps-package-json.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,wBAAwB,eACrB,MAAM,sBACE,MAAM,EAAE,4BACF,MAAM,EAAE,KACnC,OAAO,CAAC,IAAI,CAuCd,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"transform-integration-configs.d.ts","sourceRoot":"","sources":["../../src/scaffold/transform-integration-configs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAwE9C,eAAO,MAAM,2BAA2B,GACpC,YAAY,MAAM,EAClB,sBAAsB,MAAM,EAAE,EAC9B,qBAAqB,kBAAkB,EAAE,EACzC,oBAAoB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,EAC5C,qBAAqB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAC5C,OAAO,CAAC,MAAM,EAAE,CAwClB,CAAC"}
1
+ {"version":3,"file":"transform-integration-configs.d.ts","sourceRoot":"","sources":["../../src/scaffold/transform-integration-configs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AA0G9C,eAAO,MAAM,2BAA2B,eACxB,MAAM,wBACI,MAAM,EAAE,uBACT,kBAAkB,EAAE,sBACrB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,uBACvB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAC5C,OAAO,CAAC,MAAM,EAAE,CAsDlB,CAAC"}
@@ -36,9 +36,35 @@ Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.transformIntegrationConfigs = void 0;
37
37
  const fs = __importStar(require("fs-extra"));
38
38
  const path = __importStar(require("path"));
39
- const CONFIGS_MODELS_PATH = 'packages/configs/integrations/src/models';
39
+ const CONFIG_FILE_PATH = 'packages/configs/integrations/src/config.ts';
40
40
  const CONFIGS_PACKAGE_JSON_PATH = 'packages/configs/integrations/package.json';
41
- const MOCKED_IMPORT = `@o2s/integrations.mocked/integration`;
41
+ // Domains configured in packages/configs/integrations/src/config.ts, mirroring the framework's
42
+ // DOMAIN_KEYS. Each has its own `import * as <Domain>Source ...` line that we retarget on swap.
43
+ // (Documents is intentionally excluded — it is a namespace re-export, not a swappable domain.)
44
+ const CONFIG_DOMAINS = [
45
+ 'articles',
46
+ 'auth',
47
+ 'billingAccounts',
48
+ 'cache',
49
+ 'carts',
50
+ 'checkout',
51
+ 'cms',
52
+ 'customers',
53
+ 'invoices',
54
+ 'notifications',
55
+ 'orders',
56
+ 'organizations',
57
+ 'payments',
58
+ 'products',
59
+ 'resources',
60
+ 'search',
61
+ 'tickets',
62
+ 'users',
63
+ ];
64
+ // Per-domain import alias used in config.ts, e.g. "tickets" → "TicketsSource", "cms" → "CmsSource".
65
+ const domainToAlias = (domain) => `${domain.charAt(0).toUpperCase()}${domain.slice(1)}Source`;
66
+ const mockedPath = () => `@o2s/integrations.mocked/integration`;
67
+ const integrationPath = (name) => `@o2s/integrations.${name}/integration`;
42
68
  // Build a map from framework module name → winning integration.
43
69
  // Integrations without o2sModules entries (e.g. mocked) contribute no modules.
44
70
  const buildModuleIntegrationMap = (selectedIntegrations, conflictResolutions, integrationModules) => {
@@ -52,7 +78,12 @@ const buildModuleIntegrationMap = (selectedIntegrations, conflictResolutions, in
52
78
  }
53
79
  }
54
80
  for (const resolution of conflictResolutions) {
55
- moduleMap.set(resolution.module, resolution.winner);
81
+ // Defense-in-depth: only honor a resolution whose winner actually declares the module.
82
+ // The wizard already guarantees this, but a programmatic caller might not.
83
+ const winnerModules = integrationModules[resolution.winner] ?? [];
84
+ if (winnerModules.includes(resolution.module)) {
85
+ moduleMap.set(resolution.module, resolution.winner);
86
+ }
56
87
  }
57
88
  return moduleMap;
58
89
  };
@@ -88,32 +119,42 @@ const updateConfigsPackageJson = async (projectDir, selectedIntegrations, integr
88
119
  const transformIntegrationConfigs = async (projectDir, selectedIntegrations, conflictResolutions, integrationModules, integrationVersions) => {
89
120
  // Always update configs package.json to add/remove integration dependencies
90
121
  await updateConfigsPackageJson(projectDir, selectedIntegrations, integrationVersions);
91
- const modelsDir = path.join(projectDir, CONFIGS_MODELS_PATH);
92
- if (!(await fs.pathExists(modelsDir))) {
122
+ const configFilePath = path.join(projectDir, CONFIG_FILE_PATH);
123
+ if (!(await fs.pathExists(configFilePath))) {
93
124
  return [];
94
125
  }
95
- // Replace mocked imports with selected integration imports
126
+ const content = await fs.readFile(configFilePath, 'utf-8');
127
+ // Build module → integration map
96
128
  const moduleMap = buildModuleIntegrationMap(selectedIntegrations, conflictResolutions, integrationModules);
129
+ // Swap a domain by retargeting the module path on its single `import * as <Domain>Source ...`
130
+ // line. Both the runtime map and the type re-export reference that alias, so they stay in sync.
131
+ const lines = content.split('\n');
97
132
  for (const [module, integration] of moduleMap.entries()) {
98
- const filePath = path.join(modelsDir, `${module}.ts`);
99
- if (!(await fs.pathExists(filePath)))
133
+ if (integration === 'mocked')
134
+ continue;
135
+ if (!CONFIG_DOMAINS.includes(module))
100
136
  continue;
101
- const content = await fs.readFile(filePath, 'utf-8');
102
- const updatedContent = content.replaceAll(MOCKED_IMPORT, `@o2s/integrations.${integration}/integration`);
103
- await fs.writeFile(filePath, updatedContent, 'utf-8');
137
+ const alias = domainToAlias(module);
138
+ const importRegex = new RegExp(`^(import \\* as ${alias} from ')[^']+(';)$`);
139
+ for (let i = 0; i < lines.length; i++) {
140
+ const line = lines[i] ?? '';
141
+ if (importRegex.test(line)) {
142
+ lines[i] = line.replace(importRegex, `$1${integrationPath(integration)}$2`);
143
+ break;
144
+ }
145
+ }
104
146
  }
105
- // Detect model files that still import mocked but mocked is not selected.
106
- // Skip only when 'mocked' (full) is selected — it covers all modules.
107
- // 'mocked-dxp' covers only cms/articles/search, so uncovered detection runs normally.
147
+ const updatedContent = lines.join('\n');
148
+ await fs.writeFile(configFilePath, updatedContent, 'utf-8');
149
+ // Detect domains that still resolve to Mocked while 'mocked' is not selected — those will
150
+ // fail to build until configured. Skip when 'mocked' (full) is selected; it covers everything.
108
151
  const uncoveredModules = [];
109
152
  if (!selectedIntegrations.includes('mocked')) {
110
- const files = await fs.readdir(modelsDir);
111
- for (const file of files) {
112
- if (file === 'index.ts' || !file.endsWith('.ts'))
113
- continue;
114
- const content = await fs.readFile(path.join(modelsDir, file), 'utf-8');
115
- if (content.includes(MOCKED_IMPORT)) {
116
- uncoveredModules.push(file.replace('.ts', ''));
153
+ for (const domain of CONFIG_DOMAINS) {
154
+ const alias = domainToAlias(domain);
155
+ const stillMockedRegex = new RegExp(`^import \\* as ${alias} from '${mockedPath().replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}';$`, 'm');
156
+ if (stillMockedRegex.test(updatedContent)) {
157
+ uncoveredModules.push(domain);
117
158
  }
118
159
  }
119
160
  }
@@ -1 +1 @@
1
- {"version":3,"file":"transform-package-json.d.ts","sourceRoot":"","sources":["../../src/scaffold/transform-package-json.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,wBAAwB,GAAU,YAAY,MAAM,KAAG,OAAO,CAAC,IAAI,CAiB/E,CAAC"}
1
+ {"version":3,"file":"transform-package-json.d.ts","sourceRoot":"","sources":["../../src/scaffold/transform-package-json.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,wBAAwB,eAAsB,MAAM,KAAG,OAAO,CAAC,IAAI,CAiB/E,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"transform-page-model.d.ts","sourceRoot":"","sources":["../../src/scaffold/transform-page-model.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,kBAAkB,GAAU,YAAY,MAAM,EAAE,oBAAoB,MAAM,EAAE,KAAG,OAAO,CAAC,IAAI,CAsCvG,CAAC"}
1
+ {"version":3,"file":"transform-page-model.d.ts","sourceRoot":"","sources":["../../src/scaffold/transform-page-model.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,kBAAkB,eAAsB,MAAM,sBAAsB,MAAM,EAAE,KAAG,OAAO,CAAC,IAAI,CAsCvG,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"transform-render-blocks.d.ts","sourceRoot":"","sources":["../../src/scaffold/transform-render-blocks.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,qBAAqB,GAAU,YAAY,MAAM,EAAE,oBAAoB,MAAM,EAAE,KAAG,OAAO,CAAC,IAAI,CAkD1G,CAAC"}
1
+ {"version":3,"file":"transform-render-blocks.d.ts","sourceRoot":"","sources":["../../src/scaffold/transform-render-blocks.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,qBAAqB,eAAsB,MAAM,sBAAsB,MAAM,EAAE,KAAG,OAAO,CAAC,IAAI,CAkD1G,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const transformStorybookConfig: (projectDir: string) => Promise<void>;
2
+ //# sourceMappingURL=transform-storybook-config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transform-storybook-config.d.ts","sourceRoot":"","sources":["../../src/scaffold/transform-storybook-config.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,wBAAwB,eAAsB,MAAM,KAAG,OAAO,CAAC,IAAI,CAe/E,CAAC"}
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.transformStorybookConfig = void 0;
37
+ const fs = __importStar(require("fs-extra"));
38
+ const path = __importStar(require("path"));
39
+ const FILE_PATH = '.storybook/main.ts';
40
+ // Regex matches lines containing '@o2s/framework' in optimizeDeps.include or resolve.alias
41
+ const FRAMEWORK_REFERENCE_REGEX = /['"]@o2s\/framework\//;
42
+ const transformStorybookConfig = async (projectDir) => {
43
+ const filePath = path.join(projectDir, FILE_PATH);
44
+ if (!(await fs.pathExists(filePath)))
45
+ return;
46
+ const content = await fs.readFile(filePath, 'utf-8');
47
+ const lines = content.split('\n');
48
+ const filteredLines = lines.filter((line) => {
49
+ return !FRAMEWORK_REFERENCE_REGEX.test(line);
50
+ });
51
+ if (filteredLines.length === lines.length)
52
+ return;
53
+ await fs.writeFile(filePath, filteredLines.join('\n'), 'utf-8');
54
+ };
55
+ exports.transformStorybookConfig = transformStorybookConfig;
@@ -1 +1 @@
1
- {"version":3,"file":"block-discovery.d.ts","sourceRoot":"","sources":["../../src/utils/block-discovery.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAUrC,eAAO,MAAM,cAAc,GAAU,SAAS,MAAM,KAAG,OAAO,CAAC,SAAS,EAAE,CAoCzE,CAAC"}
1
+ {"version":3,"file":"block-discovery.d.ts","sourceRoot":"","sources":["../../src/utils/block-discovery.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAUrC,eAAO,MAAM,cAAc,YAAmB,MAAM,KAAG,OAAO,CAAC,SAAS,EAAE,CAoCzE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"integration-discovery.d.ts","sourceRoot":"","sources":["../../src/utils/integration-discovery.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAU3C,eAAO,MAAM,oBAAoB,GAAU,SAAS,MAAM,KAAG,OAAO,CAAC,eAAe,EAAE,CA4BrF,CAAC"}
1
+ {"version":3,"file":"integration-discovery.d.ts","sourceRoot":"","sources":["../../src/utils/integration-discovery.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAU3C,eAAO,MAAM,oBAAoB,YAAmB,MAAM,KAAG,OAAO,CAAC,eAAe,EAAE,CA4BrF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAKxC,eAAO,MAAM,WAAW,QAAO,IAyB9B,CAAC;AAEF,eAAO,MAAM,YAAY,GACrB,WAAW,MAAM,EACjB,UAAU,YAAY,EACtB,gBAAgB,MAAM,EAAE,EACxB,sBAAsB,MAAM,EAAE,EAC9B,mBAAkB,MAAM,EAAO,EAC/B,qBAAmB,KACpB,IA0HF,CAAC;AAEF,eAAO,MAAM,UAAU,GAAI,SAAS,MAAM,EAAE,QAAQ,OAAO,KAAG,IAS7D,CAAC"}
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAKxC,eAAO,MAAM,WAAW,QAAO,IAyB9B,CAAC;AAEF,eAAO,MAAM,YAAY,cACV,MAAM,YACP,YAAY,kBACN,MAAM,EAAE,wBACF,MAAM,EAAE,qBACZ,MAAM,EAAE,4BAE3B,IA0HF,CAAC;AAEF,eAAO,MAAM,UAAU,YAAa,MAAM,UAAU,OAAO,KAAG,IAS7D,CAAC"}
@@ -64,7 +64,7 @@ const printSummary = (targetDir, template, selectedBlocks, selectedIntegrations,
64
64
  }
65
65
  addEmpty();
66
66
  addLine(` ${kleur_1.default.red('The project will NOT start until these are configured.')}`, ' The project will NOT start until these are configured.');
67
- addLine(` ${kleur_1.default.dim('Edit packages/configs/integrations/src/models/<module>.ts')}`, ' Edit packages/configs/integrations/src/models/<module>.ts');
67
+ addLine(` ${kleur_1.default.dim('Edit packages/configs/integrations/src/config.ts')}`, ' Edit packages/configs/integrations/src/config.ts');
68
68
  }
69
69
  addEmpty();
70
70
  addLine(` ${kleur_1.default.bold('Next steps:')}`, ' Next steps:');
@@ -1 +1 @@
1
- {"version":3,"file":"env-prompts.d.ts","sourceRoot":"","sources":["../../src/wizard/env-prompts.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAI9C,UAAU,cAAc;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,EAAE,CAAC;CAC1B;AAED,eAAO,MAAM,eAAe,GACxB,sBAAsB,MAAM,EAAE,EAC9B,oBAAoB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,KAC7C,cAAc,EAahB,CAAC;AAEF,eAAO,MAAM,yBAAyB,GAAU,WAAW,cAAc,EAAE,KAAG,OAAO,CAAC,kBAAkB,EAAE,CAsBzG,CAAC;AAEF,eAAO,MAAM,aAAa,GAAU,sBAAsB,MAAM,EAAE,KAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CA8BlG,CAAC"}
1
+ {"version":3,"file":"env-prompts.d.ts","sourceRoot":"","sources":["../../src/wizard/env-prompts.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAI9C,UAAU,cAAc;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,EAAE,CAAC;CAC1B;AAED,eAAO,MAAM,eAAe,yBACF,MAAM,EAAE,sBACV,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,KAC7C,cAAc,EAahB,CAAC;AAEF,eAAO,MAAM,yBAAyB,cAAqB,cAAc,EAAE,KAAG,OAAO,CAAC,kBAAkB,EAAE,CAsBzG,CAAC;AAEF,eAAO,MAAM,aAAa,yBAAgC,MAAM,EAAE,KAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CA8BlG,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/wizard/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAMvD,eAAO,MAAM,SAAS,GAClB,SAAS,MAAM,EACf,UAAU,MAAM,EAChB,cAAc,YAAY,EAC1B,YAAY,MAAM,EAAE,EACpB,kBAAkB,MAAM,EAAE,KAC3B,OAAO,CAAC,aAAa,CAoCvB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/wizard/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAMvD,eAAO,MAAM,SAAS,YACT,MAAM,YACL,MAAM,gBACF,YAAY,cACd,MAAM,EAAE,oBACF,MAAM,EAAE,KAC3B,OAAO,CAAC,aAAa,CAoCvB,CAAC"}
@@ -3,5 +3,5 @@ export declare const promptProjectName: (defaultName: string) => Promise<string>
3
3
  export declare const promptTemplate: () => Promise<TemplateType>;
4
4
  export declare const promptBlockSelection: (availableBlocks: BlockInfo[], preselected: string[]) => Promise<string[]>;
5
5
  export declare const promptIntegrationSelection: (availableIntegrations: IntegrationInfo[], preselected: string[]) => Promise<string[]>;
6
- export declare const runWizardPrompts: (availableBlocks: BlockInfo[], availableIntegrations: IntegrationInfo[], cliName?: string, cliTemplate?: TemplateType) => Promise<Omit<WizardAnswers, "integrationModules">>;
6
+ export declare const runWizardPrompts: (availableBlocks: BlockInfo[], availableIntegrations: IntegrationInfo[], cliName?: string, cliTemplate?: TemplateType) => Promise<Omit<WizardAnswers, 'integrationModules'>>;
7
7
  //# sourceMappingURL=prompts.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../src/wizard/prompts.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AA+JnF,eAAO,MAAM,iBAAiB,GAAU,aAAa,MAAM,KAAG,OAAO,CAAC,MAAM,CAa3E,CAAC;AAEF,eAAO,MAAM,cAAc,QAAa,OAAO,CAAC,YAAY,CAiB3D,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAU,iBAAiB,SAAS,EAAE,EAAE,aAAa,MAAM,EAAE,KAAG,OAAO,CAAC,MAAM,EAAE,CA8ChH,CAAC;AAEF,eAAO,MAAM,0BAA0B,GACnC,uBAAuB,eAAe,EAAE,EACxC,aAAa,MAAM,EAAE,KACtB,OAAO,CAAC,MAAM,EAAE,CAgBlB,CAAC;AAEF,eAAO,MAAM,gBAAgB,GACzB,iBAAiB,SAAS,EAAE,EAC5B,uBAAuB,eAAe,EAAE,EACxC,UAAU,MAAM,EAChB,cAAc,YAAY,KAC3B,OAAO,CAAC,IAAI,CAAC,aAAa,EAAE,oBAAoB,CAAC,CAiDnD,CAAC"}
1
+ {"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../src/wizard/prompts.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AA+JnF,eAAO,MAAM,iBAAiB,gBAAuB,MAAM,KAAG,OAAO,CAAC,MAAM,CAa3E,CAAC;AAEF,eAAO,MAAM,cAAc,QAAa,OAAO,CAAC,YAAY,CAiB3D,CAAC;AAEF,eAAO,MAAM,oBAAoB,oBAA2B,SAAS,EAAE,eAAe,MAAM,EAAE,KAAG,OAAO,CAAC,MAAM,EAAE,CA8ChH,CAAC;AAEF,eAAO,MAAM,0BAA0B,0BACZ,eAAe,EAAE,eAC3B,MAAM,EAAE,KACtB,OAAO,CAAC,MAAM,EAAE,CAgBlB,CAAC;AAEF,eAAO,MAAM,gBAAgB,oBACR,SAAS,EAAE,yBACL,eAAe,EAAE,YAC9B,MAAM,gBACF,YAAY,KAC3B,OAAO,CAAC,IAAI,CAAC,aAAa,EAAE,oBAAoB,CAAC,CAiDnD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../src/wizard/templates.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAEpE,MAAM,WAAW,kBAAkB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,KAAK,GAAG,KAAK,GAAG,IAAI,CAAC;CAClC;AAED,eAAO,MAAM,SAAS,EAAE,MAAM,CAAC,YAAY,EAAE,kBAAkB,CAkB9D,CAAC;AAGF,eAAO,MAAM,wBAAwB,QAAO,MAAM,EACoC,CAAC;AAGvF,eAAO,MAAM,sBAAsB,GAAI,UAAU,YAAY,EAAE,WAAW,SAAS,EAAE,KAAG,MAAM,EAW7F,CAAC;AAIF,eAAO,MAAM,4BAA4B,GAAI,UAAU,YAAY,EAAE,iBAAiB,eAAe,EAAE,KAAG,MAAM,EAY/G,CAAC"}
1
+ {"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../src/wizard/templates.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAEpE,MAAM,WAAW,kBAAkB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,KAAK,GAAG,KAAK,GAAG,IAAI,CAAC;CAClC;AAED,eAAO,MAAM,SAAS,EAAE,MAAM,CAAC,YAAY,EAAE,kBAAkB,CAkB9D,CAAC;AAGF,eAAO,MAAM,wBAAwB,QAAO,MAAM,EACoC,CAAC;AAGvF,eAAO,MAAM,sBAAsB,aAAc,YAAY,aAAa,SAAS,EAAE,KAAG,MAAM,EAW7F,CAAC;AAIF,eAAO,MAAM,4BAA4B,aAAc,YAAY,mBAAmB,eAAe,EAAE,KAAG,MAAM,EAY/G,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-o2s-app",
3
- "version": "4.1.8",
3
+ "version": "4.1.10",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "description": "CLI tool to scaffold new O2S applications with Next.js and NestJS setup.",
@@ -27,19 +27,19 @@
27
27
  },
28
28
  "scripts": {
29
29
  "create-o2s-app": "ts-node ./src/index.ts",
30
- "build": "tsc --preserveWatchOutput && tsc-alias",
30
+ "build": "tsc7 --preserveWatchOutput && tsc-alias",
31
31
  "lint": "tsc --noEmit && eslint . --max-warnings=0",
32
32
  "format": "prettier --write \"src/**/*.{js,jsx,ts,tsx,css,scss,json}\""
33
33
  },
34
34
  "dependencies": {
35
- "@o2s/telemetry": "^1.2.2",
35
+ "@o2s/telemetry": "^1.2.4",
36
36
  "@types/prompts": "^2.4.9",
37
37
  "cli-progress": "^3.12.0",
38
- "commander": "^14.0.3",
39
- "fs-extra": "^11.3.4",
40
- "kleur": "^3.0.3",
38
+ "commander": "^15.1.0",
39
+ "fs-extra": "^11.4.1",
40
+ "kleur": "^4.1.5",
41
41
  "prompts": "^2.4.2",
42
- "simple-git": "^3.32.3",
42
+ "simple-git": "^4.1.0",
43
43
  "ts-node": "^10.9.2"
44
44
  },
45
45
  "devDependencies": {
@@ -49,8 +49,8 @@
49
49
  "@o2s/typescript-config": "*",
50
50
  "@types/cli-progress": "^3.11.6",
51
51
  "@types/fs-extra": "^11.0.4",
52
- "eslint": "^9.39.4",
53
- "prettier": "^3.8.1",
54
- "typescript": "^5.9.3"
52
+ "eslint": "^9.39.5",
53
+ "prettier": "^3.10.1",
54
+ "typescript": "^6.0.3"
55
55
  }
56
56
  }
@@ -3,7 +3,7 @@ import cliProgress from 'cli-progress';
3
3
  import * as fs from 'fs-extra';
4
4
  import * as os from 'os';
5
5
  import * as path from 'path';
6
- import simpleGit from 'simple-git';
6
+ import { simpleGit } from 'simple-git';
7
7
 
8
8
  export const cloneRepository = async (): Promise<string> => {
9
9
  const tempDir = path.join(os.tmpdir(), `openselfservice-${Date.now()}`);
@@ -10,6 +10,7 @@ import { transformIntegrationConfigs } from './transform-integration-configs';
10
10
  import { transformRootPackageJson } from './transform-package-json';
11
11
  import { transformPageModel } from './transform-page-model';
12
12
  import { transformRenderBlocks } from './transform-render-blocks';
13
+ import { transformStorybookConfig } from './transform-storybook-config';
13
14
  import * as fs from 'fs-extra';
14
15
  import * as path from 'path';
15
16
 
@@ -74,6 +75,7 @@ export const scaffold = async (
74
75
  transformRenderBlocks(targetDir, selectedBlocks),
75
76
  transformPageModel(targetDir, selectedBlocks),
76
77
  transformAppsPackageJson(targetDir, selectedBlocks, selectedIntegrations),
78
+ transformStorybookConfig(targetDir),
77
79
  ]);
78
80
 
79
81
  // Step 5: Clean up root package.json (remove workspace entries for deleted dirs)
@@ -19,6 +19,8 @@ export const warnUnconfiguredModules = (uncoveredModules: string[]): void => {
19
19
  kleur.red('These modules still reference @o2s/integrations.mocked which was not included in your project.'),
20
20
  );
21
21
  console.warn(kleur.red('The project build will fail until you configure these modules manually.'));
22
- console.warn('To fix: update packages/configs/integrations/src/models/<module>.ts to use your integration.');
22
+ console.warn(
23
+ 'To fix: update packages/configs/integrations/src/config.ts to assign an integration for these domains.',
24
+ );
23
25
  console.warn();
24
26
  };
@@ -2,9 +2,38 @@ import { ConflictResolution } from '../types';
2
2
  import * as fs from 'fs-extra';
3
3
  import * as path from 'path';
4
4
 
5
- const CONFIGS_MODELS_PATH = 'packages/configs/integrations/src/models';
5
+ const CONFIG_FILE_PATH = 'packages/configs/integrations/src/config.ts';
6
6
  const CONFIGS_PACKAGE_JSON_PATH = 'packages/configs/integrations/package.json';
7
- const MOCKED_IMPORT = `@o2s/integrations.mocked/integration`;
7
+
8
+ // Domains configured in packages/configs/integrations/src/config.ts, mirroring the framework's
9
+ // DOMAIN_KEYS. Each has its own `import * as <Domain>Source ...` line that we retarget on swap.
10
+ // (Documents is intentionally excluded — it is a namespace re-export, not a swappable domain.)
11
+ const CONFIG_DOMAINS = [
12
+ 'articles',
13
+ 'auth',
14
+ 'billingAccounts',
15
+ 'cache',
16
+ 'carts',
17
+ 'checkout',
18
+ 'cms',
19
+ 'customers',
20
+ 'invoices',
21
+ 'notifications',
22
+ 'orders',
23
+ 'organizations',
24
+ 'payments',
25
+ 'products',
26
+ 'resources',
27
+ 'search',
28
+ 'tickets',
29
+ 'users',
30
+ ] as const;
31
+
32
+ // Per-domain import alias used in config.ts, e.g. "tickets" → "TicketsSource", "cms" → "CmsSource".
33
+ const domainToAlias = (domain: string): string => `${domain.charAt(0).toUpperCase()}${domain.slice(1)}Source`;
34
+
35
+ const mockedPath = (): string => `@o2s/integrations.mocked/integration`;
36
+ const integrationPath = (name: string): string => `@o2s/integrations.${name}/integration`;
8
37
 
9
38
  // Build a map from framework module name → winning integration.
10
39
  // Integrations without o2sModules entries (e.g. mocked) contribute no modules.
@@ -25,7 +54,12 @@ const buildModuleIntegrationMap = (
25
54
  }
26
55
 
27
56
  for (const resolution of conflictResolutions) {
28
- moduleMap.set(resolution.module, resolution.winner);
57
+ // Defense-in-depth: only honor a resolution whose winner actually declares the module.
58
+ // The wizard already guarantees this, but a programmatic caller might not.
59
+ const winnerModules = integrationModules[resolution.winner] ?? [];
60
+ if (winnerModules.includes(resolution.module)) {
61
+ moduleMap.set(resolution.module, resolution.winner);
62
+ }
29
63
  }
30
64
 
31
65
  return moduleMap;
@@ -80,37 +114,51 @@ export const transformIntegrationConfigs = async (
80
114
  // Always update configs package.json to add/remove integration dependencies
81
115
  await updateConfigsPackageJson(projectDir, selectedIntegrations, integrationVersions);
82
116
 
83
- const modelsDir = path.join(projectDir, CONFIGS_MODELS_PATH);
117
+ const configFilePath = path.join(projectDir, CONFIG_FILE_PATH);
84
118
 
85
- if (!(await fs.pathExists(modelsDir))) {
119
+ if (!(await fs.pathExists(configFilePath))) {
86
120
  return [];
87
121
  }
88
122
 
89
- // Replace mocked imports with selected integration imports
123
+ const content = await fs.readFile(configFilePath, 'utf-8');
124
+
125
+ // Build module → integration map
90
126
  const moduleMap = buildModuleIntegrationMap(selectedIntegrations, conflictResolutions, integrationModules);
91
127
 
128
+ // Swap a domain by retargeting the module path on its single `import * as <Domain>Source ...`
129
+ // line. Both the runtime map and the type re-export reference that alias, so they stay in sync.
130
+ const lines = content.split('\n');
92
131
  for (const [module, integration] of moduleMap.entries()) {
93
- const filePath = path.join(modelsDir, `${module}.ts`);
94
-
95
- if (!(await fs.pathExists(filePath))) continue;
132
+ if (integration === 'mocked') continue;
133
+ if (!(CONFIG_DOMAINS as readonly string[]).includes(module)) continue;
96
134
 
97
- const content = await fs.readFile(filePath, 'utf-8');
98
- const updatedContent = content.replaceAll(MOCKED_IMPORT, `@o2s/integrations.${integration}/integration`);
135
+ const alias = domainToAlias(module);
136
+ const importRegex = new RegExp(`^(import \\* as ${alias} from ')[^']+(';)$`);
99
137
 
100
- await fs.writeFile(filePath, updatedContent, 'utf-8');
138
+ for (let i = 0; i < lines.length; i++) {
139
+ const line = lines[i] ?? '';
140
+ if (importRegex.test(line)) {
141
+ lines[i] = line.replace(importRegex, `$1${integrationPath(integration)}$2`);
142
+ break;
143
+ }
144
+ }
101
145
  }
146
+ const updatedContent = lines.join('\n');
147
+
148
+ await fs.writeFile(configFilePath, updatedContent, 'utf-8');
102
149
 
103
- // Detect model files that still import mocked but mocked is not selected.
104
- // Skip only when 'mocked' (full) is selected — it covers all modules.
105
- // 'mocked-dxp' covers only cms/articles/search, so uncovered detection runs normally.
150
+ // Detect domains that still resolve to Mocked while 'mocked' is not selected — those will
151
+ // fail to build until configured. Skip when 'mocked' (full) is selected; it covers everything.
106
152
  const uncoveredModules: string[] = [];
107
153
  if (!selectedIntegrations.includes('mocked')) {
108
- const files = await fs.readdir(modelsDir);
109
- for (const file of files) {
110
- if (file === 'index.ts' || !file.endsWith('.ts')) continue;
111
- const content = await fs.readFile(path.join(modelsDir, file), 'utf-8');
112
- if (content.includes(MOCKED_IMPORT)) {
113
- uncoveredModules.push(file.replace('.ts', ''));
154
+ for (const domain of CONFIG_DOMAINS) {
155
+ const alias = domainToAlias(domain);
156
+ const stillMockedRegex = new RegExp(
157
+ `^import \\* as ${alias} from '${mockedPath().replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}';$`,
158
+ 'm',
159
+ );
160
+ if (stillMockedRegex.test(updatedContent)) {
161
+ uncoveredModules.push(domain);
114
162
  }
115
163
  }
116
164
  }
@@ -0,0 +1,24 @@
1
+ import * as fs from 'fs-extra';
2
+ import * as path from 'path';
3
+
4
+ const FILE_PATH = '.storybook/main.ts';
5
+
6
+ // Regex matches lines containing '@o2s/framework' in optimizeDeps.include or resolve.alias
7
+ const FRAMEWORK_REFERENCE_REGEX = /['"]@o2s\/framework\//;
8
+
9
+ export const transformStorybookConfig = async (projectDir: string): Promise<void> => {
10
+ const filePath = path.join(projectDir, FILE_PATH);
11
+
12
+ if (!(await fs.pathExists(filePath))) return;
13
+
14
+ const content = await fs.readFile(filePath, 'utf-8');
15
+ const lines = content.split('\n');
16
+
17
+ const filteredLines = lines.filter((line) => {
18
+ return !FRAMEWORK_REFERENCE_REGEX.test(line);
19
+ });
20
+
21
+ if (filteredLines.length === lines.length) return;
22
+
23
+ await fs.writeFile(filePath, filteredLines.join('\n'), 'utf-8');
24
+ };
@@ -87,8 +87,8 @@ export const printSummary = (
87
87
  ' The project will NOT start until these are configured.',
88
88
  );
89
89
  addLine(
90
- ` ${kleur.dim('Edit packages/configs/integrations/src/models/<module>.ts')}`,
91
- ' Edit packages/configs/integrations/src/models/<module>.ts',
90
+ ` ${kleur.dim('Edit packages/configs/integrations/src/config.ts')}`,
91
+ ' Edit packages/configs/integrations/src/config.ts',
92
92
  );
93
93
  }
94
94
 
package/tsconfig.json CHANGED
@@ -2,6 +2,7 @@
2
2
  "extends": "@o2s/typescript-config/base.json",
3
3
  "compilerOptions": {
4
4
  "paths": {},
5
+ "rootDir": "./src",
5
6
  "outDir": "./dist"
6
7
  },
7
8
  "include": ["src"],