@forge/cli-shared 8.23.1-next.5 → 8.23.1-next.6-experimental-5c60439
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 +26 -0
- package/out/apps/template-module.d.ts +12 -9
- package/out/apps/template-module.d.ts.map +1 -1
- package/out/apps/template-module.js +62 -25
- package/out/graphql/graphql-types.d.ts +17380 -5
- package/out/graphql/graphql-types.d.ts.map +1 -1
- package/out/ui/text.d.ts +53 -2
- package/out/ui/text.d.ts.map +1 -1
- package/out/ui/text.js +56 -5
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# @forge/cli-shared
|
|
2
2
|
|
|
3
|
+
## 8.23.1-next.6-experimental-5c60439
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 2415638: Prerelease of forge module add command
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
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
|
|
21
|
+
|
|
22
|
+
## 8.23.1-next.6
|
|
23
|
+
|
|
24
|
+
### Patch Changes
|
|
25
|
+
|
|
26
|
+
- Updated dependencies [8197e66]
|
|
27
|
+
- @forge/manifest@12.9.0-next.5
|
|
28
|
+
|
|
3
29
|
## 8.23.1-next.5
|
|
4
30
|
|
|
5
31
|
### Patch Changes
|
|
@@ -15,11 +15,12 @@ export interface ModuleTemplateMeta {
|
|
|
15
15
|
category?: string;
|
|
16
16
|
uiFramework?: UIFramework;
|
|
17
17
|
moduleKey: string;
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
manifestPath?: string;
|
|
19
|
+
dependencies?: Record<string, string>;
|
|
20
|
+
devDependencies?: Record<string, string>;
|
|
20
21
|
frontend?: {
|
|
21
|
-
dependencies?: string
|
|
22
|
-
devDependencies?: string
|
|
22
|
+
dependencies?: Record<string, string>;
|
|
23
|
+
devDependencies?: Record<string, string>;
|
|
23
24
|
};
|
|
24
25
|
customUiDependencies?: string[];
|
|
25
26
|
customUiDevDependencies?: string[];
|
|
@@ -33,11 +34,11 @@ export interface ModuleTemplateMeta {
|
|
|
33
34
|
}>;
|
|
34
35
|
variants?: Record<UIFramework, {
|
|
35
36
|
manifestPath?: string;
|
|
36
|
-
dependencies?: Record<string, string
|
|
37
|
-
devDependencies?: Record<string, string
|
|
37
|
+
dependencies?: Record<string, string>;
|
|
38
|
+
devDependencies?: Record<string, string>;
|
|
38
39
|
frontend?: {
|
|
39
|
-
dependencies?: string
|
|
40
|
-
devDependencies?: string
|
|
40
|
+
dependencies?: Record<string, string>;
|
|
41
|
+
devDependencies?: Record<string, string>;
|
|
41
42
|
};
|
|
42
43
|
variables?: TemplateVariableDef[];
|
|
43
44
|
fileOperations?: Array<{
|
|
@@ -56,7 +57,9 @@ export declare class TemplateModuleServices {
|
|
|
56
57
|
getAvailableModules(product: string): Promise<ModuleTemplateMeta[]>;
|
|
57
58
|
private fetchModuleTemplates;
|
|
58
59
|
fetchManifestFragment(manifestPath: string): Promise<string>;
|
|
59
|
-
|
|
60
|
+
applyVariant(template: ModuleTemplateMeta, uiFramework?: UIFramework): ModuleTemplateMeta;
|
|
61
|
+
prepareModuleMetadata(template: ModuleTemplateMeta, uiFramework?: UIFramework): Promise<ModuleTemplateMeta>;
|
|
62
|
+
downloadModuleBundle(template: ModuleTemplateMeta, uiFramework?: UIFramework): Promise<void>;
|
|
60
63
|
cleanupCache(cacheDir: string): void;
|
|
61
64
|
}
|
|
62
65
|
//# 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":"
|
|
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,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzC,QAAQ,CAAC,EAAE;QACT,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACtC,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KAC1C,CAAC;IAEF,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAC;IAChC,uBAAuB,CAAC,EAAE,MAAM,EAAE,CAAC;IACnC,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,SAAS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AM,GAAG,OAAO,CAAC,MAAM,CAAC;IAYlE,YAAY,CAAC,QAAQ,EAAE,kBAAkB,EAAE,WAAW,CAAC,EAAE,WAAW,GAAG,kBAAkB;IAqBnF,qBAAqB,CAChC,QAAQ,EAAE,kBAAkB,EAC5B,WAAW,CAAC,EAAE,WAAW,GACxB,OAAO,CAAC,kBAAkB,CAAC;IAajB,oBAAoB,CAAC,QAAQ,EAAE,kBAAkB,EAAE,WAAW,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IA2ClG,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;CAO5C"}
|
|
@@ -7,6 +7,7 @@ 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"));
|
|
10
11
|
const text_1 = require("../ui/text");
|
|
11
12
|
const BIFROST_BASE_URL = 'https://forge-templates-bifrost.ddev.frontend.public.atl-paas.net/assets/';
|
|
12
13
|
const MODULE_INDEX_FILE = 'template-modules.json';
|
|
@@ -52,41 +53,77 @@ class TemplateModuleServices {
|
|
|
52
53
|
}
|
|
53
54
|
return await res.text();
|
|
54
55
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
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);
|
|
65
|
-
}
|
|
66
|
-
const cacheDir = fs_1.default.mkdtempSync(path_1.default.join(os_1.default.tmpdir(), 'forge-module-'));
|
|
67
|
-
if (manifestFragment) {
|
|
68
|
-
fs_1.default.writeFileSync(path_1.default.join(cacheDir, 'manifest-fragment.yml'), manifestFragment);
|
|
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));
|
|
69
62
|
}
|
|
70
63
|
return {
|
|
71
64
|
...template,
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
fileOperations: variantData.fileOperations ?? template.fileOperations
|
|
80
|
-
}
|
|
81
|
-
: {}),
|
|
82
|
-
cacheDir
|
|
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
|
|
83
72
|
};
|
|
84
73
|
}
|
|
74
|
+
async prepareModuleMetadata(template, uiFramework) {
|
|
75
|
+
const resolved = this.applyVariant(template, uiFramework);
|
|
76
|
+
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);
|
|
79
|
+
fs_1.default.writeFileSync(path_1.default.join(cacheDir, 'manifest-fragment.yml'), manifestFragment);
|
|
80
|
+
}
|
|
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
|
+
}
|
|
120
|
+
}
|
|
85
121
|
cleanupCache(cacheDir) {
|
|
86
122
|
try {
|
|
87
123
|
fs_1.default.rmSync(cacheDir, { recursive: true, force: true });
|
|
88
124
|
}
|
|
89
125
|
catch {
|
|
126
|
+
throw new Error(text_1.Text.module.add.errorCacheCleanupFailed(cacheDir));
|
|
90
127
|
}
|
|
91
128
|
}
|
|
92
129
|
}
|