create-o2s-app 4.1.5 → 4.1.7
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 +12 -0
- package/README.md +2 -0
- package/dist/scaffold/install.d.ts.map +1 -1
- package/dist/scaffold/install.js +4 -0
- package/dist/scaffold/transform-apps-package-json.d.ts.map +1 -1
- package/dist/scaffold/transform-apps-package-json.js +0 -30
- package/dist/scaffold/transform-package-json.d.ts.map +1 -1
- package/dist/scaffold/transform-package-json.js +0 -17
- package/package.json +1 -1
- package/src/scaffold/install.ts +4 -0
- package/src/scaffold/transform-apps-package-json.ts +0 -37
- package/src/scaffold/transform-package-json.ts +0 -22
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# create-o2s-app
|
|
2
2
|
|
|
3
|
+
## 4.1.7
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 3ff35ec: remove unused logic for handling private modules during scaffolding
|
|
8
|
+
|
|
9
|
+
## 4.1.6
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- ff780e0: fix(cli): deduplicate npm dependencies during project scaffolding
|
|
14
|
+
|
|
3
15
|
## 4.1.5
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -89,3 +89,5 @@ The `.env.local` file is generated automatically with all required environment v
|
|
|
89
89
|
- [O2S Documentation](https://openselfservice.com/docs)
|
|
90
90
|
- `@o2s/framework` — Core framework types and services
|
|
91
91
|
- `@o2s/telemetry` — Anonymous usage telemetry
|
|
92
|
+
|
|
93
|
+
Scaffolded apps should keep **`@o2s/utils.frontend`** and **`@o2s/utils.api-harmonization`** as direct dependencies in `apps/frontend` and `apps/api-harmonization`. Blocks expect these from the app (peer dependencies), not from nested installs under each block.
|
|
@@ -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,
|
|
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"}
|
package/dist/scaffold/install.js
CHANGED
|
@@ -103,6 +103,10 @@ const installDependencies = async (projectDir, selectedIntegrations) => {
|
|
|
103
103
|
cwd: projectDir,
|
|
104
104
|
stdio: 'inherit',
|
|
105
105
|
});
|
|
106
|
+
(0, child_process_1.execSync)('npm dedupe', {
|
|
107
|
+
cwd: projectDir,
|
|
108
|
+
stdio: 'inherit',
|
|
109
|
+
});
|
|
106
110
|
console.log('Dependencies installed successfully.');
|
|
107
111
|
}
|
|
108
112
|
catch (error) {
|
|
@@ -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"}
|
|
@@ -46,31 +46,7 @@ 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
|
-
};
|
|
72
49
|
const transformAppsPackageJson = async (projectDir, selectedBlockNames, selectedIntegrationNames) => {
|
|
73
|
-
const privateModuleNames = await getPrivateModuleNames(projectDir);
|
|
74
50
|
for (const relPath of APP_PACKAGE_JSON_PATHS) {
|
|
75
51
|
const filePath = path.join(projectDir, relPath);
|
|
76
52
|
if (!(await fs.pathExists(filePath)))
|
|
@@ -97,12 +73,6 @@ const transformAppsPackageJson = async (projectDir, selectedBlockNames, selected
|
|
|
97
73
|
integrationMatch[1] &&
|
|
98
74
|
!selectedIntegrationNames.includes(integrationMatch[1])) {
|
|
99
75
|
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];
|
|
106
76
|
}
|
|
107
77
|
}
|
|
108
78
|
}
|
|
@@ -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":"AAGA,eAAO,MAAM,wBAAwB,GAAU,YAAY,MAAM,KAAG,OAAO,CAAC,IAAI,CAiB/E,CAAC"}
|
|
@@ -36,26 +36,9 @@ 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 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/*'];
|
|
43
39
|
const transformRootPackageJson = async (projectDir) => {
|
|
44
40
|
const filePath = path.join(projectDir, 'package.json');
|
|
45
41
|
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];
|
|
55
|
-
// Remove workspace entries for deleted directories
|
|
56
|
-
if (Array.isArray(packageJson.workspaces)) {
|
|
57
|
-
packageJson.workspaces = packageJson.workspaces.filter((ws) => !allRemovedGlobs.includes(ws));
|
|
58
|
-
}
|
|
59
42
|
// Clean up scripts that reference removed directories
|
|
60
43
|
if (packageJson.scripts) {
|
|
61
44
|
for (const [key, value] of Object.entries(packageJson.scripts)) {
|
package/package.json
CHANGED
package/src/scaffold/install.ts
CHANGED
|
@@ -76,6 +76,10 @@ export const installDependencies = async (projectDir: string, selectedIntegratio
|
|
|
76
76
|
cwd: projectDir,
|
|
77
77
|
stdio: 'inherit',
|
|
78
78
|
});
|
|
79
|
+
execSync('npm dedupe', {
|
|
80
|
+
cwd: projectDir,
|
|
81
|
+
stdio: 'inherit',
|
|
82
|
+
});
|
|
79
83
|
console.log('Dependencies installed successfully.');
|
|
80
84
|
} catch (error) {
|
|
81
85
|
console.error('Error while installing dependencies.');
|
|
@@ -13,41 +13,11 @@ 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
|
-
|
|
44
16
|
export const transformAppsPackageJson = async (
|
|
45
17
|
projectDir: string,
|
|
46
18
|
selectedBlockNames: string[],
|
|
47
19
|
selectedIntegrationNames: string[],
|
|
48
20
|
): Promise<void> => {
|
|
49
|
-
const privateModuleNames = await getPrivateModuleNames(projectDir);
|
|
50
|
-
|
|
51
21
|
for (const relPath of APP_PACKAGE_JSON_PATHS) {
|
|
52
22
|
const filePath = path.join(projectDir, relPath);
|
|
53
23
|
|
|
@@ -80,13 +50,6 @@ export const transformAppsPackageJson = async (
|
|
|
80
50
|
!selectedIntegrationNames.includes(integrationMatch[1])
|
|
81
51
|
) {
|
|
82
52
|
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];
|
|
90
53
|
}
|
|
91
54
|
}
|
|
92
55
|
}
|
|
@@ -1,32 +1,10 @@
|
|
|
1
1
|
import * as fs from 'fs-extra';
|
|
2
2
|
import * as path from 'path';
|
|
3
3
|
|
|
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/*'];
|
|
9
|
-
|
|
10
4
|
export const transformRootPackageJson = async (projectDir: string): Promise<void> => {
|
|
11
5
|
const filePath = path.join(projectDir, 'package.json');
|
|
12
6
|
const packageJson = await fs.readJson(filePath);
|
|
13
7
|
|
|
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
|
-
|
|
25
|
-
// Remove workspace entries for deleted directories
|
|
26
|
-
if (Array.isArray(packageJson.workspaces)) {
|
|
27
|
-
packageJson.workspaces = packageJson.workspaces.filter((ws: string) => !allRemovedGlobs.includes(ws));
|
|
28
|
-
}
|
|
29
|
-
|
|
30
8
|
// Clean up scripts that reference removed directories
|
|
31
9
|
if (packageJson.scripts) {
|
|
32
10
|
for (const [key, value] of Object.entries(packageJson.scripts)) {
|