create-o2s-app 4.1.3 → 4.1.5
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 +18 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +0 -1
- package/dist/scaffold/cleanup.d.ts.map +1 -1
- package/dist/scaffold/cleanup.js +29 -0
- package/dist/scaffold/transform-apps-package-json.d.ts.map +1 -1
- package/dist/scaffold/transform-apps-package-json.js +30 -0
- package/dist/scaffold/transform-package-json.d.ts.map +1 -1
- package/dist/scaffold/transform-package-json.js +14 -3
- package/package.json +1 -1
- package/src/constants.ts +0 -1
- package/src/scaffold/cleanup.ts +37 -0
- package/src/scaffold/transform-apps-package-json.ts +37 -0
- package/src/scaffold/transform-package-json.ts +17 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# create-o2s-app
|
|
2
2
|
|
|
3
|
+
## 4.1.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 5ea13c5: fix: preserve private modules during project scaffolding
|
|
8
|
+
|
|
9
|
+
Previously, the CLI removed the entire `packages/modules` directory during scaffolding. Now only public (non-private) modules are removed, while private modules (e.g. `packages/modules/documents`) are kept as local workspace packages in the scaffolded project.
|
|
10
|
+
|
|
11
|
+
## 4.1.4
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- 31df3a8: fix(deps): move @o2s/framework to peerDependencies in all published packages
|
|
16
|
+
|
|
17
|
+
`@o2s/framework` was listed in `dependencies` of blocks, integrations, modules, and utils packages. When installed from npm with mismatched versions across the dependency tree, npm would create nested copies of `@o2s/framework` with different class references. This caused NestJS to fail resolving DI tokens (e.g. `SearchService`) because injected class instances came from a different `@o2s/framework` copy than the one registered in the application module.
|
|
18
|
+
|
|
19
|
+
Moved `@o2s/framework` to `peerDependencies` across all affected packages so that the consuming application always provides a single shared copy. Also moved `@o2s/integrations.mocked` to `peerDependencies` in `@o2s/integrations.mocked-dxp`.
|
|
20
|
+
|
|
3
21
|
## 4.1.3
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
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,sEAAsE,CAAC;AAC5F,eAAO,MAAM,qBAAqB,sDAAsD,CAAC;AAEzF,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,sEAAsE,CAAC;AAC5F,eAAO,MAAM,qBAAqB,sDAAsD,CAAC;AAEzF,eAAO,MAAM,WAAW,oBAAoB,CAAC;AAC7C,eAAO,MAAM,iBAAiB,0BAA0B,CAAC;AAGzD,eAAO,MAAM,kBAAkB,EAAE,MAAM,EAWtC,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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cleanup.d.ts","sourceRoot":"","sources":["../../src/scaffold/cleanup.ts"],"names":[],"mappings":"
|
|
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"}
|
package/dist/scaffold/cleanup.js
CHANGED
|
@@ -37,6 +37,34 @@ 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
|
+
/**
|
|
41
|
+
* Remove only public (non-private) packages from packages/modules/.
|
|
42
|
+
* Private modules are kept as local workspace packages in scaffolded projects.
|
|
43
|
+
*/
|
|
44
|
+
const cleanupModules = async (projectDir) => {
|
|
45
|
+
const modulesDir = path.join(projectDir, 'packages', 'modules');
|
|
46
|
+
if (!(await fs.pathExists(modulesDir)))
|
|
47
|
+
return;
|
|
48
|
+
const entries = await fs.readdir(modulesDir, { withFileTypes: true });
|
|
49
|
+
for (const entry of entries) {
|
|
50
|
+
if (!entry.isDirectory())
|
|
51
|
+
continue;
|
|
52
|
+
const pkgJsonPath = path.join(modulesDir, entry.name, 'package.json');
|
|
53
|
+
if (!(await fs.pathExists(pkgJsonPath))) {
|
|
54
|
+
await fs.remove(path.join(modulesDir, entry.name));
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
const pkgJson = await fs.readJson(pkgJsonPath);
|
|
58
|
+
if (pkgJson.private !== true) {
|
|
59
|
+
await fs.remove(path.join(modulesDir, entry.name));
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
// Remove the modules directory itself if empty
|
|
63
|
+
const remaining = await fs.readdir(modulesDir);
|
|
64
|
+
if (remaining.length === 0) {
|
|
65
|
+
await fs.remove(modulesDir);
|
|
66
|
+
}
|
|
67
|
+
};
|
|
40
68
|
const cleanupProject = async (projectDir) => {
|
|
41
69
|
console.log('Organizing project structure...');
|
|
42
70
|
for (const dir of constants_1.ALWAYS_REMOVE_DIRS) {
|
|
@@ -51,5 +79,6 @@ const cleanupProject = async (projectDir) => {
|
|
|
51
79
|
await fs.remove(fullPath);
|
|
52
80
|
}
|
|
53
81
|
}
|
|
82
|
+
await cleanupModules(projectDir);
|
|
54
83
|
};
|
|
55
84
|
exports.cleanupProject = cleanupProject;
|
|
@@ -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":"AA2CA,eAAO,MAAM,wBAAwB,GACjC,YAAY,MAAM,EAClB,oBAAoB,MAAM,EAAE,EAC5B,0BAA0B,MAAM,EAAE,KACnC,OAAO,CAAC,IAAI,CAgDd,CAAC"}
|
|
@@ -46,7 +46,31 @@ const PRIVATE_PACKAGES = [
|
|
|
46
46
|
'@o2s/typescript-config',
|
|
47
47
|
'@o2s/vitest-config',
|
|
48
48
|
];
|
|
49
|
+
/**
|
|
50
|
+
* Collect the names of private modules that still exist in the scaffolded project.
|
|
51
|
+
* Public modules are removed during cleanup, so anything still present is private.
|
|
52
|
+
*/
|
|
53
|
+
const getPrivateModuleNames = async (projectDir) => {
|
|
54
|
+
const modulesDir = path.join(projectDir, 'packages', 'modules');
|
|
55
|
+
const names = new Set();
|
|
56
|
+
if (!(await fs.pathExists(modulesDir)))
|
|
57
|
+
return names;
|
|
58
|
+
const entries = await fs.readdir(modulesDir, { withFileTypes: true });
|
|
59
|
+
for (const entry of entries) {
|
|
60
|
+
if (!entry.isDirectory())
|
|
61
|
+
continue;
|
|
62
|
+
const pkgJsonPath = path.join(modulesDir, entry.name, 'package.json');
|
|
63
|
+
if (await fs.pathExists(pkgJsonPath)) {
|
|
64
|
+
const pkgJson = await fs.readJson(pkgJsonPath);
|
|
65
|
+
if (pkgJson.name) {
|
|
66
|
+
names.add(pkgJson.name);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return names;
|
|
71
|
+
};
|
|
49
72
|
const transformAppsPackageJson = async (projectDir, selectedBlockNames, selectedIntegrationNames) => {
|
|
73
|
+
const privateModuleNames = await getPrivateModuleNames(projectDir);
|
|
50
74
|
for (const relPath of APP_PACKAGE_JSON_PATHS) {
|
|
51
75
|
const filePath = path.join(projectDir, relPath);
|
|
52
76
|
if (!(await fs.pathExists(filePath)))
|
|
@@ -73,6 +97,12 @@ const transformAppsPackageJson = async (projectDir, selectedBlockNames, selected
|
|
|
73
97
|
integrationMatch[1] &&
|
|
74
98
|
!selectedIntegrationNames.includes(integrationMatch[1])) {
|
|
75
99
|
delete packageJson[section][depName];
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
102
|
+
// Remove public (non-private) module dependencies — they are installed from npm
|
|
103
|
+
const moduleMatch = depName.match(/^@o2s\/modules\..+$/);
|
|
104
|
+
if (moduleMatch && !privateModuleNames.has(depName)) {
|
|
105
|
+
delete packageJson[section][depName];
|
|
76
106
|
}
|
|
77
107
|
}
|
|
78
108
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transform-package-json.d.ts","sourceRoot":"","sources":["../../src/scaffold/transform-package-json.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"transform-package-json.d.ts","sourceRoot":"","sources":["../../src/scaffold/transform-package-json.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,wBAAwB,GAAU,YAAY,MAAM,KAAG,OAAO,CAAC,IAAI,CAiC/E,CAAC"}
|
|
@@ -36,14 +36,25 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
exports.transformRootPackageJson = void 0;
|
|
37
37
|
const fs = __importStar(require("fs-extra"));
|
|
38
38
|
const path = __importStar(require("path"));
|
|
39
|
-
// Workspace globs to remove (their parent directories are deleted during cleanup)
|
|
40
|
-
const REMOVED_WORKSPACE_GLOBS = ['packages/cli/*', 'packages/
|
|
39
|
+
// Workspace globs to always remove (their parent directories are deleted during cleanup)
|
|
40
|
+
const REMOVED_WORKSPACE_GLOBS = ['packages/cli/*', 'packages/utils/*'];
|
|
41
|
+
// Workspace globs to remove only when the directory is empty after cleanup
|
|
42
|
+
const CONDITIONAL_WORKSPACE_GLOBS = ['packages/modules/*'];
|
|
41
43
|
const transformRootPackageJson = async (projectDir) => {
|
|
42
44
|
const filePath = path.join(projectDir, 'package.json');
|
|
43
45
|
const packageJson = await fs.readJson(filePath);
|
|
46
|
+
// Check which conditional globs still have content
|
|
47
|
+
const emptyConditionalGlobs = [];
|
|
48
|
+
for (const glob of CONDITIONAL_WORKSPACE_GLOBS) {
|
|
49
|
+
const dir = path.join(projectDir, glob.replace('/*', ''));
|
|
50
|
+
if (!(await fs.pathExists(dir))) {
|
|
51
|
+
emptyConditionalGlobs.push(glob);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
const allRemovedGlobs = [...REMOVED_WORKSPACE_GLOBS, ...emptyConditionalGlobs];
|
|
44
55
|
// Remove workspace entries for deleted directories
|
|
45
56
|
if (Array.isArray(packageJson.workspaces)) {
|
|
46
|
-
packageJson.workspaces = packageJson.workspaces.filter((ws) => !
|
|
57
|
+
packageJson.workspaces = packageJson.workspaces.filter((ws) => !allRemovedGlobs.includes(ws));
|
|
47
58
|
}
|
|
48
59
|
// Clean up scripts that reference removed directories
|
|
49
60
|
if (packageJson.scripts) {
|
package/package.json
CHANGED
package/src/constants.ts
CHANGED
package/src/scaffold/cleanup.ts
CHANGED
|
@@ -2,6 +2,41 @@ import { ALWAYS_REMOVE_DIRS, ALWAYS_REMOVE_FILES } from '../constants';
|
|
|
2
2
|
import * as fs from 'fs-extra';
|
|
3
3
|
import * as path from 'path';
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Remove only public (non-private) packages from packages/modules/.
|
|
7
|
+
* Private modules are kept as local workspace packages in scaffolded projects.
|
|
8
|
+
*/
|
|
9
|
+
const cleanupModules = async (projectDir: string): Promise<void> => {
|
|
10
|
+
const modulesDir = path.join(projectDir, 'packages', 'modules');
|
|
11
|
+
|
|
12
|
+
if (!(await fs.pathExists(modulesDir))) return;
|
|
13
|
+
|
|
14
|
+
const entries = await fs.readdir(modulesDir, { withFileTypes: true });
|
|
15
|
+
|
|
16
|
+
for (const entry of entries) {
|
|
17
|
+
if (!entry.isDirectory()) continue;
|
|
18
|
+
|
|
19
|
+
const pkgJsonPath = path.join(modulesDir, entry.name, 'package.json');
|
|
20
|
+
|
|
21
|
+
if (!(await fs.pathExists(pkgJsonPath))) {
|
|
22
|
+
await fs.remove(path.join(modulesDir, entry.name));
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const pkgJson = await fs.readJson(pkgJsonPath);
|
|
27
|
+
|
|
28
|
+
if (pkgJson.private !== true) {
|
|
29
|
+
await fs.remove(path.join(modulesDir, entry.name));
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Remove the modules directory itself if empty
|
|
34
|
+
const remaining = await fs.readdir(modulesDir);
|
|
35
|
+
if (remaining.length === 0) {
|
|
36
|
+
await fs.remove(modulesDir);
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
|
|
5
40
|
export const cleanupProject = async (projectDir: string): Promise<void> => {
|
|
6
41
|
console.log('Organizing project structure...');
|
|
7
42
|
|
|
@@ -18,4 +53,6 @@ export const cleanupProject = async (projectDir: string): Promise<void> => {
|
|
|
18
53
|
await fs.remove(fullPath);
|
|
19
54
|
}
|
|
20
55
|
}
|
|
56
|
+
|
|
57
|
+
await cleanupModules(projectDir);
|
|
21
58
|
};
|
|
@@ -13,11 +13,41 @@ const PRIVATE_PACKAGES = [
|
|
|
13
13
|
'@o2s/vitest-config',
|
|
14
14
|
];
|
|
15
15
|
|
|
16
|
+
/**
|
|
17
|
+
* Collect the names of private modules that still exist in the scaffolded project.
|
|
18
|
+
* Public modules are removed during cleanup, so anything still present is private.
|
|
19
|
+
*/
|
|
20
|
+
const getPrivateModuleNames = async (projectDir: string): Promise<Set<string>> => {
|
|
21
|
+
const modulesDir = path.join(projectDir, 'packages', 'modules');
|
|
22
|
+
const names = new Set<string>();
|
|
23
|
+
|
|
24
|
+
if (!(await fs.pathExists(modulesDir))) return names;
|
|
25
|
+
|
|
26
|
+
const entries = await fs.readdir(modulesDir, { withFileTypes: true });
|
|
27
|
+
|
|
28
|
+
for (const entry of entries) {
|
|
29
|
+
if (!entry.isDirectory()) continue;
|
|
30
|
+
|
|
31
|
+
const pkgJsonPath = path.join(modulesDir, entry.name, 'package.json');
|
|
32
|
+
|
|
33
|
+
if (await fs.pathExists(pkgJsonPath)) {
|
|
34
|
+
const pkgJson = await fs.readJson(pkgJsonPath);
|
|
35
|
+
if (pkgJson.name) {
|
|
36
|
+
names.add(pkgJson.name);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return names;
|
|
42
|
+
};
|
|
43
|
+
|
|
16
44
|
export const transformAppsPackageJson = async (
|
|
17
45
|
projectDir: string,
|
|
18
46
|
selectedBlockNames: string[],
|
|
19
47
|
selectedIntegrationNames: string[],
|
|
20
48
|
): Promise<void> => {
|
|
49
|
+
const privateModuleNames = await getPrivateModuleNames(projectDir);
|
|
50
|
+
|
|
21
51
|
for (const relPath of APP_PACKAGE_JSON_PATHS) {
|
|
22
52
|
const filePath = path.join(projectDir, relPath);
|
|
23
53
|
|
|
@@ -50,6 +80,13 @@ export const transformAppsPackageJson = async (
|
|
|
50
80
|
!selectedIntegrationNames.includes(integrationMatch[1])
|
|
51
81
|
) {
|
|
52
82
|
delete packageJson[section][depName];
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// Remove public (non-private) module dependencies — they are installed from npm
|
|
87
|
+
const moduleMatch = depName.match(/^@o2s\/modules\..+$/);
|
|
88
|
+
if (moduleMatch && !privateModuleNames.has(depName)) {
|
|
89
|
+
delete packageJson[section][depName];
|
|
53
90
|
}
|
|
54
91
|
}
|
|
55
92
|
}
|
|
@@ -1,16 +1,30 @@
|
|
|
1
1
|
import * as fs from 'fs-extra';
|
|
2
2
|
import * as path from 'path';
|
|
3
3
|
|
|
4
|
-
// Workspace globs to remove (their parent directories are deleted during cleanup)
|
|
5
|
-
const REMOVED_WORKSPACE_GLOBS = ['packages/cli/*', 'packages/
|
|
4
|
+
// Workspace globs to always remove (their parent directories are deleted during cleanup)
|
|
5
|
+
const REMOVED_WORKSPACE_GLOBS = ['packages/cli/*', 'packages/utils/*'];
|
|
6
|
+
|
|
7
|
+
// Workspace globs to remove only when the directory is empty after cleanup
|
|
8
|
+
const CONDITIONAL_WORKSPACE_GLOBS = ['packages/modules/*'];
|
|
6
9
|
|
|
7
10
|
export const transformRootPackageJson = async (projectDir: string): Promise<void> => {
|
|
8
11
|
const filePath = path.join(projectDir, 'package.json');
|
|
9
12
|
const packageJson = await fs.readJson(filePath);
|
|
10
13
|
|
|
14
|
+
// Check which conditional globs still have content
|
|
15
|
+
const emptyConditionalGlobs: string[] = [];
|
|
16
|
+
for (const glob of CONDITIONAL_WORKSPACE_GLOBS) {
|
|
17
|
+
const dir = path.join(projectDir, glob.replace('/*', ''));
|
|
18
|
+
if (!(await fs.pathExists(dir))) {
|
|
19
|
+
emptyConditionalGlobs.push(glob);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const allRemovedGlobs = [...REMOVED_WORKSPACE_GLOBS, ...emptyConditionalGlobs];
|
|
24
|
+
|
|
11
25
|
// Remove workspace entries for deleted directories
|
|
12
26
|
if (Array.isArray(packageJson.workspaces)) {
|
|
13
|
-
packageJson.workspaces = packageJson.workspaces.filter((ws: string) => !
|
|
27
|
+
packageJson.workspaces = packageJson.workspaces.filter((ws: string) => !allRemovedGlobs.includes(ws));
|
|
14
28
|
}
|
|
15
29
|
|
|
16
30
|
// Clean up scripts that reference removed directories
|