@forgecart/cli 2.202610021510.0 → 2.202610021701.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/dist/src/commands/__test__/cli-harness.d.ts +16 -1
- package/dist/src/commands/__test__/cli-harness.js +19 -1
- package/dist/src/commands/__test__/cli-harness.js.map +1 -1
- package/dist/src/commands/init-questions.d.ts +47 -0
- package/dist/src/commands/init-questions.js +128 -0
- package/dist/src/commands/init-questions.js.map +1 -0
- package/dist/src/commands/init.d.ts +22 -17
- package/dist/src/commands/init.js +103 -49
- package/dist/src/commands/init.js.map +1 -1
- package/dist/src/commands/refresh.d.ts +9 -8
- package/dist/src/commands/refresh.js +5 -3
- package/dist/src/commands/refresh.js.map +1 -1
- package/dist/src/commands/template-manifest.d.ts +25 -5
- package/dist/src/commands/template-manifest.js +28 -5
- package/dist/src/commands/template-manifest.js.map +1 -1
- package/dist/src/commands/type/init.input.d.ts +16 -0
- package/dist/src/commands/type/init.input.js +2 -0
- package/dist/src/commands/type/init.input.js.map +1 -0
- package/dist/src/commands/type/init.types.d.ts +14 -0
- package/dist/src/commands/type/init.types.js +2 -0
- package/dist/src/commands/type/init.types.js.map +1 -0
- package/dist/src/question/util/question-id.util.d.ts +8 -0
- package/dist/src/question/util/question-id.util.js +36 -0
- package/dist/src/question/util/question-id.util.js.map +1 -0
- package/dist/src/template/template-set.d.ts +34 -0
- package/dist/src/template/template-set.js +63 -0
- package/dist/src/template/template-set.js.map +1 -0
- package/dist/src/template/template-unavailable-error.d.ts +17 -0
- package/dist/src/template/template-unavailable-error.js +31 -0
- package/dist/src/template/template-unavailable-error.js.map +1 -0
- package/dist/src/template/type/template-set.types.d.ts +47 -0
- package/dist/src/template/type/template-set.types.js +3 -0
- package/dist/src/template/type/template-set.types.js.map +1 -0
- package/package.json +1 -1
- package/templates/template-set.json +23 -0
|
@@ -18,4 +18,19 @@ export interface CliRun {
|
|
|
18
18
|
/** stdout alone, for `--json` report parsing. */
|
|
19
19
|
stdout: string;
|
|
20
20
|
}
|
|
21
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Run the built CLI with `args` exactly as typed: the run a spec makes when
|
|
23
|
+
* the questions a command asks are its subject.
|
|
24
|
+
*/
|
|
25
|
+
export declare function runCliAsTyped(args: readonly string[], cwd: string, envOverrides?: Record<string, string>): CliRun;
|
|
26
|
+
/**
|
|
27
|
+
* Run the built CLI as a scripted caller without a terminal runs it. `init`
|
|
28
|
+
* asks its questions once the credentials are given (#2774) — the UI
|
|
29
|
+
* framework, the example or a blank storefront, and an example's catalog —
|
|
30
|
+
* and a run without a terminal must answer them or exit 2, so every `init`
|
|
31
|
+
* run here also passes `--yes`: each question the run leaves open takes its
|
|
32
|
+
* declared default (the first framework, the example, no catalog), the
|
|
33
|
+
* storefront every scaffold rendered before the questions existed. An answer
|
|
34
|
+
* the run gives itself still wins over the default.
|
|
35
|
+
*/
|
|
36
|
+
export declare function runCli(args: readonly string[], cwd: string, envOverrides?: Record<string, string>): CliRun;
|
|
@@ -13,7 +13,11 @@ import { resolve } from 'node:path';
|
|
|
13
13
|
export const CLI = resolve(__dirname, '..', '..', '..', 'dist', 'bin', 'forgecart.js');
|
|
14
14
|
/** The bundled storefront template the built CLI scaffolds from. */
|
|
15
15
|
export const TEMPLATE_SRC = resolve(__dirname, '..', '..', '..', 'templates', 'storefront');
|
|
16
|
-
|
|
16
|
+
/**
|
|
17
|
+
* Run the built CLI with `args` exactly as typed: the run a spec makes when
|
|
18
|
+
* the questions a command asks are its subject.
|
|
19
|
+
*/
|
|
20
|
+
export function runCliAsTyped(args, cwd, envOverrides = {}) {
|
|
17
21
|
// Hermetic by default: a WORKSPACE_TEMPLATE_DIR exported in the developer's
|
|
18
22
|
// shell must not flip the cold-path tests into the warmed path.
|
|
19
23
|
const env = { ...process.env };
|
|
@@ -26,4 +30,18 @@ export function runCli(args, cwd, envOverrides = {}) {
|
|
|
26
30
|
stdout: result.stdout ?? '',
|
|
27
31
|
};
|
|
28
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* Run the built CLI as a scripted caller without a terminal runs it. `init`
|
|
35
|
+
* asks its questions once the credentials are given (#2774) — the UI
|
|
36
|
+
* framework, the example or a blank storefront, and an example's catalog —
|
|
37
|
+
* and a run without a terminal must answer them or exit 2, so every `init`
|
|
38
|
+
* run here also passes `--yes`: each question the run leaves open takes its
|
|
39
|
+
* declared default (the first framework, the example, no catalog), the
|
|
40
|
+
* storefront every scaffold rendered before the questions existed. An answer
|
|
41
|
+
* the run gives itself still wins over the default.
|
|
42
|
+
*/
|
|
43
|
+
export function runCli(args, cwd, envOverrides = {}) {
|
|
44
|
+
const answered = args[0] === 'init' ? [...args, '--yes'] : args;
|
|
45
|
+
return runCliAsTyped(answered, cwd, envOverrides);
|
|
46
|
+
}
|
|
29
47
|
//# sourceMappingURL=cli-harness.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-harness.js","sourceRoot":"","sources":["../../../../src/commands/__test__/cli-harness.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,GAAG,GAAG,OAAO,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,CAAC,CAAC;AAEvF,oEAAoE;AACpE,MAAM,CAAC,MAAM,YAAY,GAAG,OAAO,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,YAAY,CAAC,CAAC;AAU5F,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"cli-harness.js","sourceRoot":"","sources":["../../../../src/commands/__test__/cli-harness.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,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;IAChE,OAAO,aAAa,CAAC,QAAQ,EAAE,GAAG,EAAE,YAAY,CAAC,CAAC;AACpD,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { QuestionPrompt } from '../question/type/question-prompt.types.js';
|
|
2
|
+
import type { TemplateSet } from '../template/template-set.js';
|
|
3
|
+
import type { InitQuestionsInput } from './type/init.input.js';
|
|
4
|
+
import type { SettledScaffold } from './type/init.types.js';
|
|
5
|
+
/**
|
|
6
|
+
* `forgecart init`'s questions (#2774), asked once the credentials are given:
|
|
7
|
+
* the UI framework (`ui-framework`), an example or a blank storefront
|
|
8
|
+
* (`example`) and — for an example only — a demo catalog (`catalog`). Each
|
|
9
|
+
* declares its default: the release's first framework, its first example, no
|
|
10
|
+
* catalog. `--ui`, `--example` and `--catalog` / `--no-catalog` answer on the
|
|
11
|
+
* command line; a question they leave open goes to the ONE question adapter
|
|
12
|
+
* (#2771) — `--answer`, `--answers-file`, `--yes`, a terminal prompt, or exit 2
|
|
13
|
+
* naming it. Every asking mints fresh question ids.
|
|
14
|
+
*/
|
|
15
|
+
export declare class InitQuestions {
|
|
16
|
+
private readonly templateSet;
|
|
17
|
+
private readonly flags;
|
|
18
|
+
private readonly prompt;
|
|
19
|
+
/**
|
|
20
|
+
* @param templateSet the release's template set: the options, and the template the answers pick.
|
|
21
|
+
* @param flags the run's own answers.
|
|
22
|
+
* @param prompt the question adapter every open question goes to.
|
|
23
|
+
*/
|
|
24
|
+
constructor(templateSet: TemplateSet, flags: InitQuestionsInput, prompt: QuestionPrompt);
|
|
25
|
+
/**
|
|
26
|
+
* Ask, in order, and settle the template the answers pick: an identity the
|
|
27
|
+
* release renders no template for is refused before the catalog question,
|
|
28
|
+
* and the catalog question is asked for an example only.
|
|
29
|
+
*/
|
|
30
|
+
ask(): Promise<SettledScaffold>;
|
|
31
|
+
/** The UI framework and the example: what the flags leave open is asked in one go. */
|
|
32
|
+
private askIdentity;
|
|
33
|
+
/** The demo catalog: none for a blank storefront, else the flag's answer or the question's. */
|
|
34
|
+
private askCatalog;
|
|
35
|
+
/** The adapter's answers to `questions` — nothing asked when the flags answered them all. */
|
|
36
|
+
private askOpen;
|
|
37
|
+
/** `ui-framework`: the UI frameworks the release ships, in its order. */
|
|
38
|
+
private uiFrameworkQuestion;
|
|
39
|
+
/** `example`: the examples the release ships, in its order, then blank. */
|
|
40
|
+
private exampleQuestion;
|
|
41
|
+
/** `catalog`: whether a demo catalog comes with the example. */
|
|
42
|
+
private catalogQuestion;
|
|
43
|
+
/** A single choice under a fresh id, whose first option is its default. */
|
|
44
|
+
private static choice;
|
|
45
|
+
/** The option a single choice was answered with. */
|
|
46
|
+
private static chosen;
|
|
47
|
+
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { mintQuestionId } from '../question/util/question-id.util.js';
|
|
2
|
+
import { BLANK_EXAMPLE } from '../template/type/template-set.types.js';
|
|
3
|
+
/**
|
|
4
|
+
* The stable keys init's questions answer to on every run — what `--answer
|
|
5
|
+
* <key>=…` and an `--answers-file` name.
|
|
6
|
+
*/
|
|
7
|
+
var InitQuestionKey;
|
|
8
|
+
(function (InitQuestionKey) {
|
|
9
|
+
InitQuestionKey["uiFramework"] = "ui-framework";
|
|
10
|
+
InitQuestionKey["example"] = "example";
|
|
11
|
+
InitQuestionKey["catalog"] = "catalog";
|
|
12
|
+
})(InitQuestionKey || (InitQuestionKey = {}));
|
|
13
|
+
/** The `catalog` option that adds a demo catalog to the example. */
|
|
14
|
+
const DEMO_CATALOG = 'yes';
|
|
15
|
+
/** The `catalog` option that adds none — the question's default. */
|
|
16
|
+
const NO_CATALOG = 'no';
|
|
17
|
+
/** The `example` question's last option: a storefront that starts from no example. */
|
|
18
|
+
const BLANK_OPTION = {
|
|
19
|
+
id: BLANK_EXAMPLE,
|
|
20
|
+
label: 'Blank',
|
|
21
|
+
hint: 'An empty storefront, with no example pages.',
|
|
22
|
+
};
|
|
23
|
+
/** The `catalog` question's options, its default first. */
|
|
24
|
+
const CATALOG_OPTIONS = [
|
|
25
|
+
{ id: NO_CATALOG, label: 'No', hint: 'The example shows the channel’s own products.' },
|
|
26
|
+
{ id: DEMO_CATALOG, label: 'Yes', hint: 'Demo products and collections for the example.' },
|
|
27
|
+
];
|
|
28
|
+
/**
|
|
29
|
+
* `forgecart init`'s questions (#2774), asked once the credentials are given:
|
|
30
|
+
* the UI framework (`ui-framework`), an example or a blank storefront
|
|
31
|
+
* (`example`) and — for an example only — a demo catalog (`catalog`). Each
|
|
32
|
+
* declares its default: the release's first framework, its first example, no
|
|
33
|
+
* catalog. `--ui`, `--example` and `--catalog` / `--no-catalog` answer on the
|
|
34
|
+
* command line; a question they leave open goes to the ONE question adapter
|
|
35
|
+
* (#2771) — `--answer`, `--answers-file`, `--yes`, a terminal prompt, or exit 2
|
|
36
|
+
* naming it. Every asking mints fresh question ids.
|
|
37
|
+
*/
|
|
38
|
+
export class InitQuestions {
|
|
39
|
+
templateSet;
|
|
40
|
+
flags;
|
|
41
|
+
prompt;
|
|
42
|
+
/**
|
|
43
|
+
* @param templateSet the release's template set: the options, and the template the answers pick.
|
|
44
|
+
* @param flags the run's own answers.
|
|
45
|
+
* @param prompt the question adapter every open question goes to.
|
|
46
|
+
*/
|
|
47
|
+
constructor(templateSet, flags, prompt) {
|
|
48
|
+
this.templateSet = templateSet;
|
|
49
|
+
this.flags = flags;
|
|
50
|
+
this.prompt = prompt;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Ask, in order, and settle the template the answers pick: an identity the
|
|
54
|
+
* release renders no template for is refused before the catalog question,
|
|
55
|
+
* and the catalog question is asked for an example only.
|
|
56
|
+
*/
|
|
57
|
+
async ask() {
|
|
58
|
+
const identity = await this.askIdentity();
|
|
59
|
+
const templateDir = this.templateSet.templateDir(identity);
|
|
60
|
+
const catalog = await this.askCatalog(identity);
|
|
61
|
+
return { answers: { ...identity, catalog }, templateDir };
|
|
62
|
+
}
|
|
63
|
+
/** The UI framework and the example: what the flags leave open is asked in one go. */
|
|
64
|
+
async askIdentity() {
|
|
65
|
+
const uiFramework = this.uiFrameworkQuestion();
|
|
66
|
+
const example = this.exampleQuestion();
|
|
67
|
+
const answers = await this.askOpen([
|
|
68
|
+
...(this.flags.ui === undefined ? [uiFramework] : []),
|
|
69
|
+
...(this.flags.example === undefined ? [example] : []),
|
|
70
|
+
]);
|
|
71
|
+
return {
|
|
72
|
+
uiFramework: this.flags.ui ?? InitQuestions.chosen(answers, uiFramework),
|
|
73
|
+
example: this.flags.example ?? InitQuestions.chosen(answers, example),
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
/** The demo catalog: none for a blank storefront, else the flag's answer or the question's. */
|
|
77
|
+
async askCatalog(identity) {
|
|
78
|
+
if (identity.example === BLANK_EXAMPLE)
|
|
79
|
+
return false;
|
|
80
|
+
if (this.flags.catalog !== undefined)
|
|
81
|
+
return this.flags.catalog;
|
|
82
|
+
const catalog = this.catalogQuestion();
|
|
83
|
+
const answers = await this.prompt.ask([catalog]);
|
|
84
|
+
return InitQuestions.chosen(answers, catalog) === DEMO_CATALOG;
|
|
85
|
+
}
|
|
86
|
+
/** The adapter's answers to `questions` — nothing asked when the flags answered them all. */
|
|
87
|
+
async askOpen(questions) {
|
|
88
|
+
if (questions.length === 0)
|
|
89
|
+
return [];
|
|
90
|
+
return this.prompt.ask(questions);
|
|
91
|
+
}
|
|
92
|
+
/** `ui-framework`: the UI frameworks the release ships, in its order. */
|
|
93
|
+
uiFrameworkQuestion() {
|
|
94
|
+
return InitQuestions.choice(InitQuestionKey.uiFramework, 'Which UI framework?', this.templateSet.uiFrameworks);
|
|
95
|
+
}
|
|
96
|
+
/** `example`: the examples the release ships, in its order, then blank. */
|
|
97
|
+
exampleQuestion() {
|
|
98
|
+
return InitQuestions.choice(InitQuestionKey.example, 'Start from an example, or blank?', [
|
|
99
|
+
...this.templateSet.examples,
|
|
100
|
+
BLANK_OPTION,
|
|
101
|
+
]);
|
|
102
|
+
}
|
|
103
|
+
/** `catalog`: whether a demo catalog comes with the example. */
|
|
104
|
+
catalogQuestion() {
|
|
105
|
+
return InitQuestions.choice(InitQuestionKey.catalog, 'Also create a demo catalog?', CATALOG_OPTIONS);
|
|
106
|
+
}
|
|
107
|
+
/** A single choice under a fresh id, whose first option is its default. */
|
|
108
|
+
static choice(key, question, options) {
|
|
109
|
+
return {
|
|
110
|
+
id: mintQuestionId(),
|
|
111
|
+
key,
|
|
112
|
+
question,
|
|
113
|
+
kind: 'choice',
|
|
114
|
+
options,
|
|
115
|
+
allowMultiple: false,
|
|
116
|
+
defaultOptionId: options.at(0)?.id,
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
/** The option a single choice was answered with. */
|
|
120
|
+
static chosen(answers, question) {
|
|
121
|
+
const optionId = answers.find((answer) => answer.questionId === question.id)?.optionIds?.at(0);
|
|
122
|
+
if (optionId === undefined) {
|
|
123
|
+
throw new Error(`Question ${question.id} "${question.question}" was answered with no option.`);
|
|
124
|
+
}
|
|
125
|
+
return optionId;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
//# sourceMappingURL=init-questions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init-questions.js","sourceRoot":"","sources":["../../../src/commands/init-questions.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AAEtE,OAAO,EAAE,aAAa,EAAyB,MAAM,wCAAwC,CAAC;AAK9F;;;GAGG;AACH,IAAK,eAIJ;AAJD,WAAK,eAAe;IAClB,+CAA4B,CAAA;IAC5B,sCAAmB,CAAA;IACnB,sCAAmB,CAAA;AACrB,CAAC,EAJI,eAAe,KAAf,eAAe,QAInB;AAED,oEAAoE;AACpE,MAAM,YAAY,GAAG,KAAK,CAAC;AAE3B,oEAAoE;AACpE,MAAM,UAAU,GAAG,IAAI,CAAC;AAExB,sFAAsF;AACtF,MAAM,YAAY,GAAsB;IACtC,EAAE,EAAE,aAAa;IACjB,K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AAC,OAAO,EAAE,kCAAkC,EAAE;YACvF,GAAG,IAAI,CAAC,WAAW,CAAC,QAAQ;YAC5B,YAAY;SACb,CAAC,CAAC;IACL,CAAC;IAED,gEAAgE;IACxD,eAAe;QACrB,OAAO,aAAa,CAAC,MAAM,CACzB,eAAe,CAAC,OAAO,EACvB,6BAA6B,EAC7B,eAAe,CAChB,CAAC;IACJ,CAAC;IAED,2EAA2E;IACnE,MAAM,CAAC,MAAM,CACnB,GAAoB,EACpB,QAAgB,EAChB,OAAqC;QAErC,OAAO;YACL,EAAE,EAAE,cAAc,EAAE;YACpB,GAAG;YACH,QAAQ;YACR,IAAI,EAAE,QAAQ;YACd,OAAO;YACP,aAAa,EAAE,KAAK;YACpB,eAAe,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE;SACnC,CAAC;IACJ,CAAC;IAED,oDAAoD;IAC5C,MAAM,CAAC,MAAM,CAAC,OAAwC,EAAE,QAAqB;QACnF,MAAM,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,UAAU,KAAK,QAAQ,CAAC,EAAE,CAAC,EAAE,SAAS,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;QAC/F,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;YAC3B,MAAM,IAAI,KAAK,CAAC,YAAY,QAAQ,CAAC,EAAE,KAAK,QAAQ,CAAC,QAAQ,gCAAgC,CAAC,CAAC;QACjG,CAAC;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
2
|
import type { QuestionPromptInput } from '../question/type/question-prompt.input.js';
|
|
3
|
+
import { TemplateSet } from '../template/template-set.js';
|
|
4
|
+
import type { InitQuestionsInput } from './type/init.input.js';
|
|
3
5
|
/**
|
|
4
6
|
* Default shop API base, INCLUDING the mounted path. The API serves the shop
|
|
5
7
|
* GraphQL endpoint at `/shop-api` (`app/forgecart/src/main.ts`), and the SDK
|
|
@@ -28,10 +30,10 @@ export declare const WORKSPACE_TEMPLATE_DIR_ENV = "WORKSPACE_TEMPLATE_DIR";
|
|
|
28
30
|
*/
|
|
29
31
|
export declare const DEPS_READY_MARKER_PATH = ".forgecart/deps-ready.json";
|
|
30
32
|
/**
|
|
31
|
-
* Resolved options for `forgecart init`: its own,
|
|
32
|
-
* questioning command shares (#2771).
|
|
33
|
+
* Resolved options for `forgecart init`: its own, its answers to its questions
|
|
34
|
+
* (#2774), and the three flags every questioning command shares (#2771).
|
|
33
35
|
*/
|
|
34
|
-
export interface InitOptions extends QuestionPromptInput {
|
|
36
|
+
export interface InitOptions extends QuestionPromptInput, InitQuestionsInput {
|
|
35
37
|
/** Channel token (required). */
|
|
36
38
|
token?: string;
|
|
37
39
|
/**
|
|
@@ -70,26 +72,29 @@ export interface InitOptions extends QuestionPromptInput {
|
|
|
70
72
|
* dependency- and dev-compile-warmed storefront (materialized into the pod's
|
|
71
73
|
* `/workspace` from the image's pre-warmed tree). Write ONLY the per-channel
|
|
72
74
|
* config + `.env` and skip the template copy entirely — copying would
|
|
73
|
-
* clobber the warm `.next` and bust the Turbopack dev cache.
|
|
75
|
+
* clobber the warm `.next` and bust the Turbopack dev cache. Nothing is
|
|
76
|
+
* asked: the tree already has its template identity.
|
|
74
77
|
*/
|
|
75
78
|
configOnly?: boolean;
|
|
76
79
|
}
|
|
77
80
|
/**
|
|
78
|
-
*
|
|
81
|
+
* Run `forgecart init`: the credentials, then the questions, then the scaffold
|
|
82
|
+
* (#2774).
|
|
79
83
|
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
|
|
83
|
-
export declare function getStorefrontTemplateDir(): string;
|
|
84
|
-
/**
|
|
85
|
-
* Run `forgecart init`.
|
|
86
|
-
*
|
|
87
|
-
* Resolves the target directory, scaffolds the storefront from the warmed
|
|
84
|
+
* Resolves the channel token and the target directory, asks init's questions
|
|
85
|
+
* ({@link InitQuestions}) — refusing, before any file is written, a template
|
|
86
|
+
* the release does not render — scaffolds the storefront from the warmed
|
|
88
87
|
* template when one is available (see {@link resolveScaffoldPlan}) or the
|
|
89
|
-
*
|
|
88
|
+
* template the answers picked otherwise, writes the ForgeCart config with the
|
|
89
|
+
* answers and `.env`, inventories the render under its template identity, and
|
|
90
90
|
* prints next steps. Throws a clear Error on any failure (missing token,
|
|
91
|
-
* missing template, copy failure)
|
|
91
|
+
* unrendered template, missing template, copy failure); an unanswered question
|
|
92
|
+
* exits 2 through the question adapter's refusal.
|
|
93
|
+
*/
|
|
94
|
+
export declare function runInit(name: string | undefined, options: InitOptions, templateSet: TemplateSet): Promise<void>;
|
|
95
|
+
/**
|
|
96
|
+
* Build the `init [name]` command: its own flags, its answers to its questions
|
|
97
|
+
* (#2774) — validated against the release's template set, whose frameworks and
|
|
98
|
+
* examples `--help` lists — and the question adapter's three flags.
|
|
92
99
|
*/
|
|
93
|
-
export declare function runInit(name: string | undefined, options: InitOptions): Promise<void>;
|
|
94
|
-
/** Build the `init [name]` command, carrying the question adapter's three flags. */
|
|
95
100
|
export declare function createInitCommand(): Command;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { mkdir, cp, readFile, rm, writeFile, stat } from 'node:fs/promises';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { Command } from 'commander';
|
|
2
|
+
import { join, resolve } from 'node:path';
|
|
3
|
+
import { Command, Option } from 'commander';
|
|
5
4
|
import { print } from '../output.js';
|
|
6
5
|
import { QuestionPromptAdapter } from '../question/question-prompt.adapter.js';
|
|
6
|
+
import { TemplateSet } from '../template/template-set.js';
|
|
7
7
|
import { readPackageVersion } from '../version.js';
|
|
8
|
+
import { InitQuestions } from './init-questions.js';
|
|
8
9
|
import { readTemplateManifest, writeTemplateManifest } from './template-manifest.js';
|
|
9
10
|
/**
|
|
10
11
|
* Default shop API base, INCLUDING the mounted path. The API serves the shop
|
|
@@ -33,16 +34,8 @@ export const WORKSPACE_TEMPLATE_DIR_ENV = 'WORKSPACE_TEMPLATE_DIR';
|
|
|
33
34
|
* regular install, so older images and cold scaffolds keep working unchanged.
|
|
34
35
|
*/
|
|
35
36
|
export const DEPS_READY_MARKER_PATH = '.forgecart/deps-ready.json';
|
|
36
|
-
/**
|
|
37
|
-
|
|
38
|
-
*
|
|
39
|
-
* At runtime this file lives at `<pkg>/dist/src/commands/init.js`, so the
|
|
40
|
-
* `templates/` directory shipped alongside `dist/` is three levels up.
|
|
41
|
-
*/
|
|
42
|
-
export function getStorefrontTemplateDir() {
|
|
43
|
-
const here = dirname(fileURLToPath(import.meta.url));
|
|
44
|
-
return resolve(here, '..', '..', '..', 'templates', 'storefront');
|
|
45
|
-
}
|
|
37
|
+
/** The committable scaffold metadata, relative to the storefront root. */
|
|
38
|
+
const CONFIG_RELPATH = '.forgecart/config.json';
|
|
46
39
|
/** True if the path exists and is a directory. */
|
|
47
40
|
async function isDirectory(path) {
|
|
48
41
|
try {
|
|
@@ -124,17 +117,51 @@ async function writeDepsReadyMarker(targetDir, plan) {
|
|
|
124
117
|
};
|
|
125
118
|
await writeFile(markerPath, `${JSON.stringify(marker, null, 2)}\n`, 'utf8');
|
|
126
119
|
}
|
|
127
|
-
/**
|
|
128
|
-
|
|
120
|
+
/**
|
|
121
|
+
* Build the `.forgecart/config.json` payload, with the scaffold record and the
|
|
122
|
+
* mirrored design-system seat, each when there is one.
|
|
123
|
+
*/
|
|
124
|
+
function buildConfig(channelToken, options, scaffold, designSystem) {
|
|
129
125
|
return {
|
|
130
126
|
version: '2.0',
|
|
131
127
|
channelToken,
|
|
132
128
|
apiUrl: options.apiUrl,
|
|
133
129
|
hasApplication: options.application ?? false,
|
|
134
130
|
storefrontPath: '.',
|
|
131
|
+
scaffold,
|
|
135
132
|
designSystem,
|
|
136
133
|
};
|
|
137
134
|
}
|
|
135
|
+
/**
|
|
136
|
+
* The scaffold record an existing tree's `.forgecart/config.json` carries, so
|
|
137
|
+
* the `--config-only` rewrite keeps the answers that tree was scaffolded with.
|
|
138
|
+
* None when the tree has no config, one that is not a JSON object, or no
|
|
139
|
+
* complete record in it — the rewrite replaces whatever is there.
|
|
140
|
+
*/
|
|
141
|
+
async function readScaffoldRecord(targetDir) {
|
|
142
|
+
const config = parseJsonObject(await readFileIfPresent(join(targetDir, CONFIG_RELPATH)));
|
|
143
|
+
const scaffold = config?.scaffold;
|
|
144
|
+
return isScaffoldAnswers(scaffold) ? scaffold : undefined;
|
|
145
|
+
}
|
|
146
|
+
/** A JSON object's fields — null for text that is not one (an absent file reads as ''). */
|
|
147
|
+
function parseJsonObject(raw) {
|
|
148
|
+
try {
|
|
149
|
+
const parsed = JSON.parse(raw);
|
|
150
|
+
if (typeof parsed !== 'object' || parsed === null || Array.isArray(parsed))
|
|
151
|
+
return null;
|
|
152
|
+
return parsed;
|
|
153
|
+
}
|
|
154
|
+
catch {
|
|
155
|
+
return null;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
/** Whether a value is a complete scaffold record: the template identity and the catalog answer. */
|
|
159
|
+
function isScaffoldAnswers(value) {
|
|
160
|
+
if (typeof value !== 'object' || value === null)
|
|
161
|
+
return false;
|
|
162
|
+
const { uiFramework, example, catalog } = value;
|
|
163
|
+
return (typeof uiFramework === 'string' && typeof example === 'string' && typeof catalog === 'boolean');
|
|
164
|
+
}
|
|
138
165
|
/**
|
|
139
166
|
* The platform-owned `.env` keys this invocation manages, in canonical render
|
|
140
167
|
* order. Conditional keys (browser URL, admin secret) enter the map only when
|
|
@@ -222,19 +249,19 @@ async function readFileIfPresent(path) {
|
|
|
222
249
|
}
|
|
223
250
|
/**
|
|
224
251
|
* Write the per-channel config the storefront reads at runtime: `.forgecart/
|
|
225
|
-
* config.json` (channel token, api url, app flag
|
|
226
|
-
*
|
|
227
|
-
*
|
|
228
|
-
*
|
|
229
|
-
*
|
|
230
|
-
*
|
|
231
|
-
*
|
|
232
|
-
*
|
|
252
|
+
* config.json` (channel token, api url, app flag, and the scaffold record —
|
|
253
|
+
* the answers to init's questions, #2774) and `.env` (the SDK client env).
|
|
254
|
+
* Shared by the full scaffold and the `--config-only` serve-in-place path, so
|
|
255
|
+
* both write the same channel config — the full scaffold records the answers it
|
|
256
|
+
* just took, the in-place path the record the tree already carries.
|
|
257
|
+
* `config.json` is pure platform state and is rewritten wholesale, mirroring the
|
|
258
|
+
* design-system seat the workspace's template manifest records (#2773) — every
|
|
259
|
+
* provisioning drive re-runs init, and a rewrite without it would drop the
|
|
260
|
+
* mirror; `.env` is merge-preserved (#1123 — see mergeEnv).
|
|
233
261
|
*/
|
|
234
|
-
async function writeChannelConfig(targetDir, channelToken, options, designSystem) {
|
|
235
|
-
|
|
236
|
-
await
|
|
237
|
-
await writeFile(join(configDir, 'config.json'), `${JSON.stringify(buildConfig(channelToken, options, designSystem), null, 2)}\n`, 'utf8');
|
|
262
|
+
async function writeChannelConfig(targetDir, channelToken, options, scaffold, designSystem) {
|
|
263
|
+
await mkdir(join(targetDir, '.forgecart'), { recursive: true });
|
|
264
|
+
await writeFile(join(targetDir, CONFIG_RELPATH), `${JSON.stringify(buildConfig(channelToken, options, scaffold, designSystem), null, 2)}\n`, 'utf8');
|
|
238
265
|
const envPath = join(targetDir, '.env');
|
|
239
266
|
const existingEnv = await readFileIfPresent(envPath);
|
|
240
267
|
await writeFile(envPath, mergeEnv(existingEnv, channelToken, options), 'utf8');
|
|
@@ -279,34 +306,48 @@ function printConfigOnly(targetDir) {
|
|
|
279
306
|
print('');
|
|
280
307
|
}
|
|
281
308
|
/**
|
|
282
|
-
*
|
|
309
|
+
* Serve-in-place: the target is already a warm storefront materialized from the
|
|
310
|
+
* image's pre-warmed tree (node_modules + a warm `.next`). Write only the
|
|
311
|
+
* per-channel config + env — copying the template would clobber the pre-warmed
|
|
312
|
+
* `.next` and bust the Turbopack dev cache the bake exists to provide — and ask
|
|
313
|
+
* nothing: the tree already has its template identity, and its config keeps the
|
|
314
|
+
* scaffold record it carries and mirrors the design-system seat the workspace
|
|
315
|
+
* records (#2773).
|
|
316
|
+
*/
|
|
317
|
+
async function configureInPlace(targetDir, channelToken, options, designSystem) {
|
|
318
|
+
if (!(await isFile(join(targetDir, 'package.json')))) {
|
|
319
|
+
throw new Error(`--config-only requires an existing storefront at ${targetDir} (no package.json found).`);
|
|
320
|
+
}
|
|
321
|
+
await writeChannelConfig(targetDir, channelToken, options, await readScaffoldRecord(targetDir), designSystem);
|
|
322
|
+
printConfigOnly(targetDir);
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* Run `forgecart init`: the credentials, then the questions, then the scaffold
|
|
326
|
+
* (#2774).
|
|
283
327
|
*
|
|
284
|
-
* Resolves the
|
|
328
|
+
* Resolves the channel token and the target directory, asks init's questions
|
|
329
|
+
* ({@link InitQuestions}) — refusing, before any file is written, a template
|
|
330
|
+
* the release does not render — scaffolds the storefront from the warmed
|
|
285
331
|
* template when one is available (see {@link resolveScaffoldPlan}) or the
|
|
286
|
-
*
|
|
332
|
+
* template the answers picked otherwise, writes the ForgeCart config with the
|
|
333
|
+
* answers and `.env`, inventories the render under its template identity, and
|
|
287
334
|
* prints next steps. Throws a clear Error on any failure (missing token,
|
|
288
|
-
* missing template, copy failure)
|
|
335
|
+
* unrendered template, missing template, copy failure); an unanswered question
|
|
336
|
+
* exits 2 through the question adapter's refusal.
|
|
289
337
|
*/
|
|
290
|
-
export async function runInit(name, options) {
|
|
338
|
+
export async function runInit(name, options, templateSet) {
|
|
291
339
|
const channelToken = options.token?.trim();
|
|
292
340
|
if (!channelToken) {
|
|
293
341
|
throw new Error('A channel token is required. Pass it with --token <token> (or -t <token>).');
|
|
294
342
|
}
|
|
295
343
|
const targetDir = name ? resolve(process.cwd(), name) : process.cwd();
|
|
296
344
|
const designSystem = await recordedDesignSystem(targetDir);
|
|
297
|
-
// Serve-in-place: the target is already a warm storefront materialized from the
|
|
298
|
-
// image's pre-warmed tree (node_modules + a warm `.next`). Write only the
|
|
299
|
-
// per-channel config + env and return — copying the template would clobber the
|
|
300
|
-
// pre-warmed `.next` and bust the Turbopack dev cache the bake exists to provide.
|
|
301
345
|
if (options.configOnly) {
|
|
302
|
-
|
|
303
|
-
throw new Error(`--config-only requires an existing storefront at ${targetDir} (no package.json found).`);
|
|
304
|
-
}
|
|
305
|
-
await writeChannelConfig(targetDir, channelToken, options, designSystem);
|
|
306
|
-
printConfigOnly(targetDir);
|
|
346
|
+
await configureInPlace(targetDir, channelToken, options, designSystem);
|
|
307
347
|
return;
|
|
308
348
|
}
|
|
309
|
-
const
|
|
349
|
+
const questions = new InitQuestions(templateSet, options, new QuestionPromptAdapter(options));
|
|
350
|
+
const { answers, templateDir } = await questions.ask();
|
|
310
351
|
if (!(await isDirectory(templateDir))) {
|
|
311
352
|
throw new Error(`Storefront template not found at ${templateDir}.`);
|
|
312
353
|
}
|
|
@@ -318,15 +359,24 @@ export async function runInit(name, options) {
|
|
|
318
359
|
recursive: true,
|
|
319
360
|
});
|
|
320
361
|
}
|
|
321
|
-
await writeChannelConfig(targetDir, channelToken, options, designSystem);
|
|
362
|
+
await writeChannelConfig(targetDir, channelToken, options, answers, designSystem);
|
|
322
363
|
await writeDepsReadyMarker(targetDir, plan);
|
|
323
|
-
// Inventory the render for `forgecart refresh` (#1116)
|
|
324
|
-
//
|
|
325
|
-
|
|
364
|
+
// Inventory the render for `forgecart refresh` (#1116) under the template
|
|
365
|
+
// identity it re-renders from (#2774) — hashed from the plan's template dir,
|
|
366
|
+
// the exact bytes the copy above landed — carrying the design-system seat the
|
|
367
|
+
// workspace already recorded (#2773).
|
|
368
|
+
await writeTemplateManifest(targetDir, plan.templateDir, readPackageVersion(), { uiFramework: answers.uiFramework, example: answers.example }, designSystem);
|
|
326
369
|
printNextSteps(name ?? '.', options.application ?? false, plan.source === 'warmed');
|
|
327
370
|
}
|
|
328
|
-
/**
|
|
371
|
+
/**
|
|
372
|
+
* Build the `init [name]` command: its own flags, its answers to its questions
|
|
373
|
+
* (#2774) — validated against the release's template set, whose frameworks and
|
|
374
|
+
* examples `--help` lists — and the question adapter's three flags.
|
|
375
|
+
*/
|
|
329
376
|
export function createInitCommand() {
|
|
377
|
+
const templateSet = TemplateSet.shipped();
|
|
378
|
+
const ui = new Option('--ui <framework>', 'UI framework of the storefront; asked when omitted');
|
|
379
|
+
const example = new Option('--example <name>', 'Example the storefront starts from, or blank; asked when omitted');
|
|
330
380
|
const command = new Command('init')
|
|
331
381
|
.description('Scaffold a ForgeCart storefront in the target directory')
|
|
332
382
|
.argument('[name]', 'Target directory name (defaults to the current directory)')
|
|
@@ -336,9 +386,13 @@ export function createInitCommand() {
|
|
|
336
386
|
.option('--browser-api-url <url>', 'Shop API URL for the shopper browser when it differs from --api-url (split-horizon pods; must be HTTPS so the session socket can use WSS)')
|
|
337
387
|
.option('--public-origin <url>', 'Public origin the storefront is served at (https://shop.example.com). Omit for preview deployments: without it every route is noindex and robots.txt disallows the whole tree')
|
|
338
388
|
.option('-a, --application', 'Also scaffold a NestJS application (TODO: next phase)')
|
|
339
|
-
.option('--config-only', 'Write only per-channel config into an existing pre-warmed storefront (skip the template copy)')
|
|
389
|
+
.option('--config-only', 'Write only per-channel config into an existing pre-warmed storefront (skip the template copy and the questions)')
|
|
390
|
+
.addOption(ui.choices(templateSet.uiFrameworkIds))
|
|
391
|
+
.addOption(example.choices(templateSet.exampleIds))
|
|
392
|
+
.option('--catalog', 'Also create a demo catalog with the example; asked when omitted')
|
|
393
|
+
.option('--no-catalog', 'Create no demo catalog')
|
|
340
394
|
.action(async (name, options) => {
|
|
341
|
-
await runInit(name, options);
|
|
395
|
+
await runInit(name, options, templateSet);
|
|
342
396
|
});
|
|
343
397
|
return QuestionPromptAdapter.registerOptions(command);
|
|
344
398
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../../src/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,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,WAAW,CAAC,yDAAyD,CAAC;SACtE,QAAQ,CAAC,QAAQ,EAAE,2DAA2D,CAAC;SAC/E,MAAM,CAAC,qBAAqB,EAAE,oCAAoC,CAAC;SACnE,MAAM,CACL,yBAAyB,EACzB,8EAA8E,CAC/E;SACA,MAAM,CACL,iBAAiB,EACjB,yDAAyD,EACzD,oBAAoB,CACrB;SACA,MAAM,CACL,yBAAyB,EACzB,2IAA2I,CAC5I;SACA,MAAM,CACL,uBAAuB,EACvB,+KAA+K,CAChL;SACA,MAAM,CAAC,mBAAmB,EAAE,uDAAuD,CAAC;SACpF,MAAM,CACL,eAAe,EACf,iHAAiH,CAClH;SACA,SAAS,CAAC,EAAE,CAAC,OAAO,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC;SACjD,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;SAClD,MAAM,CAAC,WAAW,EAAE,iEAAiE,CAAC;SACtF,MAAM,CAAC,cAAc,EAAE,wBAAwB,CAAC;SAChD,MAAM,CAAC,KAAK,EAAE,IAAwB,EAAE,OAAoB,EAAE,EAAE;QAC/D,MAAM,OAAO,CAAC,IAAI,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC;IAC5C,CAAC,CAAC,CAAC;IACL,OAAO,qBAAqB,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;AACxD,CAAC"}
|
|
@@ -2,8 +2,8 @@ import { Command } from 'commander';
|
|
|
2
2
|
import { type DesignSystemPartition } from './design-system-seat.js';
|
|
3
3
|
/**
|
|
4
4
|
* `forgecart refresh` (#1116) — re-render the platform-owned template files
|
|
5
|
-
* of an EXISTING workspace from the CLI's bundled template
|
|
6
|
-
* file-ownership partition:
|
|
5
|
+
* of an EXISTING workspace from the CLI's bundled template its manifest names
|
|
6
|
+
* (#2774, {@link manifestTemplate}), under the file-ownership partition:
|
|
7
7
|
*
|
|
8
8
|
* - a platform file whose content still matches its manifest hash (pristine
|
|
9
9
|
* since generation) re-renders to the current template;
|
|
@@ -21,12 +21,13 @@ import { type DesignSystemPartition } from './design-system-seat.js';
|
|
|
21
21
|
* (`package-manifest.ts`, #2666). Every file is decided before any is written,
|
|
22
22
|
* so a refresh that stops on a file it cannot decide — an adopted
|
|
23
23
|
* `package.json` whose packages cannot be read — leaves the workspace as it
|
|
24
|
-
* found it. The refresh always (re)writes the manifest
|
|
25
|
-
* workspace becomes precise after its first
|
|
26
|
-
* the manifest records (#2773) is carried into
|
|
27
|
-
* stands, and the report names it beside the
|
|
28
|
-
* lives in `.forgecart/`, so no verdict can. The
|
|
29
|
-
* machine seam the provisioning orchestrator
|
|
24
|
+
* found it. The refresh always (re)writes the manifest — under the template it
|
|
25
|
+
* rendered from — so a pre-manifest workspace becomes precise after its first
|
|
26
|
+
* refresh; the design-system seat the manifest records (#2773) is carried into
|
|
27
|
+
* the rewritten manifest as it stands, and the report names it beside the
|
|
28
|
+
* per-file verdicts — the seat lives in `.forgecart/`, so no verdict can. The
|
|
29
|
+
* JSON report (`--json`) is the machine seam the provisioning orchestrator
|
|
30
|
+
* parses.
|
|
30
31
|
*/
|
|
31
32
|
interface RefreshOptions {
|
|
32
33
|
json?: boolean;
|
|
@@ -2,11 +2,11 @@ import { mkdir, readFile, stat, writeFile } from 'node:fs/promises';
|
|
|
2
2
|
import { dirname, join, resolve } from 'node:path';
|
|
3
3
|
import { Command } from 'commander';
|
|
4
4
|
import { print } from '../output.js';
|
|
5
|
+
import { TemplateSet } from '../template/template-set.js';
|
|
5
6
|
import { readPackageVersion } from '../version.js';
|
|
6
7
|
import { describeDesignSystem, designSystemPartition, sameDesignSystem, } from './design-system-seat.js';
|
|
7
|
-
import { getStorefrontTemplateDir } from './init.js';
|
|
8
8
|
import { PACKAGE_MANIFEST_RELPATH, adoptPackageManifest } from './package-manifest.js';
|
|
9
|
-
import { TEMPLATE_MANIFEST_SCHEMA_VERSION, hashContent, listTemplateFiles, readTemplateManifest, serializeTemplateManifest, templateManifestPath, } from './template-manifest.js';
|
|
9
|
+
import { TEMPLATE_MANIFEST_SCHEMA_VERSION, hashContent, listTemplateFiles, manifestTemplate, readTemplateManifest, serializeTemplateManifest, templateManifestPath, } from './template-manifest.js';
|
|
10
10
|
/** True if the path exists and is a regular file. */
|
|
11
11
|
async function isFile(path) {
|
|
12
12
|
try {
|
|
@@ -124,7 +124,8 @@ export async function runRefresh(name, options) {
|
|
|
124
124
|
throw new Error(`refresh requires an existing storefront at ${targetDir} (no package.json found).`);
|
|
125
125
|
}
|
|
126
126
|
const manifest = await readTemplateManifest(targetDir);
|
|
127
|
-
const
|
|
127
|
+
const template = manifestTemplate(manifest);
|
|
128
|
+
const decisions = await decideTemplateFiles(targetDir, TemplateSet.shipped().templateDir(template), manifest, new Set(options.adopt ?? []));
|
|
128
129
|
const report = {
|
|
129
130
|
rendered: [],
|
|
130
131
|
conflicts: [],
|
|
@@ -141,6 +142,7 @@ export async function runRefresh(name, options) {
|
|
|
141
142
|
const nextManifest = {
|
|
142
143
|
schemaVersion: TEMPLATE_MANIFEST_SCHEMA_VERSION,
|
|
143
144
|
templateVersion: readPackageVersion(),
|
|
145
|
+
template,
|
|
144
146
|
generatedAt: new Date().toISOString(),
|
|
145
147
|
files: nextFiles,
|
|
146
148
|
designSystem: manifest?.designSystem,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"refresh.js","sourceRoot":"","sources":["../../../src/commands/refresh.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACpE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEnD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAEnD,OAAO,EACL,oBAAoB,E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,EAAE,IAAwB,EAAE,OAAuB,EAAE,EAAE;QAClE,MAAM,UAAU,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAClC,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { TemplateIdentity } from '../template/type/template-set.types.js';
|
|
1
2
|
import { type DesignSystemSeat } from './design-system-seat.js';
|
|
2
3
|
/**
|
|
3
4
|
* The template manifest — the file-ownership partition's source of truth
|
|
@@ -12,6 +13,13 @@ export interface TemplateManifest {
|
|
|
12
13
|
schemaVersion: number;
|
|
13
14
|
/** The CLI version whose bundled template rendered this workspace. */
|
|
14
15
|
templateVersion: string;
|
|
16
|
+
/**
|
|
17
|
+
* The template that rendered this workspace (#2774): its UI framework and
|
|
18
|
+
* its example — what `forgecart refresh` re-renders from. A manifest written
|
|
19
|
+
* before the identity was recorded names none; {@link manifestTemplate}
|
|
20
|
+
* reads that as {@link PRE_IDENTITY_TEMPLATE}.
|
|
21
|
+
*/
|
|
22
|
+
template?: TemplateIdentity;
|
|
15
23
|
generatedAt: string;
|
|
16
24
|
/** posix relpath → sha256 hex of the rendered content. */
|
|
17
25
|
files: Record<string, string>;
|
|
@@ -23,7 +31,18 @@ export interface TemplateManifest {
|
|
|
23
31
|
*/
|
|
24
32
|
designSystem?: DesignSystemSeat;
|
|
25
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* Unchanged by the template identity (#2774): the seat is optional, so every
|
|
36
|
+
* manifest written before it still reads — a bump would null them all
|
|
37
|
+
* ({@link readTemplateManifest}) and turn every pristine file into a conflict.
|
|
38
|
+
*/
|
|
26
39
|
export declare const TEMPLATE_MANIFEST_SCHEMA_VERSION = 1;
|
|
40
|
+
/**
|
|
41
|
+
* The template a workspace was rendered from: the one its manifest records,
|
|
42
|
+
* else — a manifest written before the identity, or none at all — the one
|
|
43
|
+
* template every earlier CLI rendered.
|
|
44
|
+
*/
|
|
45
|
+
export declare function manifestTemplate(manifest: TemplateManifest | null): TemplateIdentity;
|
|
27
46
|
/** sha256 hex of file content — the manifest's and refresh's shared hash. */
|
|
28
47
|
export declare function hashContent(content: Buffer | string): string;
|
|
29
48
|
/**
|
|
@@ -37,12 +56,13 @@ export declare function templateManifestPath(targetDir: string): string;
|
|
|
37
56
|
/** The bytes every manifest writer lands: two-space JSON with a final newline. */
|
|
38
57
|
export declare function serializeTemplateManifest(manifest: TemplateManifest): string;
|
|
39
58
|
/**
|
|
40
|
-
* Inventory the just-rendered template into the workspace's manifest
|
|
41
|
-
* the TEMPLATE side of the copy — the
|
|
42
|
-
* later refresh can prove per-file
|
|
43
|
-
*
|
|
59
|
+
* Inventory the just-rendered template into the workspace's manifest, under
|
|
60
|
+
* the identity that picked it. Hashes the TEMPLATE side of the copy — the
|
|
61
|
+
* bytes that actually landed — so a later refresh can prove per-file
|
|
62
|
+
* pristineness. `designSystem` is the seat the workspace already recorded,
|
|
63
|
+
* carried over; a fresh workspace has none.
|
|
44
64
|
*/
|
|
45
|
-
export declare function writeTemplateManifest(targetDir: string, templateDir: string, templateVersion: string, designSystem: DesignSystemSeat | undefined): Promise<void>;
|
|
65
|
+
export declare function writeTemplateManifest(targetDir: string, templateDir: string, templateVersion: string, template: TemplateIdentity, designSystem: DesignSystemSeat | undefined): Promise<void>;
|
|
46
66
|
/**
|
|
47
67
|
* Read a workspace's manifest. Absent OR unreadable → null: the workspace is
|
|
48
68
|
* treated as pre-manifest, where refresh refuses every divergent file until
|
|
@@ -11,7 +11,28 @@ import { parseDesignSystemSeat } from './design-system-seat.js';
|
|
|
11
11
|
* (inventoried but diverged; conflict — skip and flag, never clobber).
|
|
12
12
|
*/
|
|
13
13
|
export const TEMPLATE_MANIFEST_RELPATH = '.forgecart/template-manifest.json';
|
|
14
|
+
/**
|
|
15
|
+
* Unchanged by the template identity (#2774): the seat is optional, so every
|
|
16
|
+
* manifest written before it still reads — a bump would null them all
|
|
17
|
+
* ({@link readTemplateManifest}) and turn every pristine file into a conflict.
|
|
18
|
+
*/
|
|
14
19
|
export const TEMPLATE_MANIFEST_SCHEMA_VERSION = 1;
|
|
20
|
+
/**
|
|
21
|
+
* The template a manifest without an identity was rendered from: until #2774
|
|
22
|
+
* every CLI rendered exactly one — the daisyUI storefront.
|
|
23
|
+
*/
|
|
24
|
+
const PRE_IDENTITY_TEMPLATE = {
|
|
25
|
+
uiFramework: 'daisyui',
|
|
26
|
+
example: 'storefront',
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* The template a workspace was rendered from: the one its manifest records,
|
|
30
|
+
* else — a manifest written before the identity, or none at all — the one
|
|
31
|
+
* template every earlier CLI rendered.
|
|
32
|
+
*/
|
|
33
|
+
export function manifestTemplate(manifest) {
|
|
34
|
+
return manifest?.template ?? { ...PRE_IDENTITY_TEMPLATE };
|
|
35
|
+
}
|
|
15
36
|
/**
|
|
16
37
|
* Top-level names never inventoried: dependency trees and build caches are
|
|
17
38
|
* runtime state, `.forgecart/` and `.env` are per-channel config owned by
|
|
@@ -80,12 +101,13 @@ export function serializeTemplateManifest(manifest) {
|
|
|
80
101
|
return `${JSON.stringify(manifest, null, 2)}\n`;
|
|
81
102
|
}
|
|
82
103
|
/**
|
|
83
|
-
* Inventory the just-rendered template into the workspace's manifest
|
|
84
|
-
* the TEMPLATE side of the copy — the
|
|
85
|
-
* later refresh can prove per-file
|
|
86
|
-
*
|
|
104
|
+
* Inventory the just-rendered template into the workspace's manifest, under
|
|
105
|
+
* the identity that picked it. Hashes the TEMPLATE side of the copy — the
|
|
106
|
+
* bytes that actually landed — so a later refresh can prove per-file
|
|
107
|
+
* pristineness. `designSystem` is the seat the workspace already recorded,
|
|
108
|
+
* carried over; a fresh workspace has none.
|
|
87
109
|
*/
|
|
88
|
-
export async function writeTemplateManifest(targetDir, templateDir, templateVersion, designSystem) {
|
|
110
|
+
export async function writeTemplateManifest(targetDir, templateDir, templateVersion, template, designSystem) {
|
|
89
111
|
const files = {};
|
|
90
112
|
for (const relpath of await listTemplateFiles(templateDir)) {
|
|
91
113
|
files[relpath] = hashContent(await readFile(join(templateDir, ...relpath.split('/'))));
|
|
@@ -93,6 +115,7 @@ export async function writeTemplateManifest(targetDir, templateDir, templateVers
|
|
|
93
115
|
const manifest = {
|
|
94
116
|
schemaVersion: TEMPLATE_MANIFEST_SCHEMA_VERSION,
|
|
95
117
|
templateVersion,
|
|
118
|
+
template,
|
|
96
119
|
generatedAt: new Date().toISOString(),
|
|
97
120
|
files,
|
|
98
121
|
designSystem,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"template-manifest.js","sourceRoot":"","sources":["../../../src/commands/template-manifest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"template-manifest.js","sourceRoot":"","sources":["../../../src/commands/template-manifest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAIjC,OAAO,EAAE,qBAAqB,EAAyB,MAAM,yBAAyB,CAAC;AAEvF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,mCAAmC,CAAC;AAyB7E;;;;GAIG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAAC,CAAC;AAElD;;;GAGG;AACH,MAAM,qBAAqB,GAA+B;IACxD,WAAW,EAAE,SAAS;IACtB,OAAO,EAAE,YAAY;CACtB,CAAC;AAEF;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,QAAiC;IAChE,OAAO,QAAQ,EAAE,QAAQ,IAAI,EAAE,G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EAAE,YAAY,EAAE,qBAAqB,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,SAAS,EAAE,CAAC;IAC9F,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `forgecart init`'s own answers to its questions (#2774), as commander parses
|
|
3
|
+
* them: a headless caller names the template on the command line. A question
|
|
4
|
+
* none of them answers goes to the question adapter (#2771).
|
|
5
|
+
*/
|
|
6
|
+
export interface InitQuestionsInput {
|
|
7
|
+
/** `--ui <framework>`: answers `ui-framework` — a UI framework the release ships. */
|
|
8
|
+
ui?: string;
|
|
9
|
+
/** `--example <name>`: answers `example` — an example the release ships, or `blank`. */
|
|
10
|
+
example?: string;
|
|
11
|
+
/**
|
|
12
|
+
* `--catalog` / `--no-catalog`: answers `catalog`, which is asked only for an
|
|
13
|
+
* example — a blank storefront never gets a demo catalog.
|
|
14
|
+
*/
|
|
15
|
+
catalog?: boolean;
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.input.js","sourceRoot":"","sources":["../../../../src/commands/type/init.input.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { TemplateIdentity } from '../../template/type/template-set.types.js';
|
|
2
|
+
/**
|
|
3
|
+
* The answers `forgecart init`'s questions took (#2774) — the scaffold record
|
|
4
|
+
* `.forgecart/config.json` commits for the steps that read it later.
|
|
5
|
+
*/
|
|
6
|
+
export interface ScaffoldAnswers extends TemplateIdentity {
|
|
7
|
+
/** Whether a demo catalog comes with the example — never for a blank storefront. */
|
|
8
|
+
catalog: boolean;
|
|
9
|
+
}
|
|
10
|
+
/** The answers a run settled, and the template directory their identity renders from. */
|
|
11
|
+
export interface SettledScaffold {
|
|
12
|
+
answers: ScaffoldAnswers;
|
|
13
|
+
templateDir: string;
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.types.js","sourceRoot":"","sources":["../../../../src/commands/type/init.types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A fresh question id: `q_` and a ULID, the shape the record prints
|
|
3
|
+
* (`q_01JR2K7B4M9ZT5XN3FD8WQV6PA`, record `refs/design/cli-improvements`). An
|
|
4
|
+
* id names exactly one asking — every prompt prints it and every refusal names
|
|
5
|
+
* it — so a run mints its own, and the question's stable key is what answers it
|
|
6
|
+
* again on the next run.
|
|
7
|
+
*/
|
|
8
|
+
export declare function mintQuestionId(): string;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { randomInt } from 'node:crypto';
|
|
2
|
+
/** Crockford's base32, the ULID alphabet: no I, L, O or U. */
|
|
3
|
+
const ULID_ALPHABET = '0123456789ABCDEFGHJKMNPQRSTVWXYZ';
|
|
4
|
+
/** A ULID's 48-bit millisecond timestamp, in base32 characters — most significant first. */
|
|
5
|
+
const TIME_CHARS = 10;
|
|
6
|
+
/** A ULID's 80 random bits, in base32 characters. */
|
|
7
|
+
const RANDOM_CHARS = 16;
|
|
8
|
+
/**
|
|
9
|
+
* A fresh question id: `q_` and a ULID, the shape the record prints
|
|
10
|
+
* (`q_01JR2K7B4M9ZT5XN3FD8WQV6PA`, record `refs/design/cli-improvements`). An
|
|
11
|
+
* id names exactly one asking — every prompt prints it and every refusal names
|
|
12
|
+
* it — so a run mints its own, and the question's stable key is what answers it
|
|
13
|
+
* again on the next run.
|
|
14
|
+
*/
|
|
15
|
+
export function mintQuestionId() {
|
|
16
|
+
return `q_${timeChars(Date.now())}${randomChars()}`;
|
|
17
|
+
}
|
|
18
|
+
/** The timestamp, as ULID time characters. */
|
|
19
|
+
function timeChars(milliseconds) {
|
|
20
|
+
let rest = milliseconds;
|
|
21
|
+
let chars = '';
|
|
22
|
+
for (let position = 0; position < TIME_CHARS; position++) {
|
|
23
|
+
chars = `${ULID_ALPHABET.charAt(rest % ULID_ALPHABET.length)}${chars}`;
|
|
24
|
+
rest = Math.floor(rest / ULID_ALPHABET.length);
|
|
25
|
+
}
|
|
26
|
+
return chars;
|
|
27
|
+
}
|
|
28
|
+
/** Uniformly random ULID characters, each one five random bits. */
|
|
29
|
+
function randomChars() {
|
|
30
|
+
let chars = '';
|
|
31
|
+
for (let position = 0; position < RANDOM_CHARS; position++) {
|
|
32
|
+
chars += ULID_ALPHABET.charAt(randomInt(ULID_ALPHABET.length));
|
|
33
|
+
}
|
|
34
|
+
return chars;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=question-id.util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"question-id.util.js","sourceRoot":"","sources":["../../../../src/question/util/question-id.util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,8DAA8D;AAC9D,MAAM,aAAa,GAAG,kCAAkC,CAAC;AAEzD,4FAA4F;AAC5F,MAAM,UAAU,GAAG,EAAE,CAAC;AAEtB,qDAAqD;AACrD,MAAM,YAAY,GAAG,EAAE,CAAC;AAExB;;;;;;GAMG;AACH,MAAM,UAAU,cAAc;IAC5B,OAAO,KAAK,SAAS,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,GAAG,WAAW,EAAE,EAAE,CAAC;AACtD,CAAC;AAED,8CAA8C;AAC9C,SAAS,SAAS,CAAC,YAAoB;IACrC,IAAI,IAAI,GAAG,YAAY,CAAC;IACxB,IAAI,KAAK,GAAG,EAAE,CAAC;IACf,KAAK,IAAI,QAAQ,GAAG,CAAC,EAAE,QAAQ,GAAG,UAAU,EAAE,QAAQ,EAAE,EAAE,CAAC;QACzD,KAAK,GAAG,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,GAAG,aAAa,CAAC,MAAM,CAAC,GAAG,KAAK,EAAE,CAAC;QACvE,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC;IACjD,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,mEAAmE;AACnE,SAAS,WAAW;IAClB,IAAI,KAAK,GAAG,EAAE,CAAC;IACf,KAAK,IAAI,QAAQ,GAAG,CAAC,EAAE,QAAQ,GAAG,YAAY,EAAE,QAAQ,EAAE,EAAE,CAAC;QAC3D,KAAK,IAAI,aAAa,CAAC,MAAM,CAAC,SAAS,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC;IACjE,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { type TemplateExample, type TemplateIdentity, type UiFramework } from './type/template-set.types.js';
|
|
2
|
+
/**
|
|
3
|
+
* The template set a CLI release ships (#2774): its UI frameworks and its
|
|
4
|
+
* example storefronts, in prompt order, and the template directory of every
|
|
5
|
+
* identity it renders — read from `templates/template-set.json`, the data the
|
|
6
|
+
* release ships beside the templates. `forgecart init` derives its questions'
|
|
7
|
+
* options from it and validates `--ui` and `--example` against it, so a
|
|
8
|
+
* framework is added as a row there and never as prompt code; the directory
|
|
9
|
+
* each row names is B's (forgecart/shop-beta#2775) layout to own.
|
|
10
|
+
*/
|
|
11
|
+
export declare class TemplateSet {
|
|
12
|
+
private readonly templatesDir;
|
|
13
|
+
private readonly document;
|
|
14
|
+
private constructor();
|
|
15
|
+
/**
|
|
16
|
+
* The template set of this CLI build. At runtime this module lives at
|
|
17
|
+
* `<pkg>/dist/src/template/template-set.js`, so the `templates/` directory
|
|
18
|
+
* shipped beside `dist/` is three levels up.
|
|
19
|
+
*/
|
|
20
|
+
static shipped(): TemplateSet;
|
|
21
|
+
/** The UI frameworks, in prompt order: the first is the default. */
|
|
22
|
+
get uiFrameworks(): readonly UiFramework[];
|
|
23
|
+
/** The examples, in prompt order: the first is the default. */
|
|
24
|
+
get examples(): readonly TemplateExample[];
|
|
25
|
+
/** What `--ui` takes: every UI framework's id. */
|
|
26
|
+
get uiFrameworkIds(): string[];
|
|
27
|
+
/** What `--example` takes: every example's id, then blank. */
|
|
28
|
+
get exampleIds(): string[];
|
|
29
|
+
/**
|
|
30
|
+
* The template directory `identity` renders from — a
|
|
31
|
+
* {@link TemplateUnavailableError} when the release renders no template for it.
|
|
32
|
+
*/
|
|
33
|
+
templateDir(identity: TemplateIdentity): string;
|
|
34
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
import { dirname, join, resolve } from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
import { TemplateUnavailableError } from './template-unavailable-error.js';
|
|
5
|
+
import { BLANK_EXAMPLE, } from './type/template-set.types.js';
|
|
6
|
+
/** The template set's own record, beside the templates it names. */
|
|
7
|
+
const TEMPLATE_SET_FILE = 'template-set.json';
|
|
8
|
+
/**
|
|
9
|
+
* The template set a CLI release ships (#2774): its UI frameworks and its
|
|
10
|
+
* example storefronts, in prompt order, and the template directory of every
|
|
11
|
+
* identity it renders — read from `templates/template-set.json`, the data the
|
|
12
|
+
* release ships beside the templates. `forgecart init` derives its questions'
|
|
13
|
+
* options from it and validates `--ui` and `--example` against it, so a
|
|
14
|
+
* framework is added as a row there and never as prompt code; the directory
|
|
15
|
+
* each row names is B's (forgecart/shop-beta#2775) layout to own.
|
|
16
|
+
*/
|
|
17
|
+
export class TemplateSet {
|
|
18
|
+
templatesDir;
|
|
19
|
+
document;
|
|
20
|
+
constructor(templatesDir, document) {
|
|
21
|
+
this.templatesDir = templatesDir;
|
|
22
|
+
this.document = document;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* The template set of this CLI build. At runtime this module lives at
|
|
26
|
+
* `<pkg>/dist/src/template/template-set.js`, so the `templates/` directory
|
|
27
|
+
* shipped beside `dist/` is three levels up.
|
|
28
|
+
*/
|
|
29
|
+
static shipped() {
|
|
30
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
31
|
+
const templatesDir = resolve(here, '..', '..', '..', 'templates');
|
|
32
|
+
const document = JSON.parse(readFileSync(join(templatesDir, TEMPLATE_SET_FILE), 'utf8'));
|
|
33
|
+
return new TemplateSet(templatesDir, document);
|
|
34
|
+
}
|
|
35
|
+
/** The UI frameworks, in prompt order: the first is the default. */
|
|
36
|
+
get uiFrameworks() {
|
|
37
|
+
return this.document.uiFrameworks;
|
|
38
|
+
}
|
|
39
|
+
/** The examples, in prompt order: the first is the default. */
|
|
40
|
+
get examples() {
|
|
41
|
+
return this.document.examples;
|
|
42
|
+
}
|
|
43
|
+
/** What `--ui` takes: every UI framework's id. */
|
|
44
|
+
get uiFrameworkIds() {
|
|
45
|
+
return this.uiFrameworks.map((framework) => framework.id);
|
|
46
|
+
}
|
|
47
|
+
/** What `--example` takes: every example's id, then blank. */
|
|
48
|
+
get exampleIds() {
|
|
49
|
+
return [...this.examples.map((example) => example.id), BLANK_EXAMPLE];
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* The template directory `identity` renders from — a
|
|
53
|
+
* {@link TemplateUnavailableError} when the release renders no template for it.
|
|
54
|
+
*/
|
|
55
|
+
templateDir(identity) {
|
|
56
|
+
const { templates } = this.document;
|
|
57
|
+
const template = templates.find((row) => row.uiFramework === identity.uiFramework && row.example === identity.example);
|
|
58
|
+
if (template === undefined)
|
|
59
|
+
throw new TemplateUnavailableError(identity, templates);
|
|
60
|
+
return resolve(this.templatesDir, template.directory);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=template-set.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"template-set.js","sourceRoot":"","sources":["../../../src/template/template-set.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,aAA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,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,aAAa,CAAC,CAAC;IACxE,CAAC;IAED;;;OAGG;IACH,WAAW,CAAC,QAA0B;QACpC,MAAM,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC,QAAQ,CAAC;QACpC,MAAM,QAAQ,GAAG,SAAS,CAAC,IAAI,CAC7B,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,WAAW,KAAK,QAAQ,CAAC,WAAW,IAAI,GAAG,CAAC,OAAO,KAAK,QAAQ,CAAC,OAAO,CACtF,CAAC;QACF,IAAI,QAAQ,KAAK,SAAS;YAAE,MAAM,IAAI,wBAAwB,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;QACpF,OAAO,OAAO,CAAC,IAAI,CAAC,YAAY,EAAE,QAAQ,CAAC,SAAS,CAAC,CAAC;IACxD,CAAC;CACF"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type TemplateIdentity } from './type/template-set.types.js';
|
|
2
|
+
/**
|
|
3
|
+
* An identity the release's template set renders no template for (#2774) —
|
|
4
|
+
* refused before the catalog question and before any file is written, behind
|
|
5
|
+
* `run`'s `Error:` on exit 1. A blank storefront is refused naming the issue
|
|
6
|
+
* that ships its template, B (forgecart/shop-beta#2775); every refusal lists the
|
|
7
|
+
* identities the release does render, as the flags that pick them.
|
|
8
|
+
*/
|
|
9
|
+
export declare class TemplateUnavailableError extends Error {
|
|
10
|
+
/**
|
|
11
|
+
* @param identity the identity the run picked.
|
|
12
|
+
* @param rendered every identity the release renders.
|
|
13
|
+
*/
|
|
14
|
+
constructor(identity: TemplateIdentity, rendered: readonly TemplateIdentity[]);
|
|
15
|
+
/** What the release lacks for `identity`. */
|
|
16
|
+
private static missing;
|
|
17
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { BLANK_EXAMPLE } from './type/template-set.types.js';
|
|
2
|
+
/** The issue that ships the blank storefront template — B of launch#62. */
|
|
3
|
+
const BLANK_TEMPLATE_ISSUE = 'forgecart/shop-beta#2775';
|
|
4
|
+
/**
|
|
5
|
+
* An identity the release's template set renders no template for (#2774) —
|
|
6
|
+
* refused before the catalog question and before any file is written, behind
|
|
7
|
+
* `run`'s `Error:` on exit 1. A blank storefront is refused naming the issue
|
|
8
|
+
* that ships its template, B (forgecart/shop-beta#2775); every refusal lists the
|
|
9
|
+
* identities the release does render, as the flags that pick them.
|
|
10
|
+
*/
|
|
11
|
+
export class TemplateUnavailableError extends Error {
|
|
12
|
+
/**
|
|
13
|
+
* @param identity the identity the run picked.
|
|
14
|
+
* @param rendered every identity the release renders.
|
|
15
|
+
*/
|
|
16
|
+
constructor(identity, rendered) {
|
|
17
|
+
const choices = rendered
|
|
18
|
+
.map(({ uiFramework, example }) => `--ui ${uiFramework} --example ${example}`)
|
|
19
|
+
.join('; ');
|
|
20
|
+
super(`${TemplateUnavailableError.missing(identity)}. Pick one it renders: ${choices}.`);
|
|
21
|
+
this.name = 'TemplateUnavailableError';
|
|
22
|
+
}
|
|
23
|
+
/** What the release lacks for `identity`. */
|
|
24
|
+
static missing(identity) {
|
|
25
|
+
if (identity.example === BLANK_EXAMPLE) {
|
|
26
|
+
return `This release ships no blank ${identity.uiFramework} storefront — the blank template arrives with ${BLANK_TEMPLATE_ISSUE}`;
|
|
27
|
+
}
|
|
28
|
+
return `This release ships no ${identity.uiFramework} template for the ${identity.example} example`;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=template-unavailable-error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"template-unavailable-error.js","sourceRoot":"","sources":["../../../src/template/template-unavailable-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAyB,MAAM,8BAA8B,CAAC;AAEpF,2EAA2E;AAC3E,MAAM,oBAAoB,GAAG,0BAA0B,CAAC;AAExD;;;;;;GAMG;AACH,MAAM,OAAO,wBAAyB,SAAQ,KAAK;IACjD;;;OAGG;IACH,YAAY,QAA0B,EAAE,QAAqC;QAC3E,MAAM,OAAO,GAAG,QAAQ;aACrB,GAAG,CAAC,CAAC,EAAE,WAAW,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,QAAQ,WAAW,cAAc,OAAO,EAAE,CAAC;aAC7E,IAAI,CAAC,IAAI,CAAC,CAAC;QACd,KAAK,CAAC,GAAG,wBAAwB,CAAC,OAAO,CAAC,QAAQ,CAAC,0BAA0B,OAAO,GAAG,CAAC,CAAC;QACzF,IAAI,CAAC,IAAI,GAAG,0BAA0B,CAAC;IACzC,CAAC;IAED,6CAA6C;IACrC,MAAM,CAAC,OAAO,CAAC,QAA0B;QAC/C,IAAI,QAAQ,CAAC,OAAO,KAAK,aAAa,EAAE,CAAC;YACvC,OAAO,+BAA+B,QAAQ,CAAC,WAAW,iDAAiD,oBAAoB,EAAE,CAAC;QACpI,CAAC;QACD,OAAO,yBAAyB,QAAQ,CAAC,WAAW,qBAAqB,QAAQ,CAAC,OAAO,UAAU,CAAC;IACtG,CAAC;CACF"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One UI framework the CLI release ships a template set for — a row of
|
|
3
|
+
* `templates/template-set.json`, and the id `forgecart init --ui <id>` takes.
|
|
4
|
+
*/
|
|
5
|
+
export interface UiFramework {
|
|
6
|
+
/** `daisyui` — the `ui-framework` question's option id. */
|
|
7
|
+
id: string;
|
|
8
|
+
/** What a merchant reads: `daisyUI`. */
|
|
9
|
+
label: string;
|
|
10
|
+
/** The consequence of choosing it, printed under its label. */
|
|
11
|
+
hint: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* One example storefront the CLI release ships — a row of
|
|
15
|
+
* `templates/template-set.json`, and the id `forgecart init --example <id>` takes.
|
|
16
|
+
*/
|
|
17
|
+
export interface TemplateExample {
|
|
18
|
+
/** `storefront` — the `example` question's option id. */
|
|
19
|
+
id: string;
|
|
20
|
+
label: string;
|
|
21
|
+
hint: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* The template a scaffold renders (#2774): its UI framework and the example it
|
|
25
|
+
* starts from — or {@link BLANK_EXAMPLE}. The template manifest records it, and
|
|
26
|
+
* `forgecart refresh` re-renders from the template it names.
|
|
27
|
+
*/
|
|
28
|
+
export interface TemplateIdentity {
|
|
29
|
+
uiFramework: string;
|
|
30
|
+
/** An example's id, or {@link BLANK_EXAMPLE}. */
|
|
31
|
+
example: string;
|
|
32
|
+
}
|
|
33
|
+
/** One identity the release renders, and its template's directory under `templates/`. */
|
|
34
|
+
export interface TemplateDirectory extends TemplateIdentity {
|
|
35
|
+
directory: string;
|
|
36
|
+
}
|
|
37
|
+
/** `templates/template-set.json` — the template set one CLI release ships. */
|
|
38
|
+
export interface TemplateSetDocument {
|
|
39
|
+
/** In prompt order: the first is the `ui-framework` question's default. */
|
|
40
|
+
uiFrameworks: UiFramework[];
|
|
41
|
+
/** In prompt order: the first is the `example` question's default. */
|
|
42
|
+
examples: TemplateExample[];
|
|
43
|
+
/** Every identity the release renders — an identity missing here is refused. */
|
|
44
|
+
templates: TemplateDirectory[];
|
|
45
|
+
}
|
|
46
|
+
/** The `example` answer that starts the storefront from no example: blank. */
|
|
47
|
+
export declare const BLANK_EXAMPLE = "blank";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"template-set.types.js","sourceRoot":"","sources":["../../../../src/template/type/template-set.types.ts"],"names":[],"mappings":"AAkDA,8EAA8E;AAC9E,MAAM,CAAC,MAAM,aAAa,GAAG,OAAO,CAAC"}
|
package/package.json
CHANGED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"uiFrameworks": [
|
|
3
|
+
{
|
|
4
|
+
"id": "daisyui",
|
|
5
|
+
"label": "daisyUI",
|
|
6
|
+
"hint": "Tailwind CSS 4 + daisyUI 5 components."
|
|
7
|
+
}
|
|
8
|
+
],
|
|
9
|
+
"examples": [
|
|
10
|
+
{
|
|
11
|
+
"id": "storefront",
|
|
12
|
+
"label": "Storefront",
|
|
13
|
+
"hint": "Home with a hero and a collection grid, product pages, cart and the checkout entry."
|
|
14
|
+
}
|
|
15
|
+
],
|
|
16
|
+
"templates": [
|
|
17
|
+
{
|
|
18
|
+
"uiFramework": "daisyui",
|
|
19
|
+
"example": "storefront",
|
|
20
|
+
"directory": "storefront"
|
|
21
|
+
}
|
|
22
|
+
]
|
|
23
|
+
}
|