@gooddata/create-pluggable-module 11.42.0-alpha.3 → 11.42.0-alpha.5
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/dist/templates/harness/package.json +1 -1
- package/dist/templates/module/package.json +1 -1
- package/esm/engine/__tests__/snapshot.test.js +1 -0
- package/esm/engine/prompts.d.ts.map +1 -1
- package/esm/engine/prompts.js +6 -1
- package/esm/profiles/__tests__/client.test.js +23 -3
- package/esm/profiles/client.d.ts.map +1 -1
- package/esm/profiles/client.js +4 -0
- package/esm/types.d.ts +6 -4
- package/esm/types.d.ts.map +1 -1
- package/package.json +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../src/engine/prompts.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAoB,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AA+DzF;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAK9D;AA+CD;;;GAGG;AACH,wBAAsB,UAAU,CAAC,YAAY,EAAE,SAAS,iBAAiB,EAAE,GAAG,OAAO,CAAC,gBAAgB,CAAC,
|
|
1
|
+
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../src/engine/prompts.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAoB,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AA+DzF;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAK9D;AA+CD;;;GAGG;AACH,wBAAsB,UAAU,CAAC,YAAY,EAAE,SAAS,iBAAiB,EAAE,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAoCtG"}
|
package/esm/engine/prompts.js
CHANGED
|
@@ -126,7 +126,12 @@ export async function runPrompts(extraPrompts) {
|
|
|
126
126
|
return validateTextValue(v);
|
|
127
127
|
});
|
|
128
128
|
const scope = await askScope(reader);
|
|
129
|
-
const
|
|
129
|
+
const maintainer = await askUntilValid(reader, "Maintainer (preferably email, but could be a person or team name)", (v) => {
|
|
130
|
+
if (!v)
|
|
131
|
+
return "Maintainer is required.";
|
|
132
|
+
return validateTextValue(v);
|
|
133
|
+
});
|
|
134
|
+
const answers = { appName, title, scope, maintainer };
|
|
130
135
|
for (const prompt of extraPrompts) {
|
|
131
136
|
const value = await askExtra(reader, prompt);
|
|
132
137
|
if (value !== undefined) {
|
|
@@ -3,7 +3,7 @@ import { describe, expect, it } from "vitest";
|
|
|
3
3
|
import { clientProfile } from "../client.js";
|
|
4
4
|
function mockCtx(overrides = {}) {
|
|
5
5
|
return {
|
|
6
|
-
answers: { appName: "gdc-mock", title: "Mock", scope: "workspace" },
|
|
6
|
+
answers: { appName: "gdc-mock", title: "Mock", scope: "workspace", maintainer: "team@gooddata.com" },
|
|
7
7
|
derived: {
|
|
8
8
|
route: "/mock",
|
|
9
9
|
federationName: "gdc_mock",
|
|
@@ -59,11 +59,17 @@ describe("clientProfile", () => {
|
|
|
59
59
|
});
|
|
60
60
|
describe("resolveDestRoot", () => {
|
|
61
61
|
it("uses modules/<appName> when destPath is not overridden", () => {
|
|
62
|
-
const destRoot = clientProfile.resolveDestRoot({ appName: "gdc-x", title: "X", scope: "workspace" }, "/fake/repo");
|
|
62
|
+
const destRoot = clientProfile.resolveDestRoot({ appName: "gdc-x", title: "X", scope: "workspace", maintainer: "team@gooddata.com" }, "/fake/repo");
|
|
63
63
|
expect(destRoot).toBe("/fake/repo/modules/gdc-x");
|
|
64
64
|
});
|
|
65
65
|
it("accepts an in-cwd destPath override", () => {
|
|
66
|
-
const destRoot = clientProfile.resolveDestRoot({
|
|
66
|
+
const destRoot = clientProfile.resolveDestRoot({
|
|
67
|
+
appName: "gdc-x",
|
|
68
|
+
title: "X",
|
|
69
|
+
scope: "workspace",
|
|
70
|
+
maintainer: "team@gooddata.com",
|
|
71
|
+
destPath: "apps/gdc-x",
|
|
72
|
+
}, "/fake/repo");
|
|
67
73
|
expect(destRoot).toBe("/fake/repo/apps/gdc-x");
|
|
68
74
|
});
|
|
69
75
|
it("rejects path-traversal destPath that resolves outside cwd", () => {
|
|
@@ -71,6 +77,7 @@ describe("clientProfile", () => {
|
|
|
71
77
|
appName: "gdc-x",
|
|
72
78
|
title: "X",
|
|
73
79
|
scope: "workspace",
|
|
80
|
+
maintainer: "team@gooddata.com",
|
|
74
81
|
destPath: "../../../etc",
|
|
75
82
|
}, "/fake/repo")).toThrow(/resolves outside the current directory/);
|
|
76
83
|
});
|
|
@@ -79,6 +86,7 @@ describe("clientProfile", () => {
|
|
|
79
86
|
appName: "gdc-x",
|
|
80
87
|
title: "X",
|
|
81
88
|
scope: "workspace",
|
|
89
|
+
maintainer: "team@gooddata.com",
|
|
82
90
|
destPath: "/somewhere/else",
|
|
83
91
|
}, "/fake/repo")).toThrow(/resolves outside the current directory/);
|
|
84
92
|
});
|
|
@@ -87,6 +95,7 @@ describe("clientProfile", () => {
|
|
|
87
95
|
appName: "gdc-x",
|
|
88
96
|
title: "X",
|
|
89
97
|
scope: "workspace",
|
|
98
|
+
maintainer: "team@gooddata.com",
|
|
90
99
|
destPath: "../repo-other/sub",
|
|
91
100
|
}, "/fake/repo")).toThrow(/resolves outside the current directory/);
|
|
92
101
|
});
|
|
@@ -147,5 +156,16 @@ describe("clientProfile", () => {
|
|
|
147
156
|
expect(scripts.build).toBe("tsc");
|
|
148
157
|
expect(scripts.test).toBe("vitest");
|
|
149
158
|
});
|
|
159
|
+
it("records the entered maintainer as the package author (so the prompt isn't discarded)", () => {
|
|
160
|
+
const after = clientProfile.transformPackageJson({ author: "{applicationTemplateTitle} template author" }, mockCtx({
|
|
161
|
+
answers: {
|
|
162
|
+
appName: "gdc-mock",
|
|
163
|
+
title: "Mock",
|
|
164
|
+
scope: "workspace",
|
|
165
|
+
maintainer: "owner@gooddata.com",
|
|
166
|
+
},
|
|
167
|
+
}));
|
|
168
|
+
expect(after["author"]).toBe("owner@gooddata.com");
|
|
169
|
+
});
|
|
150
170
|
});
|
|
151
171
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/profiles/client.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAMR,gBAAgB,EAEnB,MAAM,aAAa,CAAC;AA+CrB,eAAO,MAAM,aAAa,EAAE,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/profiles/client.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAMR,gBAAgB,EAEnB,MAAM,aAAa,CAAC;AA+CrB,eAAO,MAAM,aAAa,EAAE,gBAuI3B,CAAC"}
|
package/esm/profiles/client.js
CHANGED
|
@@ -118,6 +118,10 @@ export const clientProfile = {
|
|
|
118
118
|
`${ctx.answers.appName}-harness`,
|
|
119
119
|
]);
|
|
120
120
|
const out = { ...pkg };
|
|
121
|
+
// Record the maintainer the user entered as the package owner. Without this
|
|
122
|
+
// the required maintainer prompt would be collected and silently discarded,
|
|
123
|
+
// leaving the scaffolded client metadata stuck with the template's author.
|
|
124
|
+
out.author = ctx.answers.maintainer;
|
|
121
125
|
out.dependencies = rewriteWorkspaceDeps(pkg.dependencies, version, siblings);
|
|
122
126
|
out.devDependencies = rewriteWorkspaceDeps(pkg.devDependencies, version, siblings);
|
|
123
127
|
out.peerDependencies = rewriteWorkspaceDeps(pkg.peerDependencies, version, siblings);
|
package/esm/types.d.ts
CHANGED
|
@@ -26,9 +26,9 @@ export interface IRepoInfo {
|
|
|
26
26
|
packageManager: PackageManager;
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
29
|
-
* Answers populated by the engine via the shared prompts (appName, title, scope
|
|
30
|
-
* Profile-specific extra prompts (e.g. `
|
|
31
|
-
*
|
|
29
|
+
* Answers populated by the engine via the shared prompts (appName, title, scope,
|
|
30
|
+
* maintainer). Profile-specific extra prompts (e.g. `destPath` for client) write
|
|
31
|
+
* into the same object under their declared `key`.
|
|
32
32
|
*
|
|
33
33
|
* The index signature is intentional — profiles narrow with a local cast in
|
|
34
34
|
* their callbacks since they know which extras they registered. Trying to make
|
|
@@ -39,6 +39,8 @@ export interface IScaffoldAnswers {
|
|
|
39
39
|
appName: string;
|
|
40
40
|
title: string;
|
|
41
41
|
scope: ApplicationScope;
|
|
42
|
+
/** Owner contact for the new app — required for every profile. Preferably an email. */
|
|
43
|
+
maintainer: string;
|
|
42
44
|
[extraKey: string]: string | undefined;
|
|
43
45
|
}
|
|
44
46
|
export interface IPromptDescriptor {
|
|
@@ -128,7 +130,7 @@ export interface IOverlayPath {
|
|
|
128
130
|
}
|
|
129
131
|
export interface IScaffoldProfile {
|
|
130
132
|
readonly name: ProfileName;
|
|
131
|
-
/** Prompts displayed after the shared appName/title/scope prompts, in array order. */
|
|
133
|
+
/** Prompts displayed after the shared appName/title/scope/maintainer prompts, in array order. */
|
|
132
134
|
readonly extraPrompts: readonly IPromptDescriptor[];
|
|
133
135
|
/** Resolves where the scaffolded files will land. Receives raw cwd, not repoRoot. */
|
|
134
136
|
resolveDestRoot(answers: IScaffoldAnswers, cwd: string): string;
|
package/esm/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AAEH,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,UAAU,CAAC;AAEhD,MAAM,MAAM,gBAAgB,GAAG,WAAW,GAAG,cAAc,CAAC;AAE5D,MAAM,MAAM,cAAc,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;AAE9D;;;;;;;GAOG;AACH,MAAM,WAAW,SAAS;IACtB,iDAAiD;IACjD,QAAQ,EAAE,MAAM,CAAC;IACjB,oDAAkD;IAClD,cAAc,EAAE,cAAc,CAAC;CAClC;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
+
"version": "11.42.0-alpha.5",
|
|
4
4
|
"description": "Scaffolder for GoodData pluggable applications. Invoked via `npm init @gooddata/pluggable-module`.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "GoodData Corporation",
|
|
@@ -50,10 +50,10 @@
|
|
|
50
50
|
"typescript": "5.9.3",
|
|
51
51
|
"vite": "8.0.16",
|
|
52
52
|
"vitest": "4.1.8",
|
|
53
|
-
"@gooddata/
|
|
54
|
-
"@gooddata/
|
|
55
|
-
"gdc-app-template-name-
|
|
56
|
-
"gdc-app-template-name-
|
|
53
|
+
"@gooddata/oxlint-config": "11.42.0-alpha.5",
|
|
54
|
+
"@gooddata/eslint-config": "11.42.0-alpha.5",
|
|
55
|
+
"gdc-app-template-name-module": "11.42.0-alpha.5",
|
|
56
|
+
"gdc-app-template-name-harness": "11.42.0-alpha.5"
|
|
57
57
|
},
|
|
58
58
|
"engines": {
|
|
59
59
|
"node": ">=24.12.0"
|