create-o2s-app 2.0.0 → 3.0.0
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 +6 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +2 -0
- package/dist/scaffold/cleanup.d.ts +1 -1
- package/dist/scaffold/cleanup.d.ts.map +1 -1
- package/dist/scaffold/cleanup.js +2 -33
- package/dist/scaffold/index.js +2 -2
- package/dist/scaffold/transform-apps-package-json.d.ts.map +1 -1
- package/dist/scaffold/transform-apps-package-json.js +22 -4
- package/dist/scaffold/transform-integration-configs.d.ts.map +1 -1
- package/dist/scaffold/transform-integration-configs.js +2 -8
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/constants.ts +2 -0
- package/src/scaffold/cleanup.ts +2 -44
- package/src/scaffold/index.ts +2 -2
- package/src/scaffold/transform-apps-package-json.ts +24 -4
- package/src/scaffold/transform-integration-configs.ts +2 -13
package/CHANGELOG.md
CHANGED
package/dist/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEtC,eAAO,MAAM,eAAe,8CAA8C,CAAC;AAC3E,eAAO,MAAM,aAAa,wBAAwB,CAAC;AACnD,eAAO,MAAM,cAAc,QAAQ,CAAC;AACpC,eAAO,MAAM,aAAa,+CAA+C,CAAC;AAC1E,eAAO,MAAM,QAAQ,qDAAqD,CAAC;AAE3E,eAAO,MAAM,WAAW,oBAAoB,CAAC;AAC7C,eAAO,MAAM,iBAAiB,0BAA0B,CAAC;AAGzD,eAAO,MAAM,kBAAkB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEtC,eAAO,MAAM,eAAe,8CAA8C,CAAC;AAC3E,eAAO,MAAM,aAAa,wBAAwB,CAAC;AACnD,eAAO,MAAM,cAAc,QAAQ,CAAC;AACpC,eAAO,MAAM,aAAa,+CAA+C,CAAC;AAC1E,eAAO,MAAM,QAAQ,qDAAqD,CAAC;AAE3E,eAAO,MAAM,WAAW,oBAAoB,CAAC;AAC7C,eAAO,MAAM,iBAAiB,0BAA0B,CAAC;AAGzD,eAAO,MAAM,kBAAkB,EAAE,MAAM,EAYtC,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,MAAM,EAAoB,CAAC;AAE7D,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAiDzD,CAAC"}
|
package/dist/constants.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const cleanupProject: (projectDir: string
|
|
1
|
+
export declare const cleanupProject: (projectDir: string) => Promise<void>;
|
|
2
2
|
//# sourceMappingURL=cleanup.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cleanup.d.ts","sourceRoot":"","sources":["../../src/scaffold/cleanup.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"cleanup.d.ts","sourceRoot":"","sources":["../../src/scaffold/cleanup.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,cAAc,GAAU,YAAY,MAAM,KAAG,OAAO,CAAC,IAAI,CAgBrE,CAAC"}
|
package/dist/scaffold/cleanup.js
CHANGED
|
@@ -37,14 +37,8 @@ exports.cleanupProject = void 0;
|
|
|
37
37
|
const constants_1 = require("../constants");
|
|
38
38
|
const fs = __importStar(require("fs-extra"));
|
|
39
39
|
const path = __importStar(require("path"));
|
|
40
|
-
const cleanupProject = async (projectDir
|
|
40
|
+
const cleanupProject = async (projectDir) => {
|
|
41
41
|
console.log('Organizing project structure...');
|
|
42
|
-
await removeAlwaysRemovedPaths(projectDir);
|
|
43
|
-
await removeUnselectedBlocks(projectDir, selectedBlockNames);
|
|
44
|
-
await removeUnselectedIntegrations(projectDir, selectedIntegrationNames);
|
|
45
|
-
};
|
|
46
|
-
exports.cleanupProject = cleanupProject;
|
|
47
|
-
const removeAlwaysRemovedPaths = async (projectDir) => {
|
|
48
42
|
for (const dir of constants_1.ALWAYS_REMOVE_DIRS) {
|
|
49
43
|
const fullPath = path.join(projectDir, dir);
|
|
50
44
|
if (await fs.pathExists(fullPath)) {
|
|
@@ -58,29 +52,4 @@ const removeAlwaysRemovedPaths = async (projectDir) => {
|
|
|
58
52
|
}
|
|
59
53
|
}
|
|
60
54
|
};
|
|
61
|
-
|
|
62
|
-
const blocksDir = path.join(projectDir, constants_1.BLOCKS_PATH);
|
|
63
|
-
if (!(await fs.pathExists(blocksDir)))
|
|
64
|
-
return;
|
|
65
|
-
const entries = await fs.readdir(blocksDir, { withFileTypes: true });
|
|
66
|
-
for (const entry of entries) {
|
|
67
|
-
if (!entry.isDirectory())
|
|
68
|
-
continue;
|
|
69
|
-
if (!selectedBlockNames.includes(entry.name)) {
|
|
70
|
-
await fs.remove(path.join(blocksDir, entry.name));
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
const removeUnselectedIntegrations = async (projectDir, selectedIntegrationNames) => {
|
|
75
|
-
const integrationsDir = path.join(projectDir, constants_1.INTEGRATIONS_PATH);
|
|
76
|
-
if (!(await fs.pathExists(integrationsDir)))
|
|
77
|
-
return;
|
|
78
|
-
const entries = await fs.readdir(integrationsDir, { withFileTypes: true });
|
|
79
|
-
for (const entry of entries) {
|
|
80
|
-
if (!entry.isDirectory())
|
|
81
|
-
continue;
|
|
82
|
-
if (!selectedIntegrationNames.includes(entry.name)) {
|
|
83
|
-
await fs.remove(path.join(integrationsDir, entry.name));
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
};
|
|
55
|
+
exports.cleanupProject = cleanupProject;
|
package/dist/scaffold/index.js
CHANGED
|
@@ -56,8 +56,8 @@ const scaffold = async (tempDir, answers, skipInstall = false, directory) => {
|
|
|
56
56
|
console.log();
|
|
57
57
|
console.log(`Creating project in "${targetDir}"...`);
|
|
58
58
|
await fs.move(tempDir, targetDir);
|
|
59
|
-
// Step 2: Remove unneeded directories
|
|
60
|
-
await (0, cleanup_1.cleanupProject)(targetDir
|
|
59
|
+
// Step 2: Remove unneeded directories (all packages/* are removed; deps come from npm registry)
|
|
60
|
+
await (0, cleanup_1.cleanupProject)(targetDir);
|
|
61
61
|
// Step 3: Remove unselected block/integration references from app source files
|
|
62
62
|
console.log('Configuring project for selected blocks...');
|
|
63
63
|
await Promise.all([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transform-apps-package-json.d.ts","sourceRoot":"","sources":["../../src/scaffold/transform-apps-package-json.ts"],"names":[],"mappings":"
|
|
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"}
|
|
@@ -37,24 +37,42 @@ exports.transformAppsPackageJson = void 0;
|
|
|
37
37
|
const fs = __importStar(require("fs-extra"));
|
|
38
38
|
const path = __importStar(require("path"));
|
|
39
39
|
const APP_PACKAGE_JSON_PATHS = ['apps/api-harmonization/package.json', 'apps/frontend/package.json'];
|
|
40
|
+
// Private workspace-only packages that are not published to npm and should be
|
|
41
|
+
// removed from scaffolded projects (they are part of the monorepo dev setup).
|
|
42
|
+
const PRIVATE_PACKAGES = [
|
|
43
|
+
'@o2s/eslint-config',
|
|
44
|
+
'@o2s/lint-staged-config',
|
|
45
|
+
'@o2s/prettier-config',
|
|
46
|
+
'@o2s/typescript-config',
|
|
47
|
+
'@o2s/vitest-config',
|
|
48
|
+
];
|
|
40
49
|
const transformAppsPackageJson = async (projectDir, selectedBlockNames, selectedIntegrationNames) => {
|
|
41
50
|
for (const relPath of APP_PACKAGE_JSON_PATHS) {
|
|
42
51
|
const filePath = path.join(projectDir, relPath);
|
|
43
52
|
if (!(await fs.pathExists(filePath)))
|
|
44
53
|
continue;
|
|
45
54
|
const packageJson = await fs.readJson(filePath);
|
|
46
|
-
|
|
47
|
-
|
|
55
|
+
for (const section of ['dependencies', 'devDependencies']) {
|
|
56
|
+
if (!packageJson[section])
|
|
57
|
+
continue;
|
|
58
|
+
for (const depName of Object.keys(packageJson[section])) {
|
|
59
|
+
// Remove private workspace-only packages
|
|
60
|
+
if (PRIVATE_PACKAGES.includes(depName)) {
|
|
61
|
+
delete packageJson[section][depName];
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
// Remove unselected blocks
|
|
48
65
|
const blockMatch = depName.match(/^@o2s\/blocks\.(.+)$/);
|
|
49
66
|
if (blockMatch && blockMatch[1] && !selectedBlockNames.includes(blockMatch[1])) {
|
|
50
|
-
delete packageJson
|
|
67
|
+
delete packageJson[section][depName];
|
|
51
68
|
continue;
|
|
52
69
|
}
|
|
70
|
+
// Remove unselected integrations
|
|
53
71
|
const integrationMatch = depName.match(/^@o2s\/integrations\.(.+)$/);
|
|
54
72
|
if (integrationMatch &&
|
|
55
73
|
integrationMatch[1] &&
|
|
56
74
|
!selectedIntegrationNames.includes(integrationMatch[1])) {
|
|
57
|
-
delete packageJson
|
|
75
|
+
delete packageJson[section][depName];
|
|
58
76
|
}
|
|
59
77
|
}
|
|
60
78
|
}
|
|
@@ -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;AAqD9C,eAAO,MAAM,2BAA2B,GACpC,YAAY,MAAM,EAClB,sBAAsB,MAAM,EAAE,EAC9B,qBAAqB,kBAAkB,EAAE,EACzC,oBAAoB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,KAC7C,OAAO,CAAC,MAAM,EAAE,CA0ClB,CAAC"}
|
|
@@ -56,7 +56,7 @@ const buildModuleIntegrationMap = (selectedIntegrations, conflictResolutions, in
|
|
|
56
56
|
}
|
|
57
57
|
return moduleMap;
|
|
58
58
|
};
|
|
59
|
-
const updateConfigsPackageJson = async (projectDir, selectedIntegrations
|
|
59
|
+
const updateConfigsPackageJson = async (projectDir, selectedIntegrations) => {
|
|
60
60
|
const pkgPath = path.join(projectDir, CONFIGS_PACKAGE_JSON_PATH);
|
|
61
61
|
if (!(await fs.pathExists(pkgPath)))
|
|
62
62
|
return;
|
|
@@ -70,12 +70,6 @@ const updateConfigsPackageJson = async (projectDir, selectedIntegrations, integr
|
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
|
-
// Add deps for selected integrations that have module mappings
|
|
74
|
-
for (const integration of selectedIntegrations) {
|
|
75
|
-
if (integrationModules[integration]?.length) {
|
|
76
|
-
pkg.dependencies[`@o2s/integrations.${integration}`] = '*';
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
73
|
await fs.writeJson(pkgPath, pkg, { spaces: 4 });
|
|
80
74
|
};
|
|
81
75
|
const transformIntegrationConfigs = async (projectDir, selectedIntegrations, conflictResolutions, integrationModules) => {
|
|
@@ -95,7 +89,7 @@ const transformIntegrationConfigs = async (projectDir, selectedIntegrations, con
|
|
|
95
89
|
const updatedContent = content.replaceAll(MOCKED_IMPORT, `@o2s/integrations.${integration}/integration`);
|
|
96
90
|
await fs.writeFile(filePath, updatedContent, 'utf-8');
|
|
97
91
|
}
|
|
98
|
-
await updateConfigsPackageJson(projectDir, selectedIntegrations
|
|
92
|
+
await updateConfigsPackageJson(projectDir, selectedIntegrations);
|
|
99
93
|
// Detect model files that still import mocked but mocked is not selected.
|
|
100
94
|
// Skip only when 'mocked' (full) is selected — it covers all modules.
|
|
101
95
|
// 'mocked-dxp' covers only cms/articles/search, so uncovered detection runs normally.
|