create-o2s-app 4.1.8 → 4.1.9
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/CHANGELOG.md +19 -0
- package/dist/scaffold/cleanup.d.ts.map +1 -1
- package/dist/scaffold/clone.d.ts.map +1 -1
- package/dist/scaffold/generate-env.d.ts.map +1 -1
- package/dist/scaffold/index.d.ts.map +1 -1
- package/dist/scaffold/index.js +2 -0
- package/dist/scaffold/install.d.ts.map +1 -1
- package/dist/scaffold/transform-app-config.d.ts.map +1 -1
- package/dist/scaffold/transform-app-config.js +1 -1
- package/dist/scaffold/transform-app-module.d.ts.map +1 -1
- package/dist/scaffold/transform-apps-package-json.d.ts.map +1 -1
- package/dist/scaffold/transform-integration-configs.d.ts.map +1 -1
- package/dist/scaffold/transform-integration-configs.js +62 -21
- package/dist/scaffold/transform-package-json.d.ts.map +1 -1
- package/dist/scaffold/transform-page-model.d.ts.map +1 -1
- package/dist/scaffold/transform-render-blocks.d.ts.map +1 -1
- package/dist/scaffold/transform-storybook-config.d.ts +2 -0
- package/dist/scaffold/transform-storybook-config.d.ts.map +1 -0
- package/dist/scaffold/transform-storybook-config.js +55 -0
- package/dist/utils/block-discovery.d.ts.map +1 -1
- package/dist/utils/integration-discovery.d.ts.map +1 -1
- package/dist/utils/logger.d.ts.map +1 -1
- package/dist/utils/logger.js +1 -1
- package/dist/wizard/env-prompts.d.ts.map +1 -1
- package/dist/wizard/index.d.ts.map +1 -1
- package/dist/wizard/prompts.d.ts +1 -1
- package/dist/wizard/prompts.d.ts.map +1 -1
- package/dist/wizard/templates.d.ts.map +1 -1
- package/package.json +10 -10
- package/src/scaffold/index.ts +2 -0
- package/src/scaffold/transform-app-config.ts +3 -1
- package/src/scaffold/transform-integration-configs.ts +69 -21
- package/src/scaffold/transform-storybook-config.ts +24 -0
- package/src/utils/logger.ts +2 -2
- package/tsconfig.json +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# create-o2s-app
|
|
2
2
|
|
|
3
|
+
## 4.1.9
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 1a520c8: chore: dependency update pass
|
|
8
|
+
|
|
9
|
+
Update dependencies across the monorepo. Highlights: NestJS 12 (Express 5),
|
|
10
|
+
TypeScript 6 for type-checking/lint with native TypeScript 7 compiling the
|
|
11
|
+
package builds, Vite 8, Docusaurus 3.10, Storybook 10.6, @medusajs 2.20,
|
|
12
|
+
redis 6, surveyjs (core + react-ui) 3, and assorted minor/patch bumps. No
|
|
13
|
+
public package API changed; peer ranges were bumped to match (notably
|
|
14
|
+
@nestjs/* to ^12).
|
|
15
|
+
|
|
16
|
+
- Updated dependencies [cb50455]
|
|
17
|
+
- Updated dependencies [681d153]
|
|
18
|
+
- Updated dependencies [1a520c8]
|
|
19
|
+
- Updated dependencies [cb50455]
|
|
20
|
+
- @o2s/telemetry@1.2.3
|
|
21
|
+
|
|
3
22
|
## 4.1.8
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cleanup.d.ts","sourceRoot":"","sources":["../../src/scaffold/cleanup.ts"],"names":[],"mappings":"AAuCA,eAAO,MAAM,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,
|
|
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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-env.d.ts","sourceRoot":"","sources":["../../src/scaffold/generate-env.ts"],"names":[],"mappings":"AA2BA,eAAO,MAAM,gBAAgB,
|
|
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;
|
|
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"}
|
package/dist/scaffold/index.js
CHANGED
|
@@ -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,
|
|
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,
|
|
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/
|
|
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,
|
|
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,
|
|
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;
|
|
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
|
|
39
|
+
const CONFIG_FILE_PATH = 'packages/configs/integrations/src/config.ts';
|
|
40
40
|
const CONFIGS_PACKAGE_JSON_PATH = 'packages/configs/integrations/package.json';
|
|
41
|
-
|
|
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
|
-
|
|
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
|
|
92
|
-
if (!(await fs.pathExists(
|
|
122
|
+
const configFilePath = path.join(projectDir, CONFIG_FILE_PATH);
|
|
123
|
+
if (!(await fs.pathExists(configFilePath))) {
|
|
93
124
|
return [];
|
|
94
125
|
}
|
|
95
|
-
|
|
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
|
-
|
|
99
|
-
|
|
133
|
+
if (integration === 'mocked')
|
|
134
|
+
continue;
|
|
135
|
+
if (!CONFIG_DOMAINS.includes(module))
|
|
100
136
|
continue;
|
|
101
|
-
const
|
|
102
|
-
const
|
|
103
|
-
|
|
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
|
-
|
|
106
|
-
|
|
107
|
-
// 'mocked
|
|
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
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
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,
|
|
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,
|
|
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,
|
|
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 @@
|
|
|
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,
|
|
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,
|
|
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,
|
|
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"}
|
package/dist/utils/logger.js
CHANGED
|
@@ -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/
|
|
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,
|
|
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,
|
|
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"}
|
package/dist/wizard/prompts.d.ts
CHANGED
|
@@ -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,
|
|
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,
|
|
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,
|
|
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.
|
|
3
|
+
"version": "4.1.9",
|
|
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": "
|
|
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.
|
|
35
|
+
"@o2s/telemetry": "^1.2.3",
|
|
36
36
|
"@types/prompts": "^2.4.9",
|
|
37
37
|
"cli-progress": "^3.12.0",
|
|
38
|
-
"commander": "^
|
|
39
|
-
"fs-extra": "^11.
|
|
40
|
-
"kleur": "^
|
|
38
|
+
"commander": "^15.0.0",
|
|
39
|
+
"fs-extra": "^11.4.0",
|
|
40
|
+
"kleur": "^4.1.5",
|
|
41
41
|
"prompts": "^2.4.2",
|
|
42
|
-
"simple-git": "^3.
|
|
42
|
+
"simple-git": "^3.36.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.
|
|
53
|
-
"prettier": "^3.
|
|
54
|
-
"typescript": "^
|
|
52
|
+
"eslint": "^9.39.5",
|
|
53
|
+
"prettier": "^3.9.6",
|
|
54
|
+
"typescript": "^6.0.3"
|
|
55
55
|
}
|
|
56
56
|
}
|
package/src/scaffold/index.ts
CHANGED
|
@@ -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(
|
|
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
|
|
5
|
+
const CONFIG_FILE_PATH = 'packages/configs/integrations/src/config.ts';
|
|
6
6
|
const CONFIGS_PACKAGE_JSON_PATH = 'packages/configs/integrations/package.json';
|
|
7
|
-
|
|
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
|
-
|
|
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
|
|
117
|
+
const configFilePath = path.join(projectDir, CONFIG_FILE_PATH);
|
|
84
118
|
|
|
85
|
-
if (!(await fs.pathExists(
|
|
119
|
+
if (!(await fs.pathExists(configFilePath))) {
|
|
86
120
|
return [];
|
|
87
121
|
}
|
|
88
122
|
|
|
89
|
-
|
|
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
|
-
|
|
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
|
|
98
|
-
const
|
|
135
|
+
const alias = domainToAlias(module);
|
|
136
|
+
const importRegex = new RegExp(`^(import \\* as ${alias} from ')[^']+(';)$`);
|
|
99
137
|
|
|
100
|
-
|
|
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
|
|
104
|
-
// Skip
|
|
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
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
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
|
+
};
|
package/src/utils/logger.ts
CHANGED
|
@@ -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/
|
|
91
|
-
' Edit packages/configs/integrations/src/
|
|
90
|
+
` ${kleur.dim('Edit packages/configs/integrations/src/config.ts')}`,
|
|
91
|
+
' Edit packages/configs/integrations/src/config.ts',
|
|
92
92
|
);
|
|
93
93
|
}
|
|
94
94
|
|