@speedkit/cli 4.38.1 → 4.40.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/README.md +10 -1
- package/dist/commands/airports_iata.json +9202 -1
- package/dist/commands/generate-customer-config.d.ts +2 -0
- package/dist/commands/generate-customer-config.js +7 -1
- package/dist/services/customer-config/customer-config-service-build-context.d.ts +8 -0
- package/dist/services/customer-config/customer-config-service-build-context.js +8 -0
- package/dist/services/customer-config/customer-config-service-factory.js +3 -1
- package/dist/services/customer-config/customer-config-service.d.ts +10 -7
- package/dist/services/customer-config/customer-config-service.js +138 -308
- package/dist/services/customer-config/index.d.ts +2 -0
- package/dist/services/customer-config/index.js +2 -0
- package/dist/services/customer-config/spec/wizard-answers.spec.d.ts +1 -0
- package/dist/services/customer-config/spec/wizard-answers.spec.js +207 -0
- package/dist/services/customer-config/wizard-answers.d.ts +48 -0
- package/dist/services/customer-config/wizard-answers.js +67 -0
- package/dist/services/customer-config/wizard-questions.d.ts +86 -0
- package/dist/services/customer-config/wizard-questions.js +400 -0
- package/dist/services/document-handler-runtime/document-handler-abort.d.ts +44 -0
- package/dist/services/document-handler-runtime/document-handler-abort.js +48 -0
- package/dist/services/document-handler-runtime/document-handler-console.d.ts +45 -0
- package/dist/services/document-handler-runtime/document-handler-console.js +81 -0
- package/dist/services/document-handler-runtime/document-handler-server.js +3 -23
- package/dist/services/document-handler-runtime/spec/document-handler-abort.spec.js +57 -1
- package/dist/services/document-handler-runtime/spec/document-handler-console.spec.d.ts +1 -0
- package/dist/services/document-handler-runtime/spec/document-handler-console.spec.js +97 -0
- package/dist/services/onboarding/error/document-handler-transform-error.d.ts +2 -0
- package/dist/services/onboarding/error/document-handler-transform-error.js +3 -0
- package/dist/services/onboarding/virtual-orestes-app/index.d.ts +3 -0
- package/dist/services/onboarding/virtual-orestes-app/index.js +27 -2
- package/dist/templates/speedKit.Revalidated.js +5 -1
- package/oclif.manifest.json +98 -83
- package/package.json +1 -1
|
@@ -10,6 +10,8 @@ export default class GenerateCustomerConfig extends SkCommand<CustomerConfigServ
|
|
|
10
10
|
customersDirectory: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
11
|
templates: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
12
|
mode: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
|
+
answers: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
|
+
"print-questions": import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
13
15
|
};
|
|
14
16
|
run(): Promise<void>;
|
|
15
17
|
}
|
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
import { SkCommand } from "../base/sk-command.js";
|
|
2
|
-
import { CustomerConfigServiceBuildContext, CustomerConfigServiceFactory, } from "../services/customer-config/index.js";
|
|
2
|
+
import { CustomerConfigServiceBuildContext, CustomerConfigServiceFactory, describeWizardQuestions, } from "../services/customer-config/index.js";
|
|
3
3
|
export default class GenerateCustomerConfig extends SkCommand {
|
|
4
4
|
static description = "Generates a customer config guided by a wizard 🧙";
|
|
5
5
|
static examples = [
|
|
6
6
|
`$ sk generate-customer-config -a <app> -d <customersDirectory>`,
|
|
7
7
|
`$ sk generate-customer-config -a decathlon -d customers`,
|
|
8
|
+
`$ sk generate-customer-config --print-questions`,
|
|
9
|
+
`$ sk generate-customer-config -a decathlon --answers answers.json < /dev/null`,
|
|
8
10
|
];
|
|
9
11
|
static buildContext = CustomerConfigServiceBuildContext;
|
|
10
12
|
static args = CustomerConfigServiceBuildContext.args;
|
|
11
13
|
static flags = CustomerConfigServiceBuildContext.flags;
|
|
12
14
|
async run() {
|
|
15
|
+
if (this.context.printQuestions) {
|
|
16
|
+
this.environment.cli.pipe(`${JSON.stringify(describeWizardQuestions(this.config.version), null, 2)}\n`);
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
13
19
|
const customerConfigService = await new CustomerConfigServiceFactory(this.context).buildService();
|
|
14
20
|
await customerConfigService.generateConfig();
|
|
15
21
|
}
|
|
@@ -6,6 +6,8 @@ declare const flags: {
|
|
|
6
6
|
customersDirectory: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
|
|
7
7
|
templates: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
|
|
8
8
|
mode: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
|
|
9
|
+
answers: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
|
|
10
|
+
"print-questions": Interfaces.BooleanFlag<boolean>;
|
|
9
11
|
};
|
|
10
12
|
/** What `sk generate-customer-config` scaffolds, as the wizard reads it. */
|
|
11
13
|
export interface CustomerConfigOptions {
|
|
@@ -15,6 +17,10 @@ export interface CustomerConfigOptions {
|
|
|
15
17
|
readonly templatesPath?: string;
|
|
16
18
|
/** Template set = wizard mode: "customer-config" (default) or "pre-poc". */
|
|
17
19
|
readonly mode: string;
|
|
20
|
+
/** JSON file with the wizard answers; see WizardAnswers. */
|
|
21
|
+
readonly answersPath?: string;
|
|
22
|
+
/** Print the question table and exit. */
|
|
23
|
+
readonly printQuestions?: boolean;
|
|
18
24
|
}
|
|
19
25
|
export interface CustomerConfigServiceBuildContextValues extends CommandContextValues, CustomerConfigOptions {
|
|
20
26
|
}
|
|
@@ -27,6 +33,8 @@ export declare class CustomerConfigServiceBuildContext extends CustomerConfigSer
|
|
|
27
33
|
customersDirectory: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
|
|
28
34
|
templates: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
|
|
29
35
|
mode: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
|
|
36
|
+
answers: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
|
|
37
|
+
"print-questions": Interfaces.BooleanFlag<boolean>;
|
|
30
38
|
};
|
|
31
39
|
static create(parsedArgs: Interfaces.InferredArgs<typeof args>, parsedFlags: Interfaces.InferredFlags<typeof flags>, environment: CliEnvironment): CustomerConfigServiceBuildContext;
|
|
32
40
|
}
|
|
@@ -18,6 +18,12 @@ const flags = {
|
|
|
18
18
|
default: "customer-config",
|
|
19
19
|
description: "Which config to scaffold: the full acceleration config, or the tracking-only pre-PoC config",
|
|
20
20
|
}),
|
|
21
|
+
answers: Flags.string({
|
|
22
|
+
description: "JSON file with the wizard answers. The wizard then asks nothing: a missing key takes the question's default, and a question without one stops the run",
|
|
23
|
+
}),
|
|
24
|
+
"print-questions": Flags.boolean({
|
|
25
|
+
description: "Print every wizard question as JSON — key, type, choices, default, condition — and exit. The keys are the keys of --answers",
|
|
26
|
+
}),
|
|
21
27
|
};
|
|
22
28
|
/** What the customer config wizard is built from. */
|
|
23
29
|
export class CustomerConfigServiceBuildContext extends Context() {
|
|
@@ -30,6 +36,8 @@ export class CustomerConfigServiceBuildContext extends Context() {
|
|
|
30
36
|
customersDirectory: parsedFlags.customersDirectory ?? "customers",
|
|
31
37
|
templatesPath: parsedFlags.templates,
|
|
32
38
|
mode: parsedFlags.mode ?? "customer-config",
|
|
39
|
+
answersPath: parsedFlags.answers,
|
|
40
|
+
printQuestions: parsedFlags["print-questions"],
|
|
33
41
|
});
|
|
34
42
|
}
|
|
35
43
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { CustomerConfigService } from "./customer-config-service.js";
|
|
2
2
|
import { SiteAnalyzerServiceBuildContext, SiteAnalyzerServiceFactory, } from "./site-analyzer/index.js";
|
|
3
|
+
import { readWizardAnswers, WizardAnswerSource } from "./wizard-answers.js";
|
|
3
4
|
export class CustomerConfigServiceFactory {
|
|
4
5
|
context;
|
|
5
6
|
service;
|
|
@@ -16,6 +17,7 @@ export class CustomerConfigServiceFactory {
|
|
|
16
17
|
const context = this.context;
|
|
17
18
|
const cliService = context.environment.cli;
|
|
18
19
|
const siteAnalyzer = new SiteAnalyzerServiceFactory(new SiteAnalyzerServiceBuildContext({ environment: context.environment })).getService();
|
|
19
|
-
|
|
20
|
+
const answers = new WizardAnswerSource(context.answersPath ? readWizardAnswers(context.answersPath) : undefined);
|
|
21
|
+
this.service = new CustomerConfigService(context, cliService, siteAnalyzer, answers);
|
|
20
22
|
}
|
|
21
23
|
}
|
|
@@ -2,9 +2,11 @@ import { CliServiceInterface } from "../cli/index.js";
|
|
|
2
2
|
import { SiteAnalyzerService } from "./site-analyzer/index.js";
|
|
3
3
|
import { CustomerConfigOptions } from "./customer-config-service-build-context.js";
|
|
4
4
|
import { CustomerConfigSettings } from "./customer-config-service-model.js";
|
|
5
|
+
import { WizardAnswerSource } from "./wizard-answers.js";
|
|
5
6
|
export declare class CustomerConfigService {
|
|
6
7
|
private context;
|
|
7
8
|
private siteAnalyzer;
|
|
9
|
+
private answers;
|
|
8
10
|
private cli;
|
|
9
11
|
private _appName;
|
|
10
12
|
private _outputDirPath;
|
|
@@ -14,26 +16,27 @@ export declare class CustomerConfigService {
|
|
|
14
16
|
private get outputDirPath();
|
|
15
17
|
/** Set from the "Downtime Detection" feature answer in the wizard. */
|
|
16
18
|
private includeDowntimeDetection;
|
|
17
|
-
constructor(context: CustomerConfigOptions, cli: CliServiceInterface, siteAnalyzer: SiteAnalyzerService);
|
|
19
|
+
constructor(context: CustomerConfigOptions, cli: CliServiceInterface, siteAnalyzer: SiteAnalyzerService, answers?: WizardAnswerSource);
|
|
18
20
|
private getOutputDirPath;
|
|
19
21
|
private getOutputFileName;
|
|
20
22
|
private getPathWithChangedDir;
|
|
21
23
|
private isDirNotEmpty;
|
|
22
24
|
private chooseNewOutputDirectoryName;
|
|
23
|
-
/**
|
|
24
|
-
* Japanese customers sign off every rollout themselves, so the approval flag
|
|
25
|
-
* is preselected for them. A `.jp` host is the signal we have at this point.
|
|
26
|
-
*/
|
|
27
|
-
private isJapaneseHost;
|
|
28
25
|
/** A pre-PoC config marks itself via splitTestId "pre_poc" in config_SpeedKit.js. */
|
|
29
26
|
private isPrePocConfig;
|
|
30
27
|
/** Parks every config_* file as *_pre-poc (suffix before the extension). */
|
|
31
28
|
private renamePrePocFiles;
|
|
32
29
|
private selectOutputDirectory;
|
|
33
30
|
private compileTemplateFiles;
|
|
34
|
-
private getEnvironmentConfig;
|
|
35
31
|
private shouldFileBeOverwritten;
|
|
36
32
|
private getConfigSettings;
|
|
33
|
+
/** Takes the answer from the answers file, or asks it; then checks and records it. */
|
|
34
|
+
private answerQuestion;
|
|
35
|
+
/** The interactive prompt of one question. */
|
|
36
|
+
private ask;
|
|
37
|
+
private analyzeSite;
|
|
37
38
|
logWarnings(configSettings: CustomerConfigSettings): Promise<void>;
|
|
39
|
+
/** The answers that decide the scaffold; the output-directory answers stay out. */
|
|
40
|
+
private settingsAnswers;
|
|
38
41
|
generateConfig(): Promise<void>;
|
|
39
42
|
}
|