@forge/cli-shared 8.23.1-next.6-experimental-5c60439 → 8.24.0-next.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,6 +1,6 @@
1
1
  # @forge/cli-shared
2
2
 
3
- ## 8.23.1-next.6-experimental-5c60439
3
+ ## 8.24.0-next.7
4
4
 
5
5
  ### Minor Changes
6
6
 
@@ -8,16 +8,7 @@
8
8
 
9
9
  ### Patch Changes
10
10
 
11
- - 22145f6: Surfacing error messages in the Forge CLI for apps that are missing billing information
12
- - Updated dependencies [ccdcfc3]
13
- - Updated dependencies [8197e66]
14
- - Updated dependencies [723fab8]
15
- - Updated dependencies [4493006]
16
- - Updated dependencies [5beb8ad]
17
- - Updated dependencies [f1f11f0]
18
- - Updated dependencies [b7b1f36]
19
- - Updated dependencies [9f3add6]
20
- - @forge/manifest@12.9.0-next.5-experimental-5c60439
11
+ - 8f4ff0a: Remove forge-cli-enable-developer-space-flow feature flag and GA developer space selection. The feature is now always enabled except in FedRAMP environments.
21
12
 
22
13
  ## 8.23.1-next.6
23
14
 
@@ -15,12 +15,11 @@ export interface ModuleTemplateMeta {
15
15
  category?: string;
16
16
  uiFramework?: UIFramework;
17
17
  moduleKey: string;
18
- manifestPath?: string;
19
- dependencies?: Record<string, string>;
20
- devDependencies?: Record<string, string>;
18
+ dependencies?: Record<string, string> | string[];
19
+ devDependencies?: Record<string, string> | string[];
21
20
  frontend?: {
22
- dependencies?: Record<string, string>;
23
- devDependencies?: Record<string, string>;
21
+ dependencies?: string[];
22
+ devDependencies?: string[];
24
23
  };
25
24
  customUiDependencies?: string[];
26
25
  customUiDevDependencies?: string[];
@@ -34,11 +33,11 @@ export interface ModuleTemplateMeta {
34
33
  }>;
35
34
  variants?: Record<UIFramework, {
36
35
  manifestPath?: string;
37
- dependencies?: Record<string, string>;
38
- devDependencies?: Record<string, string>;
36
+ dependencies?: Record<string, string> | string[];
37
+ devDependencies?: Record<string, string> | string[];
39
38
  frontend?: {
40
- dependencies?: Record<string, string>;
41
- devDependencies?: Record<string, string>;
39
+ dependencies?: string[];
40
+ devDependencies?: string[];
42
41
  };
43
42
  variables?: TemplateVariableDef[];
44
43
  fileOperations?: Array<{
@@ -57,9 +56,7 @@ export declare class TemplateModuleServices {
57
56
  getAvailableModules(product: string): Promise<ModuleTemplateMeta[]>;
58
57
  private fetchModuleTemplates;
59
58
  fetchManifestFragment(manifestPath: string): Promise<string>;
60
- applyVariant(template: ModuleTemplateMeta, uiFramework?: UIFramework): ModuleTemplateMeta;
61
- prepareModuleMetadata(template: ModuleTemplateMeta, uiFramework?: UIFramework): Promise<ModuleTemplateMeta>;
62
- downloadModuleBundle(template: ModuleTemplateMeta, uiFramework?: UIFramework): Promise<void>;
59
+ downloadModuleAssets(template: ModuleTemplateMeta, uiFramework?: UIFramework): Promise<ModuleTemplateMeta>;
63
60
  cleanupCache(cacheDir: string): void;
64
61
  }
65
62
  //# sourceMappingURL=template-module.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"template-module.d.ts","sourceRoot":"","sources":["../../src/apps/template-module.ts"],"names":[],"mappings":"AAWA,qBAAa,iBAAkB,SAAQ,KAAK;gBAC9B,OAAO,EAAE,MAAM;CAI5B;AAED,oBAAY,WAAW,GAAG,QAAQ,GAAG,WAAW,CAAC;AAEjD,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;IAElB,YA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AE,MAAM,EAAE,CAAC;SAC5B,CAAC;QACF,SAAS,CAAC,EAAE,mBAAmB,EAAE,CAAC;QAClC,cAAc,CAAC,EAAE,KAAK,CAAC;YACrB,IAAI,EAAE,QAAQ,GAAG,QAAQ,GAAG,OAAO,GAAG,QAAQ,CAAC;YAC/C,MAAM,CAAC,EAAE,MAAM,CAAC;YAChB,MAAM,EAAE,MAAM,CAAC;YACf,QAAQ,CAAC,EAAE,OAAO,CAAC;SACpB,CAAC,CAAC;KACJ,CACF,CAAC;IACF,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,qBAAa,sBAAsB;IACjC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,cAAc,CAAqC;gBAE/C,OAAO,CAAC,EAAE,MAAM;IAIf,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC;YAOlE,oBAAoB;IAsBrB,qBAAqB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAa5D,oBAAoB,CAC/B,QAAQ,EAAE,kBAAkB,EAC5B,WAAW,CAAC,EAAE,WAAW,GACxB,OAAO,CAAC,kBAAkB,CAAC;IAkCvB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;CAO5C"}
@@ -7,7 +7,6 @@ const path_1 = tslib_1.__importDefault(require("path"));
7
7
  const node_fetch_1 = tslib_1.__importDefault(require("node-fetch"));
8
8
  const os_1 = tslib_1.__importDefault(require("os"));
9
9
  const url_1 = require("url");
10
- const adm_zip_1 = tslib_1.__importDefault(require("adm-zip"));
11
10
  const text_1 = require("../ui/text");
12
11
  const BIFROST_BASE_URL = 'https://forge-templates-bifrost.ddev.frontend.public.atl-paas.net/assets/';
13
12
  const MODULE_INDEX_FILE = 'template-modules.json';
@@ -53,77 +52,41 @@ class TemplateModuleServices {
53
52
  }
54
53
  return await res.text();
55
54
  }
56
- applyVariant(template, uiFramework) {
57
- if (!uiFramework)
58
- return { ...template };
59
- const variantData = template.variants?.[uiFramework];
60
- if (!variantData) {
61
- throw new Error(text_1.Text.module.add.errorInvalidUIFramework(uiFramework, template.moduleKey));
55
+ async downloadModuleAssets(template, uiFramework) {
56
+ let manifestFragment;
57
+ let variantData;
58
+ if (uiFramework) {
59
+ variantData = template.variants?.[uiFramework];
60
+ if (!variantData)
61
+ throw new Error(text_1.Text.module.add.errorInvalidUIFramework(uiFramework, template.moduleKey));
62
+ }
63
+ if (variantData?.manifestPath) {
64
+ manifestFragment = await this.fetchManifestFragment(variantData.manifestPath);
62
65
  }
63
- return {
64
- ...template,
65
- uiFramework,
66
- manifestPath: variantData.manifestPath ?? template.manifestPath,
67
- dependencies: variantData.dependencies ?? template.dependencies,
68
- devDependencies: variantData.devDependencies ?? template.devDependencies,
69
- frontend: variantData.frontend ?? template.frontend,
70
- variables: variantData.variables ?? template.variables,
71
- fileOperations: variantData.fileOperations ?? template.fileOperations
72
- };
73
- }
74
- async prepareModuleMetadata(template, uiFramework) {
75
- const resolved = this.applyVariant(template, uiFramework);
76
66
  const cacheDir = fs_1.default.mkdtempSync(path_1.default.join(os_1.default.tmpdir(), 'forge-module-'));
77
- if (resolved.manifestPath) {
78
- const manifestFragment = await this.fetchManifestFragment(resolved.manifestPath);
67
+ if (manifestFragment) {
79
68
  fs_1.default.writeFileSync(path_1.default.join(cacheDir, 'manifest-fragment.yml'), manifestFragment);
80
69
  }
81
- return { ...resolved, cacheDir };
82
- }
83
- async downloadModuleBundle(template, uiFramework) {
84
- if (!template.fileOperations?.length) {
85
- return;
86
- }
87
- if (!template.cacheDir) {
88
- throw new Error(text_1.Text.module.add.errorCacheDirMissing(template.moduleKey));
89
- }
90
- const rel = uiFramework ? `${template.moduleKey}/${uiFramework}/bundle.zip` : `${template.moduleKey}/bundle.zip`;
91
- const url = `${this.baseUrl}${rel}`;
92
- let res;
93
- try {
94
- res = await (0, node_fetch_1.default)(url);
95
- }
96
- catch (err) {
97
- const message = err instanceof Error ? err.message : String(err);
98
- throw new Error(text_1.Text.module.add.errorFailedToDownloadBundle(template.moduleKey, message), { cause: err });
99
- }
100
- if (!res.ok) {
101
- throw new BifrostFetchError(`${text_1.Text.module.errors.bifrostZipFetchFailed(template.moduleKey, res.status, res.statusText)} (last URL: ${url})`);
102
- }
103
- const arrayBuffer = await res.arrayBuffer();
104
- const zipPath = path_1.default.join(template.cacheDir, 'bundle.zip');
105
- fs_1.default.writeFileSync(zipPath, Buffer.from(arrayBuffer));
106
- try {
107
- new adm_zip_1.default(zipPath).extractAllTo(template.cacheDir, true);
108
- }
109
- catch (err) {
110
- throw new BifrostFetchError(text_1.Text.module.add.errorZipExtractionFailed(template.moduleKey, err.message));
111
- }
112
- finally {
113
- try {
114
- fs_1.default.rmSync(zipPath, { force: true });
115
- }
116
- catch (cleanupErr) {
117
- console.warn(`${text_1.Text.module.add.errorZipCleanupFailed(template.moduleKey)}`);
118
- }
119
- }
70
+ return {
71
+ ...template,
72
+ ...(variantData
73
+ ? {
74
+ uiFramework,
75
+ dependencies: variantData.dependencies ?? template.dependencies,
76
+ devDependencies: variantData.devDependencies ?? template.devDependencies,
77
+ frontend: variantData.frontend ?? template.frontend,
78
+ variables: variantData.variables ?? template.variables,
79
+ fileOperations: variantData.fileOperations ?? template.fileOperations
80
+ }
81
+ : {}),
82
+ cacheDir
83
+ };
120
84
  }
121
85
  cleanupCache(cacheDir) {
122
86
  try {
123
87
  fs_1.default.rmSync(cacheDir, { recursive: true, force: true });
124
88
  }
125
89
  catch {
126
- throw new Error(text_1.Text.module.add.errorCacheCleanupFailed(cacheDir));
127
90
  }
128
91
  }
129
92
  }