@prisma/orm-toolchain 8.0.0-rc.23-dev.12 → 8.0.0-rc.23-dev.14
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/cli.mjs +125 -68
- package/dist/cli.mjs.map +1 -1
- package/dist/cli__control-api.d.mts +3 -1
- package/dist/cli__control-api.d.mts.map +1 -1
- package/dist/cli__control-api.mjs +1 -1
- package/dist/{ref-hKV9pGrC-DVWnb8cQ.mjs → ref-DH9J_oNY-CipATbYR.mjs} +47 -12
- package/dist/ref-DH9J_oNY-CipATbYR.mjs.map +1 -0
- package/dist/vite-plugin-contract-emit.mjs +1 -1
- package/package.json +12 -12
- package/dist/ref-hKV9pGrC-DVWnb8cQ.mjs.map +0 -1
package/dist/cli.mjs
CHANGED
|
@@ -11,7 +11,7 @@ import { d as writeRef, r as readRef } from "./refs-DM3q3IZC-BC6H6P0X.mjs";
|
|
|
11
11
|
import { a as contractHashAtMarker } from "./aggregate-BIjV2dM9.mjs";
|
|
12
12
|
import { i as createScaffoldSpecifierResolver } from "./import-roots-CWlCTZJ9.mjs";
|
|
13
13
|
import { o as isLiveMarkerRef } from "./ref-resolution-Eo0QHp4f.mjs";
|
|
14
|
-
import { $ as refuseContractSpaceIntegrity, A as executeRefDeleteCommand, B as loadAggregateIntegrityViolations, D as executeMigrationNewCommand, E as executeMigrateShowPlan, F as hasMigrationPath, G as looksLikePath, H as loadContractSource, I as isStatementVerb, J as matchConsents, K as mapContractAtError, L as labelsText, M as executeRefSetCommand, N as findPackageByDirPath, O as executeMigrationPlanCommand, P as formatSourceDiagnostic, Q as readMigrationRefs, R as listRefsByContractHash, St as
|
|
14
|
+
import { $ as refuseContractSpaceIntegrity, A as executeRefDeleteCommand, B as loadAggregateIntegrityViolations, Ct as withWarningFindings, D as executeMigrationNewCommand, E as executeMigrateShowPlan, F as hasMigrationPath, G as looksLikePath, H as loadContractSource, I as isStatementVerb, J as matchConsents, K as mapContractAtError, L as labelsText, M as executeRefSetCommand, N as findPackageByDirPath, O as executeMigrationPlanCommand, P as formatSourceDiagnostic, Q as readMigrationRefs, R as listRefsByContractHash, St as validateLoadedContract, U as loadContractSourceWithStack, V as loadContractRawSafely, W as loadContractSpaceAggregateForCli, X as planEverySpace, Y as migrationSpaceListEntriesFromAggregate, Z as preflightRefAdvancement, _ as deriveStatusEdgeAnnotations, _t as skippedOperationsText, a as advanceRefSafely, at as requireDatabaseForLiveMarkerUse, b as enumerateCheckSpaces, bt as statusForMigrationHash, ct as resolveContractRefToSnapshot, d as buildRefAdvancementFields, f as checkSingleTarget, g as createControlClient, gt as runMigrationList, h as convertAndDelete, ht as runMigrationCheck, i as RECORDED_OR_EMPTY_CONTRACT_REF_FORMS, it as renamedAndDeleted, j as executeRefListCommand, l as buildMigrationSpaceGraphEntries, m as contractValidationMeta, n as NO_REF_ADVANCEMENT, nt as refusePackageCorruptionOnAggregate, ot as resolveAppTargetPath, p as computeRefAdvancementName, pt as retryCommandFor, r as RECORDED_CONTRACT_REF_FORMS, rt as refuseUnknownInvariants, s as appliedHashesFromLedger, st as resolveContractRef$1, t as ALL_CONTRACT_REF_FORMS, tt as refuseMissingInvariantPath, u as buildReadAggregate, ut as resolveMigrationRef, vt as snapshotVerifierFor, x as executeContractEmit, xt as toDeclaredExtensionsFromRaw, yt as sourceWarningDiagnostic, z as liveMarkerUse } from "./ref-DH9J_oNY-CipATbYR.mjs";
|
|
15
15
|
import { a as PRISMA7_QUICK_REFERENCE_STEP, i as PRISMA7_LOOP_STEP, n as InitOutputSchema, o as buildNextSteps, r as NEXT_STEPS_BEFORE_SCAFFOLD, t as DB_SIGN_STEP } from "./output-BcC8eB0h-C5bRd-aC.mjs";
|
|
16
16
|
import { a as resolveGating, i as readUserConfig, r as ensureInstallationId, s as runTelemetry, u as userConfigPath } from "./exports-DwuO4y2c.mjs";
|
|
17
17
|
import { createRequire } from "node:module";
|
|
@@ -43,8 +43,8 @@ import stringWidth from "string-width";
|
|
|
43
43
|
import { bold, createColors, cyan, cyanBright, dim, green, yellow } from "colorette";
|
|
44
44
|
import { isCI } from "ci-info";
|
|
45
45
|
import { build } from "esbuild";
|
|
46
|
-
//#region ../../../1-framework/3-tooling/cli/dist/cli-
|
|
47
|
-
var version = "8.0.0-rc.23-dev.
|
|
46
|
+
//#region ../../../1-framework/3-tooling/cli/dist/cli-BvlI6kIO.mjs
|
|
47
|
+
var version = "8.0.0-rc.23-dev.14";
|
|
48
48
|
const ESCAPES = {
|
|
49
49
|
"\\": "\\\\",
|
|
50
50
|
" ": "\\t",
|
|
@@ -833,6 +833,11 @@ function renderPreviewStatement(text, language) {
|
|
|
833
833
|
function previewBlockHeader(preview) {
|
|
834
834
|
return preview.statements.length > 0 && preview.statements.every((s) => s.language === "sql") ? "DDL preview" : "Operation preview";
|
|
835
835
|
}
|
|
836
|
+
/** A planner warning as the CLI prints it: its summary, then its why. */
|
|
837
|
+
function plannerWarningText(warning) {
|
|
838
|
+
if (warning.why === void 0) return warning.summary;
|
|
839
|
+
return `${/[.!?]$/.test(warning.summary) ? warning.summary : `${warning.summary}.`} ${warning.why}`;
|
|
840
|
+
}
|
|
836
841
|
const SLOT_TEXT = {
|
|
837
842
|
convert: "conversion slot written in migration.ts",
|
|
838
843
|
backfill: "backfill slots written in migration.ts"
|
|
@@ -918,6 +923,14 @@ function operationBlocks$2(result) {
|
|
|
918
923
|
roots: result.plan.operations.map(operationNode)
|
|
919
924
|
}, ...destructiveWarningBlocks(hasDestructive)];
|
|
920
925
|
}
|
|
926
|
+
/** What the planner flagged without refusing to plan it, each its summary followed by its why. */
|
|
927
|
+
function plannerWarningBlocks(result) {
|
|
928
|
+
return (result.plannerWarnings ?? []).map((warning) => ({
|
|
929
|
+
kind: "summary",
|
|
930
|
+
status: "warn",
|
|
931
|
+
text: plannerWarningText(warning)
|
|
932
|
+
}));
|
|
933
|
+
}
|
|
921
934
|
/** The statements a database would run, printed verbatim rather than laid out. */
|
|
922
935
|
function previewBlocks$2(preview) {
|
|
923
936
|
if (preview === void 0) return [];
|
|
@@ -938,26 +951,13 @@ function previewBlocks$2(preview) {
|
|
|
938
951
|
lines: statements
|
|
939
952
|
}];
|
|
940
953
|
}
|
|
941
|
-
/** What the planner flagged without refusing to plan it. */
|
|
942
|
-
function plannerWarningBlocks(result) {
|
|
943
|
-
const warnings = result.warnings ?? [];
|
|
944
|
-
if (warnings.length === 0) return [];
|
|
945
|
-
return [{
|
|
946
|
-
kind: "summary",
|
|
947
|
-
status: "warn",
|
|
948
|
-
text: "Planner warnings"
|
|
949
|
-
}, {
|
|
950
|
-
kind: "list",
|
|
951
|
-
items: warnings.map((warning) => warning.summary)
|
|
952
|
-
}];
|
|
953
|
-
}
|
|
954
954
|
/** The new required fields whose existing rows get a temporary value, and how to choose the value. */
|
|
955
955
|
function temporaryValueBlocks$1(result, invocation, databaseStorageHash) {
|
|
956
956
|
const get = result.mode === "plan" ? "would get" : "got";
|
|
957
957
|
return (result.temporaryValues ?? []).map(({ field, value }) => ({
|
|
958
958
|
kind: "summary",
|
|
959
959
|
status: "warn",
|
|
960
|
-
text: `
|
|
960
|
+
text: `Field "${field}" ${get} the temporary value ${value} where existing data has none. To choose the value, plan a migration with ${printedPlanCommand(invocation, databaseStorageHash, [statementFlag({
|
|
961
961
|
verb: "backfill",
|
|
962
962
|
text: field
|
|
963
963
|
})])} instead.`
|
|
@@ -970,11 +970,12 @@ function planSummaryText(result) {
|
|
|
970
970
|
}
|
|
971
971
|
function applySummaryText(result) {
|
|
972
972
|
const executed = result.execution?.operationsExecuted ?? 0;
|
|
973
|
+
const planned = result.plan.operations.length;
|
|
973
974
|
const spaces = result.perSpace?.length ?? 0;
|
|
974
975
|
const across = spaces > 0 ? ` across ${spaces} contract space${spaces === 1 ? "" : "s"}` : "";
|
|
975
976
|
if (result.changedStorageEntities !== void 0) return result.summary;
|
|
976
977
|
if (executed === 0) return `Database already matches contract${across}`;
|
|
977
|
-
return `Applied ${executed} operation(s)${across}`;
|
|
978
|
+
return executed < planned ? `Applied ${executed} of ${planned} operation(s)${across}; ${skippedOperationsText(planned - executed)}` : `Applied ${executed} operation(s)${across}`;
|
|
978
979
|
}
|
|
979
980
|
/** For each namespace the plan removes, the answers that answer all of its questions. */
|
|
980
981
|
function namespaceAnswerLines(result) {
|
|
@@ -1128,9 +1129,8 @@ function migrationResultNextActions(result, invocation, applyCommand) {
|
|
|
1128
1129
|
return result.mode === "plan" ? [runCommandAction("Apply the planned operations", applyCommand)] : [runCommandAction(result.perSpace !== void 0 && result.perSpace.length === 1 ? "Confirm the space is up to date" : "Confirm every space is up to date", cliCommand(invocation, "migration status"))];
|
|
1129
1130
|
}
|
|
1130
1131
|
/**
|
|
1131
|
-
* Collects the planner's warnings a run hands to `onPlannerWarnings`. A
|
|
1132
|
-
*
|
|
1133
|
-
* its result.
|
|
1132
|
+
* Collects the planner's warnings a run hands to `onPlannerWarnings`. A successful run shows them
|
|
1133
|
+
* in its result; a failed one reports them as `warn` messages, which come before its error.
|
|
1134
1134
|
*/
|
|
1135
1135
|
function plannerWarningsCollector(report) {
|
|
1136
1136
|
let collected = [];
|
|
@@ -1143,7 +1143,7 @@ function plannerWarningsCollector(report) {
|
|
|
1143
1143
|
for (const warning of collected) report({
|
|
1144
1144
|
kind: "message",
|
|
1145
1145
|
severity: "warn",
|
|
1146
|
-
text: warning
|
|
1146
|
+
text: plannerWarningText(warning)
|
|
1147
1147
|
});
|
|
1148
1148
|
}
|
|
1149
1149
|
};
|
|
@@ -1255,7 +1255,7 @@ function initDocument(inputs) {
|
|
|
1255
1255
|
...ifDefined("perSpace", value.perSpace),
|
|
1256
1256
|
advancedRef: inputs.advancedRef,
|
|
1257
1257
|
plannedAdvanceRef: inputs.plannedAdvanceRef,
|
|
1258
|
-
...inputs.plannerWarnings.length > 0 ? {
|
|
1258
|
+
...inputs.plannerWarnings.length > 0 ? { plannerWarnings: inputs.plannerWarnings } : {},
|
|
1259
1259
|
summary: value.summary,
|
|
1260
1260
|
timings: { total: Date.now() - inputs.startedAt }
|
|
1261
1261
|
};
|
|
@@ -2430,7 +2430,7 @@ function updateDocument(inputs) {
|
|
|
2430
2430
|
removedNamespaces: removedNamespacesJson(value, inputs.statements),
|
|
2431
2431
|
addedNamespaces: value.namespaces?.added ?? []
|
|
2432
2432
|
} : {},
|
|
2433
|
-
...inputs.plannerWarnings.length > 0 ? {
|
|
2433
|
+
...inputs.plannerWarnings.length > 0 ? { plannerWarnings: inputs.plannerWarnings } : {},
|
|
2434
2434
|
advancedRef: inputs.advancedRef,
|
|
2435
2435
|
plannedAdvanceRef: inputs.plannedAdvanceRef,
|
|
2436
2436
|
summary: value.summary,
|
|
@@ -4426,7 +4426,7 @@ function dbFile(target, resolveImportSpecifier = keepInternalSpecifiers) {
|
|
|
4426
4426
|
return `import 'dotenv/config';
|
|
4427
4427
|
import ${factory} from '${runtime}';
|
|
4428
4428
|
import { contractFromJson } from '${staticEntry}';
|
|
4429
|
-
import type { Contract } from './contract.d';
|
|
4429
|
+
import type { Contract } from './contract.d.js';
|
|
4430
4430
|
import contractJson from './contract.json' with { type: 'json' };
|
|
4431
4431
|
|
|
4432
4432
|
export const contract = contractFromJson<Contract>(contractJson);
|
|
@@ -5922,6 +5922,38 @@ const REQUIRED_COMPILER_OPTIONS = {
|
|
|
5922
5922
|
* explicitly is the documented escape hatch (FR2.2).
|
|
5923
5923
|
*/
|
|
5924
5924
|
const REQUIRED_COMPILER_OPTIONS_TYPES = ["node"];
|
|
5925
|
+
const MODULE_COMPILER_OPTIONS = ["module", "moduleResolution"];
|
|
5926
|
+
/**
|
|
5927
|
+
* The `module` values that go with each resolution mode the scaffold
|
|
5928
|
+
* already typechecks under, so a project that has picked one keeps its
|
|
5929
|
+
* own pair. `db.ts` spells its type import `./contract.d.js`, which
|
|
5930
|
+
* resolves to the emitted `contract.d.ts` under each.
|
|
5931
|
+
*
|
|
5932
|
+
* Only whole pairs count: TypeScript rejects a mismatched one (TS5110,
|
|
5933
|
+
* TS5095), so a project carrying half of one still gets the required
|
|
5934
|
+
* defaults. So does one on `module: 'node16'`, which predates import
|
|
5935
|
+
* attributes — `db.ts` imports `contract.json with { type: 'json' }`,
|
|
5936
|
+
* which is TS2823 there.
|
|
5937
|
+
*/
|
|
5938
|
+
const BUNDLER_MODULE_PAIRS = { bundler: ["preserve", "esnext"] };
|
|
5939
|
+
/**
|
|
5940
|
+
* Node 18 and Node 20 projects resolve under `moduleResolution:
|
|
5941
|
+
* 'node16'` — TypeScript has no `node18` or `node20` resolution mode —
|
|
5942
|
+
* and under `'nodenext'` as well.
|
|
5943
|
+
*
|
|
5944
|
+
* These modes compile a `.ts` file as CommonJS unless `package.json`
|
|
5945
|
+
* declares `"type": "module"`, and TypeScript rejects the import
|
|
5946
|
+
* attribute in a file compiled as CommonJS (TS2856). So they are kept
|
|
5947
|
+
* only in an ES module package.
|
|
5948
|
+
*/
|
|
5949
|
+
const NODE_MODULE_PAIRS = {
|
|
5950
|
+
node16: ["node18", "node20"],
|
|
5951
|
+
nodenext: [
|
|
5952
|
+
"nodenext",
|
|
5953
|
+
"node18",
|
|
5954
|
+
"node20"
|
|
5955
|
+
]
|
|
5956
|
+
};
|
|
5925
5957
|
function defaultTsConfig() {
|
|
5926
5958
|
return JSON.stringify({
|
|
5927
5959
|
compilerOptions: {
|
|
@@ -5971,21 +6003,27 @@ function formatTsConfigParseErrors(errors) {
|
|
|
5971
6003
|
* Throws `TsConfigParseError` when the input is not parseable as JSONC.
|
|
5972
6004
|
* The caller must catch this and surface a structured error before
|
|
5973
6005
|
* writing any scaffold files (FR6.2 atomicity).
|
|
6006
|
+
*
|
|
6007
|
+
* A project already on a pair the scaffold typechecks under keeps its
|
|
6008
|
+
* own `module` / `moduleResolution`; the options it never set are still
|
|
6009
|
+
* added. `packageType` is the `package.json` `"type"` after init.
|
|
5974
6010
|
*/
|
|
5975
|
-
function mergeTsConfig(existing) {
|
|
6011
|
+
function mergeTsConfig(existing, packageType) {
|
|
5976
6012
|
const { config } = parseTsConfigText(existing);
|
|
5977
6013
|
const formattingOptions = {
|
|
5978
6014
|
tabSize: detectIndent(existing),
|
|
5979
6015
|
insertSpaces: true,
|
|
5980
6016
|
eol: existing.includes("\r\n") ? "\r\n" : "\n"
|
|
5981
6017
|
};
|
|
6018
|
+
const compilerOptions = config["compilerOptions"];
|
|
6019
|
+
const keepModuleOptions = resolvesScaffoldImports(compilerOptions, packageType);
|
|
5982
6020
|
let result = existing;
|
|
5983
6021
|
for (const [key, value] of Object.entries(REQUIRED_COMPILER_OPTIONS)) {
|
|
6022
|
+
if (keepModuleOptions && MODULE_COMPILER_OPTIONS.includes(key)) continue;
|
|
5984
6023
|
const edits = modify(result, ["compilerOptions", key], value, { formattingOptions });
|
|
5985
6024
|
result = applyEdits(result, edits);
|
|
5986
6025
|
}
|
|
5987
|
-
const
|
|
5988
|
-
const mergedTypes = mergeTypesArray(existingTypes);
|
|
6026
|
+
const mergedTypes = mergeTypesArray(compilerOptions?.["types"]);
|
|
5989
6027
|
const typesEdits = modify(result, ["compilerOptions", "types"], mergedTypes, { formattingOptions });
|
|
5990
6028
|
result = applyEdits(result, typesEdits);
|
|
5991
6029
|
return result;
|
|
@@ -6011,6 +6049,17 @@ function parseTsConfigText(text) {
|
|
|
6011
6049
|
if (errors.length > 0) throw new TsConfigParseError(errors);
|
|
6012
6050
|
return { config: value };
|
|
6013
6051
|
}
|
|
6052
|
+
function resolvesScaffoldImports(compilerOptions, packageType) {
|
|
6053
|
+
return isModulePairIn(BUNDLER_MODULE_PAIRS, compilerOptions) || packageType === "module" && isModulePairIn(NODE_MODULE_PAIRS, compilerOptions);
|
|
6054
|
+
}
|
|
6055
|
+
function isModulePairIn(pairs, compilerOptions) {
|
|
6056
|
+
const moduleResolution = compilerOptions?.["moduleResolution"];
|
|
6057
|
+
const moduleOption = compilerOptions?.["module"];
|
|
6058
|
+
if (typeof moduleResolution !== "string" || typeof moduleOption !== "string") return false;
|
|
6059
|
+
const resolution = moduleResolution.toLowerCase();
|
|
6060
|
+
if (!Object.hasOwn(pairs, resolution)) return false;
|
|
6061
|
+
return pairs[resolution]?.includes(moduleOption.toLowerCase()) ?? false;
|
|
6062
|
+
}
|
|
6014
6063
|
function detectIndent(text) {
|
|
6015
6064
|
const match = text.match(/^([ \t]+)\S/m);
|
|
6016
6065
|
if (match === null) return 2;
|
|
@@ -6100,6 +6149,10 @@ function declaresRuntimeDependencies(parsed) {
|
|
|
6100
6149
|
const value = parsed?.["dependencies"];
|
|
6101
6150
|
return value !== null && typeof value === "object" && Object.keys(value).length > 0;
|
|
6102
6151
|
}
|
|
6152
|
+
function declaredPackageType(parsed) {
|
|
6153
|
+
const value = parsed?.["type"];
|
|
6154
|
+
return typeof value === "string" ? value : void 0;
|
|
6155
|
+
}
|
|
6103
6156
|
function hasDirectDep(parsed, name) {
|
|
6104
6157
|
for (const field of ["dependencies", "devDependencies"]) {
|
|
6105
6158
|
const value = parsed[field];
|
|
@@ -6187,45 +6240,13 @@ function planScaffold(ctx) {
|
|
|
6187
6240
|
path: ".env",
|
|
6188
6241
|
content: envFileContent(inputs.target)
|
|
6189
6242
|
});
|
|
6190
|
-
const tsconfigPath = join(cwd, "tsconfig.json");
|
|
6191
|
-
if (existsSync(tsconfigPath)) {
|
|
6192
|
-
const existing = readFileSync(tsconfigPath, "utf-8");
|
|
6193
|
-
let merged;
|
|
6194
|
-
try {
|
|
6195
|
-
merged = mergeTsConfig(existing);
|
|
6196
|
-
} catch (error) {
|
|
6197
|
-
if (error instanceof TsConfigParseError) throw errorInitInvalidTsconfig({
|
|
6198
|
-
path: "tsconfig.json",
|
|
6199
|
-
cause: error.message
|
|
6200
|
-
});
|
|
6201
|
-
throw error;
|
|
6202
|
-
}
|
|
6203
|
-
files.push({
|
|
6204
|
-
path: "tsconfig.json",
|
|
6205
|
-
content: merged,
|
|
6206
|
-
note: "Updated tsconfig.json with required compiler options."
|
|
6207
|
-
});
|
|
6208
|
-
} else files.push({
|
|
6209
|
-
path: "tsconfig.json",
|
|
6210
|
-
content: defaultTsConfig()
|
|
6211
|
-
});
|
|
6212
|
-
const gitignorePath = join(cwd, ".gitignore");
|
|
6213
|
-
const nextGitignore = mergeGitignore(existsSync(gitignorePath) ? readFileSync(gitignorePath, "utf-8") : void 0);
|
|
6214
|
-
if (nextGitignore !== null) files.push({
|
|
6215
|
-
path: ".gitignore",
|
|
6216
|
-
content: nextGitignore
|
|
6217
|
-
});
|
|
6218
|
-
const gitattributesPath = join(cwd, ".gitattributes");
|
|
6219
|
-
const nextGitattributes = mergeGitattributes(existsSync(gitattributesPath) ? readFileSync(gitattributesPath, "utf-8") : void 0, requiredGitattributesLines(outputDir, inputs.target));
|
|
6220
|
-
if (nextGitattributes !== null) files.push({
|
|
6221
|
-
path: ".gitattributes",
|
|
6222
|
-
content: nextGitattributes
|
|
6223
|
-
});
|
|
6224
6243
|
const manifestPath = join(cwd, "package.json");
|
|
6225
6244
|
const manifestExisted = existsSync(manifestPath);
|
|
6226
6245
|
const synthesiseManifest = !manifestExisted && !hasProjectManifest(cwd);
|
|
6227
6246
|
let parsedManifest = null;
|
|
6228
6247
|
let scriptsRewritten = [];
|
|
6248
|
+
let manifestContent = null;
|
|
6249
|
+
let packageType;
|
|
6229
6250
|
if (manifestExisted || synthesiseManifest) {
|
|
6230
6251
|
const raw = manifestExisted ? readFileSync(manifestPath, "utf-8") : defaultPackageJsonContent(basename(cwd));
|
|
6231
6252
|
try {
|
|
@@ -6264,14 +6285,50 @@ function planScaffold(ctx) {
|
|
|
6264
6285
|
working = withType;
|
|
6265
6286
|
changed = true;
|
|
6266
6287
|
}
|
|
6267
|
-
|
|
6268
|
-
|
|
6269
|
-
content: working
|
|
6270
|
-
});
|
|
6288
|
+
packageType = withType !== null ? "module" : declaredPackageType(parsedManifest);
|
|
6289
|
+
if (changed) manifestContent = working;
|
|
6271
6290
|
warnings.push(...scriptWarnings);
|
|
6272
6291
|
if (typeWarning !== null) warnings.push(typeWarning);
|
|
6273
6292
|
if (synthesiseManifest) warnings.push("No package.json found in the target directory; created a minimal one. Edit `name` / `version` to taste.");
|
|
6274
6293
|
}
|
|
6294
|
+
const tsconfigPath = join(cwd, "tsconfig.json");
|
|
6295
|
+
if (existsSync(tsconfigPath)) {
|
|
6296
|
+
const existing = readFileSync(tsconfigPath, "utf-8");
|
|
6297
|
+
let merged;
|
|
6298
|
+
try {
|
|
6299
|
+
merged = mergeTsConfig(existing, packageType);
|
|
6300
|
+
} catch (error) {
|
|
6301
|
+
if (error instanceof TsConfigParseError) throw errorInitInvalidTsconfig({
|
|
6302
|
+
path: "tsconfig.json",
|
|
6303
|
+
cause: error.message
|
|
6304
|
+
});
|
|
6305
|
+
throw error;
|
|
6306
|
+
}
|
|
6307
|
+
files.push({
|
|
6308
|
+
path: "tsconfig.json",
|
|
6309
|
+
content: merged,
|
|
6310
|
+
note: "Updated tsconfig.json with required compiler options."
|
|
6311
|
+
});
|
|
6312
|
+
} else files.push({
|
|
6313
|
+
path: "tsconfig.json",
|
|
6314
|
+
content: defaultTsConfig()
|
|
6315
|
+
});
|
|
6316
|
+
const gitignorePath = join(cwd, ".gitignore");
|
|
6317
|
+
const nextGitignore = mergeGitignore(existsSync(gitignorePath) ? readFileSync(gitignorePath, "utf-8") : void 0);
|
|
6318
|
+
if (nextGitignore !== null) files.push({
|
|
6319
|
+
path: ".gitignore",
|
|
6320
|
+
content: nextGitignore
|
|
6321
|
+
});
|
|
6322
|
+
const gitattributesPath = join(cwd, ".gitattributes");
|
|
6323
|
+
const nextGitattributes = mergeGitattributes(existsSync(gitattributesPath) ? readFileSync(gitattributesPath, "utf-8") : void 0, requiredGitattributesLines(outputDir, inputs.target));
|
|
6324
|
+
if (nextGitattributes !== null) files.push({
|
|
6325
|
+
path: ".gitattributes",
|
|
6326
|
+
content: nextGitattributes
|
|
6327
|
+
});
|
|
6328
|
+
if (manifestContent !== null) files.push({
|
|
6329
|
+
path: "package.json",
|
|
6330
|
+
content: manifestContent
|
|
6331
|
+
});
|
|
6275
6332
|
if (source.kind === "starter" && existsSync(join(cwd, "src/index.ts"))) if (existsSync(join(cwd, "README.md"))) warnings.push("README.md already exists; leaving it untouched.");
|
|
6276
6333
|
else {
|
|
6277
6334
|
const declaredName = parsedManifest !== null && typeof parsedManifest["name"] === "string" ? parsedManifest["name"] : basename(cwd);
|
|
@@ -10668,14 +10725,14 @@ function temporaryValueBlocks(result) {
|
|
|
10668
10725
|
return result.temporaryValues.map(({ field, value }) => ({
|
|
10669
10726
|
kind: "summary",
|
|
10670
10727
|
status: "warn",
|
|
10671
|
-
text: `
|
|
10728
|
+
text: `Field "${field}" gets the temporary value ${value} where existing data has none. To choose the value, plan again with ${statementFlag({
|
|
10672
10729
|
verb: "backfill",
|
|
10673
10730
|
text: field
|
|
10674
10731
|
})}.`
|
|
10675
10732
|
}));
|
|
10676
10733
|
}
|
|
10677
10734
|
function warningBlocks(result) {
|
|
10678
|
-
return
|
|
10735
|
+
return [...result.warnings ?? [], ...(result.plannerWarnings ?? []).map(plannerWarningText)].map((text) => ({
|
|
10679
10736
|
kind: "summary",
|
|
10680
10737
|
status: "warn",
|
|
10681
10738
|
text
|