@craft-ts/deploy 0.7.0-beta.15
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/LICENSE +21 -0
- package/README.md +41 -0
- package/package.json +42 -0
- package/src/index.d.ts +18 -0
- package/src/index.d.ts.map +1 -0
- package/src/index.js +10 -0
- package/src/index.js.map +1 -0
- package/src/lib/artifact.d.ts +18 -0
- package/src/lib/artifact.d.ts.map +1 -0
- package/src/lib/artifact.js +121 -0
- package/src/lib/artifact.js.map +1 -0
- package/src/lib/check.d.ts +31 -0
- package/src/lib/check.d.ts.map +1 -0
- package/src/lib/check.js +278 -0
- package/src/lib/check.js.map +1 -0
- package/src/lib/diagnostics.d.ts +38 -0
- package/src/lib/diagnostics.d.ts.map +1 -0
- package/src/lib/diagnostics.js +297 -0
- package/src/lib/diagnostics.js.map +1 -0
- package/src/lib/format.d.ts +17 -0
- package/src/lib/format.d.ts.map +1 -0
- package/src/lib/format.js +42 -0
- package/src/lib/format.js.map +1 -0
- package/src/lib/manifest.d.ts +236 -0
- package/src/lib/manifest.d.ts.map +1 -0
- package/src/lib/manifest.js +47 -0
- package/src/lib/manifest.js.map +1 -0
- package/src/lib/protocol.d.ts +22 -0
- package/src/lib/protocol.d.ts.map +1 -0
- package/src/lib/protocol.js +182 -0
- package/src/lib/protocol.js.map +1 -0
- package/src/lib/providers.d.ts +111 -0
- package/src/lib/providers.d.ts.map +1 -0
- package/src/lib/providers.js +156 -0
- package/src/lib/providers.js.map +1 -0
- package/src/lib/sources.d.ts +31 -0
- package/src/lib/sources.d.ts.map +1 -0
- package/src/lib/sources.js +155 -0
- package/src/lib/sources.js.map +1 -0
- package/src/lib/validate.d.ts +16 -0
- package/src/lib/validate.d.ts.map +1 -0
- package/src/lib/validate.js +361 -0
- package/src/lib/validate.js.map +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check.js","sourceRoot":"","sources":["../../../../../libs/deploy/src/lib/check.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AK;YACX,OAAO,EAAE,QAAQ,CAAC,OAAO;YACzB,OAAO,EAAE,KAAK,IAAI,iEAAiE;YACnF,GAAG,EAAE,kBAAkB,IAAI,mEAAmE;SAC/F,CAAC,CAAC;IACL,CAAC;AACH,CAAC;AAED,SAAS,gBAAgB,CACvB,OAAe,EACf,QAAiC,EACjC,WAAwC;IAExC,MAAM,SAAS,GAAG,QAAQ,CAAC,SAAS,CAAC;IACrC,IAAI,CAAC,SAAS,IAAI,SAAS,CAAC,GAAG,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO;IAErD,MAAM,KAAK,GAAG,oBAAoB,CAAC,OAAO,CAAC,OAAO,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;IACtE,IAAI,KAAK,CAAC,YAAY,KAAK,IAAI;QAAE,OAAO;IAExC,KAAK,MAAM,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,SAAS,CAAC,GAAG,CAAC,OAAO,EAAE,EAAE,CAAC;QAClD,IAAI,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;YAAE,SAAS;QACxC,WAAW,CAAC,IAAI,CAAC;YACf,IAAI,EAAE,kCAAkC;YACxC,QAAQ,EAAE,SAAS;YACnB,IAAI,EAAE,iBAAiB,KAAK,GAAG;YAC/B,IAAI,EAAE,SAAS,CAAC,KAAK;YACrB,OAAO,EAAE,QAAQ,CAAC,OAAO;YACzB,OAAO,EAAE,KAAK,EAAE,+CAA+C,SAAS,CAAC,KAAK,KAAK;YACnF,GAAG,EAAE,iFAAiF;SACvF,CAAC,CAAC;IACL,CAAC;AACH,CAAC","sourcesContent":["import { existsSync } from 'node:fs';\nimport { relative, resolve } from 'node:path';\nimport { checkCraftDeploymentArtifact } from './artifact.js';\nimport type {\n CraftDeploymentDiagnostic,\n CraftDeploymentSeverity,\n} from './diagnostics.js';\nimport {\n CRAFT_DEPLOYMENT_PLATFORMS,\n CRAFT_DEPLOYMENT_RUNTIMES,\n type CraftDeploymentManifest,\n} from './manifest.js';\nimport {\n findCraftDeploymentProvider,\n requiredCapability,\n} from './providers.js';\nimport { resolveCraftDeploymentManifest } from './protocol.js';\nimport {\n collectEnvironmentReads,\n isNodeBuiltin,\n readCraftModuleGraph,\n type CraftModuleGraph,\n} from './sources.js';\nimport { validateCraftDeploymentDefinition } from './validate.js';\n\nexport type CraftDeploymentCheckOptions = Readonly<{\n /** Directory the manifest paths are relative to. Defaults to `cwd`. */\n rootDir?: string;\n /** Raw manifest, typically the default export of `craft.deploy.ts`. */\n definition: unknown;\n /** Provider the deployment targets, checked against the capability matrix. */\n provider?: string;\n /** Asserts the manifest declares this runtime. */\n runtime?: string;\n /** Asserts the manifest declares this platform. */\n platform?: string;\n /** Also inspect the produced artefact, which requires a completed build. */\n artifact?: boolean;\n}>;\n\nexport type CraftDeploymentCheckResult = Readonly<{\n passed: boolean;\n /** `null` when the manifest could not be resolved. */\n manifest: CraftDeploymentManifest | null;\n diagnostics: readonly CraftDeploymentDiagnostic[];\n}>;\n\n/**\n * Runs every deployment check that does not need a provider account.\n *\n * The order matters: nothing filesystem-related runs while the manifest itself\n * is unusable, so an author never reads a page of path errors caused by a\n * single missing field.\n */\nexport function checkCraftDeployment(\n options: CraftDeploymentCheckOptions,\n): CraftDeploymentCheckResult {\n const rootDir = resolve(options.rootDir ?? process.cwd());\n const validation = validateCraftDeploymentDefinition(options.definition);\n const diagnostics: CraftDeploymentDiagnostic[] = [...validation.diagnostics];\n\n if (!validation.definition) {\n return { passed: false, manifest: null, diagnostics };\n }\n\n const manifest = resolveCraftDeploymentManifest(validation.definition);\n\n checkRequestedTarget(options, manifest, diagnostics);\n checkProvider(options.provider, manifest, diagnostics);\n checkDeclaredPaths(rootDir, manifest, options.artifact === true, diagnostics);\n checkModuleGraphs(rootDir, manifest, diagnostics);\n\n if (options.artifact === true) {\n diagnostics.push(...checkCraftDeploymentArtifact({ rootDir, manifest }));\n }\n\n return {\n passed: diagnostics.every((diagnostic) => diagnostic.severity !== 'error'),\n manifest,\n diagnostics,\n };\n}\n\nfunction checkRequestedTarget(\n options: CraftDeploymentCheckOptions,\n manifest: CraftDeploymentManifest,\n diagnostics: CraftDeploymentDiagnostic[],\n): void {\n if (options.runtime !== undefined && options.runtime !== manifest.runtime) {\n diagnostics.push({\n code: 'CRAFT_DEPLOY_RUNTIME_MISMATCH',\n severity: 'error',\n path: 'runtime',\n runtime: manifest.runtime,\n message: `The check requested the \\`${options.runtime}\\` runtime and the manifest declares \\`${manifest.runtime}\\`.`,\n fix: CRAFT_DEPLOYMENT_RUNTIMES.includes(options.runtime as never)\n ? 'Drop `--runtime`, or change `runtime` in the manifest.'\n : `Use one of ${CRAFT_DEPLOYMENT_RUNTIMES.join(', ')}.`,\n });\n }\n if (\n options.platform !== undefined &&\n options.platform !== manifest.platform\n ) {\n diagnostics.push({\n code: 'CRAFT_DEPLOY_PLATFORM_MISMATCH',\n severity: 'error',\n path: 'platform',\n platform: manifest.platform,\n message: `The check requested the \\`${options.platform}\\` platform and the manifest declares \\`${manifest.platform}\\`.`,\n fix: CRAFT_DEPLOYMENT_PLATFORMS.includes(options.platform as never)\n ? 'Drop `--platform`, or change `platform` in the manifest.'\n : `Use one of ${CRAFT_DEPLOYMENT_PLATFORMS.join(', ')}.`,\n });\n }\n}\n\nfunction checkProvider(\n provider: string | undefined,\n manifest: CraftDeploymentManifest,\n diagnostics: CraftDeploymentDiagnostic[],\n): void {\n if (provider === undefined) return;\n\n const descriptor = findCraftDeploymentProvider(provider);\n if (!descriptor) {\n diagnostics.push({\n code: 'CRAFT_DEPLOY_PROVIDER_UNKNOWN',\n severity: 'error',\n provider,\n message: `\\`${provider}\\` is not in the provider capability matrix.`,\n fix: 'Use a documented provider name, or register the provider before checking.',\n });\n return;\n }\n\n const capability = requiredCapability(\n manifest.runtime,\n manifest.runtime === 'static' ? manifest.static.mode : undefined,\n );\n if (!descriptor.capabilities.includes(capability)) {\n diagnostics.push({\n code: 'CRAFT_DEPLOY_PROVIDER_CAPABILITY_MISSING',\n severity: 'error',\n provider,\n runtime: manifest.runtime,\n message: `\\`${provider}\\` does not declare the \\`${capability}\\` capability.`,\n fix: `Choose a provider declaring \\`${capability}\\`, or change the runtime or the static mode.`,\n });\n }\n if (!descriptor.platforms.includes(manifest.platform)) {\n diagnostics.push({\n code: 'CRAFT_DEPLOY_PROVIDER_PLATFORM_UNSUPPORTED',\n severity: 'error',\n provider,\n platform: manifest.platform,\n message: `\\`${provider}\\` does not deploy to \\`${manifest.platform}\\`.`,\n fix: `Use one of ${descriptor.platforms.join(', ')}, or change the platform.`,\n });\n }\n}\n\ntype DeclaredPath = Readonly<{\n path: string;\n value: string;\n /** Sources are committed, build outputs only exist after a build. */\n kind: 'source' | 'output';\n}>;\n\nfunction declaredPaths(\n manifest: CraftDeploymentManifest,\n): readonly DeclaredPath[] {\n const paths: DeclaredPath[] = [];\n const runtimeSection =\n manifest.runtime === 'node'\n ? { key: 'server', section: manifest.server }\n : manifest.runtime === 'worker'\n ? { key: 'worker', section: manifest.worker }\n : manifest.runtime === 'lambda'\n ? { key: 'lambda', section: manifest.lambda }\n : null;\n\n if (runtimeSection) {\n paths.push({\n path: `${runtimeSection.key}.entry`,\n value: runtimeSection.section.entry,\n kind: 'output',\n });\n if (runtimeSection.section.source) {\n paths.push({\n path: `${runtimeSection.key}.source`,\n value: runtimeSection.section.source,\n kind: 'source',\n });\n }\n }\n if (manifest.functions) {\n paths.push({\n path: 'functions.entry',\n value: manifest.functions.entry,\n kind: 'source',\n });\n }\n if (manifest.client) {\n paths.push({\n path: 'client.outDir',\n value: manifest.client.outDir,\n kind: 'output',\n });\n }\n for (const [index, file] of manifest.artifact.configFiles.entries()) {\n paths.push({\n path: `artifact.configFiles[${index}]`,\n value: file,\n kind: 'source',\n });\n }\n return paths;\n}\n\nfunction checkDeclaredPaths(\n rootDir: string,\n manifest: CraftDeploymentManifest,\n artifactMode: boolean,\n diagnostics: CraftDeploymentDiagnostic[],\n): void {\n for (const declared of declaredPaths(manifest)) {\n if (existsSync(resolve(rootDir, declared.value))) continue;\n // Before the build, a missing output is expected; it only becomes an\n // error once the check claims to inspect the artefact.\n const severity: CraftDeploymentSeverity =\n declared.kind === 'source' || artifactMode ? 'error' : 'warning';\n diagnostics.push({\n code: 'CRAFT_DEPLOY_PATH_MISSING',\n severity,\n path: declared.path,\n file: declared.value,\n runtime: manifest.runtime,\n message: `\\`${declared.value}\\` does not exist.`,\n fix:\n declared.kind === 'output'\n ? 'Run the declared build command, or correct the path in the manifest.'\n : 'Correct the path in the manifest.',\n });\n }\n}\n\nfunction checkModuleGraphs(\n rootDir: string,\n manifest: CraftDeploymentManifest,\n diagnostics: CraftDeploymentDiagnostic[],\n): void {\n const runtimeEntry = analysisEntry(manifest);\n if (runtimeEntry !== null) {\n const graph = readCraftModuleGraph(resolve(rootDir, runtimeEntry));\n if (graph.missingEntry === null) {\n if (manifest.runtime === 'worker' || manifest.runtime === 'lambda') {\n checkNodeBuiltins(rootDir, manifest, graph, diagnostics);\n }\n if (manifest.runtime === 'node') {\n checkHealthRoutes(manifest, graph, diagnostics);\n }\n checkEnvironment(manifest, graph, runtimeEntry, diagnostics);\n }\n }\n\n checkFunctionIds(rootDir, manifest, diagnostics);\n}\n\n/** Module the static analysis reads: the source when declared, else the build output. */\nfunction analysisEntry(manifest: CraftDeploymentManifest): string | null {\n if (manifest.runtime === 'node') {\n return manifest.server.source ?? manifest.server.entry;\n }\n if (manifest.runtime === 'worker') {\n return manifest.worker.source ?? manifest.worker.entry;\n }\n if (manifest.runtime === 'lambda') {\n return manifest.lambda.source ?? manifest.lambda.entry;\n }\n return null;\n}\n\nfunction checkNodeBuiltins(\n rootDir: string,\n manifest: CraftDeploymentManifest,\n graph: CraftModuleGraph,\n diagnostics: CraftDeploymentDiagnostic[],\n): void {\n for (const moduleImport of graph.imports) {\n if (!isNodeBuiltin(moduleImport.specifier)) continue;\n diagnostics.push({\n code: 'CRAFT_DEPLOY_NODE_BUILTIN_IMPORT',\n severity: 'error',\n file: relative(rootDir, moduleImport.file),\n line: moduleImport.line,\n runtime: manifest.runtime,\n platform: manifest.platform,\n message: `\\`${moduleImport.specifier}\\` is a Node built-in and the \\`${manifest.runtime}\\` runtime does not provide it.`,\n fix: 'Replace it with a Web API, or move the code behind an adapter this entry does not import.',\n });\n }\n}\n\nfunction checkHealthRoutes(\n manifest: CraftDeploymentManifest & { runtime: 'node' },\n graph: CraftModuleGraph,\n diagnostics: CraftDeploymentDiagnostic[],\n): void {\n const routes = [\n {\n code: 'CRAFT_DEPLOY_HEALTH_PATH_MISSING',\n path: 'server.healthPath',\n value: manifest.server.healthPath,\n },\n {\n code: 'CRAFT_DEPLOY_READY_PATH_MISSING',\n path: 'server.readyPath',\n value: manifest.server.readyPath,\n },\n ] as const;\n\n for (const route of routes) {\n if (graph.source.includes(`'${route.value}'`)) continue;\n if (graph.source.includes(`\"${route.value}\"`)) continue;\n if (graph.source.includes(`\\`${route.value}\\``)) continue;\n diagnostics.push({\n code: route.code,\n severity: 'error',\n path: route.path,\n runtime: 'node',\n message: `The SSR entry never mentions \\`${route.value}\\`.`,\n fix: 'Serve the declared path, or align the manifest with the path the server exposes.',\n });\n }\n}\n\nfunction checkEnvironment(\n manifest: CraftDeploymentManifest,\n graph: CraftModuleGraph,\n entry: string,\n diagnostics: CraftDeploymentDiagnostic[],\n): void {\n const declared = new Set(manifest.env.map((variable) => variable.name));\n for (const name of collectEnvironmentReads(graph.source)) {\n if (declared.has(name)) continue;\n diagnostics.push({\n code: 'CRAFT_DEPLOY_ENV_UNDECLARED',\n severity: 'warning',\n path: 'env',\n file: entry,\n runtime: manifest.runtime,\n message: `\\`${name}\\` is read by the runtime entry and is not declared in \\`env\\`.`,\n fix: `Add \\`{ name: '${name}', required: … }\\` to \\`env\\`, or stop reading it from the entry.`,\n });\n }\n}\n\nfunction checkFunctionIds(\n rootDir: string,\n manifest: CraftDeploymentManifest,\n diagnostics: CraftDeploymentDiagnostic[],\n): void {\n const functions = manifest.functions;\n if (!functions || functions.ids.length === 0) return;\n\n const graph = readCraftModuleGraph(resolve(rootDir, functions.entry));\n if (graph.missingEntry !== null) return;\n\n for (const [index, id] of functions.ids.entries()) {\n if (graph.source.includes(id)) continue;\n diagnostics.push({\n code: 'CRAFT_DEPLOY_FUNCTION_ID_UNKNOWN',\n severity: 'warning',\n path: `functions.ids[${index}]`,\n file: functions.entry,\n runtime: manifest.runtime,\n message: `\\`${id}\\` does not appear in the module graph of \\`${functions.entry}\\`.`,\n fix: 'Register the function in the entry, or remove the identifier from the manifest.',\n });\n }\n}\n"]}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { CraftDeploymentPlatform, CraftDeploymentRuntime } from './manifest.js';
|
|
2
|
+
export type CraftDeploymentSeverity = 'error' | 'warning';
|
|
3
|
+
export declare const CRAFT_DEPLOYMENT_DIAGNOSTIC_CODES: readonly ["CRAFT_DEPLOY_CONFIG_NOT_FOUND", "CRAFT_DEPLOY_CONFIG_LOAD_FAILED", "CRAFT_DEPLOY_CONFIG_NO_DEFAULT_EXPORT", "CRAFT_DEPLOY_MANIFEST_NOT_AN_OBJECT", "CRAFT_DEPLOY_MANIFEST_MISSING_FIELD", "CRAFT_DEPLOY_MANIFEST_INVALID_FIELD", "CRAFT_DEPLOY_MANIFEST_UNKNOWN_RUNTIME", "CRAFT_DEPLOY_MANIFEST_UNKNOWN_PLATFORM", "CRAFT_DEPLOY_MANIFEST_SECTION_MISSING", "CRAFT_DEPLOY_MANIFEST_SECTION_UNEXPECTED", "CRAFT_DEPLOY_PROTOCOL_VERSION_UNSUPPORTED", "CRAFT_DEPLOY_RUNTIME_MISMATCH", "CRAFT_DEPLOY_PLATFORM_MISMATCH", "CRAFT_DEPLOY_RUNTIME_PLATFORM_INCOMPATIBLE", "CRAFT_DEPLOY_PROVIDER_UNKNOWN", "CRAFT_DEPLOY_PROVIDER_CAPABILITY_MISSING", "CRAFT_DEPLOY_PROVIDER_PLATFORM_UNSUPPORTED", "CRAFT_DEPLOY_PROVIDER_NOT_INSTALLED", "CRAFT_DEPLOY_PROVIDER_INVALID_MODULE", "CRAFT_DEPLOY_PROVIDER_CREDENTIALS_MISSING", "CRAFT_DEPLOY_PROVIDER_STATE_UNAVAILABLE", "CRAFT_DEPLOY_PROVIDER_TOOLCHAIN_MISSING", "CRAFT_DEPLOY_PROVIDER_UNSUPPORTED_RESOURCE", "CRAFT_DEPLOY_DEPLOY_NOT_CONFIRMED", "CRAFT_DEPLOY_PATH_MISSING", "CRAFT_DEPLOY_NODE_BUILTIN_IMPORT", "CRAFT_DEPLOY_HEALTH_PATH_MISSING", "CRAFT_DEPLOY_READY_PATH_MISSING", "CRAFT_DEPLOY_SSG_ROUTES_MISSING", "CRAFT_DEPLOY_SSG_ROUTE_NOT_STATIC", "CRAFT_DEPLOY_SPA_FALLBACK_MISSING", "CRAFT_DEPLOY_ENV_NAME_INVALID", "CRAFT_DEPLOY_ENV_VALUE_FORBIDDEN", "CRAFT_DEPLOY_ENV_UNDECLARED", "CRAFT_DEPLOY_FUNCTION_ID_DUPLICATE", "CRAFT_DEPLOY_FUNCTION_ID_UNKNOWN", "CRAFT_DEPLOY_ARTIFACT_MISSING", "CRAFT_DEPLOY_ARTIFACT_NO_ENTRY", "CRAFT_DEPLOY_ARTIFACT_NO_JAVASCRIPT", "CRAFT_DEPLOY_ARTIFACT_SOURCE_MAP", "CRAFT_DEPLOY_SSG_ROUTE_NOT_RENDERED"];
|
|
4
|
+
export type CraftDeploymentDiagnosticCode = (typeof CRAFT_DEPLOYMENT_DIAGNOSTIC_CODES)[number];
|
|
5
|
+
/**
|
|
6
|
+
* A single deployment problem. The shape mirrors the reference page: a reader
|
|
7
|
+
* must find the concerned runtime or platform, the file, the cause and the
|
|
8
|
+
* expected correction without opening the source of the checker.
|
|
9
|
+
*/
|
|
10
|
+
export type CraftDeploymentDiagnostic = Readonly<{
|
|
11
|
+
code: CraftDeploymentDiagnosticCode;
|
|
12
|
+
severity: CraftDeploymentSeverity;
|
|
13
|
+
/** What is wrong, stated as a fact. */
|
|
14
|
+
message: string;
|
|
15
|
+
/** What the author has to change. */
|
|
16
|
+
fix: string;
|
|
17
|
+
/** Dotted path inside the manifest, e.g. `server.entry`. */
|
|
18
|
+
path?: string;
|
|
19
|
+
/** Path relative to the checked root. */
|
|
20
|
+
file?: string;
|
|
21
|
+
line?: number;
|
|
22
|
+
runtime?: CraftDeploymentRuntime;
|
|
23
|
+
platform?: CraftDeploymentPlatform;
|
|
24
|
+
provider?: string;
|
|
25
|
+
}>;
|
|
26
|
+
export type CraftDeploymentDiagnosticDescription = Readonly<{
|
|
27
|
+
code: CraftDeploymentDiagnosticCode;
|
|
28
|
+
title: string;
|
|
29
|
+
cause: string;
|
|
30
|
+
fix: string;
|
|
31
|
+
}>;
|
|
32
|
+
/**
|
|
33
|
+
* Documentation of every code the checker can emit. The reference page and
|
|
34
|
+
* this table are verified against each other, so a new code cannot ship
|
|
35
|
+
* undocumented.
|
|
36
|
+
*/
|
|
37
|
+
export declare const CRAFT_DEPLOYMENT_DIAGNOSTICS: Readonly<Record<CraftDeploymentDiagnosticCode, CraftDeploymentDiagnosticDescription>>;
|
|
38
|
+
//# sourceMappingURL=diagnostics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diagnostics.d.ts","sourceRoot":"","sources":["../../../../../libs/deploy/src/lib/diagnostics.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,uBAAuB,EACvB,sBAAsB,EACvB,MAAM,eAAe,CAAC;AAEvB,MAAM,MAAM,uBAAuB,GAAG,OAAO,GAAG,SAAS,CAAC;AAE1D,eAAO,MAAM,iCAAiC,2iDA0CpC,CAAC;AAEX,MAAM,MAAM,6BAA6B,GACvC,CAAC,OAAO,iCAAiC,CAAC,CAAC,MAAM,CAAC,CAAC;AAErD;;;;GAIG;AACH,MAAM,MAAM,yBAAyB,GAAG,QAAQ,CAAC;IAC/C,IAAI,EAAE,6BAA6B,CAAC;IACpC,QAAQ,EAAE,uB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|
+
'CRAFT_DEPLOY_MANIFEST_SECTION_UNEXPECTED',
|
|
12
|
+
'CRAFT_DEPLOY_PROTOCOL_VERSION_UNSUPPORTED',
|
|
13
|
+
'CRAFT_DEPLOY_RUNTIME_MISMATCH',
|
|
14
|
+
'CRAFT_DEPLOY_PLATFORM_MISMATCH',
|
|
15
|
+
'CRAFT_DEPLOY_RUNTIME_PLATFORM_INCOMPATIBLE',
|
|
16
|
+
'CRAFT_DEPLOY_PROVIDER_UNKNOWN',
|
|
17
|
+
'CRAFT_DEPLOY_PROVIDER_CAPABILITY_MISSING',
|
|
18
|
+
'CRAFT_DEPLOY_PROVIDER_PLATFORM_UNSUPPORTED',
|
|
19
|
+
'CRAFT_DEPLOY_PROVIDER_NOT_INSTALLED',
|
|
20
|
+
'CRAFT_DEPLOY_PROVIDER_INVALID_MODULE',
|
|
21
|
+
'CRAFT_DEPLOY_PROVIDER_CREDENTIALS_MISSING',
|
|
22
|
+
'CRAFT_DEPLOY_PROVIDER_STATE_UNAVAILABLE',
|
|
23
|
+
'CRAFT_DEPLOY_PROVIDER_TOOLCHAIN_MISSING',
|
|
24
|
+
'CRAFT_DEPLOY_PROVIDER_UNSUPPORTED_RESOURCE',
|
|
25
|
+
'CRAFT_DEPLOY_DEPLOY_NOT_CONFIRMED',
|
|
26
|
+
'CRAFT_DEPLOY_PATH_MISSING',
|
|
27
|
+
'CRAFT_DEPLOY_NODE_BUILTIN_IMPORT',
|
|
28
|
+
'CRAFT_DEPLOY_HEALTH_PATH_MISSING',
|
|
29
|
+
'CRAFT_DEPLOY_READY_PATH_MISSING',
|
|
30
|
+
'CRAFT_DEPLOY_SSG_ROUTES_MISSING',
|
|
31
|
+
'CRAFT_DEPLOY_SSG_ROUTE_NOT_STATIC',
|
|
32
|
+
'CRAFT_DEPLOY_SPA_FALLBACK_MISSING',
|
|
33
|
+
'CRAFT_DEPLOY_ENV_NAME_INVALID',
|
|
34
|
+
'CRAFT_DEPLOY_ENV_VALUE_FORBIDDEN',
|
|
35
|
+
'CRAFT_DEPLOY_ENV_UNDECLARED',
|
|
36
|
+
'CRAFT_DEPLOY_FUNCTION_ID_DUPLICATE',
|
|
37
|
+
'CRAFT_DEPLOY_FUNCTION_ID_UNKNOWN',
|
|
38
|
+
'CRAFT_DEPLOY_ARTIFACT_MISSING',
|
|
39
|
+
'CRAFT_DEPLOY_ARTIFACT_NO_ENTRY',
|
|
40
|
+
'CRAFT_DEPLOY_ARTIFACT_NO_JAVASCRIPT',
|
|
41
|
+
'CRAFT_DEPLOY_ARTIFACT_SOURCE_MAP',
|
|
42
|
+
'CRAFT_DEPLOY_SSG_ROUTE_NOT_RENDERED',
|
|
43
|
+
];
|
|
44
|
+
/**
|
|
45
|
+
* Documentation of every code the checker can emit. The reference page and
|
|
46
|
+
* this table are verified against each other, so a new code cannot ship
|
|
47
|
+
* undocumented.
|
|
48
|
+
*/
|
|
49
|
+
export const CRAFT_DEPLOYMENT_DIAGNOSTICS = Object.freeze({
|
|
50
|
+
CRAFT_DEPLOY_CONFIG_NOT_FOUND: {
|
|
51
|
+
code: 'CRAFT_DEPLOY_CONFIG_NOT_FOUND',
|
|
52
|
+
title: 'No deployment manifest found',
|
|
53
|
+
cause: 'No `craft.deploy.ts`, `craft.deploy.mjs`, `craft.deploy.js` or `craft.deploy.json` was found in the checked directory.',
|
|
54
|
+
fix: 'Create a manifest with `defineCraftDeployment` or point the CLI at one with `--config`.',
|
|
55
|
+
},
|
|
56
|
+
CRAFT_DEPLOY_CONFIG_LOAD_FAILED: {
|
|
57
|
+
code: 'CRAFT_DEPLOY_CONFIG_LOAD_FAILED',
|
|
58
|
+
title: 'The deployment manifest could not be imported',
|
|
59
|
+
cause: 'Loading the manifest threw, or the serialised manifest is not valid JSON. A TypeScript manifest also fails when the running Node cannot strip types and TypeScript is not installed.',
|
|
60
|
+
fix: 'Fix the thrown error, or run the CLI under a TypeScript loader, or commit a `craft.deploy.json` produced by the build.',
|
|
61
|
+
},
|
|
62
|
+
CRAFT_DEPLOY_CONFIG_NO_DEFAULT_EXPORT: {
|
|
63
|
+
code: 'CRAFT_DEPLOY_CONFIG_NO_DEFAULT_EXPORT',
|
|
64
|
+
title: 'The deployment manifest has no default export',
|
|
65
|
+
cause: 'The module loaded but exposes no default export to read.',
|
|
66
|
+
fix: 'Add `export default defineCraftDeployment({ ... })`.',
|
|
67
|
+
},
|
|
68
|
+
CRAFT_DEPLOY_MANIFEST_NOT_AN_OBJECT: {
|
|
69
|
+
code: 'CRAFT_DEPLOY_MANIFEST_NOT_AN_OBJECT',
|
|
70
|
+
title: 'The manifest is not an object',
|
|
71
|
+
cause: 'The default export or the parsed JSON is not a plain object.',
|
|
72
|
+
fix: 'Export the object returned by `defineCraftDeployment`.',
|
|
73
|
+
},
|
|
74
|
+
CRAFT_DEPLOY_MANIFEST_MISSING_FIELD: {
|
|
75
|
+
code: 'CRAFT_DEPLOY_MANIFEST_MISSING_FIELD',
|
|
76
|
+
title: 'A required manifest field is missing',
|
|
77
|
+
cause: 'A field the runtime or the providers need is absent.',
|
|
78
|
+
fix: 'Add the field reported by `path`.',
|
|
79
|
+
},
|
|
80
|
+
CRAFT_DEPLOY_MANIFEST_INVALID_FIELD: {
|
|
81
|
+
code: 'CRAFT_DEPLOY_MANIFEST_INVALID_FIELD',
|
|
82
|
+
title: 'A manifest field has an invalid value',
|
|
83
|
+
cause: 'The field exists but its type or its shape does not match the contract.',
|
|
84
|
+
fix: 'Correct the value reported by `path`; the message states what was expected.',
|
|
85
|
+
},
|
|
86
|
+
CRAFT_DEPLOY_MANIFEST_UNKNOWN_RUNTIME: {
|
|
87
|
+
code: 'CRAFT_DEPLOY_MANIFEST_UNKNOWN_RUNTIME',
|
|
88
|
+
title: 'Unknown runtime',
|
|
89
|
+
cause: '`runtime` is not one of `static`, `node`, `worker` or `lambda`.',
|
|
90
|
+
fix: 'Pick one of the four supported runtimes.',
|
|
91
|
+
},
|
|
92
|
+
CRAFT_DEPLOY_MANIFEST_UNKNOWN_PLATFORM: {
|
|
93
|
+
code: 'CRAFT_DEPLOY_MANIFEST_UNKNOWN_PLATFORM',
|
|
94
|
+
title: 'Unknown platform',
|
|
95
|
+
cause: '`platform` is not part of the documented platform list.',
|
|
96
|
+
fix: 'Pick a supported platform, or open an issue to add it to the matrix.',
|
|
97
|
+
},
|
|
98
|
+
CRAFT_DEPLOY_MANIFEST_SECTION_MISSING: {
|
|
99
|
+
code: 'CRAFT_DEPLOY_MANIFEST_SECTION_MISSING',
|
|
100
|
+
title: 'The runtime section is missing',
|
|
101
|
+
cause: 'Each runtime requires its own section: `static` and `client`, `server`, `worker` or `lambda`.',
|
|
102
|
+
fix: 'Add the section the runtime requires.',
|
|
103
|
+
},
|
|
104
|
+
CRAFT_DEPLOY_MANIFEST_SECTION_UNEXPECTED: {
|
|
105
|
+
code: 'CRAFT_DEPLOY_MANIFEST_SECTION_UNEXPECTED',
|
|
106
|
+
title: 'A section does not belong to this runtime',
|
|
107
|
+
cause: 'A section of another runtime is present; nothing would ever execute it.',
|
|
108
|
+
fix: 'Remove the section, or change the runtime to the one that uses it.',
|
|
109
|
+
},
|
|
110
|
+
CRAFT_DEPLOY_PROTOCOL_VERSION_UNSUPPORTED: {
|
|
111
|
+
code: 'CRAFT_DEPLOY_PROTOCOL_VERSION_UNSUPPORTED',
|
|
112
|
+
title: 'Unsupported manifest protocol version',
|
|
113
|
+
cause: 'The serialised manifest was produced by another version of the protocol.',
|
|
114
|
+
fix: 'Rebuild the manifest with the current CraftTS tooling, or follow the migration notes.',
|
|
115
|
+
},
|
|
116
|
+
CRAFT_DEPLOY_RUNTIME_MISMATCH: {
|
|
117
|
+
code: 'CRAFT_DEPLOY_RUNTIME_MISMATCH',
|
|
118
|
+
title: 'The requested runtime is not the manifest runtime',
|
|
119
|
+
cause: '`--runtime` was passed with a value the manifest does not declare.',
|
|
120
|
+
fix: 'Drop the flag, or change `runtime` in the manifest.',
|
|
121
|
+
},
|
|
122
|
+
CRAFT_DEPLOY_PLATFORM_MISMATCH: {
|
|
123
|
+
code: 'CRAFT_DEPLOY_PLATFORM_MISMATCH',
|
|
124
|
+
title: 'The requested platform is not the manifest platform',
|
|
125
|
+
cause: '`--platform` was passed with a value the manifest does not declare.',
|
|
126
|
+
fix: 'Drop the flag, or change `platform` in the manifest.',
|
|
127
|
+
},
|
|
128
|
+
CRAFT_DEPLOY_RUNTIME_PLATFORM_INCOMPATIBLE: {
|
|
129
|
+
code: 'CRAFT_DEPLOY_RUNTIME_PLATFORM_INCOMPATIBLE',
|
|
130
|
+
title: 'This platform cannot execute this runtime',
|
|
131
|
+
cause: 'The platform has no execution shape for the declared runtime, for instance a `lambda` runtime on Cloudflare.',
|
|
132
|
+
fix: 'Change the runtime or the platform; the compatibility matrix lists the supported pairs.',
|
|
133
|
+
},
|
|
134
|
+
CRAFT_DEPLOY_PROVIDER_UNKNOWN: {
|
|
135
|
+
code: 'CRAFT_DEPLOY_PROVIDER_UNKNOWN',
|
|
136
|
+
title: 'Unknown provider',
|
|
137
|
+
cause: 'The provider name is absent from the capability matrix.',
|
|
138
|
+
fix: 'Use a documented provider name, or register the provider before checking.',
|
|
139
|
+
},
|
|
140
|
+
CRAFT_DEPLOY_PROVIDER_CAPABILITY_MISSING: {
|
|
141
|
+
code: 'CRAFT_DEPLOY_PROVIDER_CAPABILITY_MISSING',
|
|
142
|
+
title: 'The provider does not support this runtime',
|
|
143
|
+
cause: 'The capability required by the runtime, and by the static mode when relevant, is not offered by the provider.',
|
|
144
|
+
fix: 'Choose a provider that declares the capability, or change the runtime or the static mode.',
|
|
145
|
+
},
|
|
146
|
+
CRAFT_DEPLOY_PROVIDER_PLATFORM_UNSUPPORTED: {
|
|
147
|
+
code: 'CRAFT_DEPLOY_PROVIDER_PLATFORM_UNSUPPORTED',
|
|
148
|
+
title: 'The provider does not target this platform',
|
|
149
|
+
cause: 'The provider cannot deploy to the platform declared by the manifest.',
|
|
150
|
+
fix: 'Choose a provider that targets the platform, or change the platform.',
|
|
151
|
+
},
|
|
152
|
+
CRAFT_DEPLOY_PROVIDER_NOT_INSTALLED: {
|
|
153
|
+
code: 'CRAFT_DEPLOY_PROVIDER_NOT_INSTALLED',
|
|
154
|
+
title: 'The provider package is not installed',
|
|
155
|
+
cause: 'The CLI resolves a provider from `@craft-ts/deploy-<name>` at run time, and that package is absent from the project.',
|
|
156
|
+
fix: 'Install the provider package, or point `--provider-module` at the module that exports it.',
|
|
157
|
+
},
|
|
158
|
+
CRAFT_DEPLOY_PROVIDER_INVALID_MODULE: {
|
|
159
|
+
code: 'CRAFT_DEPLOY_PROVIDER_INVALID_MODULE',
|
|
160
|
+
title: 'The provider package does not export a provider',
|
|
161
|
+
cause: 'The module loaded but exposes no `createCraftDeploymentProvider` factory.',
|
|
162
|
+
fix: 'Export `createCraftDeploymentProvider(options?)` returning a `CraftDeploymentProvider`.',
|
|
163
|
+
},
|
|
164
|
+
CRAFT_DEPLOY_PROVIDER_CREDENTIALS_MISSING: {
|
|
165
|
+
code: 'CRAFT_DEPLOY_PROVIDER_CREDENTIALS_MISSING',
|
|
166
|
+
title: 'The provider has no credentials',
|
|
167
|
+
cause: 'A credential the platform requires is absent from the environment. The tooling never stores one, so it can only report the name it expected.',
|
|
168
|
+
fix: 'Export the named variable in the shell or the CI secret store, then run the command again.',
|
|
169
|
+
},
|
|
170
|
+
CRAFT_DEPLOY_PROVIDER_STATE_UNAVAILABLE: {
|
|
171
|
+
code: 'CRAFT_DEPLOY_PROVIDER_STATE_UNAVAILABLE',
|
|
172
|
+
title: 'The provider state cannot be read',
|
|
173
|
+
cause: 'An infrastructure provider reconciles against a recorded state; without it, a deployment cannot tell a creation from an update.',
|
|
174
|
+
fix: 'Make the state backend reachable, or initialise it for this stage before deploying.',
|
|
175
|
+
},
|
|
176
|
+
CRAFT_DEPLOY_PROVIDER_TOOLCHAIN_MISSING: {
|
|
177
|
+
code: 'CRAFT_DEPLOY_PROVIDER_TOOLCHAIN_MISSING',
|
|
178
|
+
title: 'A tool the provider drives is missing',
|
|
179
|
+
cause: 'The provider shells out to a CLI or imports a runtime package that is not installed.',
|
|
180
|
+
fix: 'Install the reported tool, or choose a provider that does not need it.',
|
|
181
|
+
},
|
|
182
|
+
CRAFT_DEPLOY_PROVIDER_UNSUPPORTED_RESOURCE: {
|
|
183
|
+
code: 'CRAFT_DEPLOY_PROVIDER_UNSUPPORTED_RESOURCE',
|
|
184
|
+
title: 'The provider has no resource for this part of the manifest',
|
|
185
|
+
cause: 'The runtime, the platform or a declared binding maps to nothing the provider knows how to create.',
|
|
186
|
+
fix: 'Remove the declaration, or deploy that part with a provider that supports it.',
|
|
187
|
+
},
|
|
188
|
+
CRAFT_DEPLOY_DEPLOY_NOT_CONFIRMED: {
|
|
189
|
+
code: 'CRAFT_DEPLOY_DEPLOY_NOT_CONFIRMED',
|
|
190
|
+
title: 'A deployment was requested without confirmation',
|
|
191
|
+
cause: '`craft-ts deploy` mutates an infrastructure, so it refuses to run until the plan has been approved explicitly.',
|
|
192
|
+
fix: 'Review `craft-ts deploy preview`, then pass `--yes` to apply it.',
|
|
193
|
+
},
|
|
194
|
+
CRAFT_DEPLOY_PATH_MISSING: {
|
|
195
|
+
code: 'CRAFT_DEPLOY_PATH_MISSING',
|
|
196
|
+
title: 'A declared path does not exist',
|
|
197
|
+
cause: 'An entry point, an output directory or a configuration file declared by the manifest is absent from disk.',
|
|
198
|
+
fix: 'Run the build that produces it, or correct the path in the manifest.',
|
|
199
|
+
},
|
|
200
|
+
CRAFT_DEPLOY_NODE_BUILTIN_IMPORT: {
|
|
201
|
+
code: 'CRAFT_DEPLOY_NODE_BUILTIN_IMPORT',
|
|
202
|
+
title: 'A Node built-in is imported by a Worker or Lambda entry',
|
|
203
|
+
cause: 'The module graph reachable from the entry imports a Node built-in such as `node:fs` or `node:http`, which a Worker runtime does not provide.',
|
|
204
|
+
fix: 'Replace the built-in with a Web API, or move the code behind a platform adapter that the Worker entry does not import.',
|
|
205
|
+
},
|
|
206
|
+
CRAFT_DEPLOY_HEALTH_PATH_MISSING: {
|
|
207
|
+
code: 'CRAFT_DEPLOY_HEALTH_PATH_MISSING',
|
|
208
|
+
title: 'The health route is not served by the SSR entry',
|
|
209
|
+
cause: 'The path declared as `server.healthPath` was not found in the module graph of the SSR entry.',
|
|
210
|
+
fix: 'Serve the declared path, or align the manifest with the path the server exposes.',
|
|
211
|
+
},
|
|
212
|
+
CRAFT_DEPLOY_READY_PATH_MISSING: {
|
|
213
|
+
code: 'CRAFT_DEPLOY_READY_PATH_MISSING',
|
|
214
|
+
title: 'The readiness route is not served by the SSR entry',
|
|
215
|
+
cause: 'The path declared as `server.readyPath` was not found in the module graph of the SSR entry.',
|
|
216
|
+
fix: 'Serve the declared path, or align the manifest with the path the server exposes.',
|
|
217
|
+
},
|
|
218
|
+
CRAFT_DEPLOY_SSG_ROUTES_MISSING: {
|
|
219
|
+
code: 'CRAFT_DEPLOY_SSG_ROUTES_MISSING',
|
|
220
|
+
title: 'The SSG mode declares no route',
|
|
221
|
+
cause: 'A `ssg` deployment pre-renders one HTML file per route and the route list is empty.',
|
|
222
|
+
fix: 'List the routes in `static.routes`, or switch the mode to `spa`.',
|
|
223
|
+
},
|
|
224
|
+
CRAFT_DEPLOY_SSG_ROUTE_NOT_STATIC: {
|
|
225
|
+
code: 'CRAFT_DEPLOY_SSG_ROUTE_NOT_STATIC',
|
|
226
|
+
title: 'An SSG route cannot be pre-rendered',
|
|
227
|
+
cause: 'The route is not an absolute literal path: it carries a `:param`, a wildcard or a query string, so no single HTML file represents it.',
|
|
228
|
+
fix: 'Expand the route into its literal paths, or declare it in `static.serverRoutes`.',
|
|
229
|
+
},
|
|
230
|
+
CRAFT_DEPLOY_SPA_FALLBACK_MISSING: {
|
|
231
|
+
code: 'CRAFT_DEPLOY_SPA_FALLBACK_MISSING',
|
|
232
|
+
title: 'The SPA fallback document is missing from the client output',
|
|
233
|
+
cause: 'A `spa` deployment answers unknown paths with the fallback document, which is absent from the built output.',
|
|
234
|
+
fix: 'Build the client, or correct `static.fallback`.',
|
|
235
|
+
},
|
|
236
|
+
CRAFT_DEPLOY_ENV_NAME_INVALID: {
|
|
237
|
+
code: 'CRAFT_DEPLOY_ENV_NAME_INVALID',
|
|
238
|
+
title: 'Invalid environment variable name',
|
|
239
|
+
cause: 'A declared name is not an upper snake case identifier, which several platforms reject.',
|
|
240
|
+
fix: 'Rename the variable to `UPPER_SNAKE_CASE`.',
|
|
241
|
+
},
|
|
242
|
+
CRAFT_DEPLOY_ENV_VALUE_FORBIDDEN: {
|
|
243
|
+
code: 'CRAFT_DEPLOY_ENV_VALUE_FORBIDDEN',
|
|
244
|
+
title: 'An environment variable carries a value',
|
|
245
|
+
cause: 'The manifest is committed and read by every provider, so it declares names and requirements only.',
|
|
246
|
+
fix: 'Remove the value and provide it through the CI or the provider secret store.',
|
|
247
|
+
},
|
|
248
|
+
CRAFT_DEPLOY_ENV_UNDECLARED: {
|
|
249
|
+
code: 'CRAFT_DEPLOY_ENV_UNDECLARED',
|
|
250
|
+
title: 'An environment variable is read but not declared',
|
|
251
|
+
cause: 'The module graph of the runtime entry reads a variable the manifest does not list, so no provider can know it must be set.',
|
|
252
|
+
fix: 'Declare the variable in `env`, or stop reading it from the runtime entry.',
|
|
253
|
+
},
|
|
254
|
+
CRAFT_DEPLOY_FUNCTION_ID_DUPLICATE: {
|
|
255
|
+
code: 'CRAFT_DEPLOY_FUNCTION_ID_DUPLICATE',
|
|
256
|
+
title: 'A server-function identifier is declared twice',
|
|
257
|
+
cause: 'The identifier is the routing key of the protocol, so a duplicate makes the exposed contract ambiguous.',
|
|
258
|
+
fix: 'Keep one declaration per identifier.',
|
|
259
|
+
},
|
|
260
|
+
CRAFT_DEPLOY_FUNCTION_ID_UNKNOWN: {
|
|
261
|
+
code: 'CRAFT_DEPLOY_FUNCTION_ID_UNKNOWN',
|
|
262
|
+
title: 'A declared server-function identifier is not in the registry entry',
|
|
263
|
+
cause: 'The identifier does not appear in the module graph of `functions.entry`.',
|
|
264
|
+
fix: 'Register the function in the entry, or remove the identifier from the manifest.',
|
|
265
|
+
},
|
|
266
|
+
CRAFT_DEPLOY_ARTIFACT_MISSING: {
|
|
267
|
+
code: 'CRAFT_DEPLOY_ARTIFACT_MISSING',
|
|
268
|
+
title: 'The artefact directory does not exist',
|
|
269
|
+
cause: 'The directory the provider would publish has not been produced.',
|
|
270
|
+
fix: 'Run the declared build command before checking the artefact.',
|
|
271
|
+
},
|
|
272
|
+
CRAFT_DEPLOY_ARTIFACT_NO_ENTRY: {
|
|
273
|
+
code: 'CRAFT_DEPLOY_ARTIFACT_NO_ENTRY',
|
|
274
|
+
title: 'The artefact has no browser entry point',
|
|
275
|
+
cause: 'The public directory contains no `index.html`.',
|
|
276
|
+
fix: 'Check the build output directory declared in `client.outDir`.',
|
|
277
|
+
},
|
|
278
|
+
CRAFT_DEPLOY_ARTIFACT_NO_JAVASCRIPT: {
|
|
279
|
+
code: 'CRAFT_DEPLOY_ARTIFACT_NO_JAVASCRIPT',
|
|
280
|
+
title: 'The artefact contains no JavaScript',
|
|
281
|
+
cause: 'The public directory has no `.js` or `.mjs` file, which means the build produced nothing executable.',
|
|
282
|
+
fix: 'Check the build command and its output directory.',
|
|
283
|
+
},
|
|
284
|
+
CRAFT_DEPLOY_ARTIFACT_SOURCE_MAP: {
|
|
285
|
+
code: 'CRAFT_DEPLOY_ARTIFACT_SOURCE_MAP',
|
|
286
|
+
title: 'The artefact ships source maps',
|
|
287
|
+
cause: 'The source map policy is `forbidden` and the public directory contains `.map` files.',
|
|
288
|
+
fix: 'Disable source maps in the production build, or relax `artifact.sourceMaps`.',
|
|
289
|
+
},
|
|
290
|
+
CRAFT_DEPLOY_SSG_ROUTE_NOT_RENDERED: {
|
|
291
|
+
code: 'CRAFT_DEPLOY_SSG_ROUTE_NOT_RENDERED',
|
|
292
|
+
title: 'A declared SSG route has no pre-rendered document',
|
|
293
|
+
cause: 'The artefact contains neither `<route>.html` nor `<route>/index.html` for a route listed in `static.routes`.',
|
|
294
|
+
fix: 'Run the pre-render step for that route, or remove it from `static.routes`.',
|
|
295
|
+
},
|
|
296
|
+
});
|
|
297
|
+
//# sourceMappingURL=diagnostics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diagnostics.js","sourceRoot":"","sources":["../../../../../libs/deploy/src/lib/diagnostics.ts"],"names":[],"mappings":"AAOA,MAAM,CAAC,MAAM,iCAAiC,GAAG;IAC/C,+BAA+B;IAC/B,iCAAiC;IACjC,uCAAuC;IACvC,qCAAqC;IACrC,qCAAqC;IACrC,qCAAqC;IACrC,uCAAuC;IACvC,wCAAwC;IACxC,uCAAuC;IACvC,0CAA0C;IAC1C,2CAA2C;IAC3C,+BAA+B;IAC/B,gCAAgC;IAChC,4CAA4C;IAC5C,+BAA+B;IAC/B,0CAA0C;IAC1C,4CAA4C;IAC5C,qCAAqC;IACrC,sCAAsC;IACtC,2CAA2C;IAC3C,yCAAyC;IACzC,yCAAyC;IACzC,4CAA4C;IAC5C,mCAAmC;IACnC,2BAA2B;IAC3B,kCAAkC;IAClC,kCAAkC;IAClC,iCAAiC;IACjC,iCAAiC;IACjC,mCAAmC;IACnC,mCAAmC;IACnC,+BAA+B;IAC/B,kCAAkC;IAClC,6BAA6B;IAC7B,oCAAoC;IACpC,kCAAkC;IAClC,+BAA+B;IAC/B,gCAAgC;IAChC,qCAAqC;IACrC,kCAAkC;IAClC,qCAAqC;CAC7B,CAAC;AAkCX;;;;GAIG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAErC,MAAM,CAAC,MAAM,CAAC;IAChB,6BAA6B,EAAE;QAC7B,IAAI,EAAE,+BAA+B;QACrC,KAAK,EAAE,8BAA8B;QACrC,KAAK,EACH,wHAAwH;QAC1H,GAAG,EAAE,yFAAyF;KAC/F;IACD,+BAA+B,EAAE;QAC/B,IAAI,EAAE,iCAAiC;QACvC,KAAK,EAAE,+CAA+C;QACtD,KAAK,EACH,sLAAsL;QACxL,GAAG,EAAE,wHAAwH;KAC9H;IACD,qCAAqC,EAAE;QACr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xC,KAAK,EAAE,gCAAgC;QACvC,KAAK,EACH,sFAAsF;QACxF,GAAG,EAAE,8EAA8E;KACpF;IACD,mCAAmC,EAAE;QACnC,IAAI,EAAE,qCAAqC;QAC3C,KAAK,EAAE,mDAAmD;QAC1D,KAAK,EACH,8GAA8G;QAChH,GAAG,EAAE,4EAA4E;KAClF;CACF,CAAC,CAAC","sourcesContent":["import type {\n CraftDeploymentPlatform,\n CraftDeploymentRuntime,\n} from './manifest.js';\n\nexport type CraftDeploymentSeverity = 'error' | 'warning';\n\nexport const CRAFT_DEPLOYMENT_DIAGNOSTIC_CODES = [\n 'CRAFT_DEPLOY_CONFIG_NOT_FOUND',\n 'CRAFT_DEPLOY_CONFIG_LOAD_FAILED',\n 'CRAFT_DEPLOY_CONFIG_NO_DEFAULT_EXPORT',\n 'CRAFT_DEPLOY_MANIFEST_NOT_AN_OBJECT',\n 'CRAFT_DEPLOY_MANIFEST_MISSING_FIELD',\n 'CRAFT_DEPLOY_MANIFEST_INVALID_FIELD',\n 'CRAFT_DEPLOY_MANIFEST_UNKNOWN_RUNTIME',\n 'CRAFT_DEPLOY_MANIFEST_UNKNOWN_PLATFORM',\n 'CRAFT_DEPLOY_MANIFEST_SECTION_MISSING',\n 'CRAFT_DEPLOY_MANIFEST_SECTION_UNEXPECTED',\n 'CRAFT_DEPLOY_PROTOCOL_VERSION_UNSUPPORTED',\n 'CRAFT_DEPLOY_RUNTIME_MISMATCH',\n 'CRAFT_DEPLOY_PLATFORM_MISMATCH',\n 'CRAFT_DEPLOY_RUNTIME_PLATFORM_INCOMPATIBLE',\n 'CRAFT_DEPLOY_PROVIDER_UNKNOWN',\n 'CRAFT_DEPLOY_PROVIDER_CAPABILITY_MISSING',\n 'CRAFT_DEPLOY_PROVIDER_PLATFORM_UNSUPPORTED',\n 'CRAFT_DEPLOY_PROVIDER_NOT_INSTALLED',\n 'CRAFT_DEPLOY_PROVIDER_INVALID_MODULE',\n 'CRAFT_DEPLOY_PROVIDER_CREDENTIALS_MISSING',\n 'CRAFT_DEPLOY_PROVIDER_STATE_UNAVAILABLE',\n 'CRAFT_DEPLOY_PROVIDER_TOOLCHAIN_MISSING',\n 'CRAFT_DEPLOY_PROVIDER_UNSUPPORTED_RESOURCE',\n 'CRAFT_DEPLOY_DEPLOY_NOT_CONFIRMED',\n 'CRAFT_DEPLOY_PATH_MISSING',\n 'CRAFT_DEPLOY_NODE_BUILTIN_IMPORT',\n 'CRAFT_DEPLOY_HEALTH_PATH_MISSING',\n 'CRAFT_DEPLOY_READY_PATH_MISSING',\n 'CRAFT_DEPLOY_SSG_ROUTES_MISSING',\n 'CRAFT_DEPLOY_SSG_ROUTE_NOT_STATIC',\n 'CRAFT_DEPLOY_SPA_FALLBACK_MISSING',\n 'CRAFT_DEPLOY_ENV_NAME_INVALID',\n 'CRAFT_DEPLOY_ENV_VALUE_FORBIDDEN',\n 'CRAFT_DEPLOY_ENV_UNDECLARED',\n 'CRAFT_DEPLOY_FUNCTION_ID_DUPLICATE',\n 'CRAFT_DEPLOY_FUNCTION_ID_UNKNOWN',\n 'CRAFT_DEPLOY_ARTIFACT_MISSING',\n 'CRAFT_DEPLOY_ARTIFACT_NO_ENTRY',\n 'CRAFT_DEPLOY_ARTIFACT_NO_JAVASCRIPT',\n 'CRAFT_DEPLOY_ARTIFACT_SOURCE_MAP',\n 'CRAFT_DEPLOY_SSG_ROUTE_NOT_RENDERED',\n] as const;\n\nexport type CraftDeploymentDiagnosticCode =\n (typeof CRAFT_DEPLOYMENT_DIAGNOSTIC_CODES)[number];\n\n/**\n * A single deployment problem. The shape mirrors the reference page: a reader\n * must find the concerned runtime or platform, the file, the cause and the\n * expected correction without opening the source of the checker.\n */\nexport type CraftDeploymentDiagnostic = Readonly<{\n code: CraftDeploymentDiagnosticCode;\n severity: CraftDeploymentSeverity;\n /** What is wrong, stated as a fact. */\n message: string;\n /** What the author has to change. */\n fix: string;\n /** Dotted path inside the manifest, e.g. `server.entry`. */\n path?: string;\n /** Path relative to the checked root. */\n file?: string;\n line?: number;\n runtime?: CraftDeploymentRuntime;\n platform?: CraftDeploymentPlatform;\n provider?: string;\n}>;\n\nexport type CraftDeploymentDiagnosticDescription = Readonly<{\n code: CraftDeploymentDiagnosticCode;\n title: string;\n cause: string;\n fix: string;\n}>;\n\n/**\n * Documentation of every code the checker can emit. The reference page and\n * this table are verified against each other, so a new code cannot ship\n * undocumented.\n */\nexport const CRAFT_DEPLOYMENT_DIAGNOSTICS: Readonly<\n Record<CraftDeploymentDiagnosticCode, CraftDeploymentDiagnosticDescription>\n> = Object.freeze({\n CRAFT_DEPLOY_CONFIG_NOT_FOUND: {\n code: 'CRAFT_DEPLOY_CONFIG_NOT_FOUND',\n title: 'No deployment manifest found',\n cause:\n 'No `craft.deploy.ts`, `craft.deploy.mjs`, `craft.deploy.js` or `craft.deploy.json` was found in the checked directory.',\n fix: 'Create a manifest with `defineCraftDeployment` or point the CLI at one with `--config`.',\n },\n CRAFT_DEPLOY_CONFIG_LOAD_FAILED: {\n code: 'CRAFT_DEPLOY_CONFIG_LOAD_FAILED',\n title: 'The deployment manifest could not be imported',\n cause:\n 'Loading the manifest threw, or the serialised manifest is not valid JSON. A TypeScript manifest also fails when the running Node cannot strip types and TypeScript is not installed.',\n fix: 'Fix the thrown error, or run the CLI under a TypeScript loader, or commit a `craft.deploy.json` produced by the build.',\n },\n CRAFT_DEPLOY_CONFIG_NO_DEFAULT_EXPORT: {\n code: 'CRAFT_DEPLOY_CONFIG_NO_DEFAULT_EXPORT',\n title: 'The deployment manifest has no default export',\n cause: 'The module loaded but exposes no default export to read.',\n fix: 'Add `export default defineCraftDeployment({ ... })`.',\n },\n CRAFT_DEPLOY_MANIFEST_NOT_AN_OBJECT: {\n code: 'CRAFT_DEPLOY_MANIFEST_NOT_AN_OBJECT',\n title: 'The manifest is not an object',\n cause: 'The default export or the parsed JSON is not a plain object.',\n fix: 'Export the object returned by `defineCraftDeployment`.',\n },\n CRAFT_DEPLOY_MANIFEST_MISSING_FIELD: {\n code: 'CRAFT_DEPLOY_MANIFEST_MISSING_FIELD',\n title: 'A required manifest field is missing',\n cause: 'A field the runtime or the providers need is absent.',\n fix: 'Add the field reported by `path`.',\n },\n CRAFT_DEPLOY_MANIFEST_INVALID_FIELD: {\n code: 'CRAFT_DEPLOY_MANIFEST_INVALID_FIELD',\n title: 'A manifest field has an invalid value',\n cause:\n 'The field exists but its type or its shape does not match the contract.',\n fix: 'Correct the value reported by `path`; the message states what was expected.',\n },\n CRAFT_DEPLOY_MANIFEST_UNKNOWN_RUNTIME: {\n code: 'CRAFT_DEPLOY_MANIFEST_UNKNOWN_RUNTIME',\n title: 'Unknown runtime',\n cause: '`runtime` is not one of `static`, `node`, `worker` or `lambda`.',\n fix: 'Pick one of the four supported runtimes.',\n },\n CRAFT_DEPLOY_MANIFEST_UNKNOWN_PLATFORM: {\n code: 'CRAFT_DEPLOY_MANIFEST_UNKNOWN_PLATFORM',\n title: 'Unknown platform',\n cause: '`platform` is not part of the documented platform list.',\n fix: 'Pick a supported platform, or open an issue to add it to the matrix.',\n },\n CRAFT_DEPLOY_MANIFEST_SECTION_MISSING: {\n code: 'CRAFT_DEPLOY_MANIFEST_SECTION_MISSING',\n title: 'The runtime section is missing',\n cause:\n 'Each runtime requires its own section: `static` and `client`, `server`, `worker` or `lambda`.',\n fix: 'Add the section the runtime requires.',\n },\n CRAFT_DEPLOY_MANIFEST_SECTION_UNEXPECTED: {\n code: 'CRAFT_DEPLOY_MANIFEST_SECTION_UNEXPECTED',\n title: 'A section does not belong to this runtime',\n cause:\n 'A section of another runtime is present; nothing would ever execute it.',\n fix: 'Remove the section, or change the runtime to the one that uses it.',\n },\n CRAFT_DEPLOY_PROTOCOL_VERSION_UNSUPPORTED: {\n code: 'CRAFT_DEPLOY_PROTOCOL_VERSION_UNSUPPORTED',\n title: 'Unsupported manifest protocol version',\n cause:\n 'The serialised manifest was produced by another version of the protocol.',\n fix: 'Rebuild the manifest with the current CraftTS tooling, or follow the migration notes.',\n },\n CRAFT_DEPLOY_RUNTIME_MISMATCH: {\n code: 'CRAFT_DEPLOY_RUNTIME_MISMATCH',\n title: 'The requested runtime is not the manifest runtime',\n cause: '`--runtime` was passed with a value the manifest does not declare.',\n fix: 'Drop the flag, or change `runtime` in the manifest.',\n },\n CRAFT_DEPLOY_PLATFORM_MISMATCH: {\n code: 'CRAFT_DEPLOY_PLATFORM_MISMATCH',\n title: 'The requested platform is not the manifest platform',\n cause:\n '`--platform` was passed with a value the manifest does not declare.',\n fix: 'Drop the flag, or change `platform` in the manifest.',\n },\n CRAFT_DEPLOY_RUNTIME_PLATFORM_INCOMPATIBLE: {\n code: 'CRAFT_DEPLOY_RUNTIME_PLATFORM_INCOMPATIBLE',\n title: 'This platform cannot execute this runtime',\n cause:\n 'The platform has no execution shape for the declared runtime, for instance a `lambda` runtime on Cloudflare.',\n fix: 'Change the runtime or the platform; the compatibility matrix lists the supported pairs.',\n },\n CRAFT_DEPLOY_PROVIDER_UNKNOWN: {\n code: 'CRAFT_DEPLOY_PROVIDER_UNKNOWN',\n title: 'Unknown provider',\n cause: 'The provider name is absent from the capability matrix.',\n fix: 'Use a documented provider name, or register the provider before checking.',\n },\n CRAFT_DEPLOY_PROVIDER_CAPABILITY_MISSING: {\n code: 'CRAFT_DEPLOY_PROVIDER_CAPABILITY_MISSING',\n title: 'The provider does not support this runtime',\n cause:\n 'The capability required by the runtime, and by the static mode when relevant, is not offered by the provider.',\n fix: 'Choose a provider that declares the capability, or change the runtime or the static mode.',\n },\n CRAFT_DEPLOY_PROVIDER_PLATFORM_UNSUPPORTED: {\n code: 'CRAFT_DEPLOY_PROVIDER_PLATFORM_UNSUPPORTED',\n title: 'The provider does not target this platform',\n cause:\n 'The provider cannot deploy to the platform declared by the manifest.',\n fix: 'Choose a provider that targets the platform, or change the platform.',\n },\n CRAFT_DEPLOY_PROVIDER_NOT_INSTALLED: {\n code: 'CRAFT_DEPLOY_PROVIDER_NOT_INSTALLED',\n title: 'The provider package is not installed',\n cause:\n 'The CLI resolves a provider from `@craft-ts/deploy-<name>` at run time, and that package is absent from the project.',\n fix: 'Install the provider package, or point `--provider-module` at the module that exports it.',\n },\n CRAFT_DEPLOY_PROVIDER_INVALID_MODULE: {\n code: 'CRAFT_DEPLOY_PROVIDER_INVALID_MODULE',\n title: 'The provider package does not export a provider',\n cause:\n 'The module loaded but exposes no `createCraftDeploymentProvider` factory.',\n fix: 'Export `createCraftDeploymentProvider(options?)` returning a `CraftDeploymentProvider`.',\n },\n CRAFT_DEPLOY_PROVIDER_CREDENTIALS_MISSING: {\n code: 'CRAFT_DEPLOY_PROVIDER_CREDENTIALS_MISSING',\n title: 'The provider has no credentials',\n cause:\n 'A credential the platform requires is absent from the environment. The tooling never stores one, so it can only report the name it expected.',\n fix: 'Export the named variable in the shell or the CI secret store, then run the command again.',\n },\n CRAFT_DEPLOY_PROVIDER_STATE_UNAVAILABLE: {\n code: 'CRAFT_DEPLOY_PROVIDER_STATE_UNAVAILABLE',\n title: 'The provider state cannot be read',\n cause:\n 'An infrastructure provider reconciles against a recorded state; without it, a deployment cannot tell a creation from an update.',\n fix: 'Make the state backend reachable, or initialise it for this stage before deploying.',\n },\n CRAFT_DEPLOY_PROVIDER_TOOLCHAIN_MISSING: {\n code: 'CRAFT_DEPLOY_PROVIDER_TOOLCHAIN_MISSING',\n title: 'A tool the provider drives is missing',\n cause:\n 'The provider shells out to a CLI or imports a runtime package that is not installed.',\n fix: 'Install the reported tool, or choose a provider that does not need it.',\n },\n CRAFT_DEPLOY_PROVIDER_UNSUPPORTED_RESOURCE: {\n code: 'CRAFT_DEPLOY_PROVIDER_UNSUPPORTED_RESOURCE',\n title: 'The provider has no resource for this part of the manifest',\n cause:\n 'The runtime, the platform or a declared binding maps to nothing the provider knows how to create.',\n fix: 'Remove the declaration, or deploy that part with a provider that supports it.',\n },\n CRAFT_DEPLOY_DEPLOY_NOT_CONFIRMED: {\n code: 'CRAFT_DEPLOY_DEPLOY_NOT_CONFIRMED',\n title: 'A deployment was requested without confirmation',\n cause:\n '`craft-ts deploy` mutates an infrastructure, so it refuses to run until the plan has been approved explicitly.',\n fix: 'Review `craft-ts deploy preview`, then pass `--yes` to apply it.',\n },\n CRAFT_DEPLOY_PATH_MISSING: {\n code: 'CRAFT_DEPLOY_PATH_MISSING',\n title: 'A declared path does not exist',\n cause:\n 'An entry point, an output directory or a configuration file declared by the manifest is absent from disk.',\n fix: 'Run the build that produces it, or correct the path in the manifest.',\n },\n CRAFT_DEPLOY_NODE_BUILTIN_IMPORT: {\n code: 'CRAFT_DEPLOY_NODE_BUILTIN_IMPORT',\n title: 'A Node built-in is imported by a Worker or Lambda entry',\n cause:\n 'The module graph reachable from the entry imports a Node built-in such as `node:fs` or `node:http`, which a Worker runtime does not provide.',\n fix: 'Replace the built-in with a Web API, or move the code behind a platform adapter that the Worker entry does not import.',\n },\n CRAFT_DEPLOY_HEALTH_PATH_MISSING: {\n code: 'CRAFT_DEPLOY_HEALTH_PATH_MISSING',\n title: 'The health route is not served by the SSR entry',\n cause:\n 'The path declared as `server.healthPath` was not found in the module graph of the SSR entry.',\n fix: 'Serve the declared path, or align the manifest with the path the server exposes.',\n },\n CRAFT_DEPLOY_READY_PATH_MISSING: {\n code: 'CRAFT_DEPLOY_READY_PATH_MISSING',\n title: 'The readiness route is not served by the SSR entry',\n cause:\n 'The path declared as `server.readyPath` was not found in the module graph of the SSR entry.',\n fix: 'Serve the declared path, or align the manifest with the path the server exposes.',\n },\n CRAFT_DEPLOY_SSG_ROUTES_MISSING: {\n code: 'CRAFT_DEPLOY_SSG_ROUTES_MISSING',\n title: 'The SSG mode declares no route',\n cause:\n 'A `ssg` deployment pre-renders one HTML file per route and the route list is empty.',\n fix: 'List the routes in `static.routes`, or switch the mode to `spa`.',\n },\n CRAFT_DEPLOY_SSG_ROUTE_NOT_STATIC: {\n code: 'CRAFT_DEPLOY_SSG_ROUTE_NOT_STATIC',\n title: 'An SSG route cannot be pre-rendered',\n cause:\n 'The route is not an absolute literal path: it carries a `:param`, a wildcard or a query string, so no single HTML file represents it.',\n fix: 'Expand the route into its literal paths, or declare it in `static.serverRoutes`.',\n },\n CRAFT_DEPLOY_SPA_FALLBACK_MISSING: {\n code: 'CRAFT_DEPLOY_SPA_FALLBACK_MISSING',\n title: 'The SPA fallback document is missing from the client output',\n cause:\n 'A `spa` deployment answers unknown paths with the fallback document, which is absent from the built output.',\n fix: 'Build the client, or correct `static.fallback`.',\n },\n CRAFT_DEPLOY_ENV_NAME_INVALID: {\n code: 'CRAFT_DEPLOY_ENV_NAME_INVALID',\n title: 'Invalid environment variable name',\n cause:\n 'A declared name is not an upper snake case identifier, which several platforms reject.',\n fix: 'Rename the variable to `UPPER_SNAKE_CASE`.',\n },\n CRAFT_DEPLOY_ENV_VALUE_FORBIDDEN: {\n code: 'CRAFT_DEPLOY_ENV_VALUE_FORBIDDEN',\n title: 'An environment variable carries a value',\n cause:\n 'The manifest is committed and read by every provider, so it declares names and requirements only.',\n fix: 'Remove the value and provide it through the CI or the provider secret store.',\n },\n CRAFT_DEPLOY_ENV_UNDECLARED: {\n code: 'CRAFT_DEPLOY_ENV_UNDECLARED',\n title: 'An environment variable is read but not declared',\n cause:\n 'The module graph of the runtime entry reads a variable the manifest does not list, so no provider can know it must be set.',\n fix: 'Declare the variable in `env`, or stop reading it from the runtime entry.',\n },\n CRAFT_DEPLOY_FUNCTION_ID_DUPLICATE: {\n code: 'CRAFT_DEPLOY_FUNCTION_ID_DUPLICATE',\n title: 'A server-function identifier is declared twice',\n cause:\n 'The identifier is the routing key of the protocol, so a duplicate makes the exposed contract ambiguous.',\n fix: 'Keep one declaration per identifier.',\n },\n CRAFT_DEPLOY_FUNCTION_ID_UNKNOWN: {\n code: 'CRAFT_DEPLOY_FUNCTION_ID_UNKNOWN',\n title: 'A declared server-function identifier is not in the registry entry',\n cause:\n 'The identifier does not appear in the module graph of `functions.entry`.',\n fix: 'Register the function in the entry, or remove the identifier from the manifest.',\n },\n CRAFT_DEPLOY_ARTIFACT_MISSING: {\n code: 'CRAFT_DEPLOY_ARTIFACT_MISSING',\n title: 'The artefact directory does not exist',\n cause: 'The directory the provider would publish has not been produced.',\n fix: 'Run the declared build command before checking the artefact.',\n },\n CRAFT_DEPLOY_ARTIFACT_NO_ENTRY: {\n code: 'CRAFT_DEPLOY_ARTIFACT_NO_ENTRY',\n title: 'The artefact has no browser entry point',\n cause: 'The public directory contains no `index.html`.',\n fix: 'Check the build output directory declared in `client.outDir`.',\n },\n CRAFT_DEPLOY_ARTIFACT_NO_JAVASCRIPT: {\n code: 'CRAFT_DEPLOY_ARTIFACT_NO_JAVASCRIPT',\n title: 'The artefact contains no JavaScript',\n cause:\n 'The public directory has no `.js` or `.mjs` file, which means the build produced nothing executable.',\n fix: 'Check the build command and its output directory.',\n },\n CRAFT_DEPLOY_ARTIFACT_SOURCE_MAP: {\n code: 'CRAFT_DEPLOY_ARTIFACT_SOURCE_MAP',\n title: 'The artefact ships source maps',\n cause:\n 'The source map policy is `forbidden` and the public directory contains `.map` files.',\n fix: 'Disable source maps in the production build, or relax `artifact.sourceMaps`.',\n },\n CRAFT_DEPLOY_SSG_ROUTE_NOT_RENDERED: {\n code: 'CRAFT_DEPLOY_SSG_ROUTE_NOT_RENDERED',\n title: 'A declared SSG route has no pre-rendered document',\n cause:\n 'The artefact contains neither `<route>.html` nor `<route>/index.html` for a route listed in `static.routes`.',\n fix: 'Run the pre-render step for that route, or remove it from `static.routes`.',\n },\n});\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { CraftDeploymentDiagnostic } from './diagnostics.js';
|
|
2
|
+
import type { CraftDeploymentPlan } from './providers.js';
|
|
3
|
+
/**
|
|
4
|
+
* Renders a diagnostic on one line, followed by the correction.
|
|
5
|
+
*
|
|
6
|
+
* The location comes first so an editor or a CI log parser finds the file, and
|
|
7
|
+
* the fix is never dropped: a code without a correction is what makes a check
|
|
8
|
+
* get disabled instead of satisfied.
|
|
9
|
+
*/
|
|
10
|
+
export declare function formatCraftDeploymentDiagnostic(diagnostic: CraftDeploymentDiagnostic): string;
|
|
11
|
+
/**
|
|
12
|
+
* Renders a plan as the approval surface it is: one line per resource, the
|
|
13
|
+
* action first so a `delete` cannot be skimmed past, then the facts that
|
|
14
|
+
* justify it.
|
|
15
|
+
*/
|
|
16
|
+
export declare function formatCraftDeploymentPlan(plan: CraftDeploymentPlan): string;
|
|
17
|
+
//# sourceMappingURL=format.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../../../../libs/deploy/src/lib/format.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAE1D;;;;;;GAMG;AACH,wBAAgB,+BAA+B,CAC7C,UAAU,EAAE,yBAAyB,GACpC,MAAM,CAgBR;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,mBAAmB,GAAG,MAAM,CAmB3E"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Renders a diagnostic on one line, followed by the correction.
|
|
3
|
+
*
|
|
4
|
+
* The location comes first so an editor or a CI log parser finds the file, and
|
|
5
|
+
* the fix is never dropped: a code without a correction is what makes a check
|
|
6
|
+
* get disabled instead of satisfied.
|
|
7
|
+
*/
|
|
8
|
+
export function formatCraftDeploymentDiagnostic(diagnostic) {
|
|
9
|
+
const location = diagnostic.file
|
|
10
|
+
? `${diagnostic.file}${diagnostic.line ? `:${diagnostic.line}` : ''}`
|
|
11
|
+
: (diagnostic.path ?? 'craft.deploy');
|
|
12
|
+
const target = [
|
|
13
|
+
diagnostic.runtime && `runtime ${diagnostic.runtime}`,
|
|
14
|
+
diagnostic.platform && `platform ${diagnostic.platform}`,
|
|
15
|
+
diagnostic.provider && `provider ${diagnostic.provider}`,
|
|
16
|
+
]
|
|
17
|
+
.filter((part) => typeof part === 'string')
|
|
18
|
+
.join(', ');
|
|
19
|
+
const header = `${diagnostic.severity} ${location} ${diagnostic.code}${target ? ` (${target})` : ''}: ${diagnostic.message}`;
|
|
20
|
+
return `${header}\n fix: ${diagnostic.fix}`;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Renders a plan as the approval surface it is: one line per resource, the
|
|
24
|
+
* action first so a `delete` cannot be skimmed past, then the facts that
|
|
25
|
+
* justify it.
|
|
26
|
+
*/
|
|
27
|
+
export function formatCraftDeploymentPlan(plan) {
|
|
28
|
+
const lines = [
|
|
29
|
+
`plan: ${plan.provider} → stage ${plan.stage} (${plan.resources.length} resource(s))`,
|
|
30
|
+
];
|
|
31
|
+
for (const resource of plan.resources) {
|
|
32
|
+
lines.push(` ${resource.action.padEnd(9)} ${resource.type} ${resource.name}`);
|
|
33
|
+
for (const [key, value] of Object.entries(resource.details)) {
|
|
34
|
+
lines.push(` ${key}: ${value}`);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
for (const note of plan.notes) {
|
|
38
|
+
lines.push(` note: ${note}`);
|
|
39
|
+
}
|
|
40
|
+
return lines.join('\n');
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=format.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format.js","sourceRoot":"","sources":["../../../../../libs/deploy/src/lib/format.ts"],"names":[],"mappings":"AAGA;;;;;;GAMG;AACH,MAAM,UAAU,+BAA+B,CAC7C,UAAqC;IAErC,MAAM,QAAQ,GAAG,UAAU,CAAC,IAAI;QAC9B,CAAC,CAAC,GAAG,UAAU,CAAC,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,UAAU,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE;QACrE,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,IAAI,cAAc,CAAC,CAAC;IACxC,MAAM,MAAM,GAAG;QACb,U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AE,CAAC;QAC9B,KAAK,CAAC,IAAI,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC;IAChC,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC","sourcesContent":["import type { CraftDeploymentDiagnostic } from './diagnostics.js';\nimport type { CraftDeploymentPlan } from './providers.js';\n\n/**\n * Renders a diagnostic on one line, followed by the correction.\n *\n * The location comes first so an editor or a CI log parser finds the file, and\n * the fix is never dropped: a code without a correction is what makes a check\n * get disabled instead of satisfied.\n */\nexport function formatCraftDeploymentDiagnostic(\n diagnostic: CraftDeploymentDiagnostic,\n): string {\n const location = diagnostic.file\n ? `${diagnostic.file}${diagnostic.line ? `:${diagnostic.line}` : ''}`\n : (diagnostic.path ?? 'craft.deploy');\n const target = [\n diagnostic.runtime && `runtime ${diagnostic.runtime}`,\n diagnostic.platform && `platform ${diagnostic.platform}`,\n diagnostic.provider && `provider ${diagnostic.provider}`,\n ]\n .filter((part): part is string => typeof part === 'string')\n .join(', ');\n\n const header = `${diagnostic.severity} ${location} ${diagnostic.code}${\n target ? ` (${target})` : ''\n }: ${diagnostic.message}`;\n return `${header}\\n fix: ${diagnostic.fix}`;\n}\n\n/**\n * Renders a plan as the approval surface it is: one line per resource, the\n * action first so a `delete` cannot be skimmed past, then the facts that\n * justify it.\n */\nexport function formatCraftDeploymentPlan(plan: CraftDeploymentPlan): string {\n const lines = [\n `plan: ${plan.provider} → stage ${plan.stage} (${plan.resources.length} resource(s))`,\n ];\n\n for (const resource of plan.resources) {\n lines.push(\n ` ${resource.action.padEnd(9)} ${resource.type} ${resource.name}`,\n );\n for (const [key, value] of Object.entries(resource.details)) {\n lines.push(` ${key}: ${value}`);\n }\n }\n\n for (const note of plan.notes) {\n lines.push(` note: ${note}`);\n }\n\n return lines.join('\\n');\n}\n"]}
|