@nestia/migrate 12.0.0-rc.3 → 12.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/NestiaMigrateApplication.js +9 -44
- package/lib/NestiaMigrateApplication.js.map +1 -1
- package/lib/NestiaMigrateApplication.mjs +90 -3
- package/lib/NestiaMigrateApplication.mjs.map +1 -1
- package/lib/_virtual/_rolldown/runtime.mjs +13 -0
- package/lib/analyzers/NestiaMigrateControllerAnalyzer.mjs +45 -3
- package/lib/analyzers/NestiaMigrateControllerAnalyzer.mjs.map +1 -1
- package/lib/archivers/NestiaMigrateFileArchiver.js +4 -0
- package/lib/archivers/NestiaMigrateFileArchiver.js.map +1 -1
- package/lib/archivers/NestiaMigrateFileArchiver.mjs +25 -3
- package/lib/archivers/NestiaMigrateFileArchiver.mjs.map +1 -1
- package/lib/bundles/NEST_TEMPLATE.js +47 -44
- package/lib/bundles/NEST_TEMPLATE.js.map +1 -1
- package/lib/bundles/NEST_TEMPLATE.mjs +59 -3
- package/lib/bundles/NEST_TEMPLATE.mjs.map +1 -1
- package/lib/bundles/SDK_TEMPLATE.js +7 -8
- package/lib/bundles/SDK_TEMPLATE.js.map +1 -1
- package/lib/bundles/SDK_TEMPLATE.mjs +27 -3
- package/lib/bundles/SDK_TEMPLATE.mjs.map +1 -1
- package/lib/executable/NestiaMigrateCommander.mjs +80 -3
- package/lib/executable/NestiaMigrateCommander.mjs.map +1 -1
- package/lib/executable/NestiaMigrateInquirer.mjs +59 -3
- package/lib/executable/NestiaMigrateInquirer.mjs.map +1 -1
- package/lib/executable/migrate.mjs +9 -3
- package/lib/executable/migrate.mjs.map +1 -1
- package/lib/factories/ExpressionFactory.mjs +10 -3
- package/lib/factories/ExpressionFactory.mjs.map +1 -1
- package/lib/factories/FormatCheatSheet.mjs +31 -3
- package/lib/factories/FormatCheatSheet.mjs.map +1 -1
- package/lib/factories/IdentifierFactory.mjs +22 -3
- package/lib/factories/IdentifierFactory.mjs.map +1 -1
- package/lib/factories/LiteralFactory.mjs +31 -3
- package/lib/factories/LiteralFactory.mjs.map +1 -1
- package/lib/factories/StatementFactory.mjs +12 -3
- package/lib/factories/StatementFactory.mjs.map +1 -1
- package/lib/factories/TypeFactory.mjs +21 -3
- package/lib/factories/TypeFactory.mjs.map +1 -1
- package/lib/factories/TypeLiteralFactory.js +2 -37
- package/lib/factories/TypeLiteralFactory.js.map +1 -1
- package/lib/factories/TypeLiteralFactory.mjs +17 -3
- package/lib/factories/TypeLiteralFactory.mjs.map +1 -1
- package/lib/index.mjs +24 -2
- package/lib/index.mjs.map +1 -1
- package/lib/internal/ts.mjs +6 -2
- package/lib/internal/ts.mjs.map +1 -1
- package/lib/module.mjs +43 -2
- package/lib/module.mjs.map +1 -1
- package/lib/programmers/NestiaMigrateApiFileProgrammer.mjs +36 -3
- package/lib/programmers/NestiaMigrateApiFileProgrammer.mjs.map +1 -1
- package/lib/programmers/NestiaMigrateApiFunctionProgrammer.js +2 -37
- package/lib/programmers/NestiaMigrateApiFunctionProgrammer.js.map +1 -1
- package/lib/programmers/NestiaMigrateApiFunctionProgrammer.mjs +106 -3
- package/lib/programmers/NestiaMigrateApiFunctionProgrammer.mjs.map +1 -1
- package/lib/programmers/NestiaMigrateApiNamespaceProgrammer.mjs +139 -3
- package/lib/programmers/NestiaMigrateApiNamespaceProgrammer.mjs.map +1 -1
- package/lib/programmers/NestiaMigrateApiProgrammer.js +1 -1
- package/lib/programmers/NestiaMigrateApiProgrammer.js.map +1 -1
- package/lib/programmers/NestiaMigrateApiProgrammer.mjs +71 -3
- package/lib/programmers/NestiaMigrateApiProgrammer.mjs.map +1 -1
- package/lib/programmers/NestiaMigrateApiSimulationProgrammer.mjs +102 -3
- package/lib/programmers/NestiaMigrateApiSimulationProgrammer.mjs.map +1 -1
- package/lib/programmers/NestiaMigrateApiStartProgrammer.mjs +50 -3
- package/lib/programmers/NestiaMigrateApiStartProgrammer.mjs.map +1 -1
- package/lib/programmers/NestiaMigrateDtoProgrammer.mjs +53 -3
- package/lib/programmers/NestiaMigrateDtoProgrammer.mjs.map +1 -1
- package/lib/programmers/NestiaMigrateE2eFileProgrammer.mjs +58 -3
- package/lib/programmers/NestiaMigrateE2eFileProgrammer.mjs.map +1 -1
- package/lib/programmers/NestiaMigrateE2eProgrammer.js +11 -4
- package/lib/programmers/NestiaMigrateE2eProgrammer.js.map +1 -1
- package/lib/programmers/NestiaMigrateE2eProgrammer.mjs +35 -3
- package/lib/programmers/NestiaMigrateE2eProgrammer.mjs.map +1 -1
- package/lib/programmers/NestiaMigrateImportProgrammer.js +12 -5
- package/lib/programmers/NestiaMigrateImportProgrammer.js.map +1 -1
- package/lib/programmers/NestiaMigrateImportProgrammer.mjs +50 -3
- package/lib/programmers/NestiaMigrateImportProgrammer.mjs.map +1 -1
- package/lib/programmers/NestiaMigrateNestControllerProgrammer.js +4 -3
- package/lib/programmers/NestiaMigrateNestControllerProgrammer.js.map +1 -1
- package/lib/programmers/NestiaMigrateNestControllerProgrammer.mjs +31 -3
- package/lib/programmers/NestiaMigrateNestControllerProgrammer.mjs.map +1 -1
- package/lib/programmers/NestiaMigrateNestMethodProgrammer.mjs +128 -3
- package/lib/programmers/NestiaMigrateNestMethodProgrammer.mjs.map +1 -1
- package/lib/programmers/NestiaMigrateNestModuleProgrammer.mjs +18 -3
- package/lib/programmers/NestiaMigrateNestModuleProgrammer.mjs.map +1 -1
- package/lib/programmers/NestiaMigrateNestProgrammer.js +25 -4
- package/lib/programmers/NestiaMigrateNestProgrammer.js.map +1 -1
- package/lib/programmers/NestiaMigrateNestProgrammer.mjs +60 -3
- package/lib/programmers/NestiaMigrateNestProgrammer.mjs.map +1 -1
- package/lib/programmers/NestiaMigrateSchemaProgrammer.js +14 -49
- package/lib/programmers/NestiaMigrateSchemaProgrammer.js.map +1 -1
- package/lib/programmers/NestiaMigrateSchemaProgrammer.mjs +199 -3
- package/lib/programmers/NestiaMigrateSchemaProgrammer.mjs.map +1 -1
- package/lib/programmers/index.mjs +16 -2
- package/lib/structures/INestiaMigrateConfig.mjs +0 -3
- package/lib/structures/INestiaMigrateContext.mjs +0 -3
- package/lib/structures/INestiaMigrateController.mjs +0 -3
- package/lib/structures/INestiaMigrateFile.mjs +0 -3
- package/lib/structures/index.mjs +0 -2
- package/lib/utils/FilePrinter.mjs +20 -3
- package/lib/utils/FilePrinter.mjs.map +1 -1
- package/lib/utils/MapUtil.mjs +15 -3
- package/lib/utils/MapUtil.mjs.map +1 -1
- package/lib/utils/StringUtil.mjs +100 -3
- package/lib/utils/StringUtil.mjs.map +1 -1
- package/package.json +10 -14
- package/src/NestiaMigrateApplication.ts +8 -12
- package/src/archivers/NestiaMigrateFileArchiver.ts +4 -0
- package/src/bundles/NEST_TEMPLATE.ts +47 -44
- package/src/bundles/SDK_TEMPLATE.ts +7 -8
- package/src/executable/bundle.js +95 -23
- package/src/factories/TypeLiteralFactory.ts +1 -4
- package/src/programmers/NestiaMigrateApiFunctionProgrammer.ts +1 -4
- package/src/programmers/NestiaMigrateApiProgrammer.ts +1 -1
- package/src/programmers/NestiaMigrateE2eProgrammer.ts +19 -5
- package/src/programmers/NestiaMigrateImportProgrammer.ts +21 -13
- package/src/programmers/NestiaMigrateNestControllerProgrammer.ts +4 -8
- package/src/programmers/NestiaMigrateNestProgrammer.ts +28 -7
- package/src/programmers/NestiaMigrateSchemaProgrammer.ts +1 -4
- package/lib/NestiaMigrateApplication2.mjs +0 -153
- package/lib/NestiaMigrateApplication2.mjs.map +0 -1
- package/lib/_virtual/ExpressionFactory.mjs +0 -4
- package/lib/_virtual/ExpressionFactory.mjs.map +0 -1
- package/lib/_virtual/FilePrinter.mjs +0 -4
- package/lib/_virtual/FilePrinter.mjs.map +0 -1
- package/lib/_virtual/FormatCheatSheet.mjs +0 -4
- package/lib/_virtual/FormatCheatSheet.mjs.map +0 -1
- package/lib/_virtual/INestiaMigrateConfig.mjs +0 -4
- package/lib/_virtual/INestiaMigrateConfig.mjs.map +0 -1
- package/lib/_virtual/INestiaMigrateContext.mjs +0 -4
- package/lib/_virtual/INestiaMigrateContext.mjs.map +0 -1
- package/lib/_virtual/INestiaMigrateController.mjs +0 -4
- package/lib/_virtual/INestiaMigrateController.mjs.map +0 -1
- package/lib/_virtual/INestiaMigrateFile.mjs +0 -4
- package/lib/_virtual/INestiaMigrateFile.mjs.map +0 -1
- package/lib/_virtual/IdentifierFactory.mjs +0 -4
- package/lib/_virtual/IdentifierFactory.mjs.map +0 -1
- package/lib/_virtual/LiteralFactory.mjs +0 -4
- package/lib/_virtual/LiteralFactory.mjs.map +0 -1
- package/lib/_virtual/MapUtil.mjs +0 -4
- package/lib/_virtual/MapUtil.mjs.map +0 -1
- package/lib/_virtual/NEST_TEMPLATE.mjs +0 -4
- package/lib/_virtual/NEST_TEMPLATE.mjs.map +0 -1
- package/lib/_virtual/NestiaMigrateApiFileProgrammer.mjs +0 -4
- package/lib/_virtual/NestiaMigrateApiFileProgrammer.mjs.map +0 -1
- package/lib/_virtual/NestiaMigrateApiFunctionProgrammer.mjs +0 -4
- package/lib/_virtual/NestiaMigrateApiFunctionProgrammer.mjs.map +0 -1
- package/lib/_virtual/NestiaMigrateApiNamespaceProgrammer.mjs +0 -4
- package/lib/_virtual/NestiaMigrateApiNamespaceProgrammer.mjs.map +0 -1
- package/lib/_virtual/NestiaMigrateApiProgrammer.mjs +0 -4
- package/lib/_virtual/NestiaMigrateApiProgrammer.mjs.map +0 -1
- package/lib/_virtual/NestiaMigrateApiSimulationProgrammer.mjs +0 -4
- package/lib/_virtual/NestiaMigrateApiSimulationProgrammer.mjs.map +0 -1
- package/lib/_virtual/NestiaMigrateApiStartProgrammer.mjs +0 -4
- package/lib/_virtual/NestiaMigrateApiStartProgrammer.mjs.map +0 -1
- package/lib/_virtual/NestiaMigrateApplication.mjs +0 -4
- package/lib/_virtual/NestiaMigrateApplication.mjs.map +0 -1
- package/lib/_virtual/NestiaMigrateCommander.mjs +0 -4
- package/lib/_virtual/NestiaMigrateCommander.mjs.map +0 -1
- package/lib/_virtual/NestiaMigrateControllerAnalyzer.mjs +0 -4
- package/lib/_virtual/NestiaMigrateControllerAnalyzer.mjs.map +0 -1
- package/lib/_virtual/NestiaMigrateDtoProgrammer.mjs +0 -4
- package/lib/_virtual/NestiaMigrateDtoProgrammer.mjs.map +0 -1
- package/lib/_virtual/NestiaMigrateE2eFileProgrammer.mjs +0 -4
- package/lib/_virtual/NestiaMigrateE2eFileProgrammer.mjs.map +0 -1
- package/lib/_virtual/NestiaMigrateE2eProgrammer.mjs +0 -4
- package/lib/_virtual/NestiaMigrateE2eProgrammer.mjs.map +0 -1
- package/lib/_virtual/NestiaMigrateFileArchiver.mjs +0 -4
- package/lib/_virtual/NestiaMigrateFileArchiver.mjs.map +0 -1
- package/lib/_virtual/NestiaMigrateImportProgrammer.mjs +0 -4
- package/lib/_virtual/NestiaMigrateImportProgrammer.mjs.map +0 -1
- package/lib/_virtual/NestiaMigrateInquirer.mjs +0 -4
- package/lib/_virtual/NestiaMigrateInquirer.mjs.map +0 -1
- package/lib/_virtual/NestiaMigrateNestControllerProgrammer.mjs +0 -4
- package/lib/_virtual/NestiaMigrateNestControllerProgrammer.mjs.map +0 -1
- package/lib/_virtual/NestiaMigrateNestMethodProgrammer.mjs +0 -4
- package/lib/_virtual/NestiaMigrateNestMethodProgrammer.mjs.map +0 -1
- package/lib/_virtual/NestiaMigrateNestModuleProgrammer.mjs +0 -4
- package/lib/_virtual/NestiaMigrateNestModuleProgrammer.mjs.map +0 -1
- package/lib/_virtual/NestiaMigrateNestProgrammer.mjs +0 -4
- package/lib/_virtual/NestiaMigrateNestProgrammer.mjs.map +0 -1
- package/lib/_virtual/NestiaMigrateSchemaProgrammer.mjs +0 -4
- package/lib/_virtual/NestiaMigrateSchemaProgrammer.mjs.map +0 -1
- package/lib/_virtual/SDK_TEMPLATE.mjs +0 -4
- package/lib/_virtual/SDK_TEMPLATE.mjs.map +0 -1
- package/lib/_virtual/StatementFactory.mjs +0 -4
- package/lib/_virtual/StatementFactory.mjs.map +0 -1
- package/lib/_virtual/StringUtil.mjs +0 -4
- package/lib/_virtual/StringUtil.mjs.map +0 -1
- package/lib/_virtual/TypeFactory.mjs +0 -4
- package/lib/_virtual/TypeFactory.mjs.map +0 -1
- package/lib/_virtual/TypeLiteralFactory.mjs +0 -4
- package/lib/_virtual/TypeLiteralFactory.mjs.map +0 -1
- package/lib/_virtual/_commander.mjs +0 -7
- package/lib/_virtual/_commander.mjs.map +0 -1
- package/lib/_virtual/_commonjsHelpers.mjs +0 -35
- package/lib/_virtual/_commonjsHelpers.mjs.map +0 -1
- package/lib/_virtual/_inquirer.mjs +0 -7
- package/lib/_virtual/_inquirer.mjs.map +0 -1
- package/lib/_virtual/_node_child_process.mjs +0 -7
- package/lib/_virtual/_node_child_process.mjs.map +0 -1
- package/lib/_virtual/_node_fs.mjs +0 -7
- package/lib/_virtual/_node_fs.mjs.map +0 -1
- package/lib/_virtual/_node_path.mjs +0 -7
- package/lib/_virtual/_node_path.mjs.map +0 -1
- package/lib/_virtual/_prettier-plugin-jsdoc.mjs +0 -7
- package/lib/_virtual/_prettier-plugin-jsdoc.mjs.map +0 -1
- package/lib/_virtual/_prettier.mjs +0 -7
- package/lib/_virtual/_prettier.mjs.map +0 -1
- package/lib/_virtual/_tstl.mjs +0 -7
- package/lib/_virtual/_tstl.mjs.map +0 -1
- package/lib/_virtual/factory.mjs +0 -7
- package/lib/_virtual/factory.mjs.map +0 -1
- package/lib/_virtual/index.mjs +0 -4
- package/lib/_virtual/index.mjs.map +0 -1
- package/lib/_virtual/index2.mjs +0 -4
- package/lib/_virtual/index2.mjs.map +0 -1
- package/lib/_virtual/index3.mjs +0 -4
- package/lib/_virtual/index3.mjs.map +0 -1
- package/lib/_virtual/index4.mjs +0 -4
- package/lib/_virtual/index4.mjs.map +0 -1
- package/lib/_virtual/migrate.mjs +0 -4
- package/lib/_virtual/migrate.mjs.map +0 -1
- package/lib/_virtual/module.mjs +0 -4
- package/lib/_virtual/module.mjs.map +0 -1
- package/lib/_virtual/prettier-plugin-sort-imports.mjs +0 -7
- package/lib/_virtual/prettier-plugin-sort-imports.mjs.map +0 -1
- package/lib/_virtual/ts.mjs +0 -4
- package/lib/_virtual/ts.mjs.map +0 -1
- package/lib/_virtual/utils.mjs +0 -7
- package/lib/_virtual/utils.mjs.map +0 -1
- package/lib/analyzers/NestiaMigrateControllerAnalyzer2.mjs +0 -53
- package/lib/analyzers/NestiaMigrateControllerAnalyzer2.mjs.map +0 -1
- package/lib/archivers/NestiaMigrateFileArchiver2.mjs +0 -40
- package/lib/archivers/NestiaMigrateFileArchiver2.mjs.map +0 -1
- package/lib/bundles/NEST_TEMPLATE2.mjs +0 -66
- package/lib/bundles/NEST_TEMPLATE2.mjs.map +0 -1
- package/lib/bundles/SDK_TEMPLATE2.mjs +0 -38
- package/lib/bundles/SDK_TEMPLATE2.mjs.map +0 -1
- package/lib/executable/NestiaMigrateCommander2.mjs +0 -148
- package/lib/executable/NestiaMigrateCommander2.mjs.map +0 -1
- package/lib/executable/NestiaMigrateInquirer2.mjs +0 -93
- package/lib/executable/NestiaMigrateInquirer2.mjs.map +0 -1
- package/lib/executable/migrate2.mjs +0 -13
- package/lib/executable/migrate2.mjs.map +0 -1
- package/lib/factories/ExpressionFactory2.mjs +0 -20
- package/lib/factories/ExpressionFactory2.mjs.map +0 -1
- package/lib/factories/FormatCheatSheet2.mjs +0 -37
- package/lib/factories/FormatCheatSheet2.mjs.map +0 -1
- package/lib/factories/IdentifierFactory2.mjs +0 -56
- package/lib/factories/IdentifierFactory2.mjs.map +0 -1
- package/lib/factories/LiteralFactory2.mjs +0 -56
- package/lib/factories/LiteralFactory2.mjs.map +0 -1
- package/lib/factories/StatementFactory2.mjs +0 -26
- package/lib/factories/StatementFactory2.mjs.map +0 -1
- package/lib/factories/TypeFactory2.mjs +0 -31
- package/lib/factories/TypeFactory2.mjs.map +0 -1
- package/lib/factories/TypeLiteralFactory2.mjs +0 -72
- package/lib/factories/TypeLiteralFactory2.mjs.map +0 -1
- package/lib/index2.mjs +0 -53
- package/lib/index2.mjs.map +0 -1
- package/lib/internal/ts2.mjs +0 -10
- package/lib/internal/ts2.mjs.map +0 -1
- package/lib/module2.mjs +0 -38
- package/lib/module2.mjs.map +0 -1
- package/lib/programmers/NestiaMigrateApiFileProgrammer2.mjs +0 -49
- package/lib/programmers/NestiaMigrateApiFileProgrammer2.mjs.map +0 -1
- package/lib/programmers/NestiaMigrateApiFunctionProgrammer2.mjs +0 -234
- package/lib/programmers/NestiaMigrateApiFunctionProgrammer2.mjs.map +0 -1
- package/lib/programmers/NestiaMigrateApiNamespaceProgrammer2.mjs +0 -238
- package/lib/programmers/NestiaMigrateApiNamespaceProgrammer2.mjs.map +0 -1
- package/lib/programmers/NestiaMigrateApiProgrammer2.mjs +0 -92
- package/lib/programmers/NestiaMigrateApiProgrammer2.mjs.map +0 -1
- package/lib/programmers/NestiaMigrateApiSimulationProgrammer2.mjs +0 -156
- package/lib/programmers/NestiaMigrateApiSimulationProgrammer2.mjs.map +0 -1
- package/lib/programmers/NestiaMigrateApiStartProgrammer2.mjs +0 -88
- package/lib/programmers/NestiaMigrateApiStartProgrammer2.mjs.map +0 -1
- package/lib/programmers/NestiaMigrateDtoProgrammer2.mjs +0 -90
- package/lib/programmers/NestiaMigrateDtoProgrammer2.mjs.map +0 -1
- package/lib/programmers/NestiaMigrateE2eFileProgrammer2.mjs +0 -88
- package/lib/programmers/NestiaMigrateE2eFileProgrammer2.mjs.map +0 -1
- package/lib/programmers/NestiaMigrateE2eProgrammer2.mjs +0 -41
- package/lib/programmers/NestiaMigrateE2eProgrammer2.mjs.map +0 -1
- package/lib/programmers/NestiaMigrateImportProgrammer2.mjs +0 -72
- package/lib/programmers/NestiaMigrateImportProgrammer2.mjs.map +0 -1
- package/lib/programmers/NestiaMigrateNestControllerProgrammer2.mjs +0 -52
- package/lib/programmers/NestiaMigrateNestControllerProgrammer2.mjs.map +0 -1
- package/lib/programmers/NestiaMigrateNestMethodProgrammer2.mjs +0 -229
- package/lib/programmers/NestiaMigrateNestMethodProgrammer2.mjs.map +0 -1
- package/lib/programmers/NestiaMigrateNestModuleProgrammer2.mjs +0 -32
- package/lib/programmers/NestiaMigrateNestModuleProgrammer2.mjs.map +0 -1
- package/lib/programmers/NestiaMigrateNestProgrammer2.mjs +0 -78
- package/lib/programmers/NestiaMigrateNestProgrammer2.mjs.map +0 -1
- package/lib/programmers/NestiaMigrateSchemaProgrammer2.mjs +0 -388
- package/lib/programmers/NestiaMigrateSchemaProgrammer2.mjs.map +0 -1
- package/lib/programmers/index.mjs.map +0 -1
- package/lib/programmers/index2.mjs +0 -71
- package/lib/programmers/index2.mjs.map +0 -1
- package/lib/structures/INestiaMigrateConfig.mjs.map +0 -1
- package/lib/structures/INestiaMigrateConfig2.mjs +0 -6
- package/lib/structures/INestiaMigrateConfig2.mjs.map +0 -1
- package/lib/structures/INestiaMigrateContext.mjs.map +0 -1
- package/lib/structures/INestiaMigrateContext2.mjs +0 -6
- package/lib/structures/INestiaMigrateContext2.mjs.map +0 -1
- package/lib/structures/INestiaMigrateController.mjs.map +0 -1
- package/lib/structures/INestiaMigrateController2.mjs +0 -6
- package/lib/structures/INestiaMigrateController2.mjs.map +0 -1
- package/lib/structures/INestiaMigrateFile.mjs.map +0 -1
- package/lib/structures/INestiaMigrateFile2.mjs +0 -6
- package/lib/structures/INestiaMigrateFile2.mjs.map +0 -1
- package/lib/structures/index.mjs.map +0 -1
- package/lib/structures/index2.mjs +0 -38
- package/lib/structures/index2.mjs.map +0 -1
- package/lib/utils/FilePrinter2.mjs +0 -28
- package/lib/utils/FilePrinter2.mjs.map +0 -1
- package/lib/utils/MapUtil2.mjs +0 -18
- package/lib/utils/MapUtil2.mjs.map +0 -1
- package/lib/utils/StringUtil2.mjs +0 -110
- package/lib/utils/StringUtil2.mjs.map +0 -1
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
export const SDK_TEMPLATE: Record<string, string> = {
|
|
2
|
-
".gitignore": ".git/\nbin/\nlib/\nnode_modules/\n\npackage-lock.json
|
|
2
|
+
".gitignore": ".git/\nbin/\nlib/\nnode_modules/\n\npackage-lock.json",
|
|
3
3
|
".vscode/launch.json": "{\n // Use IntelliSense to learn about possible Node.js debug attributes.\n // Hover to view descriptions of existing attributes.\n // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387\n \"version\": \"0.2.0\",\n \"configurations\": [\n {\n \"type\": \"node\",\n \"request\": \"launch\",\n \"name\": \"JavaScript Test using SourceMap\",\n \"program\": \"${workspaceRoot}/test/index.ts\",\n \"cwd\": \"${workspaceRoot}\",\n \"args\": [\n //----\n // You can run specific test functions\n //----\n // \"--include\", \"something\",\n // \"--exclude\", \"nothing\",\n ],\n \"outFiles\": [\"${workspaceRoot}/bin/**/*.js\"],\n }\n ]\n}",
|
|
4
4
|
".vscode/settings.json": "{\n \"editor.tabSize\": 2,\n \"editor.formatOnSave\": true,\n \"[javascript][typescript]\": {\n \"editor.defaultFormatter\": \"esbenp.prettier-vscode\",\n \"editor.codeActionsOnSave\": {\n \"source.fixAll.eslint\": \"explicit\"\n },\n },\n}",
|
|
5
5
|
"LICENSE": "MIT License\n\nCopyright (c) 2024 Jeongho Nam\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n",
|
|
6
|
-
"README.md": "# Software Development Kit\nThis is a SDK library generated by [`@nestia/migrate`](https://nestia.io/docs/migrate) or [`@nestia/editor`](https://nestia.io/docs/editor).\n\nWith this SDK library, you can easily and safely interact with backend server.\n\nJust import and call some API functions like gif image below:\n\n\n\n> Left is server code, and right is client code utilizing the SDK\n\n\n\n\n## How to Test\n```bash\
|
|
7
|
-
"hello.js": "function print(command, description) {\n return console.log(`\\x1b[1m${command}\\x1b[2m: ${description}\\x1b[0m`);\n}\n\nconsole.log(\"-----------------------------------------\");\nconsole.log(\"\\x1b[7mGenerated by \\x1b[2m@nestia/editor\\x1b[0m\");\nconsole.log(\"\");\nconsole.log(\" - \\x1b[36mhttps://nestia.io/docs/editor\\x1b[0m\");\nconsole.log(\" - \\x1b[36mhttps://github.com/samchon/nestia\\x1b[0m\");\nconsole.log(\"-----------------------------------------\");\n\nprint(\"
|
|
8
|
-
"package.json": "{\n \"name\": \"@ORGANIZATION/PROJECT-api\",\n \"version\": \"0.1.0\",\n \"description\": \"SDK library generated by Nestia\",\n \"main\": \"
|
|
9
|
-
"
|
|
10
|
-
"rollup.config.js": "const typescript = require(\"@rollup/plugin-typescript\");\nconst terser = require(\"@rollup/plugin-terser\");\n\nmodule.exports = {\n input: \"./src/index.ts\",\n output: {\n dir: \"lib\",\n format: \"esm\",\n entryFileNames: \"[name].mjs\",\n sourcemap: true,\n },\n plugins: [\n typescript({\n tsconfig: \"tsconfig.json\",\n module: \"ES2020\",\n target: \"ES2020\",\n }),\n terser({\n format: {\n comments: \"some\",\n beautify: true,\n ecma: \"2020\",\n },\n compress: false,\n mangle: false,\n module: true,\n }),\n ],\n};\n",
|
|
6
|
+
"README.md": "# Software Development Kit\nThis is a SDK library generated by [`@nestia/migrate`](https://nestia.io/docs/migrate) or [`@nestia/editor`](https://nestia.io/docs/editor).\n\nWith this SDK library, you can easily and safely interact with backend server.\n\nJust import and call some API functions like gif image below:\n\n\n\n> Left is server code, and right is client code utilizing the SDK\n\n\n\n\n## How to Test\n```bash\npnpm install\npnpm run start # run only \"test/start.ts\" file\npnpm run test # everything under the \"test/features\" directory\npnpm run test:simulate # \"test/features\" with mockup simulation mode\n```\n\nIf you run `pnpm run start` command, only [test/start.ts](test/start.ts) file would be executed.\n\nOtherwise you run `pnpm run test` command instead, run everything in the [test/features](test/features) directory.\n\nFor reference, the [test/features](test/features) directory and E2E test functions (for each API endpoints) would be automatically composed only when you've configured the \"E2E test function generation mode\" of the `@nestia/migrate` (or `@nestia/editor`).\n\n```bash\npnpm dlx @nestia/migrate\n? Migration mode (Use arrow keys):\n NestJS\n > SDK\n? Swagger file location: assets/input/clickhouse.json\n? Output directory path: assets/output/clickhouse-sdk-manual\n? Mokup Simulator: true\n? E2E Test Functions: true\n```\n\n\n\n\n## Deploy\n```bash\npnpm install\npnpm run deploy\n```\n\nJust run `pnpm run deploy` command, then your SDK library would be published.\n\nBy the way, the initial package name of this template repository is `@ORGANIZATION/PROJECT-api`. I think it would better to change the word to your own organization and project name. If you're utilizing `VsCode`, you can do it through `Edit > Replace in Files` (*Ctrl + Shift + H*) feature.\n\n-----------\n\n> ## What [`Nestia`](https://nestia.io) is:\n> \n> \n> [](https://github.com/samchon/nestia/blob/master/LICENSE)\n> [](https://www.npmjs.com/package/@nestia/core)\n> [](https://www.npmjs.com/package/@nestia/core)\n> [](https://github.com/samchon/nestia/actions?query=workflow%3Abuild)\n> [](https://nestia.io/docs/)\n> \n> Nestia is a set of helper libraries for NestJS, supporting below features:\n> \n> - `@nestia/core`: Super-fast decorators\n> - `@nestia/sdk`:\n> - Swagger generator evolved than ever\n> - SDK library generator for clients\n> - Mockup Simulator for client applications\n> - Automatic E2E test functions generator\n> - `@nestia/migrate`: Migration from Swagger to NestJS\n> - `@nestia/editor`: Online TypeScript Swagger Editor\n> - `nestia`: Just CLI (command line interface) tool\n> \n>> **Note**\n>> \n>> - **Only one line** required, with pure TypeScript type\n>> - Enhance performance **30x** up\n>> - Runtime validator is **20,000x faster** than `class-validator`\n>> - JSON serialization is **200x faster** than `class-transformer`\n>> - Software Development Kit\n>> - SDK is a collection of `fetch` functions with type definitions like [tRPC](https://> trpc.io/)\n>> - Mockup simulator means embedded backend simulator in SDK\n>> - similar with [msw](https://mswjs.io/), but fully automated\n",
|
|
7
|
+
"hello.js": "function print(command, description) {\n return console.log(`\\x1b[1m${command}\\x1b[2m: ${description}\\x1b[0m`);\n}\n\nconsole.log(\"-----------------------------------------\");\nconsole.log(\"\\x1b[7mGenerated by \\x1b[2m@nestia/editor\\x1b[0m\");\nconsole.log(\"\");\nconsole.log(\" - \\x1b[36mhttps://nestia.io/docs/editor\\x1b[0m\");\nconsole.log(\" - \\x1b[36mhttps://github.com/samchon/nestia\\x1b[0m\");\nconsole.log(\"-----------------------------------------\");\n\nprint(\"pnpm run start\", \"Run only test/start.ts\");\nprint(\"pnpm run test\", \"Run every test/features/**/*.ts files\");\nprint(\"pnpm run test:simulate\", \"Test with mockup simulator\");\n",
|
|
8
|
+
"package.json": "{\n \"name\": \"@ORGANIZATION/PROJECT-api\",\n \"version\": \"0.1.0\",\n \"description\": \"SDK library generated by Nestia\",\n \"main\": \"src/index.ts\",\n \"exports\": {\n \".\": \"./src/index.ts\",\n \"./lib/*\": \"./src/*.ts\",\n \"./package.json\": \"./package.json\"\n },\n \"publishConfig\": {\n \"main\": \"lib/index.mjs\",\n \"module\": \"lib/index.mjs\",\n \"types\": \"lib/index.d.ts\",\n \"exports\": {\n \".\": {\n \"types\": \"./lib/index.d.ts\",\n \"import\": \"./lib/index.mjs\",\n \"default\": \"./lib/index.js\"\n },\n \"./lib/*\": {\n \"types\": \"./lib/*.d.ts\",\n \"import\": \"./lib/*.mjs\",\n \"default\": \"./lib/*.js\"\n },\n \"./package.json\": \"./package.json\"\n }\n },\n \"scripts\": {\n \"build\": \"rimraf lib && ttsc && rolldown -c\",\n \"build:test\": \"rimraf bin && ttsc --project test/tsconfig.json\",\n \"deploy\": \"pnpm run build && pnpm publish\",\n \"dev\": \"pnpm run build:test --watch\",\n \"hello\": \"node hello\",\n \"start\": \"ttsx test/start.ts\",\n \"swagger\": \"ttsx test/swagger.ts\",\n \"test\": \"ttsx test/index.ts\",\n \"test:simulate\": \"ttsx test/index.ts --simulate true\"\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/samchon/nestia\"\n },\n \"author\": \"Jeongho Nam\",\n \"license\": \"MIT\",\n \"bugs\": {\n \"url\": \"https://github.com/samchon/nestia/issues\"\n },\n \"homepage\": \"https://nestia.io\",\n \"files\": [\n \"lib\",\n \"swagger.json\",\n \"package.json\",\n \"README.md\"\n ],\n \"dependencies\": {\n \"@nestia/fetcher\": \"^12.0.0\",\n \"tgrid\": \"^1.2.1\",\n \"typia\": \"^13.0.2\"\n },\n \"devDependencies\": {\n \"@nestia/e2e\": \"^12.0.0\",\n \"@ttsc/unplugin\": \"^0.18.2\",\n \"@types/express\": \"^4.17.21\",\n \"@types/swagger-ui-express\": \"^4.1.6\",\n \"chalk\": \"4.1.2\",\n \"express\": \"^4.19.2\",\n \"rimraf\": \"^5.0.5\",\n \"rolldown\": \"^1.1.5\",\n \"swagger-ui-express\": \"^5.0.0\",\n \"tinyglobby\": \"^0.2.17\",\n \"ttsc\": \"^0.18.2\",\n \"typescript\": \"^7.0.2\",\n \"@nestia/core\": \"^12.0.0\"\n },\n \"packageManager\": \"pnpm@10.19.0\"\n}",
|
|
9
|
+
"rolldown.config.mjs": "import ttsc from \"@ttsc/unplugin/rolldown\";\nimport path from \"node:path\";\nimport { globSync } from \"tinyglobby\";\n\nexport default {\n input: globSync(\"./src/**/*.ts\"),\n external: (id) => !id.startsWith(\".\") && !path.isAbsolute(id),\n output: {\n dir: \"./lib\",\n format: \"esm\",\n sourcemap: true,\n entryFileNames: \"[name].mjs\",\n preserveModules: true,\n preserveModulesRoot: \"src\",\n },\n plugins: [ttsc()],\n};\n",
|
|
11
10
|
"src/HttpError.ts": "export { HttpError } from \"@nestia/fetcher\";\n",
|
|
12
11
|
"src/IConnection.ts": "export type { IConnection } from \"@nestia/fetcher\";\n",
|
|
13
12
|
"src/index.ts": "import * as api from \"./module\";\n\nexport * from \"./module\";\nexport default api;\n",
|
|
@@ -17,7 +16,7 @@ export const SDK_TEMPLATE: Record<string, string> = {
|
|
|
17
16
|
"test/index.ts": "import { DynamicExecutor } from \"@nestia/e2e\";\nimport chalk from \"chalk\";\n\nimport { TestGlobal } from \"./TestGlobal\";\nimport { ArgumentParser } from \"./utils/ArgumentParser\";\n\ninterface IOptions {\n simulate: boolean;\n include?: string[];\n exclude?: string[];\n trace: boolean;\n}\n\nconst getOptions = () =>\n ArgumentParser.parse<IOptions>(async (command, prompt, action) => {\n command.option(\"--simulate <boolean>\", \"Mockup Simultator\");\n command.option(\"--include <string...>\", \"include feature files\");\n command.option(\"--exclude <string...>\", \"exclude feature files\");\n command.option(\"--trace <boolean>\", \"trace detailed errors\");\n\n return action(async (options) => {\n if (typeof options.simulate === \"string\")\n options.simulate = options.simulate === \"true\";\n options.simulate ??= await prompt.boolean(\"simulate\")(\"Mockup Simulator\");\n options.trace = options.trace !== (\"false\" as any);\n return options as IOptions;\n });\n });\n\nconst main = async (): Promise<void> => {\n // DO TEST\n const options: IOptions = await getOptions();\n const report: DynamicExecutor.IReport = await DynamicExecutor.validate({\n prefix: \"test\",\n location: __dirname + \"/features\",\n extension: __filename.substring(__filename.length - 2),\n parameters: () => [\n {\n ...TestGlobal.connection(),\n simulate: options.simulate,\n },\n ],\n filter: (func) =>\n (!options.include?.length ||\n (options.include ?? []).some((str) => func.includes(str))) &&\n (!options.exclude?.length ||\n (options.exclude ?? []).every((str) => !func.includes(str))),\n onComplete: (exec) => {\n const trace = (str: string) =>\n console.log(` - ${chalk.green(exec.name)}: ${str}`);\n if (exec.error === null) {\n const elapsed: number =\n new Date(exec.completed_at).getTime() -\n new Date(exec.started_at).getTime();\n trace(`${chalk.yellow(elapsed.toLocaleString())} ms`);\n } else trace(chalk.red(exec.error.name));\n },\n });\n\n // REPORT EXCEPTIONS\n const exceptions: Error[] = report.executions\n .filter((exec) => exec.error !== null)\n .map((exec) => exec.error!);\n if (exceptions.length === 0) {\n console.log(\"Success\");\n console.log(\"Elapsed time\", report.time.toLocaleString(), `ms`);\n } else {\n if (options.trace !== false) for (const exp of exceptions) console.log(exp);\n console.log(\"Failed\");\n console.log(\"Elapsed time\", report.time.toLocaleString(), `ms`);\n }\n\n // TERMINATE\n if (exceptions.length) process.exit(-1);\n else process.exit(0);\n};\nmain().catch((exp) => {\n console.log(exp);\n process.exit(-1);\n});\n",
|
|
18
17
|
"test/start.ts": "import api from \"@ORGANIZATION/PROJECT-api\";\nimport { IBbsArticleComment } from \"@ORGANIZATION/PROJECT-api/lib/structures/bbs/IBbsArticleComment\";\nimport typia, { tags } from \"typia\";\n\nimport { TestGlobal } from \"./TestGlobal\";\n\nconst main = async () => {\n const connection: api.IConnection = {\n ...TestGlobal.connection(),\n simulate: true,\n };\n const output: IBbsArticleComment =\n await api.functional.bbs.articles.comments.create(\n connection,\n typia.random<string & tags.Format<\"uuid\">>(),\n typia.random<IBbsArticleComment.ICreate>(),\n );\n typia.assert(output);\n};\nmain().catch((exp) => {\n console.log(exp);\n process.exit(-1);\n});\n",
|
|
19
18
|
"test/swagger.ts": "import express from \"express\";\nimport ui from \"swagger-ui-express\";\n\nimport swagger from \"../swagger.json\";\n\nconst main = async (): Promise<void> => {\n const app = express();\n app.use(\"/\", ui.serve, ui.setup(swagger));\n app.listen(3000);\n\n console.log(\"-----------------------------------------------------------\");\n console.log(\"\\n Swagger UI Address: http://127.0.0.1:3000 \\n\");\n console.log(\"-----------------------------------------------------------\");\n};\nmain().catch((exp) => {\n console.log(exp);\n process.exit(-1);\n});\n",
|
|
20
|
-
"test/tsconfig.json": "{\n \"extends\": \"../tsconfig.json\",\n \"compilerOptions\": {\n \"noEmit\": true,\n \"
|
|
19
|
+
"test/tsconfig.json": "{\n \"extends\": \"../tsconfig.json\",\n \"compilerOptions\": {\n \"noEmit\": true,\n \"rootDir\": \"../\",\n },\n \"include\": [\n \".\", \n \"../src\",\n ],\n}",
|
|
21
20
|
"test/utils/ArgumentParser.ts": "import { createInterface } from \"node:readline/promises\";\n\nexport namespace ArgumentParser {\n export interface Command {\n option: (flags: string, description?: string) => Command;\n }\n\n export interface Prompt {\n select: (\n name: string,\n ) => (\n message: string,\n ) => <Choice extends string>(choices: Choice[]) => Promise<Choice>;\n boolean: (name: string) => (message: string) => Promise<boolean>;\n number: (name: string) => (message: string) => Promise<number>;\n }\n\n export const parse = async <T>(\n inquiry: (\n command: Command,\n prompt: Prompt,\n action: (closure: (options: Partial<T>) => Promise<T>) => Promise<T>,\n ) => Promise<T>,\n ): Promise<T> => {\n const command: Command = {\n option: (_flags: string, _description?: string): Command => command,\n };\n const action = (closure: (options: Partial<T>) => Promise<T>) =>\n closure(parseArguments() as Partial<T>);\n return inquiry(\n command,\n { select, boolean, number },\n action,\n );\n };\n\n const select =\n (_name: string) =>\n (message: string) =>\n async <Choice extends string>(choices: Choice[]): Promise<Choice> => {\n const answer: string = await ask(`${message} (${choices.join(\"/\")})`);\n return (choices.find((choice) => choice === answer) ?? choices[0])!;\n };\n\n const boolean = (_name: string) => async (message: string) =>\n /^(true|t|yes|y|1)$/i.test(await ask(`${message} [y/N]`));\n\n const number = (_name: string) => async (message: string) =>\n Number(await ask(message));\n\n const ask = async (message: string): Promise<string> => {\n const reader = createInterface({\n input: process.stdin,\n output: process.stdout,\n });\n try {\n return (await reader.question(`${message}: `)).trim();\n } finally {\n reader.close();\n }\n };\n\n const parseArguments = (): Record<string, string | string[] | boolean> => {\n const output: Record<string, string | string[] | boolean> = {};\n const args: string[] = process.argv.slice(2);\n for (let i = 0; i < args.length; ++i) {\n const raw: string = args[i]!;\n if (raw.startsWith(\"--\") === false) continue;\n\n const equal: number = raw.indexOf(\"=\");\n const name: string = toCamelCase(\n raw.slice(2, equal === -1 ? undefined : equal),\n );\n if (equal !== -1) {\n assign(output, name, raw.slice(equal + 1));\n continue;\n }\n\n const values: string[] = [];\n while (i + 1 < args.length && args[i + 1]!.startsWith(\"--\") === false)\n values.push(args[++i]!);\n assign(\n output,\n name,\n values.length === 0 ? true : values.length === 1 ? values[0]! : values,\n );\n }\n return output;\n };\n\n const assign = (\n output: Record<string, string | string[] | boolean>,\n name: string,\n value: string | string[] | boolean,\n ): void => {\n const current: string | string[] | boolean | undefined = output[name];\n if (current === undefined) output[name] = value;\n else\n output[name] = [\n ...(Array.isArray(current) ? current : [String(current)]),\n ...(Array.isArray(value) ? value : [String(value)]),\n ];\n };\n\n const toCamelCase = (str: string): string =>\n str.replace(/-([a-z])/g, (_matched, letter: string) =>\n letter.toUpperCase(),\n );\n}\n",
|
|
22
|
-
"tsconfig.json": "{\n \"compilerOptions\": {\n /* Visit https://aka.ms/tsconfig to read more about this file */\n /* Projects */\n // \"incremental\": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */\n // \"composite\": true, /* Enable constraints that allow a TypeScript project to be used with project references. */\n // \"tsBuildInfoFile\": \"./.tsbuildinfo\", /* Specify the path to .tsbuildinfo incremental compilation file. */\n // \"disableSourceOfProjectReferenceRedirect\": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */\n // \"disableSolutionSearching\": true, /* Opt a project out of multi-project reference checking when editing. */\n // \"disableReferencedProjectLoad\": true, /* Reduce the number of projects loaded automatically by TypeScript. */\n /* Language and Environment */\n \"target\": \"ES2015\", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */\n \"lib\": [\n \"DOM\",\n \"ES2015\"\n ], /* Specify a set of bundled library declaration files that describe the target runtime environment. */// \"jsx\": \"preserve\", /* Specify what JSX code is generated. */\n // \"experimentalDecorators\": true, /* Enable experimental support for TC39 stage 2 draft decorators. */\n // \"emitDecoratorMetadata\": true, /* Emit design-type metadata for decorated declarations in source files. */\n // \"jsxFactory\": \"\", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */\n // \"jsxFragmentFactory\": \"\", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */\n // \"jsxImportSource\": \"\", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */\n // \"reactNamespace\": \"\", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */\n // \"noLib\": true, /* Disable including any library files, including the default lib.d.ts. */\n // \"useDefineForClassFields\": true, /* Emit ECMAScript-standard-compliant class fields. */\n // \"moduleDetection\": \"auto\", /* Control what method is used to detect module-format JS files. */\n /* Modules */\n \"module\": \"nodenext\", /* Specify what module code is generated. */\n \"moduleResolution\": \"nodenext\", /* Specify how TypeScript looks up a file from a given module specifier. */\n \"rootDir\": \"src\", /* Specify the root folder within your source files. */\n // \"baseUrl\": \"./\", /* Specify the base directory to resolve non-relative module names. */\n \"paths\": {\n \"@ORGANIZATION/PROJECT-api\": [\"../src\"],\n \"@ORGANIZATION/PROJECT-api/lib/*\": [\"../src/*\"],\n }, /* Specify a set of entries that re-map imports to additional lookup locations. */\n // \"rootDirs\": [], /* Allow multiple folders to be treated as one when resolving modules. */\n // \"typeRoots\": [], /* Specify multiple folders that act like './node_modules/@types'. */\n \"types\": [\"*\"], /* Specify type package names to be included without being referenced in a source file. */\n // \"allowUmdGlobalAccess\": true, /* Allow accessing UMD globals from modules. */\n // \"moduleSuffixes\": [], /* List of file name suffixes to search when resolving a module. */\n \"resolveJsonModule\": true, /* Enable importing .json files. */\n // \"noResolve\": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */\n /* JavaScript Support */\n // \"allowJs\": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */\n // \"checkJs\": true, /* Enable error reporting in type-checked JavaScript files. */\n // \"maxNodeModuleJsDepth\": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */\n /* Emit */\n \"declaration\": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */// \"declarationMap\": true, /* Create sourcemaps for d.ts files. */\n // \"emitDeclarationOnly\": true, /* Only output d.ts files and not JavaScript files. */\n \"sourceMap\": true, /* Create source map files for emitted JavaScript files. */// \"outFile\": \"./\", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */\n \"outDir\": \"./lib\", /* Specify an output folder for all emitted files. */// \"removeComments\": true, /* Disable emitting comments. */\n // \"noEmit\": true, /* Disable emitting files from a compilation. */\n // \"importHelpers\": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */\n // \"importsNotUsedAsValues\": \"remove\", /* Specify emit/checking behavior for imports that are only used for types. */\n // \"downlevelIteration\": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */// \"sourceRoot\": \"\", /* Specify the root path for debuggers to find the reference source code. */\n // \"mapRoot\": \"\", /* Specify the location where debugger should locate map files instead of generated locations. */\n // \"inlineSourceMap\": true, /* Include sourcemap files inside the emitted JavaScript. */\n // \"inlineSources\": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */\n // \"emitBOM\": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */\n \"newLine\": \"lf\", /* Set the newline character for emitting files. */// \"stripInternal\": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */\n // \"noEmitHelpers\": true, /* Disable generating custom helper functions like '__extends' in compiled output. */\n // \"noEmitOnError\": true, /* Disable emitting files if any type checking errors are reported. */\n // \"preserveConstEnums\": true, /* Disable erasing 'const enum' declarations in generated code. */\n // \"declarationDir\": \"./\", /* Specify the output directory for generated declaration files. */\n // \"preserveValueImports\": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */\n /* Interop Constraints */\n // \"isolatedModules\": true, /* Ensure that each file can be safely transpiled without relying on other imports. */\n // \"allowSyntheticDefaultImports\": true, /* Allow 'import x from y' when a module doesn't have a default export. */\n \"esModuleInterop\": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */// \"preserveSymlinks\": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */\n \"forceConsistentCasingInFileNames\": true, /* Ensure that casing is correct in imports. *//* Type Checking */\n \"strict\": true, /* Enable all strict type-checking options. */// \"noImplicitAny\": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */\n // \"strictNullChecks\": true, /* When type checking, take into account 'null' and 'undefined'. */\n // \"strictFunctionTypes\": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */\n // \"strictBindCallApply\": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */\n // \"strictPropertyInitialization\": true, /* Check for class properties that are declared but not set in the constructor. */\n // \"noImplicitThis\": true, /* Enable error reporting when 'this' is given the type 'any'. */\n // \"useUnknownInCatchVariables\": true, /* Default catch clause variables as 'unknown' instead of 'any'. */\n // \"alwaysStrict\": true, /* Ensure 'use strict' is always emitted. */\n // \"noUnusedLocals\": true, /* Enable error reporting when local variables aren't read. */\n // \"noUnusedParameters\": true, /* Raise an error when a function parameter isn't read. */\n // \"exactOptionalPropertyTypes\": true, /* Interpret optional property types as written, rather than adding 'undefined'. */\n // \"noImplicitReturns\": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */\n // \"noFallthroughCasesInSwitch\": true, /* Enable error reporting for fallthrough cases in switch statements. */\n // \"noUncheckedIndexedAccess\": true, /* Add 'undefined' to a type when accessed using an index. */\n // \"noImplicitOverride\": true, /* Ensure overriding members in derived classes are marked with an override modifier. */\n // \"noPropertyAccessFromIndexSignature\": true, /* Enforces using indexed accessors for keys declared using an indexed type. */\n // \"allowUnusedLabels\": true, /* Disable error reporting for unused labels. */\n // \"allowUnreachableCode\": true, /* Disable error reporting for unreachable code. */\n /* Completeness */\n // \"skipDefaultLibCheck\": true, /* Skip type checking .d.ts files that are included with TypeScript. */\n \"skipLibCheck\": true, /* Skip type checking all .d.ts files. */\n \"plugins\": [\n ],\n },\n \"include\": [\"src\"],\n}"
|
|
21
|
+
"tsconfig.json": "{\n \"compilerOptions\": {\n /* Visit https://aka.ms/tsconfig to read more about this file */\n /* Projects */\n // \"incremental\": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */\n // \"composite\": true, /* Enable constraints that allow a TypeScript project to be used with project references. */\n // \"tsBuildInfoFile\": \"./.tsbuildinfo\", /* Specify the path to .tsbuildinfo incremental compilation file. */\n // \"disableSourceOfProjectReferenceRedirect\": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */\n // \"disableSolutionSearching\": true, /* Opt a project out of multi-project reference checking when editing. */\n // \"disableReferencedProjectLoad\": true, /* Reduce the number of projects loaded automatically by TypeScript. */\n /* Language and Environment */\n \"target\": \"ESNext\", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */\n \"lib\": [\n \"DOM\",\n \"ESNext\"\n ], /* Specify a set of bundled library declaration files that describe the target runtime environment. */// \"jsx\": \"preserve\", /* Specify what JSX code is generated. */\n // \"experimentalDecorators\": true, /* Enable experimental support for TC39 stage 2 draft decorators. */\n // \"emitDecoratorMetadata\": true, /* Emit design-type metadata for decorated declarations in source files. */\n // \"jsxFactory\": \"\", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */\n // \"jsxFragmentFactory\": \"\", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */\n // \"jsxImportSource\": \"\", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */\n // \"reactNamespace\": \"\", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */\n // \"noLib\": true, /* Disable including any library files, including the default lib.d.ts. */\n // \"useDefineForClassFields\": true, /* Emit ECMAScript-standard-compliant class fields. */\n // \"moduleDetection\": \"auto\", /* Control what method is used to detect module-format JS files. */\n /* Modules */\n \"module\": \"nodenext\", /* Specify what module code is generated. */\n \"moduleResolution\": \"nodenext\", /* Specify how TypeScript looks up a file from a given module specifier. */\n \"rootDir\": \"src\", /* Specify the root folder within your source files. */\n // \"baseUrl\": \"./\", /* Specify the base directory to resolve non-relative module names. */\n // \"paths\": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */\n // \"rootDirs\": [], /* Allow multiple folders to be treated as one when resolving modules. */\n // \"typeRoots\": [], /* Specify multiple folders that act like './node_modules/@types'. */\n \"types\": [\"*\"], /* Specify type package names to be included without being referenced in a source file. */\n // \"allowUmdGlobalAccess\": true, /* Allow accessing UMD globals from modules. */\n // \"moduleSuffixes\": [], /* List of file name suffixes to search when resolving a module. */\n \"resolveJsonModule\": true, /* Enable importing .json files. */\n // \"noResolve\": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */\n /* JavaScript Support */\n // \"allowJs\": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */\n // \"checkJs\": true, /* Enable error reporting in type-checked JavaScript files. */\n // \"maxNodeModuleJsDepth\": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */\n /* Emit */\n \"declaration\": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */// \"declarationMap\": true, /* Create sourcemaps for d.ts files. */\n // \"emitDeclarationOnly\": true, /* Only output d.ts files and not JavaScript files. */\n \"sourceMap\": true, /* Create source map files for emitted JavaScript files. */// \"outFile\": \"./\", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */\n \"outDir\": \"./lib\", /* Specify an output folder for all emitted files. */// \"removeComments\": true, /* Disable emitting comments. */\n // \"noEmit\": true, /* Disable emitting files from a compilation. */\n // \"importHelpers\": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */\n // \"importsNotUsedAsValues\": \"remove\", /* Specify emit/checking behavior for imports that are only used for types. */\n // \"downlevelIteration\": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */// \"sourceRoot\": \"\", /* Specify the root path for debuggers to find the reference source code. */\n // \"mapRoot\": \"\", /* Specify the location where debugger should locate map files instead of generated locations. */\n // \"inlineSourceMap\": true, /* Include sourcemap files inside the emitted JavaScript. */\n // \"inlineSources\": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */\n // \"emitBOM\": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */\n \"newLine\": \"lf\", /* Set the newline character for emitting files. */// \"stripInternal\": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */\n // \"noEmitHelpers\": true, /* Disable generating custom helper functions like '__extends' in compiled output. */\n // \"noEmitOnError\": true, /* Disable emitting files if any type checking errors are reported. */\n // \"preserveConstEnums\": true, /* Disable erasing 'const enum' declarations in generated code. */\n // \"declarationDir\": \"./\", /* Specify the output directory for generated declaration files. */\n // \"preserveValueImports\": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */\n /* Interop Constraints */\n // \"isolatedModules\": true, /* Ensure that each file can be safely transpiled without relying on other imports. */\n // \"allowSyntheticDefaultImports\": true, /* Allow 'import x from y' when a module doesn't have a default export. */\n \"esModuleInterop\": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */// \"preserveSymlinks\": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */\n \"forceConsistentCasingInFileNames\": true, /* Ensure that casing is correct in imports. *//* Type Checking */\n \"strict\": true, /* Enable all strict type-checking options. */// \"noImplicitAny\": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */\n // \"strictNullChecks\": true, /* When type checking, take into account 'null' and 'undefined'. */\n // \"strictFunctionTypes\": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */\n // \"strictBindCallApply\": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */\n // \"strictPropertyInitialization\": true, /* Check for class properties that are declared but not set in the constructor. */\n // \"noImplicitThis\": true, /* Enable error reporting when 'this' is given the type 'any'. */\n // \"useUnknownInCatchVariables\": true, /* Default catch clause variables as 'unknown' instead of 'any'. */\n // \"alwaysStrict\": true, /* Ensure 'use strict' is always emitted. */\n // \"noUnusedLocals\": true, /* Enable error reporting when local variables aren't read. */\n // \"noUnusedParameters\": true, /* Raise an error when a function parameter isn't read. */\n // \"exactOptionalPropertyTypes\": true, /* Interpret optional property types as written, rather than adding 'undefined'. */\n // \"noImplicitReturns\": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */\n // \"noFallthroughCasesInSwitch\": true, /* Enable error reporting for fallthrough cases in switch statements. */\n // \"noUncheckedIndexedAccess\": true, /* Add 'undefined' to a type when accessed using an index. */\n // \"noImplicitOverride\": true, /* Ensure overriding members in derived classes are marked with an override modifier. */\n // \"noPropertyAccessFromIndexSignature\": true, /* Enforces using indexed accessors for keys declared using an indexed type. */\n // \"allowUnusedLabels\": true, /* Disable error reporting for unused labels. */\n // \"allowUnreachableCode\": true, /* Disable error reporting for unreachable code. */\n /* Completeness */\n // \"skipDefaultLibCheck\": true, /* Skip type checking .d.ts files that are included with TypeScript. */\n \"skipLibCheck\": true, /* Skip type checking all .d.ts files. */\n },\n \"include\": [\"src\"],\n}"
|
|
23
22
|
}
|
package/src/executable/bundle.js
CHANGED
|
@@ -4,9 +4,11 @@ const fs = require("fs");
|
|
|
4
4
|
|
|
5
5
|
const ROOT = `${__dirname}/../..`;
|
|
6
6
|
const ASSETS = `${ROOT}/assets`;
|
|
7
|
-
const
|
|
7
|
+
const CATALOGS = require("js-yaml").load(
|
|
8
8
|
fs.readFileSync(`${__dirname}/../../../../pnpm-lock.yaml`, "utf8"),
|
|
9
|
-
).catalogs
|
|
9
|
+
).catalogs;
|
|
10
|
+
const TYPIA = CATALOGS.samchon;
|
|
11
|
+
const TYPESCRIPT = CATALOGS.typescript ?? {};
|
|
10
12
|
|
|
11
13
|
const update = (content, options = {}) => {
|
|
12
14
|
const parsed = JSON.parse(content);
|
|
@@ -14,10 +16,19 @@ const update = (content, options = {}) => {
|
|
|
14
16
|
parsed.dependencies ?? {},
|
|
15
17
|
parsed.devDependencies ?? {},
|
|
16
18
|
])
|
|
17
|
-
for (const key of Object.keys(record))
|
|
19
|
+
for (const key of Object.keys(record)) {
|
|
20
|
+
const current = record[key];
|
|
21
|
+
// `catalog:` / `workspace:` specifiers already carry their versions
|
|
22
|
+
// through pnpm-workspace.yaml, which gets its own stamping pass.
|
|
23
|
+
if (
|
|
24
|
+
typeof current === "string" &&
|
|
25
|
+
(current.startsWith("catalog:") || current.startsWith("workspace:"))
|
|
26
|
+
)
|
|
27
|
+
continue;
|
|
18
28
|
if (key.startsWith("@nestia/") || key === "nestia")
|
|
19
29
|
record[key] = `^${version}`;
|
|
20
30
|
else if (TYPIA[key]) record[key] = TYPIA[key].specifier;
|
|
31
|
+
}
|
|
21
32
|
migratePackageJson(parsed);
|
|
22
33
|
if (options.sdkAggregate) {
|
|
23
34
|
parsed.devDependencies ??= {};
|
|
@@ -34,12 +45,39 @@ const migratePackageJson = (parsed) => {
|
|
|
34
45
|
|
|
35
46
|
const devDependencies = parsed.devDependencies;
|
|
36
47
|
if (devDependencies) {
|
|
37
|
-
const usesTypeScript =
|
|
48
|
+
const usesTypeScript =
|
|
49
|
+
typeof devDependencies.typescript === "string" &&
|
|
50
|
+
devDependencies.typescript.startsWith("catalog:") === false;
|
|
38
51
|
delete devDependencies["typescript-transform-paths"];
|
|
39
|
-
|
|
52
|
+
// Single-package templates compiling with a direct typescript dependency
|
|
53
|
+
// need the ttsc compiler this repository currently builds against.
|
|
54
|
+
if (usesTypeScript && TYPESCRIPT.ttsc)
|
|
55
|
+
devDependencies.ttsc ??= TYPESCRIPT.ttsc.specifier;
|
|
40
56
|
}
|
|
41
57
|
};
|
|
42
58
|
|
|
59
|
+
// Stamp the template's pnpm-workspace.yaml catalogs with this repository's
|
|
60
|
+
// current versions. Keep the rewrite line-targeted so quoted package names,
|
|
61
|
+
// comments, ordering, and any anchors supplied by the upstream template remain
|
|
62
|
+
// intact.
|
|
63
|
+
const updateWorkspaceCatalog = (content) => {
|
|
64
|
+
const replace = (line) => {
|
|
65
|
+
const match = line.match(
|
|
66
|
+
/^(\s+(?:"([^"]+)"|'([^']+)'|([^:\s]+)): (?:&[A-Za-z0-9_-]+ )?)\S[^\r\n]*(\r?)$/,
|
|
67
|
+
);
|
|
68
|
+
if (match === null) return line;
|
|
69
|
+
|
|
70
|
+
const name = match[2] ?? match[3] ?? match[4];
|
|
71
|
+
const specifier =
|
|
72
|
+
name === "nestia" || name.startsWith("@nestia/")
|
|
73
|
+
? `^${version}`
|
|
74
|
+
: (TYPIA[name]?.specifier ?? TYPESCRIPT[name]?.specifier);
|
|
75
|
+
if (typeof specifier !== "string") return line;
|
|
76
|
+
return `${match[1]}${specifier}${match[5]}`;
|
|
77
|
+
};
|
|
78
|
+
return content.split("\n").map(replace).join("\n");
|
|
79
|
+
};
|
|
80
|
+
|
|
43
81
|
const trimTemplateDependencies = (parsed) => {
|
|
44
82
|
if (parsed.dependencies) {
|
|
45
83
|
delete parsed.dependencies.commander;
|
|
@@ -168,29 +206,35 @@ export namespace ArgumentParser {
|
|
|
168
206
|
|
|
169
207
|
const updateTsConfig = (content) => {
|
|
170
208
|
content = content.replace(
|
|
171
|
-
/^\s*\{\s*"transform":\s*"typescript-transform-paths"\s*\},\n/gm,
|
|
209
|
+
/^\s*\{\s*"transform":\s*"typescript-transform-paths"\s*\},\r?\n/gm,
|
|
172
210
|
"",
|
|
173
211
|
);
|
|
174
212
|
content = content.replace(
|
|
175
|
-
/^\s*\{\s*"transform":\s*"typia\/lib\/transform"(?:,\s*"enabled":\s*false)?\s*\},?\n/gm,
|
|
213
|
+
/^\s*\{\s*"transform":\s*"typia\/lib\/transform"(?:,\s*"enabled":\s*false)?\s*\},?\r?\n/gm,
|
|
176
214
|
"",
|
|
177
215
|
);
|
|
178
216
|
content = content.replace(
|
|
179
|
-
/^\s*\{\s*"transform":\s*"@nestia\/core\/lib\/transform"\s*\},?\n/gm,
|
|
217
|
+
/^\s*\{\s*"transform":\s*"@nestia\/core\/lib\/transform"\s*\},?\r?\n/gm,
|
|
180
218
|
"",
|
|
181
219
|
);
|
|
182
220
|
content = content.replace(
|
|
183
|
-
/^\s*\{\s*"transform":\s*"@nestia\/core\/native\/transform\.cjs"\s*\},?\n/gm,
|
|
221
|
+
/^\s*\{\s*"transform":\s*"@nestia\/core\/native\/transform\.cjs"\s*\},?\r?\n/gm,
|
|
184
222
|
"",
|
|
185
223
|
);
|
|
186
224
|
content = content.replace(
|
|
187
|
-
/^\s*\{\s*"transform":\s*"@nestia\/sdk\/lib\/transform"\s*\},\n/gm,
|
|
225
|
+
/^\s*\{\s*"transform":\s*"@nestia\/sdk\/lib\/transform"\s*\},\r?\n/gm,
|
|
188
226
|
"",
|
|
189
227
|
);
|
|
190
228
|
return content;
|
|
191
229
|
};
|
|
192
230
|
|
|
193
|
-
const bundle = async ({
|
|
231
|
+
const bundle = async ({
|
|
232
|
+
mode,
|
|
233
|
+
repository,
|
|
234
|
+
revision,
|
|
235
|
+
exceptions,
|
|
236
|
+
transform,
|
|
237
|
+
}) => {
|
|
194
238
|
const root = `${__dirname}/../..`;
|
|
195
239
|
const assets = `${root}/assets`;
|
|
196
240
|
const template = `${assets}/${mode}`;
|
|
@@ -204,8 +248,22 @@ const bundle = async ({ mode, repository, exceptions, transform }) => {
|
|
|
204
248
|
await fs.promises.mkdir(ASSETS);
|
|
205
249
|
} catch {}
|
|
206
250
|
|
|
207
|
-
|
|
208
|
-
|
|
251
|
+
// Disable line-ending conversion so the bundled template is byte-identical
|
|
252
|
+
// on every platform: with core.autocrlf=true (the common Windows default)
|
|
253
|
+
// the checkout would rewrite LF to CRLF and break the line-targeted
|
|
254
|
+
// transforms below.
|
|
255
|
+
cp.execSync(
|
|
256
|
+
`git clone --config core.autocrlf=false https://github.com/samchon/${repository} ${mode}`,
|
|
257
|
+
{
|
|
258
|
+
cwd: ASSETS,
|
|
259
|
+
},
|
|
260
|
+
);
|
|
261
|
+
// The template repositories are live projects; an unpinned clone lets any
|
|
262
|
+
// upstream push break this build (samchon/nestia-start#632 did exactly
|
|
263
|
+
// that), so every bundle checks out a reviewed revision.
|
|
264
|
+
cp.execSync(`git checkout ${revision}`, {
|
|
265
|
+
cwd: template,
|
|
266
|
+
stdio: "pipe",
|
|
209
267
|
});
|
|
210
268
|
|
|
211
269
|
// REMOVE VULNERABLE FILES
|
|
@@ -268,15 +326,23 @@ const main = async () => {
|
|
|
268
326
|
await bundle({
|
|
269
327
|
mode: "nest",
|
|
270
328
|
repository: "nestia-start",
|
|
329
|
+
// Pin the reviewed pnpm monorepo template after its catalog, rolldown, and
|
|
330
|
+
// package self-reference migrations.
|
|
331
|
+
revision: "8188661cb1c1b0fb30e6184b06422764d64a5f68",
|
|
271
332
|
exceptions: [
|
|
272
333
|
".git",
|
|
273
334
|
".github/dependabot.yml",
|
|
274
335
|
".github/workflows/dependabot-automerge.yml",
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
"
|
|
279
|
-
"
|
|
336
|
+
// The template's lockfile resolves the catalog versions that the
|
|
337
|
+
// stamping below rewrites; shipping it would only bloat NEST_TEMPLATE
|
|
338
|
+
// with 160 KB of immediately-stale data.
|
|
339
|
+
"pnpm-lock.yaml",
|
|
340
|
+
"packages/api/src/functional",
|
|
341
|
+
"packages/api/src/structures",
|
|
342
|
+
"packages/backend/src/MyModule.ts",
|
|
343
|
+
"packages/backend/src/controllers",
|
|
344
|
+
"packages/backend/src/providers",
|
|
345
|
+
"packages/backend/test/features",
|
|
280
346
|
],
|
|
281
347
|
transform: (key, value) => {
|
|
282
348
|
if (key.endsWith("package.json")) {
|
|
@@ -284,20 +350,27 @@ const main = async () => {
|
|
|
284
350
|
trimTemplateDependencies(parsed);
|
|
285
351
|
return JSON.stringify(parsed, null, 2);
|
|
286
352
|
}
|
|
287
|
-
if (key === "
|
|
288
|
-
if (key
|
|
289
|
-
return
|
|
353
|
+
if (key === "pnpm-workspace.yaml") return updateWorkspaceCatalog(value);
|
|
354
|
+
if (key === "packages/backend/test/helpers/ArgumentParser.ts")
|
|
355
|
+
return ARGUMENT_PARSER;
|
|
356
|
+
if (key.endsWith("tsconfig.json")) return updateTsConfig(value);
|
|
290
357
|
return value;
|
|
291
358
|
},
|
|
292
359
|
});
|
|
293
360
|
await bundle({
|
|
294
361
|
mode: "sdk",
|
|
295
362
|
repository: "nestia-sdk-template",
|
|
363
|
+
// Pin the reviewed pnpm-native SDK template.
|
|
364
|
+
revision: "37a019e2b8dea3d02237137aaec2f242f53dcd2d",
|
|
296
365
|
exceptions: [
|
|
297
366
|
".git",
|
|
298
367
|
".github/dependabot.yml",
|
|
299
368
|
".github/workflows/build.yml",
|
|
300
369
|
".github/workflows/dependabot-automerge.yml",
|
|
370
|
+
// update() stamps the current Nestia version into package.json. The
|
|
371
|
+
// template repository's lockfile resolves its own version, so let the
|
|
372
|
+
// first pnpm install create a lockfile that matches the migrated output.
|
|
373
|
+
"pnpm-lock.yaml",
|
|
301
374
|
"src/functional",
|
|
302
375
|
"src/structures",
|
|
303
376
|
"test/features",
|
|
@@ -311,8 +384,7 @@ const main = async () => {
|
|
|
311
384
|
return JSON.stringify(parsed, null, 2);
|
|
312
385
|
}
|
|
313
386
|
if (key === "test/utils/ArgumentParser.ts") return ARGUMENT_PARSER;
|
|
314
|
-
if (key.endsWith("tsconfig.json"))
|
|
315
|
-
return updateTsConfig(value);
|
|
387
|
+
if (key.endsWith("tsconfig.json")) return updateTsConfig(value);
|
|
316
388
|
return value;
|
|
317
389
|
},
|
|
318
390
|
});
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import { SyntaxKind, factory } from "@ttsc/factory";
|
|
2
|
-
import
|
|
2
|
+
import { NamingConvention } from "@typia/utils";
|
|
3
3
|
|
|
4
4
|
import ts from "../internal/ts";
|
|
5
5
|
|
|
6
|
-
const { NamingConvention } =
|
|
7
|
-
(typiaUtils as { default?: typeof typiaUtils }).default ?? typiaUtils;
|
|
8
|
-
|
|
9
6
|
export namespace TypeLiteralFactory {
|
|
10
7
|
export const generate = (value: any): ts.TypeNode =>
|
|
11
8
|
typeof value === "boolean"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SyntaxKind, factory } from "@ttsc/factory";
|
|
2
2
|
import { IHttpMigrateRoute, OpenApi } from "@typia/interface";
|
|
3
|
-
import
|
|
3
|
+
import { NamingConvention } from "@typia/utils";
|
|
4
4
|
|
|
5
5
|
import { IdentifierFactory } from "../factories/IdentifierFactory";
|
|
6
6
|
import { StatementFactory } from "../factories/StatementFactory";
|
|
@@ -10,9 +10,6 @@ import { FilePrinter } from "../utils/FilePrinter";
|
|
|
10
10
|
import { NestiaMigrateImportProgrammer } from "./NestiaMigrateImportProgrammer";
|
|
11
11
|
import { NestiaMigrateSchemaProgrammer } from "./NestiaMigrateSchemaProgrammer";
|
|
12
12
|
|
|
13
|
-
const { NamingConvention } =
|
|
14
|
-
(typiaUtils as { default?: typeof typiaUtils }).default ?? typiaUtils;
|
|
15
|
-
|
|
16
13
|
export namespace NestiaMigrateApiFunctionProgrammer {
|
|
17
14
|
export interface IContext {
|
|
18
15
|
config: INestiaMigrateConfig;
|
|
@@ -48,7 +48,7 @@ export namespace NestiaMigrateApiProgrammer {
|
|
|
48
48
|
// DO GENERATE
|
|
49
49
|
const files: Record<string, string> = Object.fromEntries(
|
|
50
50
|
dict.toJSON().map(({ second: value }) => [
|
|
51
|
-
|
|
51
|
+
`${ctx.mode === "nest" ? "packages/api/src" : "src"}/functional/${[...value.namespace, "index.ts"].join("/")}`,
|
|
52
52
|
FilePrinter.write({
|
|
53
53
|
statements: NestiaMigrateApiFileProgrammer.write({
|
|
54
54
|
...value,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IHttpMigrateRoute, OpenApi } from "@typia/interface";
|
|
2
|
-
import ts from "../internal/ts";
|
|
3
2
|
|
|
3
|
+
import ts from "../internal/ts";
|
|
4
4
|
import { INestiaMigrateConfig } from "../structures/INestiaMigrateConfig";
|
|
5
5
|
import { INestiaMigrateContext } from "../structures/INestiaMigrateContext";
|
|
6
6
|
import { INestiaMigrateFile } from "../structures/INestiaMigrateFile";
|
|
@@ -13,12 +13,18 @@ export namespace NestiaMigrateE2eProgrammer {
|
|
|
13
13
|
Object.fromEntries(
|
|
14
14
|
ctx.application.routes
|
|
15
15
|
.map((r) =>
|
|
16
|
-
writeFile(
|
|
16
|
+
writeFile(
|
|
17
|
+
ctx.mode,
|
|
18
|
+
ctx.config,
|
|
19
|
+
ctx.application.document().components,
|
|
20
|
+
r,
|
|
21
|
+
),
|
|
17
22
|
)
|
|
18
23
|
.map((r) => [`${r.location}/${r.file}`, r.content]),
|
|
19
24
|
);
|
|
20
25
|
|
|
21
26
|
const writeFile = (
|
|
27
|
+
mode: INestiaMigrateContext["mode"],
|
|
22
28
|
config: INestiaMigrateConfig,
|
|
23
29
|
components: OpenApi.IComponents,
|
|
24
30
|
route: IHttpMigrateRoute,
|
|
@@ -33,14 +39,22 @@ export namespace NestiaMigrateE2eProgrammer {
|
|
|
33
39
|
route,
|
|
34
40
|
});
|
|
35
41
|
const statements: ts.Statement[] = [
|
|
36
|
-
|
|
37
|
-
|
|
42
|
+
// The monorepo template consumes the api workspace package through its
|
|
43
|
+
// package name, while the single-package sdk template keeps resolving
|
|
44
|
+
// the built `lib` paths through tsconfig path mappings.
|
|
45
|
+
...importer.toStatements((name) =>
|
|
46
|
+
mode === "nest"
|
|
47
|
+
? "@ORGANIZATION/PROJECT-api"
|
|
48
|
+
: `@ORGANIZATION/PROJECT-api/lib/structures/${name}`,
|
|
38
49
|
),
|
|
39
50
|
FilePrinter.newLine(),
|
|
40
51
|
func,
|
|
41
52
|
];
|
|
42
53
|
return {
|
|
43
|
-
location:
|
|
54
|
+
location:
|
|
55
|
+
mode === "nest"
|
|
56
|
+
? `packages/backend/test/features/api`
|
|
57
|
+
: `test/features/api`,
|
|
44
58
|
file: `${["test", "api", ...route.accessor].join("_")}.ts`,
|
|
45
59
|
content: FilePrinter.write({ statements }),
|
|
46
60
|
};
|
|
@@ -55,6 +55,13 @@ export class NestiaMigrateImportProgrammer {
|
|
|
55
55
|
dtoPath: (name: string) => string,
|
|
56
56
|
current?: string,
|
|
57
57
|
): ts.Statement[] {
|
|
58
|
+
// Group the DTO references by their resolved module specifier: relative
|
|
59
|
+
// specifiers stay one-import-per-file, while package specifiers (e.g. the
|
|
60
|
+
// monorepo's `@ORGANIZATION/PROJECT-api`) merge into a single clause.
|
|
61
|
+
const modules: Map<string, string[]> = new Map();
|
|
62
|
+
for (const name of this.dtos_)
|
|
63
|
+
if (current === undefined || name !== current.split(".")[0])
|
|
64
|
+
MapUtil.take(modules)(dtoPath(name))(() => []).push(name);
|
|
58
65
|
return [
|
|
59
66
|
...[...this.external_.entries()].map(([library, props]) =>
|
|
60
67
|
factory.createImportDeclaration(
|
|
@@ -82,27 +89,28 @@ export class NestiaMigrateImportProgrammer {
|
|
|
82
89
|
...(this.external_.size && this.dtos_.size
|
|
83
90
|
? [FilePrinter.newLine()]
|
|
84
91
|
: []),
|
|
85
|
-
...[...
|
|
86
|
-
.
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
92
|
+
...[...modules.entries()].map(([specifier, names]) =>
|
|
93
|
+
factory.createImportDeclaration(
|
|
94
|
+
undefined,
|
|
95
|
+
// DTO files declare pure types, and generated code references them
|
|
96
|
+
// only in type positions — keep the clause type-only so emitted
|
|
97
|
+
// JS never loads the DTO module at runtime.
|
|
98
|
+
factory.createImportClause(
|
|
99
|
+
true,
|
|
91
100
|
undefined,
|
|
92
|
-
factory.
|
|
93
|
-
|
|
94
|
-
undefined,
|
|
95
|
-
factory.createNamedImports([
|
|
101
|
+
factory.createNamedImports(
|
|
102
|
+
names.map((name) =>
|
|
96
103
|
factory.createImportSpecifier(
|
|
97
104
|
false,
|
|
98
105
|
undefined,
|
|
99
|
-
factory.createIdentifier(
|
|
106
|
+
factory.createIdentifier(name),
|
|
100
107
|
),
|
|
101
|
-
|
|
108
|
+
),
|
|
102
109
|
),
|
|
103
|
-
factory.createStringLiteral(dtoPath(i)),
|
|
104
110
|
),
|
|
111
|
+
factory.createStringLiteral(specifier),
|
|
105
112
|
),
|
|
113
|
+
),
|
|
106
114
|
];
|
|
107
115
|
}
|
|
108
116
|
}
|
|
@@ -5,7 +5,6 @@ import ts from "../internal/ts";
|
|
|
5
5
|
import { INestiaMigrateConfig } from "../structures/INestiaMigrateConfig";
|
|
6
6
|
import { INestiaMigrateController } from "../structures/INestiaMigrateController";
|
|
7
7
|
import { FilePrinter } from "../utils/FilePrinter";
|
|
8
|
-
import { StringUtil } from "../utils/StringUtil";
|
|
9
8
|
import { NestiaMigrateImportProgrammer } from "./NestiaMigrateImportProgrammer";
|
|
10
9
|
import { NestiaMigrateNestMethodProgrammer } from "./NestiaMigrateNestMethodProgrammer";
|
|
11
10
|
|
|
@@ -56,13 +55,10 @@ export namespace NestiaMigrateNestControllerProgrammer {
|
|
|
56
55
|
.flat(),
|
|
57
56
|
);
|
|
58
57
|
return [
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
.length - 1,
|
|
64
|
-
)}api/structures/${ref}`,
|
|
65
|
-
),
|
|
58
|
+
// Controllers live in the backend workspace package while the DTO
|
|
59
|
+
// structures belong to the api package, so the types must be imported
|
|
60
|
+
// through the package name instead of a relative path.
|
|
61
|
+
...importer.toStatements(() => "@ORGANIZATION/PROJECT-api"),
|
|
66
62
|
...(importer.empty() ? [] : [FilePrinter.newLine()]),
|
|
67
63
|
$class,
|
|
68
64
|
];
|
|
@@ -17,11 +17,14 @@ export namespace NestiaMigrateNestProgrammer {
|
|
|
17
17
|
const controllers: INestiaMigrateController[] =
|
|
18
18
|
NestiaMigrateControllerAnalyzer.analyze(context.application.routes);
|
|
19
19
|
const statements: [string, ts.Statement[]][] = [
|
|
20
|
-
[
|
|
20
|
+
[
|
|
21
|
+
"packages/backend/src/MyModule.ts",
|
|
22
|
+
NestiaMigrateNestModuleProgrammer.write(controllers),
|
|
23
|
+
],
|
|
21
24
|
...controllers.map(
|
|
22
25
|
(c) =>
|
|
23
26
|
[
|
|
24
|
-
|
|
27
|
+
`packages/backend/${c.location}/${c.name}.ts`,
|
|
25
28
|
NestiaMigrateNestControllerProgrammer.write({
|
|
26
29
|
config: context.config,
|
|
27
30
|
components: context.application.document().components,
|
|
@@ -36,18 +39,36 @@ export namespace NestiaMigrateNestProgrammer {
|
|
|
36
39
|
}).entries(),
|
|
37
40
|
].map(
|
|
38
41
|
([key, value]) =>
|
|
39
|
-
[
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
],
|
|
42
|
+
[
|
|
43
|
+
`packages/api/src/structures/${key}.ts`,
|
|
44
|
+
writeDtoFile(key, value),
|
|
45
|
+
] satisfies [string, ts.Statement[]],
|
|
43
46
|
),
|
|
44
47
|
];
|
|
45
|
-
|
|
48
|
+
const files: Record<string, string> = Object.fromEntries(
|
|
46
49
|
statements.map(([key, value]) => [
|
|
47
50
|
key,
|
|
48
51
|
FilePrinter.write({ statements: value }),
|
|
49
52
|
]),
|
|
50
53
|
);
|
|
54
|
+
// The template's `packages/api/src/module.ts` re-exports the DTO types
|
|
55
|
+
// through `export * from "./structures"`, so the generated structure files
|
|
56
|
+
// need a barrel replacing the one deleted from the bundled template.
|
|
57
|
+
files["packages/api/src/structures/index.ts"] = writeDtoBarrel(files);
|
|
58
|
+
return files;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
const writeDtoBarrel = (files: Record<string, string>): string => {
|
|
62
|
+
const prefix: string = "packages/api/src/structures/";
|
|
63
|
+
const names: string[] = Object.entries(files)
|
|
64
|
+
.filter(
|
|
65
|
+
([key, content]) =>
|
|
66
|
+
key.startsWith(prefix) && key.endsWith(".ts") && content.length !== 0,
|
|
67
|
+
)
|
|
68
|
+
.map(([key]) => key.slice(prefix.length, -".ts".length))
|
|
69
|
+
.sort();
|
|
70
|
+
if (names.length === 0) return "export {};\n";
|
|
71
|
+
return names.map((name) => `export * from "./${name}";\n`).join("");
|
|
51
72
|
};
|
|
52
73
|
|
|
53
74
|
const writeDtoFile = (
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SyntaxKind, factory } from "@ttsc/factory";
|
|
2
|
-
import
|
|
2
|
+
import { NamingConvention, OpenApiTypeChecker } from "@typia/utils";
|
|
3
3
|
import type { OpenApi } from "typia";
|
|
4
4
|
|
|
5
5
|
import { FormatCheatSheet } from "../factories/FormatCheatSheet";
|
|
@@ -9,9 +9,6 @@ import { FilePrinter } from "../utils/FilePrinter";
|
|
|
9
9
|
import { StringUtil } from "../utils/StringUtil";
|
|
10
10
|
import { NestiaMigrateImportProgrammer } from "./NestiaMigrateImportProgrammer";
|
|
11
11
|
|
|
12
|
-
const { NamingConvention, OpenApiTypeChecker } =
|
|
13
|
-
(typiaUtils as { default?: typeof typiaUtils }).default ?? typiaUtils;
|
|
14
|
-
|
|
15
12
|
export namespace NestiaMigrateSchemaProgrammer {
|
|
16
13
|
/* -----------------------------------------------------------
|
|
17
14
|
FACADE
|