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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # create-o2s-app
2
2
 
3
+ ## 3.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - 1df1ec2: added fix related to dxp starter and mocked data
8
+
3
9
  ## 2.0.0
4
10
 
5
11
  ### Major Changes
@@ -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,EAUtC,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,MAAM,EAAoB,CAAC;AAE7D,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAiDzD,CAAC"}
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
@@ -14,7 +14,9 @@ exports.ALWAYS_REMOVE_DIRS = [
14
14
  '.github',
15
15
  '.changeset',
16
16
  'apps/docs',
17
+ 'packages/blocks',
17
18
  'packages/framework',
19
+ 'packages/integrations',
18
20
  'packages/modules',
19
21
  'packages/utils',
20
22
  'packages/cli',
@@ -1,2 +1,2 @@
1
- export declare const cleanupProject: (projectDir: string, selectedBlockNames: string[], selectedIntegrationNames: string[]) => Promise<void>;
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,GACvB,YAAY,MAAM,EAClB,oBAAoB,MAAM,EAAE,EAC5B,0BAA0B,MAAM,EAAE,KACnC,OAAO,CAAC,IAAI,CAMd,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"}
@@ -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, selectedBlockNames, selectedIntegrationNames) => {
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
- const removeUnselectedBlocks = async (projectDir, selectedBlockNames) => {
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;
@@ -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, selectedBlocks, selectedIntegrations);
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":"AAKA,eAAO,MAAM,wBAAwB,GACjC,YAAY,MAAM,EAClB,oBAAoB,MAAM,EAAE,EAC5B,0BAA0B,MAAM,EAAE,KACnC,OAAO,CAAC,IAAI,CA6Bd,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"}
@@ -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
- if (packageJson.dependencies) {
47
- for (const depName of Object.keys(packageJson.dependencies)) {
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.dependencies[depName];
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.dependencies[depName];
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;AAgE9C,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"}
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, integrationModules) => {
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, integrationModules);
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.