create-o2s-app 4.1.6 → 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 CHANGED
@@ -1,5 +1,11 @@
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
+
3
9
  ## 4.1.6
4
10
 
5
11
  ### Patch Changes
@@ -1 +1 @@
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"}
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":"AASA,eAAO,MAAM,wBAAwB,GAAU,YAAY,MAAM,KAAG,OAAO,CAAC,IAAI,CAiC/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,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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-o2s-app",
3
- "version": "4.1.6",
3
+ "version": "4.1.7",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "description": "CLI tool to scaffold new O2S applications with Next.js and NestJS setup.",
@@ -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)) {