@nestia/migrate 14.0.1 → 14.0.3
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/lib/NestiaMigrateApplication.d.ts +111 -0
- package/lib/NestiaMigrateApplication.js +148 -9
- package/lib/NestiaMigrateApplication.js.map +1 -1
- package/lib/NestiaMigrateApplication.mjs +147 -5
- package/lib/_virtual/_rolldown/runtime.mjs +6 -1
- package/lib/analyzers/NestiaMigrateControllerAnalyzer.d.ts +45 -0
- package/lib/analyzers/NestiaMigrateControllerAnalyzer.js +59 -3
- package/lib/analyzers/NestiaMigrateControllerAnalyzer.js.map +1 -1
- package/lib/analyzers/NestiaMigrateControllerAnalyzer.mjs +9 -3
- package/lib/archivers/NestiaMigrateFileArchiver.d.ts +34 -0
- package/lib/archivers/NestiaMigrateFileArchiver.js +34 -0
- package/lib/archivers/NestiaMigrateFileArchiver.js.map +1 -1
- package/lib/bundles/NEST_TEMPLATE.js +1 -1
- package/lib/bundles/NEST_TEMPLATE.mjs +1 -1
- package/lib/bundles/SDK_TEMPLATE.js +1 -1
- package/lib/bundles/SDK_TEMPLATE.mjs +1 -1
- package/lib/executable/NestiaMigrateCommander.d.ts +39 -1
- package/lib/executable/NestiaMigrateCommander.js +42 -2
- package/lib/executable/NestiaMigrateCommander.js.map +1 -1
- package/lib/executable/NestiaMigrateCommander.mjs +5 -3
- package/lib/executable/NestiaMigrateInquirer.d.ts +32 -1
- package/lib/executable/NestiaMigrateInquirer.js +33 -10
- package/lib/executable/NestiaMigrateInquirer.js.map +1 -1
- package/lib/executable/NestiaMigrateInquirer.mjs +4 -3
- package/lib/executable/TemplateBundleCache.d.ts +23 -0
- package/lib/executable/TemplateBundleCache.js +60 -0
- package/lib/executable/TemplateBundleCache.js.map +1 -0
- package/lib/executable/TemplateBundleCache.mjs +39 -0
- package/lib/executable/TemplateBundleCache.mjs.map +1 -0
- package/lib/executable/bundle.d.ts +1 -0
- package/lib/executable/bundle.js +404 -0
- package/lib/executable/bundle.js.map +1 -0
- package/lib/executable/bundle.mjs +324 -0
- package/lib/executable/bundle.mjs.map +1 -0
- package/lib/factories/ExpressionFactory.d.ts +14 -0
- package/lib/factories/ExpressionFactory.js +14 -0
- package/lib/factories/ExpressionFactory.js.map +1 -1
- package/lib/factories/IdentifierFactory.d.ts +20 -0
- package/lib/factories/IdentifierFactory.js +20 -0
- package/lib/factories/IdentifierFactory.js.map +1 -1
- package/lib/factories/LiteralFactory.d.ts +18 -2
- package/lib/factories/LiteralFactory.js +18 -2
- package/lib/factories/LiteralFactory.js.map +1 -1
- package/lib/factories/StatementFactory.d.ts +26 -1
- package/lib/factories/StatementFactory.js +26 -1
- package/lib/factories/StatementFactory.js.map +1 -1
- package/lib/factories/SupportedStringFormats.d.ts +6 -0
- package/lib/factories/SupportedStringFormats.js +33 -0
- package/lib/factories/SupportedStringFormats.js.map +1 -0
- package/lib/factories/SupportedStringFormats.mjs +34 -0
- package/lib/factories/SupportedStringFormats.mjs.map +1 -0
- package/lib/factories/TypeFactory.d.ts +21 -0
- package/lib/factories/TypeFactory.js +13 -0
- package/lib/factories/TypeFactory.js.map +1 -1
- package/lib/factories/TypeLiteralFactory.d.ts +18 -0
- package/lib/factories/TypeLiteralFactory.js +18 -0
- package/lib/factories/TypeLiteralFactory.js.map +1 -1
- package/lib/internal/ts.d.ts +153 -0
- package/lib/internal/ts.js.map +1 -1
- package/lib/package.mjs +55 -0
- package/lib/package.mjs.map +1 -0
- package/lib/programmers/NestiaMigrateApiFileProgrammer.d.ts +31 -0
- package/lib/programmers/NestiaMigrateApiFileProgrammer.js +17 -0
- package/lib/programmers/NestiaMigrateApiFileProgrammer.js.map +1 -1
- package/lib/programmers/NestiaMigrateApiFunctionProgrammer.d.ts +40 -0
- package/lib/programmers/NestiaMigrateApiFunctionProgrammer.js +27 -0
- package/lib/programmers/NestiaMigrateApiFunctionProgrammer.js.map +1 -1
- package/lib/programmers/NestiaMigrateApiNamespaceProgrammer.d.ts +39 -0
- package/lib/programmers/NestiaMigrateApiNamespaceProgrammer.js +26 -0
- package/lib/programmers/NestiaMigrateApiNamespaceProgrammer.js.map +1 -1
- package/lib/programmers/NestiaMigrateApiProgrammer.d.ts +18 -0
- package/lib/programmers/NestiaMigrateApiProgrammer.js +18 -0
- package/lib/programmers/NestiaMigrateApiProgrammer.js.map +1 -1
- package/lib/programmers/NestiaMigrateApiProgrammer.mjs +1 -1
- package/lib/programmers/NestiaMigrateApiSimulationProgrammer.d.ts +40 -0
- package/lib/programmers/NestiaMigrateApiSimulationProgrammer.js +27 -0
- package/lib/programmers/NestiaMigrateApiSimulationProgrammer.js.map +1 -1
- package/lib/programmers/NestiaMigrateApiStartProgrammer.d.ts +17 -0
- package/lib/programmers/NestiaMigrateApiStartProgrammer.js +19 -8
- package/lib/programmers/NestiaMigrateApiStartProgrammer.js.map +1 -1
- package/lib/programmers/NestiaMigrateApiStartProgrammer.mjs +1 -6
- package/lib/programmers/NestiaMigrateDtoProgrammer.d.ts +30 -0
- package/lib/programmers/NestiaMigrateDtoProgrammer.js +17 -0
- package/lib/programmers/NestiaMigrateDtoProgrammer.js.map +1 -1
- package/lib/programmers/NestiaMigrateE2eFileProgrammer.d.ts +39 -0
- package/lib/programmers/NestiaMigrateE2eFileProgrammer.js +26 -0
- package/lib/programmers/NestiaMigrateE2eFileProgrammer.js.map +1 -1
- package/lib/programmers/NestiaMigrateE2eProgrammer.d.ts +16 -0
- package/lib/programmers/NestiaMigrateE2eProgrammer.js +16 -0
- package/lib/programmers/NestiaMigrateE2eProgrammer.js.map +1 -1
- package/lib/programmers/NestiaMigrateImportProgrammer.d.ts +75 -0
- package/lib/programmers/NestiaMigrateImportProgrammer.js +58 -3
- package/lib/programmers/NestiaMigrateImportProgrammer.js.map +1 -1
- package/lib/programmers/NestiaMigrateImportProgrammer.mjs +58 -3
- package/lib/programmers/NestiaMigrateNestControllerProgrammer.d.ts +28 -0
- package/lib/programmers/NestiaMigrateNestControllerProgrammer.js +16 -0
- package/lib/programmers/NestiaMigrateNestControllerProgrammer.js.map +1 -1
- package/lib/programmers/NestiaMigrateNestMethodProgrammer.d.ts +30 -0
- package/lib/programmers/NestiaMigrateNestMethodProgrammer.js +16 -0
- package/lib/programmers/NestiaMigrateNestMethodProgrammer.js.map +1 -1
- package/lib/programmers/NestiaMigrateNestModuleProgrammer.d.ts +16 -0
- package/lib/programmers/NestiaMigrateNestModuleProgrammer.js +16 -0
- package/lib/programmers/NestiaMigrateNestModuleProgrammer.js.map +1 -1
- package/lib/programmers/NestiaMigrateNestProgrammer.d.ts +17 -0
- package/lib/programmers/NestiaMigrateNestProgrammer.js +17 -0
- package/lib/programmers/NestiaMigrateNestProgrammer.js.map +1 -1
- package/lib/programmers/NestiaMigrateSchemaProgrammer.d.ts +16 -0
- package/lib/programmers/NestiaMigrateSchemaProgrammer.js +20 -5
- package/lib/programmers/NestiaMigrateSchemaProgrammer.js.map +1 -1
- package/lib/programmers/NestiaMigrateSchemaProgrammer.mjs +4 -4
- package/lib/structures/INestiaMigrateConfig.d.ts +21 -0
- package/lib/structures/INestiaMigrateContext.d.ts +15 -0
- package/lib/structures/INestiaMigrateController.d.ts +13 -0
- package/lib/structures/INestiaMigrateFile.d.ts +11 -0
- package/lib/utils/FilePrinter.d.ts +33 -0
- package/lib/utils/FilePrinter.js +33 -0
- package/lib/utils/FilePrinter.js.map +1 -1
- package/lib/utils/MapUtil.d.ts +17 -0
- package/lib/utils/MapUtil.js +19 -3
- package/lib/utils/MapUtil.js.map +1 -1
- package/lib/utils/MapUtil.mjs +1 -2
- package/lib/utils/PathTemplate.d.ts +23 -1
- package/lib/utils/PathTemplate.js +15 -1
- package/lib/utils/PathTemplate.js.map +1 -1
- package/lib/utils/RequestBody.d.ts +13 -0
- package/lib/utils/RequestBody.js +13 -0
- package/lib/utils/RequestBody.js.map +1 -1
- package/lib/utils/StringUtil.d.ts +55 -0
- package/lib/utils/StringUtil.js +93 -8
- package/lib/utils/StringUtil.js.map +1 -1
- package/lib/utils/StringUtil.mjs +30 -8
- package/lib/utils/SuccessStatus.d.ts +21 -1
- package/lib/utils/SuccessStatus.js +21 -1
- package/lib/utils/SuccessStatus.js.map +1 -1
- package/package.json +5 -4
- package/src/NestiaMigrateApplication.ts +151 -13
- package/src/analyzers/NestiaMigrateControllerAnalyzer.ts +59 -4
- package/src/archivers/NestiaMigrateFileArchiver.ts +34 -0
- package/src/bundles/NEST_TEMPLATE.ts +1 -1
- package/src/bundles/SDK_TEMPLATE.ts +1 -1
- package/src/executable/NestiaMigrateCommander.ts +44 -2
- package/src/executable/NestiaMigrateInquirer.ts +35 -3
- package/src/executable/TemplateBundleCache.ts +65 -0
- package/src/executable/{bundle.js → bundle.ts} +110 -43
- package/src/factories/ExpressionFactory.ts +14 -0
- package/src/factories/IdentifierFactory.ts +20 -0
- package/src/factories/LiteralFactory.ts +18 -2
- package/src/factories/StatementFactory.ts +26 -1
- package/src/factories/SupportedStringFormats.ts +29 -0
- package/src/factories/TypeFactory.ts +21 -0
- package/src/factories/TypeLiteralFactory.ts +18 -0
- package/src/internal/ts.ts +153 -0
- package/src/programmers/NestiaMigrateApiFileProgrammer.ts +35 -0
- package/src/programmers/NestiaMigrateApiFunctionProgrammer.ts +43 -0
- package/src/programmers/NestiaMigrateApiNamespaceProgrammer.ts +42 -0
- package/src/programmers/NestiaMigrateApiProgrammer.ts +18 -0
- package/src/programmers/NestiaMigrateApiSimulationProgrammer.ts +43 -0
- package/src/programmers/NestiaMigrateApiStartProgrammer.ts +19 -10
- package/src/programmers/NestiaMigrateDtoProgrammer.ts +33 -0
- package/src/programmers/NestiaMigrateE2eFileProgrammer.ts +42 -0
- package/src/programmers/NestiaMigrateE2eProgrammer.ts +16 -0
- package/src/programmers/NestiaMigrateImportProgrammer.ts +86 -5
- package/src/programmers/NestiaMigrateNestControllerProgrammer.ts +30 -0
- package/src/programmers/NestiaMigrateNestMethodProgrammer.ts +34 -0
- package/src/programmers/NestiaMigrateNestModuleProgrammer.ts +16 -0
- package/src/programmers/NestiaMigrateNestProgrammer.ts +17 -0
- package/src/programmers/NestiaMigrateSchemaProgrammer.ts +25 -8
- package/src/structures/INestiaMigrateConfig.ts +26 -0
- package/src/structures/INestiaMigrateContext.ts +17 -0
- package/src/structures/INestiaMigrateController.ts +16 -0
- package/src/structures/INestiaMigrateFile.ts +13 -0
- package/src/utils/FilePrinter.ts +33 -0
- package/src/utils/MapUtil.ts +18 -2
- package/src/utils/PathTemplate.ts +23 -1
- package/src/utils/RequestBody.ts +13 -0
- package/src/utils/StringUtil.ts +101 -9
- package/src/utils/SuccessStatus.ts +21 -1
- package/lib/factories/FormatCheatSheet.d.ts +0 -25
- package/lib/factories/FormatCheatSheet.js +0 -34
- package/lib/factories/FormatCheatSheet.js.map +0 -1
- package/lib/factories/FormatCheatSheet.mjs +0 -31
- package/lib/factories/FormatCheatSheet.mjs.map +0 -1
- package/src/factories/FormatCheatSheet.ts +0 -71
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NestiaMigrateInquirer.js","sourceRoot":"","sources":["../../src/executable/NestiaMigrateInquirer.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yCAAoC;AACpC,uCAA8C;AAE9C,IAAiB,qBAAqB,
|
|
1
|
+
{"version":3,"file":"NestiaMigrateInquirer.js","sourceRoot":"","sources":["../../src/executable/NestiaMigrateInquirer.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yCAAoC;AACpC,uCAA8C;AAE9C;;;;;;;;GAQG;AACH,IAAiB,qBAAqB,CA+GrC;AA/GD,WAAiB,qBAAqB;IAoBpC;;;;;;;;;;;;OAYG;IACU,2BAAK,GAAG,CAAO,IAAe,EAAoB,EAAE;QAC/D,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;QAC9B,iBAAiB;QACjB,OAAO,CAAC,MAAM,CAAC,mBAAmB,EAAE,gBAAgB,CAAC,CAAC;QACtD,OAAO,CAAC,MAAM,CACZ,wBAAwB,EACxB,sCAAsC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MAAM,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,KAAK,MAAM,CAAA,CAAA,CAAC,CAAD,CAAC;YAC9D,OAAO,CAAC,OAAO,SACb,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,mCACrB,CAAC,MAAM,GAAG,CAAC,SAAS,EAAE,wBAAwB,CAAC,CAAC,CAAC;YACnD,OAAO,CAAC,QAAQ,SACd,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,mCAAI,CAAC,MAAM,GAAG,CAAC,UAAU,EAAE,iBAAiB,CAAC,CAAC,CAAC;YACvE,OAAO,CAAC,GAAG,SACT,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,mCAAI,CAAC,MAAM,GAAG,CAAC,KAAK,EAAE,oBAAoB,CAAC,CAAC,CAAC;YAChE,OAAO,OAAkB,CAAC;QAC5B,CAAC,CAAA,CAAC,CAAC;IACL,CAAC,CAAA,CAAC;AACJ,CAAC,EA/GgB,qBAAqB,aAArB,qBAAqB,GAArB,qBAAqB,QA+GrC"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Command } from "commander";
|
|
2
2
|
import { createPromptModule } from "inquirer";
|
|
3
3
|
//#region src/executable/NestiaMigrateInquirer.ts
|
|
4
4
|
let NestiaMigrateInquirer;
|
|
5
5
|
(function(_NestiaMigrateInquirer) {
|
|
6
|
-
_NestiaMigrateInquirer.parse = async () => {
|
|
6
|
+
_NestiaMigrateInquirer.parse = async (argv) => {
|
|
7
|
+
const program = new Command();
|
|
7
8
|
program.option("--mode [nest/sdk]", "migration mode");
|
|
8
9
|
program.option("--input [swagger.json]", "location of target swagger.json file");
|
|
9
10
|
program.option("--output [directory]", "output directory path");
|
|
@@ -20,7 +21,7 @@ let NestiaMigrateInquirer;
|
|
|
20
21
|
reject(exp);
|
|
21
22
|
}
|
|
22
23
|
});
|
|
23
|
-
program.parseAsync().catch(reject);
|
|
24
|
+
program.parseAsync(argv).catch(reject);
|
|
24
25
|
});
|
|
25
26
|
const select = (name) => (message) => async (choices, filter) => {
|
|
26
27
|
questioned.value = true;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reuses a complete template generation only while its inputs and outputs
|
|
3
|
+
* match.
|
|
4
|
+
*
|
|
5
|
+
* The caller owns the generated paths and cold generation. This module owns the
|
|
6
|
+
* validity manifest; failed generation never publishes a new manifest.
|
|
7
|
+
* Concurrent generation of the same output paths is not supported.
|
|
8
|
+
*
|
|
9
|
+
* @evidence contracts/common.md#principled-implementation Input identity includes the cache implementation and caller-supplied generator inputs. Reuse requires every expected output's current SHA-256 to match the manifest; a missing, changed or partial generation cannot authorize reuse.
|
|
10
|
+
* @evidence contracts/common.md#clear-and-simple-design One operation checks a manifest, delegates cold generation and publishes its successful output digests. The caller retains template-specific fetching and stamping rules.
|
|
11
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Generated contents are never replaced by expected answers. Invalid metadata is treated as a cache miss and failed generation remains a rejection.
|
|
12
|
+
* @evidence contracts/common.md#meaningful-documentation Documents manifest ownership, failed publication and the existing single-writer premise.
|
|
13
|
+
* @evidence contracts/performance.md#efficient-algorithms A hit hashes each output once, with time proportional to input/output bytes and one manifest rather than scanning template trees or fetching Git history.
|
|
14
|
+
* @evidence contracts/performance.md#reuse-equivalent-work The cache implementation, caller inputs and current output digests jointly establish reuse validity; changed inputs, edited outputs and missing files invalidate it.
|
|
15
|
+
* @evidence contracts/performance.md#bound-retention-and-release-resources Each output set owns one replaceable manifest, not per-run history. Synchronous reads and awaited writes close their file handles. The caller must serialize writers to the same paths.
|
|
16
|
+
* @evidence contracts/portability.md#os-neutral-implementation Node fs consumes caller-owned native paths; identity hashes bytes and never assumes timestamp resolution, case folding or path separators.
|
|
17
|
+
*/
|
|
18
|
+
export declare const run: ({ inputs, outputs, stampFile, generate, }: {
|
|
19
|
+
inputs: readonly unknown[];
|
|
20
|
+
outputs: readonly string[];
|
|
21
|
+
stampFile: string;
|
|
22
|
+
generate: () => Promise<void>;
|
|
23
|
+
}) => Promise<boolean>;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.run = void 0;
|
|
16
|
+
const node_crypto_1 = __importDefault(require("node:crypto"));
|
|
17
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
18
|
+
/**
|
|
19
|
+
* Reuses a complete template generation only while its inputs and outputs
|
|
20
|
+
* match.
|
|
21
|
+
*
|
|
22
|
+
* The caller owns the generated paths and cold generation. This module owns the
|
|
23
|
+
* validity manifest; failed generation never publishes a new manifest.
|
|
24
|
+
* Concurrent generation of the same output paths is not supported.
|
|
25
|
+
*
|
|
26
|
+
* @evidence contracts/common.md#principled-implementation Input identity includes the cache implementation and caller-supplied generator inputs. Reuse requires every expected output's current SHA-256 to match the manifest; a missing, changed or partial generation cannot authorize reuse.
|
|
27
|
+
* @evidence contracts/common.md#clear-and-simple-design One operation checks a manifest, delegates cold generation and publishes its successful output digests. The caller retains template-specific fetching and stamping rules.
|
|
28
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Generated contents are never replaced by expected answers. Invalid metadata is treated as a cache miss and failed generation remains a rejection.
|
|
29
|
+
* @evidence contracts/common.md#meaningful-documentation Documents manifest ownership, failed publication and the existing single-writer premise.
|
|
30
|
+
* @evidence contracts/performance.md#efficient-algorithms A hit hashes each output once, with time proportional to input/output bytes and one manifest rather than scanning template trees or fetching Git history.
|
|
31
|
+
* @evidence contracts/performance.md#reuse-equivalent-work The cache implementation, caller inputs and current output digests jointly establish reuse validity; changed inputs, edited outputs and missing files invalidate it.
|
|
32
|
+
* @evidence contracts/performance.md#bound-retention-and-release-resources Each output set owns one replaceable manifest, not per-run history. Synchronous reads and awaited writes close their file handles. The caller must serialize writers to the same paths.
|
|
33
|
+
* @evidence contracts/portability.md#os-neutral-implementation Node fs consumes caller-owned native paths; identity hashes bytes and never assumes timestamp resolution, case folding or path separators.
|
|
34
|
+
*/
|
|
35
|
+
const run = (_a) => __awaiter(void 0, [_a], void 0, function* ({ inputs, outputs, stampFile, generate, }) {
|
|
36
|
+
const digest = (content) => node_crypto_1.default.createHash("sha256").update(content).digest("hex");
|
|
37
|
+
const input = digest(JSON.stringify([node_fs_1.default.readFileSync(__filename, "utf8"), inputs]));
|
|
38
|
+
let stamp;
|
|
39
|
+
if (node_fs_1.default.existsSync(stampFile)) {
|
|
40
|
+
try {
|
|
41
|
+
stamp = JSON.parse(node_fs_1.default.readFileSync(stampFile, "utf8"));
|
|
42
|
+
}
|
|
43
|
+
catch (_b) {
|
|
44
|
+
// Invalid or interrupted metadata cannot authorize reuse.
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
if (outputs.length !== 0 &&
|
|
48
|
+
(stamp === null || stamp === void 0 ? void 0 : stamp.input) === input &&
|
|
49
|
+
outputs.every((file, index) => { var _a; return node_fs_1.default.existsSync(file) &&
|
|
50
|
+
((_a = stamp.outputs) === null || _a === void 0 ? void 0 : _a[index]) === digest(node_fs_1.default.readFileSync(file)); }))
|
|
51
|
+
return true;
|
|
52
|
+
yield generate();
|
|
53
|
+
yield node_fs_1.default.promises.writeFile(stampFile, JSON.stringify({
|
|
54
|
+
input,
|
|
55
|
+
outputs: outputs.map((file) => digest(node_fs_1.default.readFileSync(file))),
|
|
56
|
+
}), "utf8");
|
|
57
|
+
return false;
|
|
58
|
+
});
|
|
59
|
+
exports.run = run;
|
|
60
|
+
//# sourceMappingURL=TemplateBundleCache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TemplateBundleCache.js","sourceRoot":"","sources":["../../src/executable/TemplateBundleCache.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,8DAAiC;AACjC,sDAAyB;AAEzB;;;;;;;;;;;;;;;;GAgBG;AACI,MAAM,GAAG,GAAG,KAUE,EAAE,4CAVG,EACxB,MAAM,EACN,OAAO,EACP,SAAS,EACT,QAAQ,GAMT;IACC,MAAM,MAAM,GAAG,CAAC,OAAwB,EAAU,EAAE,CAClD,qBAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC5D,MAAM,KAAK,GAAG,MAAM,CAClB,IAAI,CAAC,SAAS,CAAC,CAAC,iBAAE,CAAC,YAAY,CAAC,UAAU,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,CAC9D,CAAC;IACF,IAAI,KAAyD,CAAC;IAC9D,IAAI,iBAAE,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;QAC7B,IAAI,CAAC;YACH,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,iBAAE,CAAC,YAAY,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC;QACzD,CAAC;mBAAO,CAAC;YACP,0DAA0D;QAC5D,CAAC;IACH,CAAC;IACD,IACE,OAAO,CAAC,MAAM,KAAK,CAAC;QACpB,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,KAAK,MAAK,KAAK;QACtB,OAAO,CAAC,KAAK,CACX,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,kBACd,iBAAE,CAAC,UAAU,CAAC,IAAI,CAAC;YACnB,CAAA,MAAA,KAAK,CAAC,OAAO,0CAAG,KAAK,CAAC,MAAK,MAAM,CAAC,iBAAE,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,GAAA,CAC3D;QAED,OAAO,IAAI,CAAC;IACd,MAAM,QAAQ,EAAE,CAAC;IACjB,MAAM,iBAAE,CAAC,QAAQ,CAAC,SAAS,CACzB,SAAS,EACT,IAAI,CAAC,SAAS,CAAC;QACb,KAAK;QACL,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,iBAAE,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC;KAC9D,CAAC,EACF,MAAM,CACP,CAAC;IACF,OAAO,KAAK,CAAC;AACf,CAAC,CAAA,CAAC;AA5CW,QAAA,GAAG,GAAH,GAAG,CA4Cd"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import crypto from "node:crypto";
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
//#region src/executable/TemplateBundleCache.ts
|
|
4
|
+
/**
|
|
5
|
+
* Reuses a complete template generation only while its inputs and outputs
|
|
6
|
+
* match.
|
|
7
|
+
*
|
|
8
|
+
* The caller owns the generated paths and cold generation. This module owns the
|
|
9
|
+
* validity manifest; failed generation never publishes a new manifest.
|
|
10
|
+
* Concurrent generation of the same output paths is not supported.
|
|
11
|
+
*
|
|
12
|
+
* @evidence contracts/common.md#principled-implementation Input identity includes the cache implementation and caller-supplied generator inputs. Reuse requires every expected output's current SHA-256 to match the manifest; a missing, changed or partial generation cannot authorize reuse.
|
|
13
|
+
* @evidence contracts/common.md#clear-and-simple-design One operation checks a manifest, delegates cold generation and publishes its successful output digests. The caller retains template-specific fetching and stamping rules.
|
|
14
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Generated contents are never replaced by expected answers. Invalid metadata is treated as a cache miss and failed generation remains a rejection.
|
|
15
|
+
* @evidence contracts/common.md#meaningful-documentation Documents manifest ownership, failed publication and the existing single-writer premise.
|
|
16
|
+
* @evidence contracts/performance.md#efficient-algorithms A hit hashes each output once, with time proportional to input/output bytes and one manifest rather than scanning template trees or fetching Git history.
|
|
17
|
+
* @evidence contracts/performance.md#reuse-equivalent-work The cache implementation, caller inputs and current output digests jointly establish reuse validity; changed inputs, edited outputs and missing files invalidate it.
|
|
18
|
+
* @evidence contracts/performance.md#bound-retention-and-release-resources Each output set owns one replaceable manifest, not per-run history. Synchronous reads and awaited writes close their file handles. The caller must serialize writers to the same paths.
|
|
19
|
+
* @evidence contracts/portability.md#os-neutral-implementation Node fs consumes caller-owned native paths; identity hashes bytes and never assumes timestamp resolution, case folding or path separators.
|
|
20
|
+
*/
|
|
21
|
+
const run = async ({ inputs, outputs, stampFile, generate }) => {
|
|
22
|
+
const digest = (content) => crypto.createHash("sha256").update(content).digest("hex");
|
|
23
|
+
const input = digest(JSON.stringify([fs.readFileSync(__filename, "utf8"), inputs]));
|
|
24
|
+
let stamp;
|
|
25
|
+
if (fs.existsSync(stampFile)) try {
|
|
26
|
+
stamp = JSON.parse(fs.readFileSync(stampFile, "utf8"));
|
|
27
|
+
} catch {}
|
|
28
|
+
if (outputs.length !== 0 && stamp?.input === input && outputs.every((file, index) => fs.existsSync(file) && stamp.outputs?.[index] === digest(fs.readFileSync(file)))) return true;
|
|
29
|
+
await generate();
|
|
30
|
+
await fs.promises.writeFile(stampFile, JSON.stringify({
|
|
31
|
+
input,
|
|
32
|
+
outputs: outputs.map((file) => digest(fs.readFileSync(file)))
|
|
33
|
+
}), "utf8");
|
|
34
|
+
return false;
|
|
35
|
+
};
|
|
36
|
+
//#endregion
|
|
37
|
+
export { run };
|
|
38
|
+
|
|
39
|
+
//# sourceMappingURL=TemplateBundleCache.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TemplateBundleCache.mjs","names":[],"sources":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,404 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
var _a;
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
const node_child_process_1 = __importDefault(require("node:child_process"));
|
|
17
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
18
|
+
const TemplateBundleCache_1 = require("./TemplateBundleCache");
|
|
19
|
+
const { version } = require("../../../../package.json");
|
|
20
|
+
const ROOT = `${__dirname}/../..`;
|
|
21
|
+
const ASSETS = `${ROOT}/assets`;
|
|
22
|
+
const CATALOGS = require("js-yaml").load(node_fs_1.default.readFileSync(`${__dirname}/../../../../pnpm-lock.yaml`, "utf8")).catalogs;
|
|
23
|
+
const TYPIA = CATALOGS.samchon;
|
|
24
|
+
const TYPESCRIPT = (_a = CATALOGS.typescript) !== null && _a !== void 0 ? _a : {};
|
|
25
|
+
const update = (content, options = {}) => {
|
|
26
|
+
var _a, _b, _c, _d;
|
|
27
|
+
const parsed = JSON.parse(content);
|
|
28
|
+
for (const record of [
|
|
29
|
+
(_a = parsed.dependencies) !== null && _a !== void 0 ? _a : {},
|
|
30
|
+
(_b = parsed.devDependencies) !== null && _b !== void 0 ? _b : {},
|
|
31
|
+
])
|
|
32
|
+
for (const key of Object.keys(record)) {
|
|
33
|
+
const current = record[key];
|
|
34
|
+
// `catalog:` / `workspace:` specifiers already carry their versions
|
|
35
|
+
// through pnpm-workspace.yaml, which gets its own stamping pass.
|
|
36
|
+
if (typeof current === "string" &&
|
|
37
|
+
(current.startsWith("catalog:") || current.startsWith("workspace:")))
|
|
38
|
+
continue;
|
|
39
|
+
if (key.startsWith("@nestia/") || key === "nestia")
|
|
40
|
+
record[key] = `^${version}`;
|
|
41
|
+
// Both catalogs, and in the same order updateWorkspaceCatalog resolves
|
|
42
|
+
// them. A template can pin a version two ways -- a `catalog:` reference
|
|
43
|
+
// its pnpm-workspace.yaml resolves, or a plain specifier here -- and a
|
|
44
|
+
// rule that reads only one catalog on this path leaves the toolchain
|
|
45
|
+
// frozen at whatever the upstream template last wrote. That is how a
|
|
46
|
+
// generated SDK project ended up with ttsc ^0.18.2 beside a `@nestia/core`
|
|
47
|
+
// stamped to this repository's version.
|
|
48
|
+
else {
|
|
49
|
+
const catalog = (_c = TYPIA[key]) !== null && _c !== void 0 ? _c : TYPESCRIPT[key];
|
|
50
|
+
if (catalog)
|
|
51
|
+
record[key] = catalog.specifier;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
migratePackageJson(parsed);
|
|
55
|
+
if (options.sdkAggregate) {
|
|
56
|
+
(_d = parsed.devDependencies) !== null && _d !== void 0 ? _d : (parsed.devDependencies = {});
|
|
57
|
+
parsed.devDependencies["@nestia/core"] = `^${version}`;
|
|
58
|
+
}
|
|
59
|
+
return JSON.stringify(parsed, null, 2);
|
|
60
|
+
};
|
|
61
|
+
const migratePackageJson = (parsed) => {
|
|
62
|
+
var _a;
|
|
63
|
+
if (parsed.scripts)
|
|
64
|
+
for (const [key, value] of Object.entries(parsed.scripts))
|
|
65
|
+
if (typeof value === "string")
|
|
66
|
+
parsed.scripts[key] = normalizeScript(value);
|
|
67
|
+
const devDependencies = parsed.devDependencies;
|
|
68
|
+
if (devDependencies) {
|
|
69
|
+
const usesTypeScript = typeof devDependencies.typescript === "string" &&
|
|
70
|
+
devDependencies.typescript.startsWith("catalog:") === false;
|
|
71
|
+
delete devDependencies["typescript-transform-paths"];
|
|
72
|
+
// Single-package templates compiling with a direct typescript dependency
|
|
73
|
+
// need the ttsc compiler this repository currently builds against.
|
|
74
|
+
if (usesTypeScript && TYPESCRIPT.ttsc)
|
|
75
|
+
(_a = devDependencies.ttsc) !== null && _a !== void 0 ? _a : (devDependencies.ttsc = TYPESCRIPT.ttsc.specifier);
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
// Stamp the template's pnpm-workspace.yaml catalogs with this repository's
|
|
79
|
+
// current versions. Keep the rewrite line-targeted so quoted package names,
|
|
80
|
+
// comments, ordering, and any anchors supplied by the upstream template remain
|
|
81
|
+
// intact.
|
|
82
|
+
const updateWorkspaceCatalog = (content) => {
|
|
83
|
+
const replace = (line) => {
|
|
84
|
+
var _a, _b;
|
|
85
|
+
var _c, _d, _e;
|
|
86
|
+
const match = line.match(/^(\s+(?:"([^"]+)"|'([^']+)'|([^:\s]+)): (?:&[A-Za-z0-9_-]+ )?)\S[^\r\n]*(\r?)$/);
|
|
87
|
+
if (match === null)
|
|
88
|
+
return line;
|
|
89
|
+
const name = ((_d = (_c = match[2]) !== null && _c !== void 0 ? _c : match[3]) !== null && _d !== void 0 ? _d : match[4]);
|
|
90
|
+
const specifier = name === "nestia" || name.startsWith("@nestia/")
|
|
91
|
+
? `^${version}`
|
|
92
|
+
: ((_e = (_a = TYPIA[name]) === null || _a === void 0 ? void 0 : _a.specifier) !== null && _e !== void 0 ? _e : (_b = TYPESCRIPT[name]) === null || _b === void 0 ? void 0 : _b.specifier);
|
|
93
|
+
if (typeof specifier !== "string")
|
|
94
|
+
return line;
|
|
95
|
+
return `${match[1]}${specifier}${match[5]}`;
|
|
96
|
+
};
|
|
97
|
+
return content.split("\n").map(replace).join("\n");
|
|
98
|
+
};
|
|
99
|
+
const trimTemplateDependencies = (parsed) => {
|
|
100
|
+
if (parsed.dependencies) {
|
|
101
|
+
delete parsed.dependencies.commander;
|
|
102
|
+
delete parsed.dependencies.inquirer;
|
|
103
|
+
}
|
|
104
|
+
if (parsed.devDependencies) {
|
|
105
|
+
delete parsed.devDependencies["@types/inquirer"];
|
|
106
|
+
delete parsed.devDependencies.commander;
|
|
107
|
+
delete parsed.devDependencies.inquirer;
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
const normalizeScript = (script) => script.replace(/(^|[^A-Za-z0-9_-])tsc(?=$|[^A-Za-z0-9_-])/g, "$1ttsc");
|
|
111
|
+
const ARGUMENT_PARSER = `import { createInterface } from "node:readline/promises";
|
|
112
|
+
|
|
113
|
+
export namespace ArgumentParser {
|
|
114
|
+
export interface Command {
|
|
115
|
+
option: (flags: string, description?: string) => Command;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export interface Prompt {
|
|
119
|
+
select: (
|
|
120
|
+
name: string,
|
|
121
|
+
) => (
|
|
122
|
+
message: string,
|
|
123
|
+
) => <Choice extends string>(choices: Choice[]) => Promise<Choice>;
|
|
124
|
+
boolean: (name: string) => (message: string) => Promise<boolean>;
|
|
125
|
+
number: (name: string) => (message: string) => Promise<number>;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export const parse = async <T>(
|
|
129
|
+
inquiry: (
|
|
130
|
+
command: Command,
|
|
131
|
+
prompt: Prompt,
|
|
132
|
+
action: (closure: (options: Partial<T>) => Promise<T>) => Promise<T>,
|
|
133
|
+
) => Promise<T>,
|
|
134
|
+
): Promise<T> => {
|
|
135
|
+
const command: Command = {
|
|
136
|
+
option: (_flags: string, _description?: string): Command => command,
|
|
137
|
+
};
|
|
138
|
+
const action = (closure: (options: Partial<T>) => Promise<T>) =>
|
|
139
|
+
closure(parseArguments() as Partial<T>);
|
|
140
|
+
return inquiry(
|
|
141
|
+
command,
|
|
142
|
+
{ select, boolean, number },
|
|
143
|
+
action,
|
|
144
|
+
);
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
const select =
|
|
148
|
+
(_name: string) =>
|
|
149
|
+
(message: string) =>
|
|
150
|
+
async <Choice extends string>(choices: Choice[]): Promise<Choice> => {
|
|
151
|
+
const answer: string = await ask(\`\${message} (\${choices.join("/")})\`);
|
|
152
|
+
return (choices.find((choice) => choice === answer) ?? choices[0])!;
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
const boolean = (_name: string) => async (message: string) =>
|
|
156
|
+
/^(true|t|yes|y|1)$/i.test(await ask(\`\${message} [y/N]\`));
|
|
157
|
+
|
|
158
|
+
const number = (_name: string) => async (message: string) =>
|
|
159
|
+
Number(await ask(message));
|
|
160
|
+
|
|
161
|
+
const ask = async (message: string): Promise<string> => {
|
|
162
|
+
const reader = createInterface({
|
|
163
|
+
input: process.stdin,
|
|
164
|
+
output: process.stdout,
|
|
165
|
+
});
|
|
166
|
+
try {
|
|
167
|
+
return (await reader.question(\`\${message}: \`)).trim();
|
|
168
|
+
} finally {
|
|
169
|
+
reader.close();
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
const parseArguments = (): Record<string, string | string[] | boolean> => {
|
|
174
|
+
const output: Record<string, string | string[] | boolean> = {};
|
|
175
|
+
const args: string[] = process.argv.slice(2);
|
|
176
|
+
for (let i = 0; i < args.length; ++i) {
|
|
177
|
+
const raw: string = args[i]!;
|
|
178
|
+
if (raw.startsWith("--") === false) continue;
|
|
179
|
+
|
|
180
|
+
const equal: number = raw.indexOf("=");
|
|
181
|
+
const name: string = toCamelCase(
|
|
182
|
+
raw.slice(2, equal === -1 ? undefined : equal),
|
|
183
|
+
);
|
|
184
|
+
if (equal !== -1) {
|
|
185
|
+
assign(output, name, raw.slice(equal + 1));
|
|
186
|
+
continue;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
const values: string[] = [];
|
|
190
|
+
while (i + 1 < args.length && args[i + 1]!.startsWith("--") === false)
|
|
191
|
+
values.push(args[++i]!);
|
|
192
|
+
assign(
|
|
193
|
+
output,
|
|
194
|
+
name,
|
|
195
|
+
values.length === 0 ? true : values.length === 1 ? values[0]! : values,
|
|
196
|
+
);
|
|
197
|
+
}
|
|
198
|
+
return output;
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
const assign = (
|
|
202
|
+
output: Record<string, string | string[] | boolean>,
|
|
203
|
+
name: string,
|
|
204
|
+
value: string | string[] | boolean,
|
|
205
|
+
): void => {
|
|
206
|
+
const current: string | string[] | boolean | undefined = output[name];
|
|
207
|
+
if (current === undefined) output[name] = value;
|
|
208
|
+
else
|
|
209
|
+
output[name] = [
|
|
210
|
+
...(Array.isArray(current) ? current : [String(current)]),
|
|
211
|
+
...(Array.isArray(value) ? value : [String(value)]),
|
|
212
|
+
];
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
const toCamelCase = (str: string): string =>
|
|
216
|
+
str.replace(/-([a-z])/g, (_matched, letter: string) =>
|
|
217
|
+
letter.toUpperCase(),
|
|
218
|
+
);
|
|
219
|
+
}
|
|
220
|
+
`;
|
|
221
|
+
const updateTsConfig = (content) => {
|
|
222
|
+
content = content.replace(/^\s*\{\s*"transform":\s*"typescript-transform-paths"\s*\},\r?\n/gm, "");
|
|
223
|
+
content = content.replace(/^\s*\{\s*"transform":\s*"typia\/lib\/transform"(?:,\s*"enabled":\s*false)?\s*\},?\r?\n/gm, "");
|
|
224
|
+
content = content.replace(/^\s*\{\s*"transform":\s*"@nestia\/core\/lib\/transform"\s*\},?\r?\n/gm, "");
|
|
225
|
+
content = content.replace(/^\s*\{\s*"transform":\s*"@nestia\/core\/native\/transform\.cjs"\s*\},?\r?\n/gm, "");
|
|
226
|
+
content = content.replace(/^\s*\{\s*"transform":\s*"@nestia\/sdk\/lib\/transform"\s*\},\r?\n/gm, "");
|
|
227
|
+
return content;
|
|
228
|
+
};
|
|
229
|
+
const bundle = (_a) => __awaiter(void 0, [_a], void 0, function* ({ mode, repository, revision, exceptions, transform, }) {
|
|
230
|
+
const root = `${__dirname}/../..`;
|
|
231
|
+
const assets = `${root}/assets`;
|
|
232
|
+
const template = `${assets}/${mode}`;
|
|
233
|
+
const clone = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
234
|
+
// CLONE REPOSITORY
|
|
235
|
+
if (node_fs_1.default.existsSync(template))
|
|
236
|
+
yield node_fs_1.default.promises.rm(template, { recursive: true });
|
|
237
|
+
else
|
|
238
|
+
try {
|
|
239
|
+
yield node_fs_1.default.promises.mkdir(ASSETS);
|
|
240
|
+
}
|
|
241
|
+
catch (_a) { }
|
|
242
|
+
// Disable line-ending conversion so the bundled template is byte-identical
|
|
243
|
+
// on every platform: with core.autocrlf=true (the common Windows default)
|
|
244
|
+
// the checkout would rewrite LF to CRLF and break the line-targeted
|
|
245
|
+
// transforms below.
|
|
246
|
+
yield node_fs_1.default.promises.mkdir(template, { recursive: true });
|
|
247
|
+
node_child_process_1.default.execFileSync("git", ["init", "--quiet"], { cwd: template });
|
|
248
|
+
// The template repositories are live projects; an unpinned clone lets any
|
|
249
|
+
// upstream push break this build (samchon/nestia-start#632 did exactly
|
|
250
|
+
// that), so every bundle checks out a reviewed revision.
|
|
251
|
+
node_child_process_1.default.execFileSync("git", [
|
|
252
|
+
"fetch",
|
|
253
|
+
"--quiet",
|
|
254
|
+
"--depth=1",
|
|
255
|
+
// This checkout is consumed and removed immediately. Fetch's default
|
|
256
|
+
// auto-maintenance can detach a writer into .git/objects after fetch
|
|
257
|
+
// returns, racing the awaited removal below on a cold CI build.
|
|
258
|
+
"--no-auto-maintenance",
|
|
259
|
+
`https://github.com/samchon/${repository}`,
|
|
260
|
+
revision,
|
|
261
|
+
], { cwd: template });
|
|
262
|
+
node_child_process_1.default.execFileSync("git", [
|
|
263
|
+
"-c",
|
|
264
|
+
"core.autocrlf=false",
|
|
265
|
+
"checkout",
|
|
266
|
+
"--quiet",
|
|
267
|
+
"--detach",
|
|
268
|
+
revision,
|
|
269
|
+
], {
|
|
270
|
+
cwd: template,
|
|
271
|
+
stdio: "pipe",
|
|
272
|
+
});
|
|
273
|
+
// REMOVE VULNERABLE FILES
|
|
274
|
+
for (const location of exceptions !== null && exceptions !== void 0 ? exceptions : [])
|
|
275
|
+
yield node_fs_1.default.promises.rm(`${template}/${location}`, { recursive: true });
|
|
276
|
+
});
|
|
277
|
+
const iterate = (collection) => (location) => __awaiter(void 0, void 0, void 0, function* () {
|
|
278
|
+
const directory = yield node_fs_1.default.promises.readdir(location);
|
|
279
|
+
for (const file of directory) {
|
|
280
|
+
const absolute = location + "/" + file;
|
|
281
|
+
const stats = yield node_fs_1.default.promises.stat(absolute);
|
|
282
|
+
if (stats.isDirectory())
|
|
283
|
+
yield iterate(collection)(absolute);
|
|
284
|
+
else {
|
|
285
|
+
const content = yield node_fs_1.default.promises.readFile(absolute, "utf-8");
|
|
286
|
+
collection[(() => {
|
|
287
|
+
const str = absolute.replace(template, "");
|
|
288
|
+
return str[0] === "/" ? str.substring(1) : str;
|
|
289
|
+
})()] = content;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
});
|
|
293
|
+
const archive = (collection) => __awaiter(void 0, void 0, void 0, function* () {
|
|
294
|
+
const name = `${mode.toUpperCase()}_TEMPLATE`;
|
|
295
|
+
const body = JSON.stringify(collection, null, 2);
|
|
296
|
+
const content = `export const ${name}: Record<string, string> = ${body}`;
|
|
297
|
+
try {
|
|
298
|
+
yield node_fs_1.default.promises.mkdir(`${ROOT}/src/bundles`);
|
|
299
|
+
}
|
|
300
|
+
catch (_a) { }
|
|
301
|
+
yield node_fs_1.default.promises.writeFile(`${ROOT}/src/bundles/${name}.ts`, content, "utf8");
|
|
302
|
+
});
|
|
303
|
+
const collection = {};
|
|
304
|
+
yield clone();
|
|
305
|
+
yield iterate(collection)(template);
|
|
306
|
+
if (transform)
|
|
307
|
+
for (const [key, value] of Object.entries(collection))
|
|
308
|
+
collection[key] = yield writeTransformedAsset(template, key, transform(key, value));
|
|
309
|
+
yield archive(collection);
|
|
310
|
+
});
|
|
311
|
+
const writeTransformedAsset = (template, key, value) => __awaiter(void 0, void 0, void 0, function* () {
|
|
312
|
+
yield node_fs_1.default.promises.writeFile(`${template}/${key}`, value, "utf8");
|
|
313
|
+
return value;
|
|
314
|
+
});
|
|
315
|
+
/**
|
|
316
|
+
* Generates both pinned templates using the current release and catalog stamps.
|
|
317
|
+
*
|
|
318
|
+
* The complete script is a cache input because it contains the revisions,
|
|
319
|
+
* exclusions and every transformation rule. A hit still verifies output bytes.
|
|
320
|
+
*/
|
|
321
|
+
const generate = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
322
|
+
yield bundle({
|
|
323
|
+
mode: "nest",
|
|
324
|
+
repository: "nestia-start",
|
|
325
|
+
// Pin the reviewed pnpm monorepo template after its catalog, rolldown, and
|
|
326
|
+
// package self-reference migrations.
|
|
327
|
+
revision: "8188661cb1c1b0fb30e6184b06422764d64a5f68",
|
|
328
|
+
exceptions: [
|
|
329
|
+
".git",
|
|
330
|
+
".github/dependabot.yml",
|
|
331
|
+
".github/workflows/dependabot-automerge.yml",
|
|
332
|
+
// The template's lockfile resolves the catalog versions that the
|
|
333
|
+
// stamping below rewrites; shipping it would only bloat NEST_TEMPLATE
|
|
334
|
+
// with 160 KB of immediately-stale data.
|
|
335
|
+
"pnpm-lock.yaml",
|
|
336
|
+
"packages/api/src/functional",
|
|
337
|
+
"packages/api/src/structures",
|
|
338
|
+
"packages/backend/src/MyModule.ts",
|
|
339
|
+
"packages/backend/src/controllers",
|
|
340
|
+
"packages/backend/src/providers",
|
|
341
|
+
"packages/backend/test/features",
|
|
342
|
+
],
|
|
343
|
+
transform: (key, value) => {
|
|
344
|
+
if (key.endsWith("package.json")) {
|
|
345
|
+
const parsed = JSON.parse(update(value));
|
|
346
|
+
trimTemplateDependencies(parsed);
|
|
347
|
+
return JSON.stringify(parsed, null, 2);
|
|
348
|
+
}
|
|
349
|
+
if (key === "pnpm-workspace.yaml")
|
|
350
|
+
return updateWorkspaceCatalog(value);
|
|
351
|
+
if (key === "packages/backend/test/helpers/ArgumentParser.ts")
|
|
352
|
+
return ARGUMENT_PARSER;
|
|
353
|
+
if (key.endsWith("tsconfig.json"))
|
|
354
|
+
return updateTsConfig(value);
|
|
355
|
+
return value;
|
|
356
|
+
},
|
|
357
|
+
});
|
|
358
|
+
yield bundle({
|
|
359
|
+
mode: "sdk",
|
|
360
|
+
repository: "nestia-sdk-template",
|
|
361
|
+
// Pin the reviewed pnpm-native SDK template.
|
|
362
|
+
revision: "37a019e2b8dea3d02237137aaec2f242f53dcd2d",
|
|
363
|
+
exceptions: [
|
|
364
|
+
".git",
|
|
365
|
+
".github/dependabot.yml",
|
|
366
|
+
".github/workflows/build.yml",
|
|
367
|
+
".github/workflows/dependabot-automerge.yml",
|
|
368
|
+
// update() stamps the current Nestia version into package.json. The
|
|
369
|
+
// template repository's lockfile resolves its own version, so let the
|
|
370
|
+
// first pnpm install create a lockfile that matches the migrated output.
|
|
371
|
+
"pnpm-lock.yaml",
|
|
372
|
+
"src/functional",
|
|
373
|
+
"src/structures",
|
|
374
|
+
"test/features",
|
|
375
|
+
],
|
|
376
|
+
transform: (key, value) => {
|
|
377
|
+
if (key.endsWith("package.json")) {
|
|
378
|
+
const parsed = JSON.parse(update(value, { sdkAggregate: key === "package.json" }));
|
|
379
|
+
trimTemplateDependencies(parsed);
|
|
380
|
+
return JSON.stringify(parsed, null, 2);
|
|
381
|
+
}
|
|
382
|
+
if (key === "test/utils/ArgumentParser.ts")
|
|
383
|
+
return ARGUMENT_PARSER;
|
|
384
|
+
if (key.endsWith("tsconfig.json"))
|
|
385
|
+
return updateTsConfig(value);
|
|
386
|
+
return value;
|
|
387
|
+
},
|
|
388
|
+
});
|
|
389
|
+
});
|
|
390
|
+
const main = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
391
|
+
const reused = yield (0, TemplateBundleCache_1.run)({
|
|
392
|
+
inputs: [version, CATALOGS, node_fs_1.default.readFileSync(__filename, "utf8")],
|
|
393
|
+
outputs: ["NEST_TEMPLATE", "SDK_TEMPLATE"].map((name) => `${ROOT}/src/bundles/${name}.ts`),
|
|
394
|
+
stampFile: `${ASSETS}/.bundle-cache.json`,
|
|
395
|
+
generate,
|
|
396
|
+
});
|
|
397
|
+
if (reused)
|
|
398
|
+
console.log("Reuse verified migration template bundles.");
|
|
399
|
+
});
|
|
400
|
+
main().catch((exp) => {
|
|
401
|
+
console.error(exp);
|
|
402
|
+
process.exit(-1);
|
|
403
|
+
});
|
|
404
|
+
//# sourceMappingURL=bundle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundle.js","sourceRoot":"","sources":["../../src/executable/bundle.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,4EAAoC;AACpC,sDAAyB;AAEzB,+DAAyD;AAEzD,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAAC;AAExD,MAAM,IAAI,GAAG,GAAG,SAAS,QAAQ,CAAC;AAClC,MAAM,MAAM,GAAG,GAAG,IAAI,SAAS,CAAC;AAChC,MAAM,QAAQ,GAGV,OAAO,CAAC,SAAS,CAAC,CAAC,IAAI,CACzB,iBAAE,CAAC,YAAY,CAAC,GAAG,SAAS,6BAA6B,EAAE,MAAM,CAAC,CACnE,CAAC,QAAQ,CAAC;AACX,MAAM,KAAK,GAAG,QAAQ,CAAC,OAAQ,CAAC;AAChC,MAAM,UAAU,SAAG,QAAQ,CAAC,UAAU,mCAAI,EAAE,CAAC;AAE7C,MAAM,MAAM,GAAG,CACb,OAAe,EACf,OAAO,GAA+B,EAAE,EAChC,EAAE;;IACV,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACnC,KAAK,MAAM,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