@empire-builder-kit/nx 1.0.0-rc.46 → 1.0.0-rc.47
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/generators.json +11 -1
- package/package.json +3 -3
- package/src/aws-authority/stage-authority.d.ts +30 -2
- package/src/aws-authority/stage-authority.js +220 -25
- package/src/developer-agent/generator-planning.js +99 -6
- package/src/developer-agent/model.d.ts +7 -3
- package/src/developer-agent/model.js +1 -0
- package/src/developer-agent/operation-registry.d.ts +1 -0
- package/src/developer-agent/operation-registry.js +43 -2
- package/src/developer-agent/planning.js +5 -2
- package/src/developer-agent/preview-changes.js +10 -0
- package/src/developer-agent/validation.js +7 -3
- package/src/developer-agent/workspace-inspection.js +51 -4
- package/src/executors/deployment-plan/deployment-plan.js +3 -0
- package/src/executors/dev-doctor/dev-doctor.d.ts +25 -3
- package/src/executors/dev-doctor/dev-doctor.js +136 -49
- package/src/executors/dev-setup/dev-setup.d.ts +18 -1
- package/src/executors/dev-setup/dev-setup.js +320 -196
- package/src/executors/foundation-preflight/foundation-preflight.js +9 -1
- package/src/executors/foundation-remove-preflight/foundation-remove-preflight.js +2 -2
- package/src/executors/infrastructure-plan/infrastructure-plan.js +10 -3
- package/src/executors/local-deploy/local-deploy.d.ts +15 -0
- package/src/executors/local-deploy/local-deploy.js +96 -14
- package/src/executors/sst-lifecycle/logging-preflight.js +12 -1
- package/src/executors/sst-lifecycle/run-sst-command.js +51 -5
- package/src/foundation/cost-estimate.js +1 -1
- package/src/foundation/identity-domain-parent-ready.d.ts +91 -0
- package/src/foundation/identity-domain-parent-ready.js +333 -0
- package/src/foundation/identity-domain.d.ts +94 -0
- package/src/foundation/identity-domain.js +115 -0
- package/src/foundation/index.d.ts +2 -0
- package/src/foundation/index.js +7 -0
- package/src/foundation/preflight.js +17 -1
- package/src/foundation/root-site-readiness.d.ts +27 -0
- package/src/foundation/root-site-readiness.js +78 -0
- package/src/foundation/root-site.d.ts +81 -0
- package/src/foundation/root-site.js +268 -0
- package/src/generators/framework-prerequisites.d.ts +2 -0
- package/src/generators/framework-prerequisites.js +34 -0
- package/src/generators/function/function-registration.d.ts +24 -0
- package/src/generators/function/function-registration.js +66 -0
- package/src/generators/function/function.d.ts +16 -1
- package/src/generators/function/function.js +101 -18
- package/src/generators/function/schema.d.ts +1 -0
- package/src/generators/function/schema.json +6 -0
- package/src/generators/function-access/function-access.d.ts +14 -0
- package/src/generators/function-access/function-access.js +141 -0
- package/src/generators/function-access/schema.d.ts +6 -0
- package/src/generators/function-access/schema.json +25 -0
- package/src/generators/post-generation-install.d.ts +1 -1
- package/src/generators/post-generation-install.js +1 -1
- package/src/generators/preset/dependency-overrides.d.ts +1 -1
- package/src/generators/preset/dependency-overrides.js +1 -1
- package/src/generators/preset/workspace-files-adopter-skills.js +14 -0
- package/src/generators/preset/workspace-files-developer-agent.js +17 -11
- package/src/generators/preset/workspace-files-stage-authority.js +58 -1
- package/src/generators/preset/workspace-files-thin-deploy.d.ts +11 -0
- package/src/generators/preset/workspace-files-thin-deploy.js +47 -4
- package/src/generators/preset/workspace-files-thin-docs.js +33 -5
- package/src/generators/preset/workspace-files.js +207 -13
- package/src/generators/repository-policy/repository-policy.js +2 -1
- package/src/generators/repository-policy/schema.d.ts +2 -0
- package/src/generators/repository-policy/schema.json +7 -2
- package/src/generators/site/built-in-site-documentation-files.d.ts +2 -0
- package/src/generators/site/built-in-site-documentation-files.js +92 -0
- package/src/generators/site/built-in-site-files.d.ts +8 -0
- package/src/generators/site/built-in-site-files.js +40 -0
- package/src/generators/site/built-in-site-infrastructure-files.d.ts +2 -0
- package/src/generators/site/built-in-site-infrastructure-files.js +275 -0
- package/src/generators/site/built-in-site-plan.d.ts +19 -0
- package/src/generators/site/built-in-site-plan.js +65 -0
- package/src/generators/site/built-in-site-project-files.d.ts +3 -0
- package/src/generators/site/built-in-site-project-files.js +258 -0
- package/src/generators/site/built-in-site-script-files.d.ts +2 -0
- package/src/generators/site/built-in-site-script-files.js +306 -0
- package/src/generators/site/built-in-site-shared.d.ts +9 -0
- package/src/generators/site/built-in-site-shared.js +21 -0
- package/src/generators/site/built-in-site-smoke-files.d.ts +2 -0
- package/src/generators/site/built-in-site-smoke-files.js +37 -0
- package/src/generators/site/built-in-site-sst-config-files.d.ts +2 -0
- package/src/generators/site/built-in-site-sst-config-files.js +39 -0
- package/src/generators/site/built-in-site-web-files.d.ts +2 -0
- package/src/generators/site/built-in-site-web-files.js +284 -0
- package/src/generators/site/schema.d.ts +4 -0
- package/src/generators/site/schema.json +20 -0
- package/src/generators/site/site.d.ts +13 -0
- package/src/generators/site/site.js +221 -0
- package/src/generators/slice/built-in-plan-alarm-identity.d.ts +9 -0
- package/src/generators/slice/built-in-plan-alarm-identity.js +8 -1
- package/src/generators/slice/built-in-plan-api-contract-files.js +18 -0
- package/src/generators/slice/built-in-plan-async-work-files.js +18 -0
- package/src/generators/slice/built-in-plan-data-files.js +116 -11
- package/src/generators/slice/built-in-plan-foundation-files.d.ts +12 -0
- package/src/generators/slice/built-in-plan-foundation-files.js +114 -5
- package/src/generators/slice/built-in-plan-frontend-files.js +2 -271
- package/src/generators/slice/built-in-plan-frontend-header-proof.d.ts +6 -0
- package/src/generators/slice/built-in-plan-frontend-header-proof.js +282 -0
- package/src/generators/slice/built-in-plan-infrastructure-files.js +151 -237
- package/src/generators/slice/built-in-plan-key-value-cleanup.js +4 -3
- package/src/generators/slice/built-in-plan-log-group-helpers.d.ts +29 -0
- package/src/generators/slice/built-in-plan-log-group-helpers.js +130 -0
- package/src/generators/slice/built-in-plan-metadata-files.js +21 -4
- package/src/generators/slice/built-in-plan-next-build-authority.d.ts +5 -0
- package/src/generators/slice/built-in-plan-next-build-authority.js +124 -0
- package/src/generators/slice/built-in-plan-operations-files.d.ts +6 -0
- package/src/generators/slice/built-in-plan-operations-files.js +107 -219
- package/src/generators/slice/built-in-plan-performance-files.js +6 -1
- package/src/generators/slice/built-in-plan-reliability-files.js +12 -8
- package/src/generators/slice/built-in-plan-shared.d.ts +1 -1
- package/src/generators/slice/built-in-plan-shared.js +1 -1
- package/src/generators/slice/built-in-plan-sst-config.d.ts +49 -0
- package/src/generators/slice/built-in-plan-sst-config.js +160 -0
- package/src/generators/slice/built-in-plan-testing-files.js +92 -49
- package/src/generators/slice/built-in-plan-verification-files.js +15 -4
- package/src/generators/slice/built-in-plan-web-files.js +65 -0
- package/src/generators/slice/deployed-smoke-diagnostics.d.ts +35 -0
- package/src/generators/slice/deployed-smoke-diagnostics.js +189 -0
- package/src/generators/slice/deployed-smoke-readiness.d.ts +7 -0
- package/src/generators/slice/deployed-smoke-readiness.js +118 -23
- package/src/generators/slice/persistence-contract.js +2 -2
- package/src/generators/slice/pnpm-launch-script.d.ts +13 -0
- package/src/generators/slice/pnpm-launch-script.js +28 -0
- package/src/generators/slice/slice.js +27 -0
- package/src/generators/upgrade/custom-domain-notice.d.ts +19 -0
- package/src/generators/upgrade/custom-domain-notice.js +38 -0
- package/src/generators/upgrade/external-blueprint-compositions.d.ts +84 -0
- package/src/generators/upgrade/external-blueprint-compositions.js +478 -0
- package/src/generators/upgrade/framework-package-upgrade.d.ts +58 -0
- package/src/generators/upgrade/framework-package-upgrade.js +78 -0
- package/src/generators/upgrade/function-authentication-notice.d.ts +29 -0
- package/src/generators/upgrade/function-authentication-notice.js +74 -0
- package/src/generators/upgrade/schema.json +2 -2
- package/src/generators/upgrade/upgrade-plan.d.ts +52 -0
- package/src/generators/upgrade/upgrade-plan.js +406 -0
- package/src/generators/upgrade/upgrade.d.ts +1 -35
- package/src/generators/upgrade/upgrade.js +259 -593
- package/src/generators/workload/workload.js +60 -4
- package/src/git-policy/github-bootstrap.d.ts +6 -5
- package/src/git-policy/github-bootstrap.js +6 -4
- package/src/local-dev/fleet-process.d.ts +9 -2
- package/src/local-dev/fleet-process.js +27 -7
- package/src/local-dev/gateway-daemon.d.ts +1 -1
- package/src/local-dev/gateway-daemon.js +6 -4
- package/src/local-dev/portless.d.ts +5 -0
- package/src/local-dev/portless.js +5 -0
- package/src/local-dev/process-group.d.ts +10 -0
- package/src/local-dev/process-group.js +33 -0
- package/src/local-dev/tls.js +31 -2
- package/src/local-dev/trust-store.d.ts +42 -0
- package/src/local-dev/trust-store.js +87 -0
- package/src/ownership/composition.d.ts +7 -0
- package/src/ownership/composition.js +64 -56
- package/src/ownership/index.d.ts +1 -0
- package/src/ownership/index.js +1 -0
- package/src/ownership/record.d.ts +19 -0
- package/src/ownership/record.js +26 -2
- package/src/ownership/site-record.d.ts +18 -0
- package/src/ownership/site-record.js +105 -0
- package/src/repository-policy/deployment-plan.d.ts +3 -0
- package/src/repository-policy/deployment-plan.js +33 -4
- package/src/repository-policy/index.d.ts +1 -0
- package/src/repository-policy/index.js +1 -0
- package/src/repository-policy/policy.d.ts +13 -1
- package/src/repository-policy/policy.js +55 -1
- package/src/repository-policy/public-dns.d.ts +65 -0
- package/src/repository-policy/public-dns.js +168 -0
- package/src/schemas/generated-ownership-v2.json +6 -0
- package/src/schemas/repository-policy-v1.json +67 -1
- package/src/supply-chain/blueprint-trust-git.js +24 -0
- package/src/supply-chain/blueprint-verification-authority.js +21 -3
- package/src/supply-chain/generated-blueprint-trust-command.js +15 -0
- package/src/work-markers/work-markers.js +4 -1
- package/src/workspace-deployment/ownership.d.ts +15 -0
- package/src/workspace-deployment/ownership.js +19 -3
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.renderSiteScriptFiles = renderSiteScriptFiles;
|
|
4
|
+
const index_js_1 = require("../../frontend-security/index.js");
|
|
5
|
+
const root_site_js_1 = require("../../foundation/root-site.js");
|
|
6
|
+
const built_in_plan_frontend_header_proof_js_1 = require("../slice/built-in-plan-frontend-header-proof.js");
|
|
7
|
+
const built_in_plan_operations_files_js_1 = require("../slice/built-in-plan-operations-files.js");
|
|
8
|
+
const built_in_plan_shared_js_1 = require("../slice/built-in-plan-shared.js");
|
|
9
|
+
const deployed_smoke_readiness_js_1 = require("../slice/deployed-smoke-readiness.js");
|
|
10
|
+
const pnpm_launch_script_js_1 = require("../slice/pnpm-launch-script.js");
|
|
11
|
+
const built_in_site_shared_js_1 = require("./built-in-site-shared.js");
|
|
12
|
+
function sitePolicyWithWorkerSourceNone() {
|
|
13
|
+
const policy = (0, index_js_1.sliceFrontendSecurityHeaderPolicy)(root_site_js_1.ROOT_SITE_NAME);
|
|
14
|
+
// A worker served from /sw.js could take scope / and intercept every Slice
|
|
15
|
+
// page on the shared origin, which no Slice can do to another Slice.
|
|
16
|
+
for (const profile of Object.values(policy.profiles)) {
|
|
17
|
+
for (const header of profile.headers) {
|
|
18
|
+
if (header.name.toLowerCase() === 'content-security-policy') {
|
|
19
|
+
header.value = `${header.value}; worker-src 'none'`;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return policy;
|
|
24
|
+
}
|
|
25
|
+
/** @internal */
|
|
26
|
+
function renderSiteScriptFiles() {
|
|
27
|
+
return {
|
|
28
|
+
'frontend/security-headers.json': (0, built_in_plan_shared_js_1.json)(sitePolicyWithWorkerSourceNone()),
|
|
29
|
+
// The Slice web's managed header proof, for the site's policy owner.
|
|
30
|
+
'scripts/frontend-security-headers.mjs': (0, built_in_plan_frontend_header_proof_js_1.renderFrontendSecurityHeaderProof)(root_site_js_1.ROOT_SITE_NAME, 'root site'),
|
|
31
|
+
// The Slice readiness, rendered in its root site mode.
|
|
32
|
+
'scripts/deployed-smoke-readiness.mjs': (0, deployed_smoke_readiness_js_1.rootSiteDeployedSmokeReadinessScript)(),
|
|
33
|
+
'scripts/run-smoke-deployed.mjs': renderRunSmokeDeployed(),
|
|
34
|
+
'scripts/route-check.mjs': `import { lstatSync, readdirSync, readFileSync } from 'node:fs';
|
|
35
|
+
import { createRequire } from 'node:module';
|
|
36
|
+
import { dirname, join, resolve } from 'node:path';
|
|
37
|
+
import { fileURLToPath } from 'node:url';
|
|
38
|
+
|
|
39
|
+
const require = createRequire(import.meta.url);
|
|
40
|
+
const {
|
|
41
|
+
formatRootSiteRouteInventory,
|
|
42
|
+
inspectRootSiteRoutes,
|
|
43
|
+
} = require('@empire-builder-kit/nx/foundation');
|
|
44
|
+
|
|
45
|
+
const projectRoot = resolve(dirname(fileURLToPath(import.meta.url)), '..');
|
|
46
|
+
const webRoot = join(projectRoot, 'web');
|
|
47
|
+
const packagesRoot = resolve(projectRoot, '..');
|
|
48
|
+
const maximumEntries = ${String(root_site_js_1.ROOT_SITE_ROUTE_ENTRY_LIMIT).replace(/\B(?=(\d{3})+$)/g, '_')};
|
|
49
|
+
let observedEntries = 0;
|
|
50
|
+
|
|
51
|
+
function listFiles(relativeRoot) {
|
|
52
|
+
const root = join(webRoot, relativeRoot);
|
|
53
|
+
if (!lstatSync(root, { throwIfNoEntry: false })?.isDirectory()) return [];
|
|
54
|
+
const files = [];
|
|
55
|
+
const pending = [relativeRoot];
|
|
56
|
+
while (pending.length > 0) {
|
|
57
|
+
const current = pending.pop();
|
|
58
|
+
for (const entry of readdirSync(join(webRoot, current), {
|
|
59
|
+
withFileTypes: true,
|
|
60
|
+
})) {
|
|
61
|
+
observedEntries += 1;
|
|
62
|
+
if (observedEntries > maximumEntries) {
|
|
63
|
+
throw new Error('The root site source tree exceeds its entry bound.');
|
|
64
|
+
}
|
|
65
|
+
const path = current + '/' + entry.name;
|
|
66
|
+
if (entry.isDirectory()) pending.push(path);
|
|
67
|
+
else files.push(path);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return files;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const files = [${root_site_js_1.ROOT_SITE_ROUTE_ROOTS.map((path) => `'${path}'`).join(', ')}].flatMap(
|
|
74
|
+
listFiles,
|
|
75
|
+
);
|
|
76
|
+
const sliceNames = readdirSync(packagesRoot, { withFileTypes: true })
|
|
77
|
+
.filter((entry) => entry.isDirectory())
|
|
78
|
+
.flatMap(({ name }) => {
|
|
79
|
+
const projectPath = join(packagesRoot, name, 'project.json');
|
|
80
|
+
if (!lstatSync(projectPath, { throwIfNoEntry: false })?.isFile()) return [];
|
|
81
|
+
const project = JSON.parse(readFileSync(projectPath, 'utf8'));
|
|
82
|
+
return Array.isArray(project.tags) && project.tags.includes('type:slice')
|
|
83
|
+
? [project.name ?? name]
|
|
84
|
+
: [];
|
|
85
|
+
});
|
|
86
|
+
const inventory = inspectRootSiteRoutes({ files, sliceNames });
|
|
87
|
+
const report = formatRootSiteRouteInventory(inventory);
|
|
88
|
+
if (report) process.stdout.write(report + '\\n');
|
|
89
|
+
if (inventory.findings.length > 0) {
|
|
90
|
+
process.stderr.write(
|
|
91
|
+
'[route-check] The root site has ' +
|
|
92
|
+
inventory.findings.length +
|
|
93
|
+
' route finding(s); see above.\\n',
|
|
94
|
+
);
|
|
95
|
+
process.exitCode = 1;
|
|
96
|
+
} else {
|
|
97
|
+
process.stdout.write(
|
|
98
|
+
'[route-check] The root site serves ' +
|
|
99
|
+
inventory.segments.length +
|
|
100
|
+
' top-level path(s) beside ' +
|
|
101
|
+
sliceNames.length +
|
|
102
|
+
' Product Slice(s) without a collision.\\n',
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
`,
|
|
106
|
+
'tools/ebk-next-build-environment.mjs': (0, built_in_plan_operations_files_js_1.renderNextBuildEnvironmentWrapper)(built_in_site_shared_js_1.ROOT_SITE_NEXT_BUILD_ENVIRONMENT_KEYS, 'root site'),
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
// The site's deployed smoke makes HTTP requests only: it reads no AWS
|
|
110
|
+
// resource and holds no credential, so its children get a bounded
|
|
111
|
+
// environment without AWS or GitHub variables.
|
|
112
|
+
function renderRunSmokeDeployed() {
|
|
113
|
+
return `import { spawnSync } from 'node:child_process';
|
|
114
|
+
import { mkdirSync, rmSync, writeFileSync } from 'node:fs';
|
|
115
|
+
import { join } from 'node:path';
|
|
116
|
+
import { waitForDeployedSmokeReadiness } from './deployed-smoke-readiness.mjs';
|
|
117
|
+
|
|
118
|
+
const projectRoot = process.cwd();
|
|
119
|
+
const evidenceRoot = join(projectRoot, '.ebk', 'evidence');
|
|
120
|
+
const resultPath = join(evidenceRoot, 'smoke-deployed.json');
|
|
121
|
+
const readinessPath = join(evidenceRoot, 'deployed-readiness.json');
|
|
122
|
+
const gitObjectId = /^(?:[a-f0-9]{40}|[a-f0-9]{64})$/;
|
|
123
|
+
mkdirSync(evidenceRoot, { recursive: true });
|
|
124
|
+
rmSync(resultPath, { force: true });
|
|
125
|
+
rmSync(readinessPath, { force: true });
|
|
126
|
+
|
|
127
|
+
const stage = process.env.EBK_STAGE ?? '';
|
|
128
|
+
const smokeUrl = process.env.EBK_SMOKE_URL ?? '';
|
|
129
|
+
const sourceCommit = process.env.EBK_SOURCE_COMMIT ?? '';
|
|
130
|
+
// The deployed server reports the release source of a promotion, which the
|
|
131
|
+
// lifecycle hands over as EBK_DEPLOYED_SOURCE_COMMIT.
|
|
132
|
+
const deployedSourceCommit = gitObjectId.test(
|
|
133
|
+
process.env.EBK_DEPLOYED_SOURCE_COMMIT ?? '',
|
|
134
|
+
)
|
|
135
|
+
? process.env.EBK_DEPLOYED_SOURCE_COMMIT
|
|
136
|
+
: sourceCommit;
|
|
137
|
+
const startedAt = new Date().toISOString();
|
|
138
|
+
const inheritedEnvironment = [
|
|
139
|
+
'APPDATA',
|
|
140
|
+
'CI',
|
|
141
|
+
'ComSpec',
|
|
142
|
+
'COMSPEC',
|
|
143
|
+
'HOME',
|
|
144
|
+
'LANG',
|
|
145
|
+
'LC_ALL',
|
|
146
|
+
'LOCALAPPDATA',
|
|
147
|
+
'PATH',
|
|
148
|
+
'PATHEXT',
|
|
149
|
+
'PLAYWRIGHT_BROWSERS_PATH',
|
|
150
|
+
'SystemRoot',
|
|
151
|
+
'SYSTEMROOT',
|
|
152
|
+
'TEMP',
|
|
153
|
+
'TMP',
|
|
154
|
+
'TMPDIR',
|
|
155
|
+
'USERPROFILE',
|
|
156
|
+
];
|
|
157
|
+
|
|
158
|
+
function writeEvidence(path, value) {
|
|
159
|
+
writeFileSync(path, JSON.stringify(value, null, 2) + '\\n', {
|
|
160
|
+
encoding: 'utf8',
|
|
161
|
+
mode: 0o600,
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
function finish(outcome, summary, steps, classification) {
|
|
166
|
+
writeEvidence(resultPath, {
|
|
167
|
+
...(classification ? { classification } : {}),
|
|
168
|
+
completedAt: new Date().toISOString(),
|
|
169
|
+
deployedSourceCommit,
|
|
170
|
+
kind: 'ebk-root-site-deployed-smoke',
|
|
171
|
+
outcome,
|
|
172
|
+
schemaVersion: 1,
|
|
173
|
+
service: '${root_site_js_1.ROOT_SITE_NAME}',
|
|
174
|
+
sourceCommit,
|
|
175
|
+
stage,
|
|
176
|
+
startedAt,
|
|
177
|
+
steps,
|
|
178
|
+
summary,
|
|
179
|
+
});
|
|
180
|
+
if (outcome !== 'passed') {
|
|
181
|
+
process.stderr.write('[site:smoke-deployed] ' + summary + '\\n');
|
|
182
|
+
process.exitCode = 1;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
${pnpm_launch_script_js_1.pnpmLaunchFunction}
|
|
187
|
+
function runStep(name, command, args, environment) {
|
|
188
|
+
const result = spawnSync(command, args, {
|
|
189
|
+
cwd: projectRoot,
|
|
190
|
+
encoding: 'utf8',
|
|
191
|
+
env: {
|
|
192
|
+
...Object.fromEntries(
|
|
193
|
+
inheritedEnvironment.flatMap((variable) =>
|
|
194
|
+
typeof process.env[variable] === 'string'
|
|
195
|
+
? [[variable, process.env[variable]]]
|
|
196
|
+
: [],
|
|
197
|
+
),
|
|
198
|
+
),
|
|
199
|
+
...environment,
|
|
200
|
+
},
|
|
201
|
+
shell: false,
|
|
202
|
+
stdio: ['ignore', 'inherit', 'inherit'],
|
|
203
|
+
windowsHide: true,
|
|
204
|
+
});
|
|
205
|
+
// A step that could not start or was signaled names a bounded code and
|
|
206
|
+
// signal only, never the error message.
|
|
207
|
+
if (result.error || result.signal) {
|
|
208
|
+
const code =
|
|
209
|
+
typeof result.error?.code === 'string' &&
|
|
210
|
+
/^[A-Z][A-Z0-9_]{0,31}$/.test(result.error.code)
|
|
211
|
+
? result.error.code
|
|
212
|
+
: 'unknown';
|
|
213
|
+
const signal =
|
|
214
|
+
typeof result.signal === 'string' && /^SIG[A-Z0-9]{1,16}$/.test(result.signal)
|
|
215
|
+
? ' (signal ' + result.signal + ')'
|
|
216
|
+
: '';
|
|
217
|
+
process.stderr.write(
|
|
218
|
+
'[site:smoke-deployed] The ' + name + ' step did not complete: ' + code + signal + '.\\n',
|
|
219
|
+
);
|
|
220
|
+
}
|
|
221
|
+
return {
|
|
222
|
+
name,
|
|
223
|
+
outcome: !result.error && result.status === 0 ? 'passed' : 'failed',
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
let target;
|
|
228
|
+
try {
|
|
229
|
+
target = new URL(smokeUrl);
|
|
230
|
+
} catch {
|
|
231
|
+
target = undefined;
|
|
232
|
+
}
|
|
233
|
+
if (
|
|
234
|
+
process.argv.length > 2 ||
|
|
235
|
+
!['development', 'staging', 'production'].includes(stage) ||
|
|
236
|
+
!gitObjectId.test(sourceCommit) ||
|
|
237
|
+
target?.protocol !== 'https:' ||
|
|
238
|
+
target.pathname !== '/'
|
|
239
|
+
) {
|
|
240
|
+
finish(
|
|
241
|
+
'failed',
|
|
242
|
+
'The root site deployed smoke requires development, staging or production, one exact source commit and an HTTPS EBK_SMOKE_URL with path /, and accepts no arguments.',
|
|
243
|
+
[],
|
|
244
|
+
'prerequisite-missing',
|
|
245
|
+
);
|
|
246
|
+
} else {
|
|
247
|
+
const readiness = await waitForDeployedSmokeReadiness({
|
|
248
|
+
service: '${root_site_js_1.ROOT_SITE_NAME}',
|
|
249
|
+
sourceCommit: deployedSourceCommit,
|
|
250
|
+
stage,
|
|
251
|
+
webUrl: smokeUrl,
|
|
252
|
+
});
|
|
253
|
+
writeEvidence(readinessPath, {
|
|
254
|
+
deployedSourceCommit,
|
|
255
|
+
result: readiness,
|
|
256
|
+
schemaVersion: 1,
|
|
257
|
+
service: '${root_site_js_1.ROOT_SITE_NAME}',
|
|
258
|
+
source: sourceCommit,
|
|
259
|
+
stage,
|
|
260
|
+
});
|
|
261
|
+
if (readiness.outcome !== 'ready') {
|
|
262
|
+
finish('failed', readiness.summary, [], readiness.classification);
|
|
263
|
+
} else {
|
|
264
|
+
const environment = {
|
|
265
|
+
EBK_FRONTEND_SECURITY_PROFILE: 'deployed-https',
|
|
266
|
+
EBK_SMOKE_URL: smokeUrl,
|
|
267
|
+
EBK_SOURCE_COMMIT: deployedSourceCommit,
|
|
268
|
+
EBK_STAGE: stage,
|
|
269
|
+
};
|
|
270
|
+
const playwright = pnpmLaunch(['exec', 'playwright', 'test']);
|
|
271
|
+
const steps = [
|
|
272
|
+
runStep('playwright', playwright.command, playwright.args, environment),
|
|
273
|
+
];
|
|
274
|
+
if (steps[0].outcome === 'passed') {
|
|
275
|
+
steps.push(
|
|
276
|
+
runStep(
|
|
277
|
+
'frontend-security-headers',
|
|
278
|
+
process.execPath,
|
|
279
|
+
['scripts/frontend-security-headers.mjs', '--url=' + smokeUrl],
|
|
280
|
+
// Every admitted stage serves a production build, which the
|
|
281
|
+
// deployed server resolves as deployed-https; without NODE_ENV the
|
|
282
|
+
// shared resolver reads a development stage as local.
|
|
283
|
+
{ ...environment, NODE_ENV: 'production' },
|
|
284
|
+
),
|
|
285
|
+
);
|
|
286
|
+
}
|
|
287
|
+
const failed = steps.find(({ outcome }) => outcome !== 'passed');
|
|
288
|
+
if (failed) {
|
|
289
|
+
finish(
|
|
290
|
+
'failed',
|
|
291
|
+
'The root site ' + failed.name + ' step failed against the deployed URL.',
|
|
292
|
+
steps,
|
|
293
|
+
'smoke-failed',
|
|
294
|
+
);
|
|
295
|
+
} else {
|
|
296
|
+
finish(
|
|
297
|
+
'passed',
|
|
298
|
+
'The root site passed deployed readiness, its Playwright journey and the deployed header proof.',
|
|
299
|
+
steps,
|
|
300
|
+
);
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
`;
|
|
305
|
+
}
|
|
306
|
+
//# sourceMappingURL=built-in-site-script-files.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** The fixed local `site:dev` port, outside the Fleet's 16000-29999 range. */
|
|
2
|
+
export declare const ROOT_SITE_DEV_PORT = 3100;
|
|
3
|
+
/**
|
|
4
|
+
* Exactly the keys SST's Next.js build command may see. The canonical host is
|
|
5
|
+
* runtime-only: the build never depends on the stage's domain binding.
|
|
6
|
+
*/
|
|
7
|
+
export declare const ROOT_SITE_NEXT_BUILD_ENVIRONMENT_KEYS: readonly ["CI", "EBK_LOCAL_SOURCE_TREE", "EBK_SOURCE_COMMIT", "EBK_STAGE", "NEXT_TELEMETRY_DISABLED", "SST", "SST_RESOURCE_App"];
|
|
8
|
+
/** The exact Git object ID pattern, as a JavaScript regular expression literal. */
|
|
9
|
+
export declare const SOURCE_COMMIT_PATTERN = "/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/";
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SOURCE_COMMIT_PATTERN = exports.ROOT_SITE_NEXT_BUILD_ENVIRONMENT_KEYS = exports.ROOT_SITE_DEV_PORT = void 0;
|
|
4
|
+
/** The fixed local `site:dev` port, outside the Fleet's 16000-29999 range. */
|
|
5
|
+
exports.ROOT_SITE_DEV_PORT = 3100;
|
|
6
|
+
/**
|
|
7
|
+
* Exactly the keys SST's Next.js build command may see. The canonical host is
|
|
8
|
+
* runtime-only: the build never depends on the stage's domain binding.
|
|
9
|
+
*/
|
|
10
|
+
exports.ROOT_SITE_NEXT_BUILD_ENVIRONMENT_KEYS = [
|
|
11
|
+
'CI',
|
|
12
|
+
'EBK_LOCAL_SOURCE_TREE',
|
|
13
|
+
'EBK_SOURCE_COMMIT',
|
|
14
|
+
'EBK_STAGE',
|
|
15
|
+
'NEXT_TELEMETRY_DISABLED',
|
|
16
|
+
'SST',
|
|
17
|
+
'SST_RESOURCE_App',
|
|
18
|
+
];
|
|
19
|
+
/** The exact Git object ID pattern, as a JavaScript regular expression literal. */
|
|
20
|
+
exports.SOURCE_COMMIT_PATTERN = '/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/';
|
|
21
|
+
//# sourceMappingURL=built-in-site-shared.js.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.renderSiteSmokeFiles = renderSiteSmokeFiles;
|
|
4
|
+
const root_site_js_1 = require("../../foundation/root-site.js");
|
|
5
|
+
/** @internal */
|
|
6
|
+
function renderSiteSmokeFiles() {
|
|
7
|
+
return {
|
|
8
|
+
'playwright.config.ts': `import { defineConfig } from '@playwright/test';
|
|
9
|
+
export default defineConfig({
|
|
10
|
+
forbidOnly: true,
|
|
11
|
+
retries: 0,
|
|
12
|
+
testDir: './e2e',
|
|
13
|
+
use: { trace: 'retain-on-failure' },
|
|
14
|
+
});
|
|
15
|
+
`,
|
|
16
|
+
// Seeded: the deployed smoke journey of the starting page. Extend it as
|
|
17
|
+
// the site grows.
|
|
18
|
+
'e2e/site.spec.ts': `import { expect, test } from '@playwright/test';
|
|
19
|
+
|
|
20
|
+
const smokeUrl = process.env.EBK_SMOKE_URL ?? '';
|
|
21
|
+
|
|
22
|
+
test('serves the root site home page on the deployed URL', async ({ page }) => {
|
|
23
|
+
expect(smokeUrl, 'EBK_SMOKE_URL is required').not.toBe('');
|
|
24
|
+
const response = await page.goto(smokeUrl);
|
|
25
|
+
expect(response?.status()).toBe(200);
|
|
26
|
+
const headers = response?.headers() ?? {};
|
|
27
|
+
expect(headers['content-type']).toContain('text/html');
|
|
28
|
+
expect(headers['${root_site_js_1.ROOT_SITE_ROUTE_HEADER}']).toBe('${root_site_js_1.ROOT_SITE_ROUTE_HEADER_VALUE}');
|
|
29
|
+
expect(headers['content-security-policy']).toContain("worker-src 'none'");
|
|
30
|
+
expect(new URL(page.url()).origin).toBe(new URL(smokeUrl).origin);
|
|
31
|
+
await expect(page).toHaveTitle(/\\S/);
|
|
32
|
+
await expect(page.getByRole('heading', { level: 1 })).toBeVisible();
|
|
33
|
+
});
|
|
34
|
+
`,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=built-in-site-smoke-files.js.map
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.renderSiteSstConfigFiles = renderSiteSstConfigFiles;
|
|
4
|
+
const root_site_js_1 = require("../../foundation/root-site.js");
|
|
5
|
+
const built_in_plan_sst_config_js_1 = require("../slice/built-in-plan-sst-config.js");
|
|
6
|
+
const built_in_site_shared_js_1 = require("./built-in-site-shared.js");
|
|
7
|
+
/** @internal */
|
|
8
|
+
function renderSiteSstConfigFiles(workspace, frameworkVersion) {
|
|
9
|
+
return {
|
|
10
|
+
// The Slice's sst.config.ts skeleton with the root site's builder, stage
|
|
11
|
+
// guard and entry call.
|
|
12
|
+
'sst.config.ts': (0, built_in_plan_sst_config_js_1.renderConsumerSstConfig)({
|
|
13
|
+
appName: root_site_js_1.ROOT_SITE_NAME,
|
|
14
|
+
boundaryStage: `$app.stage as 'development' | 'staging' | 'production'`,
|
|
15
|
+
boundarySubject: 'Root site',
|
|
16
|
+
buildCommandNoun: 'buildCommand',
|
|
17
|
+
buildKeys: JSON.stringify(built_in_site_shared_js_1.ROOT_SITE_NEXT_BUILD_ENVIRONMENT_KEYS, null, 2),
|
|
18
|
+
buildTriggerNote: '',
|
|
19
|
+
builderLogicalName: 'SiteWebBuilder',
|
|
20
|
+
frameworkVersion,
|
|
21
|
+
nameSourceIdentities: false,
|
|
22
|
+
runEntry: 'app(accountId)',
|
|
23
|
+
stageGuard: ` if ($dev) {
|
|
24
|
+
throw new Error(
|
|
25
|
+
'The root site has no sst dev mode in 1.0; run pnpm nx run site:dev.',
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
if (!['development', 'staging', 'production'].includes($app.stage)) {
|
|
29
|
+
throw new Error(
|
|
30
|
+
'The root site deploys only to the canonical development, staging and production stages.',
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
`,
|
|
34
|
+
tagBaselineNote: '',
|
|
35
|
+
workspace,
|
|
36
|
+
}),
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=built-in-site-sst-config-files.js.map
|