@wp-typia/project-tools 0.23.0 → 0.24.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/runtime/ai-feature-artifacts.js +4 -1
- package/dist/runtime/block-generator-service-spec.js +2 -1
- package/dist/runtime/built-in-block-non-ts-basic-artifacts.d.ts +9 -0
- package/dist/runtime/built-in-block-non-ts-basic-artifacts.js +84 -0
- package/dist/runtime/built-in-block-non-ts-compound-artifacts.d.ts +9 -0
- package/dist/runtime/built-in-block-non-ts-compound-artifacts.js +36 -0
- package/dist/runtime/built-in-block-non-ts-compound-templates.d.ts +23 -0
- package/dist/runtime/built-in-block-non-ts-compound-templates.js +453 -0
- package/dist/runtime/built-in-block-non-ts-family-artifacts.d.ts +8 -26
- package/dist/runtime/built-in-block-non-ts-family-artifacts.js +8 -1034
- package/dist/runtime/built-in-block-non-ts-interactivity-artifacts.d.ts +9 -0
- package/dist/runtime/built-in-block-non-ts-interactivity-artifacts.js +83 -0
- package/dist/runtime/built-in-block-non-ts-persistence-artifacts.d.ts +9 -0
- package/dist/runtime/built-in-block-non-ts-persistence-artifacts.js +33 -0
- package/dist/runtime/built-in-block-non-ts-persistence-templates.d.ts +23 -0
- package/dist/runtime/built-in-block-non-ts-persistence-templates.js +395 -0
- package/dist/runtime/cli-add-block-json.js +5 -1
- package/dist/runtime/cli-add-collision.js +8 -0
- package/dist/runtime/cli-add-help.js +14 -10
- package/dist/runtime/cli-add-kind-ids.d.ts +1 -1
- package/dist/runtime/cli-add-kind-ids.js +1 -0
- package/dist/runtime/cli-add-types.d.ts +45 -6
- package/dist/runtime/cli-add-types.js +2 -0
- package/dist/runtime/cli-add-validation.d.ts +7 -0
- package/dist/runtime/cli-add-validation.js +9 -0
- package/dist/runtime/cli-add-workspace-ability-anchors.d.ts +24 -0
- package/dist/runtime/cli-add-workspace-ability-anchors.js +294 -0
- package/dist/runtime/cli-add-workspace-ability-registry.d.ts +10 -0
- package/dist/runtime/cli-add-workspace-ability-registry.js +51 -0
- package/dist/runtime/cli-add-workspace-ability-scaffold.d.ts +1 -1
- package/dist/runtime/cli-add-workspace-ability-scaffold.js +5 -308
- package/dist/runtime/cli-add-workspace-admin-view-scaffold.js +6 -2
- package/dist/runtime/cli-add-workspace-admin-view-templates-core-data.d.ts +34 -0
- package/dist/runtime/cli-add-workspace-admin-view-templates-core-data.js +483 -0
- package/dist/runtime/cli-add-workspace-admin-view-templates-default.d.ts +30 -0
- package/dist/runtime/cli-add-workspace-admin-view-templates-default.js +310 -0
- package/dist/runtime/cli-add-workspace-admin-view-templates-rest.d.ts +25 -0
- package/dist/runtime/cli-add-workspace-admin-view-templates-rest.js +124 -0
- package/dist/runtime/cli-add-workspace-admin-view-templates-settings.d.ts +34 -0
- package/dist/runtime/cli-add-workspace-admin-view-templates-settings.js +370 -0
- package/dist/runtime/cli-add-workspace-admin-view-templates-shared.d.ts +49 -0
- package/dist/runtime/cli-add-workspace-admin-view-templates-shared.js +259 -0
- package/dist/runtime/cli-add-workspace-admin-view-templates.d.ts +18 -27
- package/dist/runtime/cli-add-workspace-admin-view-templates.js +30 -1326
- package/dist/runtime/cli-add-workspace-ai-anchors.d.ts +4 -4
- package/dist/runtime/cli-add-workspace-ai-anchors.js +8 -233
- package/dist/runtime/cli-add-workspace-ai-scaffold.js +4 -2
- package/dist/runtime/cli-add-workspace-ai-source-emitters.d.ts +1 -4
- package/dist/runtime/cli-add-workspace-ai-source-emitters.js +1 -129
- package/dist/runtime/cli-add-workspace-ai-sync-rest-anchors.d.ts +5 -0
- package/dist/runtime/cli-add-workspace-ai-sync-rest-anchors.js +236 -0
- package/dist/runtime/cli-add-workspace-ai-sync-script-source.d.ts +4 -0
- package/dist/runtime/cli-add-workspace-ai-sync-script-source.js +145 -0
- package/dist/runtime/cli-add-workspace-assets.d.ts +6 -63
- package/dist/runtime/cli-add-workspace-assets.js +6 -950
- package/dist/runtime/cli-add-workspace-binding-source-anchors.d.ts +23 -0
- package/dist/runtime/cli-add-workspace-binding-source-anchors.js +112 -0
- package/dist/runtime/cli-add-workspace-binding-source-source-emitters.d.ts +33 -0
- package/dist/runtime/cli-add-workspace-binding-source-source-emitters.js +436 -0
- package/dist/runtime/cli-add-workspace-binding-source-types.d.ts +20 -0
- package/dist/runtime/cli-add-workspace-binding-source-types.js +1 -0
- package/dist/runtime/cli-add-workspace-binding-source.d.ts +40 -0
- package/dist/runtime/cli-add-workspace-binding-source.js +275 -0
- package/dist/runtime/cli-add-workspace-block-style.d.ts +22 -0
- package/dist/runtime/cli-add-workspace-block-style.js +148 -0
- package/dist/runtime/cli-add-workspace-block-transform.d.ts +32 -0
- package/dist/runtime/cli-add-workspace-block-transform.js +197 -0
- package/dist/runtime/cli-add-workspace-contract.js +1 -1
- package/dist/runtime/cli-add-workspace-core-variation.d.ts +20 -0
- package/dist/runtime/cli-add-workspace-core-variation.js +322 -0
- package/dist/runtime/cli-add-workspace-editor-plugin-anchors.d.ts +37 -0
- package/dist/runtime/cli-add-workspace-editor-plugin-anchors.js +206 -0
- package/dist/runtime/cli-add-workspace-editor-plugin-source-emitters.d.ts +47 -0
- package/dist/runtime/cli-add-workspace-editor-plugin-source-emitters.js +219 -0
- package/dist/runtime/cli-add-workspace-editor-plugin.d.ts +22 -0
- package/dist/runtime/cli-add-workspace-editor-plugin.js +78 -0
- package/dist/runtime/cli-add-workspace-hooked-block.d.ts +23 -0
- package/dist/runtime/cli-add-workspace-hooked-block.js +57 -0
- package/dist/runtime/cli-add-workspace-integration-env-files.d.ts +33 -0
- package/dist/runtime/cli-add-workspace-integration-env-files.js +65 -0
- package/dist/runtime/cli-add-workspace-integration-env-package-json.d.ts +38 -0
- package/dist/runtime/cli-add-workspace-integration-env-package-json.js +122 -0
- package/dist/runtime/cli-add-workspace-integration-env-source-emitters.d.ts +44 -0
- package/dist/runtime/cli-add-workspace-integration-env-source-emitters.js +262 -0
- package/dist/runtime/cli-add-workspace-integration-env.d.ts +3 -1
- package/dist/runtime/cli-add-workspace-integration-env.js +10 -313
- package/dist/runtime/cli-add-workspace-pattern-anchors.d.ts +10 -0
- package/dist/runtime/cli-add-workspace-pattern-anchors.js +95 -0
- package/dist/runtime/cli-add-workspace-pattern-options.d.ts +20 -0
- package/dist/runtime/cli-add-workspace-pattern-options.js +113 -0
- package/dist/runtime/cli-add-workspace-pattern-source-emitters.d.ts +20 -0
- package/dist/runtime/cli-add-workspace-pattern-source-emitters.js +57 -0
- package/dist/runtime/cli-add-workspace-pattern.d.ts +42 -0
- package/dist/runtime/cli-add-workspace-pattern.js +99 -0
- package/dist/runtime/cli-add-workspace-post-meta.js +1 -1
- package/dist/runtime/cli-add-workspace-registration-hooks.d.ts +50 -0
- package/dist/runtime/cli-add-workspace-registration-hooks.js +162 -0
- package/dist/runtime/cli-add-workspace-rest-anchors.d.ts +9 -4
- package/dist/runtime/cli-add-workspace-rest-anchors.js +9 -428
- package/dist/runtime/cli-add-workspace-rest-bootstrap-anchors.d.ts +17 -0
- package/dist/runtime/cli-add-workspace-rest-bootstrap-anchors.js +108 -0
- package/dist/runtime/cli-add-workspace-rest-contract-sync-anchors.d.ts +9 -0
- package/dist/runtime/cli-add-workspace-rest-contract-sync-anchors.js +142 -0
- package/dist/runtime/cli-add-workspace-rest-generated-source-emitters.d.ts +51 -0
- package/dist/runtime/cli-add-workspace-rest-generated-source-emitters.js +415 -0
- package/dist/runtime/cli-add-workspace-rest-generated.d.ts +9 -0
- package/dist/runtime/cli-add-workspace-rest-generated.js +160 -0
- package/dist/runtime/cli-add-workspace-rest-manual-source-emitters.d.ts +80 -0
- package/dist/runtime/cli-add-workspace-rest-manual-source-emitters.js +238 -0
- package/dist/runtime/cli-add-workspace-rest-manual.d.ts +8 -0
- package/dist/runtime/cli-add-workspace-rest-manual.js +266 -0
- package/dist/runtime/cli-add-workspace-rest-php-templates.d.ts +18 -0
- package/dist/runtime/cli-add-workspace-rest-php-templates.js +359 -0
- package/dist/runtime/cli-add-workspace-rest-resource-php-routing-template.d.ts +33 -0
- package/dist/runtime/cli-add-workspace-rest-resource-php-routing-template.js +145 -0
- package/dist/runtime/cli-add-workspace-rest-resource-sync-anchors.d.ts +9 -0
- package/dist/runtime/cli-add-workspace-rest-resource-sync-anchors.js +162 -0
- package/dist/runtime/cli-add-workspace-rest-schema-helper-php-template.d.ts +7 -0
- package/dist/runtime/cli-add-workspace-rest-schema-helper-php-template.js +193 -0
- package/dist/runtime/cli-add-workspace-rest-source-emitters.d.ts +5 -91
- package/dist/runtime/cli-add-workspace-rest-source-emitters.js +5 -642
- package/dist/runtime/cli-add-workspace-rest-source-utils.d.ts +17 -0
- package/dist/runtime/cli-add-workspace-rest-source-utils.js +50 -0
- package/dist/runtime/cli-add-workspace-rest-sync-script-shared.d.ts +56 -0
- package/dist/runtime/cli-add-workspace-rest-sync-script-shared.js +122 -0
- package/dist/runtime/cli-add-workspace-rest-types.d.ts +108 -0
- package/dist/runtime/cli-add-workspace-rest-types.js +1 -0
- package/dist/runtime/cli-add-workspace-rest.d.ts +3 -20
- package/dist/runtime/cli-add-workspace-rest.js +33 -788
- package/dist/runtime/cli-add-workspace-variation.d.ts +22 -0
- package/dist/runtime/cli-add-workspace-variation.js +162 -0
- package/dist/runtime/cli-add-workspace.d.ts +42 -107
- package/dist/runtime/cli-add-workspace.js +42 -674
- package/dist/runtime/cli-add.d.ts +3 -3
- package/dist/runtime/cli-add.js +2 -2
- package/dist/runtime/cli-core.d.ts +3 -2
- package/dist/runtime/cli-core.js +2 -2
- package/dist/runtime/cli-diagnostics.d.ts +3 -1
- package/dist/runtime/cli-diagnostics.js +17 -5
- package/dist/runtime/cli-doctor-workspace-bindings.js +63 -1
- package/dist/runtime/cli-doctor-workspace-block-addons.d.ts +12 -0
- package/dist/runtime/cli-doctor-workspace-block-addons.js +162 -0
- package/dist/runtime/cli-doctor-workspace-block-iframe.d.ts +9 -0
- package/dist/runtime/cli-doctor-workspace-block-iframe.js +228 -0
- package/dist/runtime/cli-doctor-workspace-block-metadata.d.ts +11 -0
- package/dist/runtime/cli-doctor-workspace-block-metadata.js +111 -0
- package/dist/runtime/cli-doctor-workspace-blocks.js +6 -424
- package/dist/runtime/cli-doctor-workspace-features-abilities.d.ts +11 -0
- package/dist/runtime/cli-doctor-workspace-features-abilities.js +112 -0
- package/dist/runtime/cli-doctor-workspace-features-admin-views.d.ts +11 -0
- package/dist/runtime/cli-doctor-workspace-features-admin-views.js +128 -0
- package/dist/runtime/cli-doctor-workspace-features-ai.d.ts +11 -0
- package/dist/runtime/cli-doctor-workspace-features-ai.js +57 -0
- package/dist/runtime/cli-doctor-workspace-features-editor-plugins.d.ts +11 -0
- package/dist/runtime/cli-doctor-workspace-features-editor-plugins.js +80 -0
- package/dist/runtime/cli-doctor-workspace-features-post-meta.d.ts +11 -0
- package/dist/runtime/cli-doctor-workspace-features-post-meta.js +77 -0
- package/dist/runtime/cli-doctor-workspace-features-rest.d.ts +11 -0
- package/dist/runtime/cli-doctor-workspace-features-rest.js +120 -0
- package/dist/runtime/cli-doctor-workspace-features.js +14 -487
- package/dist/runtime/cli-doctor.d.ts +54 -3
- package/dist/runtime/cli-doctor.js +92 -10
- package/dist/runtime/cli-help.js +12 -7
- package/dist/runtime/cli-init-package-json.js +4 -2
- package/dist/runtime/cli-prompt.d.ts +16 -2
- package/dist/runtime/cli-prompt.js +29 -12
- package/dist/runtime/cli-scaffold.d.ts +2 -1
- package/dist/runtime/cli-scaffold.js +19 -10
- package/dist/runtime/external-template-guards.js +4 -6
- package/dist/runtime/index.d.ts +6 -3
- package/dist/runtime/index.js +4 -2
- package/dist/runtime/json-utils.d.ts +62 -4
- package/dist/runtime/json-utils.js +78 -4
- package/dist/runtime/local-dev-presets.js +6 -2
- package/dist/runtime/migration-ui-capability.js +4 -1
- package/dist/runtime/migration-utils.js +4 -1
- package/dist/runtime/package-managers.js +6 -1
- package/dist/runtime/package-versions.d.ts +1 -0
- package/dist/runtime/package-versions.js +16 -3
- package/dist/runtime/pattern-catalog.d.ts +122 -0
- package/dist/runtime/pattern-catalog.js +471 -0
- package/dist/runtime/post-meta-binding-fields.d.ts +46 -0
- package/dist/runtime/post-meta-binding-fields.js +135 -0
- package/dist/runtime/scaffold-bootstrap.js +7 -2
- package/dist/runtime/scaffold-package-manager-files.js +5 -1
- package/dist/runtime/scaffold-repository-reference.js +4 -2
- package/dist/runtime/scaffold-template-variables.js +2 -1
- package/dist/runtime/scaffold.d.ts +18 -1
- package/dist/runtime/scaffold.js +55 -2
- package/dist/runtime/temp-roots.js +4 -1
- package/dist/runtime/template-layers.js +4 -1
- package/dist/runtime/template-registry.js +9 -3
- package/dist/runtime/template-source-contracts.d.ts +2 -0
- package/dist/runtime/template-source-normalization.js +2 -1
- package/dist/runtime/template-source-remote.js +18 -5
- package/dist/runtime/template-source-seeds.js +10 -3
- package/dist/runtime/typia-llm-json-schema.d.ts +24 -0
- package/dist/runtime/typia-llm-json-schema.js +33 -0
- package/dist/runtime/typia-llm-openapi-constraints.d.ts +20 -0
- package/dist/runtime/typia-llm-openapi-constraints.js +254 -0
- package/dist/runtime/typia-llm-projection.d.ts +25 -0
- package/dist/runtime/typia-llm-projection.js +58 -0
- package/dist/runtime/typia-llm-render.d.ts +21 -0
- package/dist/runtime/typia-llm-render.js +252 -0
- package/dist/runtime/typia-llm-sync.d.ts +10 -0
- package/dist/runtime/typia-llm-sync.js +63 -0
- package/dist/runtime/typia-llm-types.d.ts +197 -0
- package/dist/runtime/typia-llm-types.js +1 -0
- package/dist/runtime/typia-llm.d.ts +9 -255
- package/dist/runtime/typia-llm.js +5 -634
- package/dist/runtime/workspace-inventory-mutations.js +15 -1
- package/dist/runtime/workspace-inventory-parser-entries.d.ts +17 -0
- package/dist/runtime/workspace-inventory-parser-entries.js +157 -0
- package/dist/runtime/workspace-inventory-parser-validation.d.ts +104 -0
- package/dist/runtime/workspace-inventory-parser-validation.js +34 -0
- package/dist/runtime/workspace-inventory-parser.d.ts +3 -45
- package/dist/runtime/workspace-inventory-parser.js +3 -581
- package/dist/runtime/workspace-inventory-section-descriptors.d.ts +19 -0
- package/dist/runtime/workspace-inventory-section-descriptors.js +443 -0
- package/dist/runtime/workspace-inventory-templates.d.ts +3 -3
- package/dist/runtime/workspace-inventory-templates.js +10 -1
- package/dist/runtime/workspace-inventory-types.d.ts +10 -1
- package/dist/runtime/workspace-project.js +4 -6
- package/package.json +8 -3
- package/templates/_shared/compound/core/scripts/block-config.ts.mustache +22 -0
- package/templates/_shared/compound/core/scripts/sync-types-to-block-json.ts.mustache +103 -2
- package/templates/_shared/compound/core/src/inner-blocks-templates.ts.mustache +13 -0
- package/templates/_shared/compound/persistence/scripts/block-config.ts.mustache +22 -1
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Append only missing lines to an existing text file, preserving any existing
|
|
3
|
+
* user-managed content.
|
|
4
|
+
*
|
|
5
|
+
* @param filePath Absolute file path to append.
|
|
6
|
+
* @param lines Lines that should be present in the file.
|
|
7
|
+
* @returns A promise that resolves after the file is created or updated.
|
|
8
|
+
*/
|
|
9
|
+
export declare function appendMissingLines(filePath: string, lines: readonly string[]): Promise<void>;
|
|
10
|
+
/**
|
|
11
|
+
* Write a generated file only when it is absent, recording a preservation
|
|
12
|
+
* warning when the target already exists.
|
|
13
|
+
*
|
|
14
|
+
* @param options File write options.
|
|
15
|
+
* @param options.filePath Absolute target file path.
|
|
16
|
+
* @param options.source Generated source to write when absent.
|
|
17
|
+
* @param options.warnings Mutable warning collection for preserved files.
|
|
18
|
+
* @returns A promise that resolves after the file is written or preserved.
|
|
19
|
+
*/
|
|
20
|
+
export declare function writeFileIfAbsent({ filePath, source, warnings, }: {
|
|
21
|
+
filePath: string;
|
|
22
|
+
source: string;
|
|
23
|
+
warnings: string[];
|
|
24
|
+
}): Promise<void>;
|
|
25
|
+
/**
|
|
26
|
+
* Write a newly generated scaffold file and fail if the target already exists.
|
|
27
|
+
*
|
|
28
|
+
* @param filePath Absolute target file path.
|
|
29
|
+
* @param source Generated source to write.
|
|
30
|
+
* @returns A promise that resolves after the file is written.
|
|
31
|
+
* @throws {Error} When the scaffold target already exists.
|
|
32
|
+
*/
|
|
33
|
+
export declare function writeNewScaffoldFile(filePath: string, source: string): Promise<void>;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { promises as fsp } from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { readOptionalUtf8File } from "./fs-async.js";
|
|
4
|
+
/**
|
|
5
|
+
* Append only missing lines to an existing text file, preserving any existing
|
|
6
|
+
* user-managed content.
|
|
7
|
+
*
|
|
8
|
+
* @param filePath Absolute file path to append.
|
|
9
|
+
* @param lines Lines that should be present in the file.
|
|
10
|
+
* @returns A promise that resolves after the file is created or updated.
|
|
11
|
+
*/
|
|
12
|
+
export async function appendMissingLines(filePath, lines) {
|
|
13
|
+
const current = (await readOptionalUtf8File(filePath)) ?? "";
|
|
14
|
+
const existingLines = new Set(current.split(/\r?\n/u));
|
|
15
|
+
const missingLines = lines.filter((line) => !existingLines.has(line));
|
|
16
|
+
if (missingLines.length === 0) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
const separator = current.length === 0 || current.endsWith("\n") ? "" : "\n";
|
|
20
|
+
await fsp.mkdir(path.dirname(filePath), { recursive: true });
|
|
21
|
+
await fsp.writeFile(filePath, `${current}${separator}${missingLines.join("\n")}\n`, "utf8");
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Write a generated file only when it is absent, recording a preservation
|
|
25
|
+
* warning when the target already exists.
|
|
26
|
+
*
|
|
27
|
+
* @param options File write options.
|
|
28
|
+
* @param options.filePath Absolute target file path.
|
|
29
|
+
* @param options.source Generated source to write when absent.
|
|
30
|
+
* @param options.warnings Mutable warning collection for preserved files.
|
|
31
|
+
* @returns A promise that resolves after the file is written or preserved.
|
|
32
|
+
*/
|
|
33
|
+
export async function writeFileIfAbsent({ filePath, source, warnings, }) {
|
|
34
|
+
await fsp.mkdir(path.dirname(filePath), { recursive: true });
|
|
35
|
+
try {
|
|
36
|
+
await fsp.writeFile(filePath, source, { encoding: "utf8", flag: "wx" });
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
if (error.code === "EEXIST") {
|
|
40
|
+
warnings.push(`Preserved existing ${path.basename(filePath)}; review it manually if you need different local integration settings.`);
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
throw error;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Write a newly generated scaffold file and fail if the target already exists.
|
|
48
|
+
*
|
|
49
|
+
* @param filePath Absolute target file path.
|
|
50
|
+
* @param source Generated source to write.
|
|
51
|
+
* @returns A promise that resolves after the file is written.
|
|
52
|
+
* @throws {Error} When the scaffold target already exists.
|
|
53
|
+
*/
|
|
54
|
+
export async function writeNewScaffoldFile(filePath, source) {
|
|
55
|
+
await fsp.mkdir(path.dirname(filePath), { recursive: true });
|
|
56
|
+
try {
|
|
57
|
+
await fsp.writeFile(filePath, source, { encoding: "utf8", flag: "wx" });
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
60
|
+
if (error.code === "EEXIST") {
|
|
61
|
+
throw new Error(`An integration environment scaffold already exists at ${filePath}. Choose a different name.`);
|
|
62
|
+
}
|
|
63
|
+
throw error;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { IntegrationEnvServiceId } from "./cli-add-shared.js";
|
|
2
|
+
import { type PackageManagerId } from "./package-managers.js";
|
|
3
|
+
interface IntegrationEnvPackageJson {
|
|
4
|
+
devDependencies?: Record<string, string>;
|
|
5
|
+
scripts?: Record<string, string>;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Read, mutate, and persist a workspace package manifest for integration-env
|
|
9
|
+
* scaffolding.
|
|
10
|
+
*
|
|
11
|
+
* @param projectDir Absolute official workspace project directory.
|
|
12
|
+
* @param mutate Callback that mutates the parsed package manifest.
|
|
13
|
+
* @returns A promise that resolves after `package.json` is written.
|
|
14
|
+
*/
|
|
15
|
+
export declare function mutateIntegrationEnvPackageJson(projectDir: string, mutate: (packageJson: IntegrationEnvPackageJson) => void): Promise<void>;
|
|
16
|
+
/**
|
|
17
|
+
* Add integration-env dev dependency and package scripts when they are missing,
|
|
18
|
+
* preserving user-defined script values with warnings.
|
|
19
|
+
*
|
|
20
|
+
* @param options Package mutation options.
|
|
21
|
+
* @param options.integrationEnvSlug Normalized integration environment slug.
|
|
22
|
+
* @param options.packageManager Package manager used for generated run scripts.
|
|
23
|
+
* @param options.packageJson Mutable parsed workspace package manifest.
|
|
24
|
+
* @param options.service Selected optional local service starter.
|
|
25
|
+
* @param options.withReleaseZip Whether release zip package scripts should be added.
|
|
26
|
+
* @param options.warnings Mutable warning collection for preserved script values.
|
|
27
|
+
* @param options.withWpEnv Whether wp-env scripts and dependency should be added.
|
|
28
|
+
*/
|
|
29
|
+
export declare function addIntegrationEnvPackageJsonEntries({ integrationEnvSlug, packageManager, packageJson, withReleaseZip, service, warnings, withWpEnv, }: {
|
|
30
|
+
integrationEnvSlug: string;
|
|
31
|
+
packageManager: PackageManagerId;
|
|
32
|
+
packageJson: IntegrationEnvPackageJson;
|
|
33
|
+
service: IntegrationEnvServiceId;
|
|
34
|
+
withReleaseZip: boolean;
|
|
35
|
+
warnings: string[];
|
|
36
|
+
withWpEnv: boolean;
|
|
37
|
+
}): void;
|
|
38
|
+
export {};
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { promises as fsp } from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { readJsonFile } from "./json-utils.js";
|
|
4
|
+
import { formatRunScript, } from "./package-managers.js";
|
|
5
|
+
import { DEFAULT_WORDPRESS_ENV_VERSION } from "./package-versions.js";
|
|
6
|
+
function addScriptIfMissing({ scriptName, scripts, scriptValue, warnings, }) {
|
|
7
|
+
if (scripts[scriptName] === undefined) {
|
|
8
|
+
scripts[scriptName] = scriptValue;
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
if (scripts[scriptName] !== scriptValue) {
|
|
12
|
+
warnings.push(`Preserved existing package script "${scriptName}"; add "${scriptValue}" manually if you want the generated integration command.`);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Read, mutate, and persist a workspace package manifest for integration-env
|
|
17
|
+
* scaffolding.
|
|
18
|
+
*
|
|
19
|
+
* @param projectDir Absolute official workspace project directory.
|
|
20
|
+
* @param mutate Callback that mutates the parsed package manifest.
|
|
21
|
+
* @returns A promise that resolves after `package.json` is written.
|
|
22
|
+
*/
|
|
23
|
+
export async function mutateIntegrationEnvPackageJson(projectDir, mutate) {
|
|
24
|
+
const packageJsonPath = path.join(projectDir, "package.json");
|
|
25
|
+
const packageJson = await readJsonFile(packageJsonPath, {
|
|
26
|
+
context: "integration env package manifest",
|
|
27
|
+
});
|
|
28
|
+
mutate(packageJson);
|
|
29
|
+
await fsp.writeFile(packageJsonPath, `${JSON.stringify(packageJson, null, "\t")}\n`, "utf8");
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Add integration-env dev dependency and package scripts when they are missing,
|
|
33
|
+
* preserving user-defined script values with warnings.
|
|
34
|
+
*
|
|
35
|
+
* @param options Package mutation options.
|
|
36
|
+
* @param options.integrationEnvSlug Normalized integration environment slug.
|
|
37
|
+
* @param options.packageManager Package manager used for generated run scripts.
|
|
38
|
+
* @param options.packageJson Mutable parsed workspace package manifest.
|
|
39
|
+
* @param options.service Selected optional local service starter.
|
|
40
|
+
* @param options.withReleaseZip Whether release zip package scripts should be added.
|
|
41
|
+
* @param options.warnings Mutable warning collection for preserved script values.
|
|
42
|
+
* @param options.withWpEnv Whether wp-env scripts and dependency should be added.
|
|
43
|
+
*/
|
|
44
|
+
export function addIntegrationEnvPackageJsonEntries({ integrationEnvSlug, packageManager, packageJson, withReleaseZip, service, warnings, withWpEnv, }) {
|
|
45
|
+
const devDependencies = {
|
|
46
|
+
...(packageJson.devDependencies ?? {}),
|
|
47
|
+
};
|
|
48
|
+
if (withWpEnv && devDependencies["@wordpress/env"] === undefined) {
|
|
49
|
+
devDependencies["@wordpress/env"] = DEFAULT_WORDPRESS_ENV_VERSION;
|
|
50
|
+
}
|
|
51
|
+
packageJson.devDependencies = devDependencies;
|
|
52
|
+
const scripts = {
|
|
53
|
+
...(packageJson.scripts ?? {}),
|
|
54
|
+
};
|
|
55
|
+
addScriptIfMissing({
|
|
56
|
+
scriptName: `smoke:${integrationEnvSlug}`,
|
|
57
|
+
scriptValue: `node scripts/integration-smoke/${integrationEnvSlug}.mjs`,
|
|
58
|
+
scripts,
|
|
59
|
+
warnings,
|
|
60
|
+
});
|
|
61
|
+
addScriptIfMissing({
|
|
62
|
+
scriptName: "smoke:integration",
|
|
63
|
+
scriptValue: formatRunScript(packageManager, `smoke:${integrationEnvSlug}`),
|
|
64
|
+
scripts,
|
|
65
|
+
warnings,
|
|
66
|
+
});
|
|
67
|
+
if (withWpEnv) {
|
|
68
|
+
addScriptIfMissing({
|
|
69
|
+
scriptName: "wp-env:start",
|
|
70
|
+
scriptValue: "wp-env start",
|
|
71
|
+
scripts,
|
|
72
|
+
warnings,
|
|
73
|
+
});
|
|
74
|
+
addScriptIfMissing({
|
|
75
|
+
scriptName: "wp-env:stop",
|
|
76
|
+
scriptValue: "wp-env stop",
|
|
77
|
+
scripts,
|
|
78
|
+
warnings,
|
|
79
|
+
});
|
|
80
|
+
addScriptIfMissing({
|
|
81
|
+
scriptName: "wp-env:reset",
|
|
82
|
+
scriptValue: "wp-env destroy all && wp-env start",
|
|
83
|
+
scripts,
|
|
84
|
+
warnings,
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
if (withReleaseZip) {
|
|
88
|
+
addScriptIfMissing({
|
|
89
|
+
scriptName: "release:zip",
|
|
90
|
+
scriptValue: `${formatRunScript(packageManager, "sync-rest:package")} && ${formatRunScript(packageManager, "build")} && wp-scripts plugin-zip`,
|
|
91
|
+
scripts,
|
|
92
|
+
warnings,
|
|
93
|
+
});
|
|
94
|
+
addScriptIfMissing({
|
|
95
|
+
scriptName: "release:zip:check",
|
|
96
|
+
scriptValue: `${formatRunScript(packageManager, "sync-rest:package:check")} && ${formatRunScript(packageManager, "build")}`,
|
|
97
|
+
scripts,
|
|
98
|
+
warnings,
|
|
99
|
+
});
|
|
100
|
+
addScriptIfMissing({
|
|
101
|
+
scriptName: "qa:check",
|
|
102
|
+
scriptValue: `${formatRunScript(packageManager, "wp-typia:doctor:workspace")} && ${formatRunScript(packageManager, "release:zip:check")}`,
|
|
103
|
+
scripts,
|
|
104
|
+
warnings,
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
if (service === "docker-compose") {
|
|
108
|
+
addScriptIfMissing({
|
|
109
|
+
scriptName: "service:start",
|
|
110
|
+
scriptValue: "docker compose -f docker-compose.integration.yml up -d",
|
|
111
|
+
scripts,
|
|
112
|
+
warnings,
|
|
113
|
+
});
|
|
114
|
+
addScriptIfMissing({
|
|
115
|
+
scriptName: "service:stop",
|
|
116
|
+
scriptValue: "docker compose -f docker-compose.integration.yml down",
|
|
117
|
+
scripts,
|
|
118
|
+
warnings,
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
packageJson.scripts = scripts;
|
|
122
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { IntegrationEnvServiceId } from "./cli-add-shared.js";
|
|
2
|
+
/**
|
|
3
|
+
* Render the default `@wordpress/env` configuration for an integration
|
|
4
|
+
* environment starter.
|
|
5
|
+
*
|
|
6
|
+
* @returns JSON source for `.wp-env.json`.
|
|
7
|
+
*/
|
|
8
|
+
export declare function buildWpEnvConfigSource(): string;
|
|
9
|
+
/**
|
|
10
|
+
* Render the placeholder docker-compose service used by the integration starter.
|
|
11
|
+
*
|
|
12
|
+
* @returns YAML source for `docker-compose.integration.yml`.
|
|
13
|
+
*/
|
|
14
|
+
export declare function buildDockerComposeSource(): string;
|
|
15
|
+
/**
|
|
16
|
+
* Render the editable Node smoke-test starter for a workspace.
|
|
17
|
+
*
|
|
18
|
+
* @param integrationEnvSlug Normalized integration environment slug.
|
|
19
|
+
* @returns JavaScript module source for the generated smoke runner.
|
|
20
|
+
*/
|
|
21
|
+
export declare function buildIntegrationSmokeScriptSource(integrationEnvSlug: string): string;
|
|
22
|
+
/**
|
|
23
|
+
* Render safe default environment variables for integration smoke checks.
|
|
24
|
+
*
|
|
25
|
+
* @param service Selected optional local service starter.
|
|
26
|
+
* @returns Source for entries appended to `.env.example`.
|
|
27
|
+
*/
|
|
28
|
+
export declare function buildEnvExampleSource(service: IntegrationEnvServiceId): string;
|
|
29
|
+
/**
|
|
30
|
+
* Render integration environment onboarding documentation.
|
|
31
|
+
*
|
|
32
|
+
* @param options Integration environment documentation options.
|
|
33
|
+
* @param options.integrationEnvSlug Normalized integration environment slug.
|
|
34
|
+
* @param options.service Selected optional local service starter.
|
|
35
|
+
* @param options.withReleaseZip Whether release zip scripts were scaffolded.
|
|
36
|
+
* @param options.withWpEnv Whether wp-env setup was scaffolded.
|
|
37
|
+
* @returns Markdown source for the generated integration environment guide.
|
|
38
|
+
*/
|
|
39
|
+
export declare function buildIntegrationEnvReadmeSource({ integrationEnvSlug, service, withReleaseZip, withWpEnv, }: {
|
|
40
|
+
integrationEnvSlug: string;
|
|
41
|
+
service: IntegrationEnvServiceId;
|
|
42
|
+
withReleaseZip: boolean;
|
|
43
|
+
withWpEnv: boolean;
|
|
44
|
+
}): string;
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
import { toTitleCase } from "./string-case.js";
|
|
2
|
+
/**
|
|
3
|
+
* Render the default `@wordpress/env` configuration for an integration
|
|
4
|
+
* environment starter.
|
|
5
|
+
*
|
|
6
|
+
* @returns JSON source for `.wp-env.json`.
|
|
7
|
+
*/
|
|
8
|
+
export function buildWpEnvConfigSource() {
|
|
9
|
+
return `${JSON.stringify({
|
|
10
|
+
$schema: "https://schemas.wp.org/trunk/wp-env.json",
|
|
11
|
+
core: null,
|
|
12
|
+
port: 8888,
|
|
13
|
+
testsEnvironment: false,
|
|
14
|
+
plugins: ["."],
|
|
15
|
+
config: {
|
|
16
|
+
WP_DEBUG: true,
|
|
17
|
+
WP_DEBUG_LOG: true,
|
|
18
|
+
WP_DEBUG_DISPLAY: false,
|
|
19
|
+
SCRIPT_DEBUG: true,
|
|
20
|
+
WP_ENVIRONMENT_TYPE: "local",
|
|
21
|
+
},
|
|
22
|
+
}, null, 2)}\n`;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Render the placeholder docker-compose service used by the integration starter.
|
|
26
|
+
*
|
|
27
|
+
* @returns YAML source for `docker-compose.integration.yml`.
|
|
28
|
+
*/
|
|
29
|
+
export function buildDockerComposeSource() {
|
|
30
|
+
return `services:
|
|
31
|
+
integration-service:
|
|
32
|
+
image: node:22-alpine
|
|
33
|
+
working_dir: /workspace
|
|
34
|
+
volumes:
|
|
35
|
+
- .:/workspace
|
|
36
|
+
command: >
|
|
37
|
+
node -e "require('node:http').createServer((request, response) => {
|
|
38
|
+
response.writeHead(request.url === '/health' ? 200 : 404, {
|
|
39
|
+
'content-type': 'application/json'
|
|
40
|
+
});
|
|
41
|
+
response.end(JSON.stringify({
|
|
42
|
+
ok: request.url === '/health',
|
|
43
|
+
service: 'wp-typia-integration-starter'
|
|
44
|
+
}));
|
|
45
|
+
}).listen(3000, '0.0.0.0')"
|
|
46
|
+
ports:
|
|
47
|
+
- "3000:3000"
|
|
48
|
+
`;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Render the editable Node smoke-test starter for a workspace.
|
|
52
|
+
*
|
|
53
|
+
* @param integrationEnvSlug Normalized integration environment slug.
|
|
54
|
+
* @returns JavaScript module source for the generated smoke runner.
|
|
55
|
+
*/
|
|
56
|
+
export function buildIntegrationSmokeScriptSource(integrationEnvSlug) {
|
|
57
|
+
return `import fs from "node:fs";
|
|
58
|
+
import path from "node:path";
|
|
59
|
+
import { fileURLToPath } from "node:url";
|
|
60
|
+
|
|
61
|
+
const ROOT_DIR = path.resolve(
|
|
62
|
+
fileURLToPath(new URL("../..", import.meta.url)),
|
|
63
|
+
);
|
|
64
|
+
const ENV_FILE = path.join(ROOT_DIR, ".env");
|
|
65
|
+
|
|
66
|
+
function parseEnvValue(value) {
|
|
67
|
+
const trimmed = value.trim();
|
|
68
|
+
if (
|
|
69
|
+
(trimmed.startsWith('"') && trimmed.endsWith('"')) ||
|
|
70
|
+
(trimmed.startsWith("'") && trimmed.endsWith("'"))
|
|
71
|
+
) {
|
|
72
|
+
return trimmed.slice(1, -1);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return trimmed;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function readEnvFile(filePath) {
|
|
79
|
+
if (!fs.existsSync(filePath)) {
|
|
80
|
+
return {};
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return Object.fromEntries(
|
|
84
|
+
fs
|
|
85
|
+
.readFileSync(filePath, "utf8")
|
|
86
|
+
.split(/\\r?\\n/u)
|
|
87
|
+
.map((line) => line.trim())
|
|
88
|
+
.filter((line) => line.length > 0 && !line.startsWith("#"))
|
|
89
|
+
.map((line) => {
|
|
90
|
+
const separatorIndex = line.indexOf("=");
|
|
91
|
+
if (separatorIndex === -1) {
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return [
|
|
96
|
+
line.slice(0, separatorIndex).trim(),
|
|
97
|
+
parseEnvValue(line.slice(separatorIndex + 1)),
|
|
98
|
+
];
|
|
99
|
+
})
|
|
100
|
+
.filter(Boolean),
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
const envFile = readEnvFile(ENV_FILE);
|
|
105
|
+
|
|
106
|
+
function getEnv(name, fallback) {
|
|
107
|
+
return process.env[name] ?? envFile[name] ?? fallback;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function getPositiveIntegerEnv(name, fallback) {
|
|
111
|
+
const value = Number.parseInt(getEnv(name, String(fallback)), 10);
|
|
112
|
+
return Number.isFinite(value) && value > 0 ? value : fallback;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function resolveEndpointUrl(baseUrl, endpointPath) {
|
|
116
|
+
const normalizedBaseUrl = new URL(baseUrl);
|
|
117
|
+
if (!normalizedBaseUrl.pathname.endsWith("/")) {
|
|
118
|
+
normalizedBaseUrl.pathname = \`\${normalizedBaseUrl.pathname}/\`;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
const relativePath = endpointPath.replace(/^\\/+/u, "");
|
|
122
|
+
return new URL(relativePath, normalizedBaseUrl);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
async function assertJsonEndpoint(label, url) {
|
|
126
|
+
const requestTimeoutMs = getPositiveIntegerEnv(
|
|
127
|
+
"WP_TYPIA_SMOKE_TIMEOUT_MS",
|
|
128
|
+
30_000,
|
|
129
|
+
);
|
|
130
|
+
const response = await fetch(url, {
|
|
131
|
+
headers: {
|
|
132
|
+
accept: "application/json",
|
|
133
|
+
},
|
|
134
|
+
signal: AbortSignal.timeout(requestTimeoutMs),
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
if (!response.ok) {
|
|
138
|
+
throw new Error(
|
|
139
|
+
\`\${label} failed at \${url} with HTTP \${response.status}.\`,
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
const contentType = response.headers.get("content-type") ?? "";
|
|
144
|
+
if (!contentType.includes("application/json")) {
|
|
145
|
+
throw new Error(
|
|
146
|
+
\`\${label} at \${url} did not return JSON (content-type: \${contentType || "missing"}).\`,
|
|
147
|
+
);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
return response.json();
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
const baseUrl = new URL(
|
|
154
|
+
getEnv("WP_TYPIA_SMOKE_BASE_URL", "http://localhost:8888"),
|
|
155
|
+
);
|
|
156
|
+
const serviceUrl = getEnv("WP_TYPIA_SERVICE_URL", "").trim();
|
|
157
|
+
|
|
158
|
+
// Extend this starter with project-specific generated REST clients or schema
|
|
159
|
+
// checks as the workspace grows. For example, read JSON schemas under
|
|
160
|
+
// src/rest/<resource>/api-schemas or import TS clients through a tsx-powered
|
|
161
|
+
// smoke runner when you need authenticated route coverage.
|
|
162
|
+
|
|
163
|
+
await assertJsonEndpoint(
|
|
164
|
+
"WordPress REST index",
|
|
165
|
+
resolveEndpointUrl(baseUrl, "wp-json/"),
|
|
166
|
+
);
|
|
167
|
+
|
|
168
|
+
if (serviceUrl.length > 0) {
|
|
169
|
+
await assertJsonEndpoint(
|
|
170
|
+
"Local integration service healthcheck",
|
|
171
|
+
resolveEndpointUrl(serviceUrl, "health"),
|
|
172
|
+
);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
console.log("wp-typia integration smoke passed: ${integrationEnvSlug}");
|
|
176
|
+
`;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Render safe default environment variables for integration smoke checks.
|
|
180
|
+
*
|
|
181
|
+
* @param service Selected optional local service starter.
|
|
182
|
+
* @returns Source for entries appended to `.env.example`.
|
|
183
|
+
*/
|
|
184
|
+
export function buildEnvExampleSource(service) {
|
|
185
|
+
return [
|
|
186
|
+
"# wp-typia integration smoke settings",
|
|
187
|
+
"WP_TYPIA_SMOKE_BASE_URL=http://localhost:8888",
|
|
188
|
+
"WP_TYPIA_SMOKE_USERNAME=admin",
|
|
189
|
+
"WP_TYPIA_SMOKE_PASSWORD=password",
|
|
190
|
+
"WP_TYPIA_SMOKE_TIMEOUT_MS=30000",
|
|
191
|
+
...(service === "docker-compose"
|
|
192
|
+
? [
|
|
193
|
+
"",
|
|
194
|
+
"# Optional docker-compose integration service starter.",
|
|
195
|
+
"WP_TYPIA_SERVICE_URL=http://localhost:3000",
|
|
196
|
+
]
|
|
197
|
+
: [
|
|
198
|
+
"",
|
|
199
|
+
"# Set this when your smoke test needs a project-specific service.",
|
|
200
|
+
"# WP_TYPIA_SERVICE_URL=http://localhost:3000",
|
|
201
|
+
]),
|
|
202
|
+
"",
|
|
203
|
+
].join("\n");
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Render integration environment onboarding documentation.
|
|
207
|
+
*
|
|
208
|
+
* @param options Integration environment documentation options.
|
|
209
|
+
* @param options.integrationEnvSlug Normalized integration environment slug.
|
|
210
|
+
* @param options.service Selected optional local service starter.
|
|
211
|
+
* @param options.withReleaseZip Whether release zip scripts were scaffolded.
|
|
212
|
+
* @param options.withWpEnv Whether wp-env setup was scaffolded.
|
|
213
|
+
* @returns Markdown source for the generated integration environment guide.
|
|
214
|
+
*/
|
|
215
|
+
export function buildIntegrationEnvReadmeSource({ integrationEnvSlug, service, withReleaseZip, withWpEnv, }) {
|
|
216
|
+
const title = toTitleCase(integrationEnvSlug);
|
|
217
|
+
const setupSteps = [
|
|
218
|
+
"Copy `.env.example` to `.env` and adjust the URLs or credentials for your local project.",
|
|
219
|
+
...(withWpEnv
|
|
220
|
+
? [
|
|
221
|
+
"Run `npm run wp-env:start` to start the generated WordPress environment.",
|
|
222
|
+
]
|
|
223
|
+
: [
|
|
224
|
+
"Point `WP_TYPIA_SMOKE_BASE_URL` at the WordPress environment you already run locally.",
|
|
225
|
+
]),
|
|
226
|
+
...(service === "docker-compose"
|
|
227
|
+
? [
|
|
228
|
+
"Run `npm run service:start` if you want the placeholder docker-compose service available at `WP_TYPIA_SERVICE_URL`.",
|
|
229
|
+
]
|
|
230
|
+
: [
|
|
231
|
+
"Set `WP_TYPIA_SERVICE_URL` only when your integration smoke needs a local service dependency.",
|
|
232
|
+
]),
|
|
233
|
+
`Run \`npm run smoke:${integrationEnvSlug}\` to execute the starter smoke check.`,
|
|
234
|
+
...(withReleaseZip
|
|
235
|
+
? [
|
|
236
|
+
"Run `npm run release:zip` after smoke checks pass to build a distributable plugin zip.",
|
|
237
|
+
]
|
|
238
|
+
: []),
|
|
239
|
+
];
|
|
240
|
+
return `# ${title} Integration Environment
|
|
241
|
+
|
|
242
|
+
This starter keeps local WordPress integration smoke checks opt-in and editable.
|
|
243
|
+
It does not change default block scaffolds or require wp-env unless this add
|
|
244
|
+
workflow was run with \`--wp-env\`.
|
|
245
|
+
|
|
246
|
+
## Setup
|
|
247
|
+
|
|
248
|
+
${setupSteps.map((step, index) => `${index + 1}. ${step}`).join("\n")}
|
|
249
|
+
|
|
250
|
+
## Adapting the Starter
|
|
251
|
+
|
|
252
|
+
- Extend \`scripts/integration-smoke/${integrationEnvSlug}.mjs\` with the REST,
|
|
253
|
+
editor, or service assertions that matter for this project.
|
|
254
|
+
- Keep secrets in \`.env\`; \`.env.example\` should document only safe defaults.
|
|
255
|
+
- If your project uses a real service stack, replace the placeholder
|
|
256
|
+
\`docker-compose.integration.yml\` service with your database, queue, API, or
|
|
257
|
+
emulator containers.
|
|
258
|
+
- Keep the smoke script focused on high-signal integration checks so CI and
|
|
259
|
+
local debugging stay fast.
|
|
260
|
+
${withReleaseZip ? "- Treat `release:zip:check` as a CI guard before packaging release artifacts.\n" : ""}
|
|
261
|
+
`;
|
|
262
|
+
}
|
|
@@ -8,6 +8,7 @@ import { type IntegrationEnvServiceId, type RunAddIntegrationEnvCommandOptions }
|
|
|
8
8
|
* @property service Canonical local service starter id selected for the scaffold.
|
|
9
9
|
* @property warnings Optional non-fatal preservation notices for existing files
|
|
10
10
|
* or scripts.
|
|
11
|
+
* @property withReleaseZip Whether release zip packaging scripts were added.
|
|
11
12
|
* @property withWpEnv Whether the generated scaffold included the wp-env preset.
|
|
12
13
|
*/
|
|
13
14
|
export interface RunAddIntegrationEnvCommandResult {
|
|
@@ -15,10 +16,11 @@ export interface RunAddIntegrationEnvCommandResult {
|
|
|
15
16
|
projectDir: string;
|
|
16
17
|
service: IntegrationEnvServiceId;
|
|
17
18
|
warnings?: string[];
|
|
19
|
+
withReleaseZip: boolean;
|
|
18
20
|
withWpEnv: boolean;
|
|
19
21
|
}
|
|
20
22
|
/**
|
|
21
23
|
* Add an opt-in local WordPress integration environment starter to an official
|
|
22
24
|
* workspace.
|
|
23
25
|
*/
|
|
24
|
-
export declare function runAddIntegrationEnvCommand({ cwd, integrationEnvName, service, withWpEnv, }: RunAddIntegrationEnvCommandOptions): Promise<RunAddIntegrationEnvCommandResult>;
|
|
26
|
+
export declare function runAddIntegrationEnvCommand({ cwd, integrationEnvName, service, withReleaseZip, withWpEnv, }: RunAddIntegrationEnvCommandOptions): Promise<RunAddIntegrationEnvCommandResult>;
|