create-qpq-app 0.1.11 → 0.1.13
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/commonjs/cli/runCreateQpqApp.js +14 -12
- package/lib/commonjs/cli/runCreateQpqApp.js.map +1 -1
- package/lib/commonjs/lib/getArgValue.d.ts +1 -0
- package/lib/commonjs/lib/getArgValue.js +14 -0
- package/lib/commonjs/lib/getArgValue.js.map +1 -0
- package/lib/commonjs/lib/{packageRoot.d.ts → getOwnPackageRoot.d.ts} +0 -1
- package/lib/commonjs/lib/{packageRoot.js → getOwnPackageRoot.js} +2 -7
- package/lib/commonjs/lib/getOwnPackageRoot.js.map +1 -0
- package/lib/commonjs/lib/getOwnVersion.d.ts +1 -0
- package/lib/commonjs/lib/getOwnVersion.js +15 -0
- package/lib/commonjs/lib/getOwnVersion.js.map +1 -0
- package/lib/commonjs/lib/{args.d.ts → getPositionalArgs.d.ts} +0 -1
- package/lib/commonjs/lib/getPositionalArgs.js +12 -0
- package/lib/commonjs/lib/getPositionalArgs.js.map +1 -0
- package/lib/commonjs/lib/index.d.ts +11 -0
- package/lib/commonjs/lib/index.js +28 -0
- package/lib/commonjs/lib/index.js.map +1 -0
- package/lib/commonjs/lib/listFilesRecursive.d.ts +1 -0
- package/lib/commonjs/lib/listFilesRecursive.js +27 -0
- package/lib/commonjs/lib/listFilesRecursive.js.map +1 -0
- package/lib/commonjs/lib/{prompts.js → promptSelect.js} +1 -1
- package/lib/commonjs/lib/promptSelect.js.map +1 -0
- package/lib/commonjs/lib/readJsonFile.d.ts +1 -0
- package/lib/commonjs/lib/readJsonFile.js +13 -0
- package/lib/commonjs/lib/readJsonFile.js.map +1 -0
- package/lib/commonjs/lib/replaceInFileExact.d.ts +1 -0
- package/lib/commonjs/lib/replaceInFileExact.js +18 -0
- package/lib/commonjs/lib/replaceInFileExact.js.map +1 -0
- package/lib/commonjs/lib/replaceInFiles.d.ts +1 -0
- package/lib/commonjs/lib/replaceInFiles.js +32 -0
- package/lib/commonjs/lib/replaceInFiles.js.map +1 -0
- package/lib/commonjs/lib/writeJsonFile.d.ts +1 -0
- package/lib/commonjs/lib/writeJsonFile.js +12 -0
- package/lib/commonjs/lib/writeJsonFile.js.map +1 -0
- package/lib/commonjs/steps/001_preflight.js +3 -3
- package/lib/commonjs/steps/001_preflight.js.map +1 -1
- package/lib/commonjs/steps/002_copyTemplate.js +1 -1
- package/lib/commonjs/steps/002_copyTemplate.js.map +1 -1
- package/lib/commonjs/steps/003_deleteDocusaurus.js +5 -4
- package/lib/commonjs/steps/003_deleteDocusaurus.js.map +1 -1
- package/lib/commonjs/steps/005_applyAppIdentity.js +12 -9
- package/lib/commonjs/steps/005_applyAppIdentity.js.map +1 -1
- package/lib/commonjs/steps/006_applyDomain.js +6 -4
- package/lib/commonjs/steps/006_applyDomain.js.map +1 -1
- package/lib/commonjs/steps/007_pinRegistryVersions.js +5 -4
- package/lib/commonjs/steps/007_pinRegistryVersions.js.map +1 -1
- package/lib/commonjs/steps/008_transpileToJavaScript.js +19 -17
- package/lib/commonjs/steps/008_transpileToJavaScript.js.map +1 -1
- package/lib/commonjs/steps/009_restoreGitignore.js +2 -2
- package/lib/commonjs/steps/009_restoreGitignore.js.map +1 -1
- package/lib/commonjs/steps/010_gitInit.js +1 -1
- package/lib/commonjs/steps/010_gitInit.js.map +1 -1
- package/lib/commonjs/steps/013_printNextSteps.js +1 -1
- package/lib/commonjs/steps/013_printNextSteps.js.map +1 -1
- package/lib/commonjs/steps/index.js +1 -1
- package/lib/commonjs/steps/index.js.map +1 -1
- package/lib/commonjs/types/AppLanguage.d.ts +4 -0
- package/lib/commonjs/{types.js → types/AppLanguage.js} +1 -1
- package/lib/commonjs/types/AppLanguage.js.map +1 -0
- package/lib/commonjs/types/CreateQpqAppAnswers.d.ts +8 -0
- package/lib/commonjs/types/CreateQpqAppAnswers.js +3 -0
- package/lib/commonjs/types/CreateQpqAppAnswers.js.map +1 -0
- package/lib/commonjs/types/CreateQpqAppStep.d.ts +7 -0
- package/lib/commonjs/types/CreateQpqAppStep.js +3 -0
- package/lib/commonjs/types/CreateQpqAppStep.js.map +1 -0
- package/lib/commonjs/types/StepContext.d.ts +7 -0
- package/lib/commonjs/types/StepContext.js +3 -0
- package/lib/commonjs/types/StepContext.js.map +1 -0
- package/lib/commonjs/types/index.d.ts +4 -0
- package/lib/commonjs/types/index.js +21 -0
- package/lib/commonjs/types/index.js.map +1 -0
- package/lib/esm/cli/runCreateQpqApp.js +8 -6
- package/lib/esm/cli/runCreateQpqApp.js.map +1 -1
- package/lib/esm/lib/getArgValue.d.ts +1 -0
- package/lib/esm/lib/getArgValue.js +10 -0
- package/lib/esm/lib/getArgValue.js.map +1 -0
- package/lib/esm/lib/{packageRoot.d.ts → getOwnPackageRoot.d.ts} +0 -1
- package/lib/esm/lib/{packageRoot.js → getOwnPackageRoot.js} +1 -5
- package/lib/esm/lib/getOwnPackageRoot.js.map +1 -0
- package/lib/esm/lib/getOwnVersion.d.ts +1 -0
- package/lib/esm/lib/getOwnVersion.js +8 -0
- package/lib/esm/lib/getOwnVersion.js.map +1 -0
- package/lib/esm/lib/{args.d.ts → getPositionalArgs.d.ts} +0 -1
- package/lib/esm/lib/getPositionalArgs.js +8 -0
- package/lib/esm/lib/getPositionalArgs.js.map +1 -0
- package/lib/esm/lib/index.d.ts +11 -0
- package/lib/esm/lib/index.js +12 -0
- package/lib/esm/lib/index.js.map +1 -0
- package/lib/esm/lib/listFilesRecursive.d.ts +1 -0
- package/lib/esm/lib/listFilesRecursive.js +20 -0
- package/lib/esm/lib/listFilesRecursive.js.map +1 -0
- package/lib/esm/lib/{prompts.js → promptSelect.js} +1 -1
- package/lib/esm/lib/promptSelect.js.map +1 -0
- package/lib/esm/lib/readJsonFile.d.ts +1 -0
- package/lib/esm/lib/readJsonFile.js +6 -0
- package/lib/esm/lib/readJsonFile.js.map +1 -0
- package/lib/esm/lib/replaceInFileExact.d.ts +1 -0
- package/lib/esm/lib/replaceInFileExact.js +11 -0
- package/lib/esm/lib/replaceInFileExact.js.map +1 -0
- package/lib/esm/lib/replaceInFiles.d.ts +1 -0
- package/lib/esm/lib/replaceInFiles.js +25 -0
- package/lib/esm/lib/replaceInFiles.js.map +1 -0
- package/lib/esm/lib/writeJsonFile.d.ts +1 -0
- package/lib/esm/lib/writeJsonFile.js +5 -0
- package/lib/esm/lib/writeJsonFile.js.map +1 -0
- package/lib/esm/steps/001_preflight.js +3 -3
- package/lib/esm/steps/001_preflight.js.map +1 -1
- package/lib/esm/steps/002_copyTemplate.js +1 -1
- package/lib/esm/steps/002_copyTemplate.js.map +1 -1
- package/lib/esm/steps/003_deleteDocusaurus.js +3 -2
- package/lib/esm/steps/003_deleteDocusaurus.js.map +1 -1
- package/lib/esm/steps/005_applyAppIdentity.js +6 -3
- package/lib/esm/steps/005_applyAppIdentity.js.map +1 -1
- package/lib/esm/steps/006_applyDomain.js +3 -1
- package/lib/esm/steps/006_applyDomain.js.map +1 -1
- package/lib/esm/steps/007_pinRegistryVersions.js +3 -2
- package/lib/esm/steps/007_pinRegistryVersions.js.map +1 -1
- package/lib/esm/steps/008_transpileToJavaScript.js +10 -8
- package/lib/esm/steps/008_transpileToJavaScript.js.map +1 -1
- package/lib/esm/steps/009_restoreGitignore.js +1 -1
- package/lib/esm/steps/009_restoreGitignore.js.map +1 -1
- package/lib/esm/steps/010_gitInit.js +1 -1
- package/lib/esm/steps/010_gitInit.js.map +1 -1
- package/lib/esm/steps/013_printNextSteps.js +1 -1
- package/lib/esm/steps/013_printNextSteps.js.map +1 -1
- package/lib/esm/steps/index.js +1 -1
- package/lib/esm/steps/index.js.map +1 -1
- package/lib/esm/types/AppLanguage.d.ts +4 -0
- package/lib/esm/{types.js → types/AppLanguage.js} +1 -1
- package/lib/esm/types/AppLanguage.js.map +1 -0
- package/lib/esm/types/CreateQpqAppAnswers.d.ts +8 -0
- package/lib/esm/types/CreateQpqAppAnswers.js +2 -0
- package/lib/esm/types/CreateQpqAppAnswers.js.map +1 -0
- package/lib/esm/types/CreateQpqAppStep.d.ts +7 -0
- package/lib/esm/types/CreateQpqAppStep.js +2 -0
- package/lib/esm/types/CreateQpqAppStep.js.map +1 -0
- package/lib/esm/types/StepContext.d.ts +7 -0
- package/lib/esm/types/StepContext.js +2 -0
- package/lib/esm/types/StepContext.js.map +1 -0
- package/lib/esm/types/index.d.ts +4 -0
- package/lib/esm/types/index.js +5 -0
- package/lib/esm/types/index.js.map +1 -0
- package/package.json +5 -4
- package/template/docusaurus/docs/actions/core/crypto/_category_.json +7 -0
- package/template/docusaurus/docs/actions/core/crypto/ask-crypto-decrypt.md +61 -0
- package/template/docusaurus/docs/actions/core/crypto/ask-crypto-encrypt.md +66 -0
- package/template/docusaurus/docs/actions/core/key-value-store/ask-key-value-store-scan-all-scopes.md +98 -0
- package/template/docusaurus/docs/actions/features/_category_.json +1 -1
- package/template/docusaurus/docs/actions/features/event-doc/ask-event-doc-append-server-event.md +2 -2
- package/template/docusaurus/docs/actions/features/event-doc/ask-event-doc-create.md +2 -2
- package/template/docusaurus/docs/actions/features/event-doc/ask-event-doc-event-append.md +17 -15
- package/template/docusaurus/docs/actions/features/event-doc/ask-event-doc-event-list.md +9 -9
- package/template/docusaurus/docs/actions/features/event-doc/ask-event-doc-event-write.md +7 -7
- package/template/docusaurus/docs/actions/features/event-doc/ask-event-doc-get-by-id.md +5 -5
- package/template/docusaurus/docs/actions/features/event-doc/ask-event-doc-get-draft.md +4 -4
- package/template/docusaurus/docs/actions/features/event-doc/ask-event-doc-provide-store.md +6 -0
- package/template/docusaurus/docs/actions/features/event-doc/ask-event-doc-references.md +47 -0
- package/template/docusaurus/docs/actions/features/event-doc/ask-event-doc-soft-delete.md +48 -10
- package/template/docusaurus/docs/actions/features/event-doc-transfer/_category_.json +1 -0
- package/template/docusaurus/docs/actions/features/event-doc-transfer/ask-event-doc-bundle-apply.md +67 -0
- package/template/docusaurus/docs/actions/features/event-doc-transfer/ask-event-doc-bundle-plan.md +67 -0
- package/template/docusaurus/docs/actions/features/event-doc-transfer/ask-event-doc-manifest.md +64 -0
- package/template/docusaurus/docs/actions/features/event-doc-transfer/ask-event-doc-transfer-export.md +67 -0
- package/template/docusaurus/docs/actions/xstate/ask-state-machine-send-event.md +6 -6
- package/template/docusaurus/docs/config/core/crypto-key.md +53 -0
- package/template/docusaurus/docs/config/core/key-value-store.md +53 -1
- package/template/docusaurus/docs/config/features/event-doc-routes.md +5 -1
- package/template/docusaurus/docs/config/features/event-doc-summary.md +7 -6
- package/template/docusaurus/docs/config/features/event-doc-transfer.md +81 -0
- package/template/docusaurus/docs/config/features/event-doc.md +1 -0
- package/template/docusaurus/docs/config/features/tenanted-event-doc-transfer.md +59 -0
- package/template/docusaurus/docs/config/features/tenanted-event-doc.md +1 -0
- package/template/docusaurus/docs/config/webserver/migration.md +4 -0
- package/template/package.json +1 -0
- package/lib/commonjs/lib/args.js +0 -21
- package/lib/commonjs/lib/args.js.map +0 -1
- package/lib/commonjs/lib/files.d.ts +0 -5
- package/lib/commonjs/lib/files.js +0 -65
- package/lib/commonjs/lib/files.js.map +0 -1
- package/lib/commonjs/lib/packageRoot.js.map +0 -1
- package/lib/commonjs/lib/prompts.js.map +0 -1
- package/lib/commonjs/types.d.ts +0 -22
- package/lib/commonjs/types.js.map +0 -1
- package/lib/esm/lib/args.js +0 -16
- package/lib/esm/lib/args.js.map +0 -1
- package/lib/esm/lib/files.d.ts +0 -5
- package/lib/esm/lib/files.js +0 -54
- package/lib/esm/lib/files.js.map +0 -1
- package/lib/esm/lib/packageRoot.js.map +0 -1
- package/lib/esm/lib/prompts.js.map +0 -1
- package/lib/esm/types.d.ts +0 -22
- package/lib/esm/types.js.map +0 -1
- /package/lib/commonjs/lib/{prompts.d.ts → promptSelect.d.ts} +0 -0
- /package/lib/esm/lib/{prompts.d.ts → promptSelect.d.ts} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"006_applyDomain.js","sourceRoot":"","sources":["../../../src/steps/006_applyDomain.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,gDAAwB;AAExB,
|
|
1
|
+
{"version":3,"file":"006_applyDomain.js","sourceRoot":"","sources":["../../../src/steps/006_applyDomain.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,gDAAwB;AAExB,sDAAmD;AACnD,kEAA+D;AAC/D,wDAAqD;AAGrD,0EAA0E;AAC1E,6EAA6E;AAC7E,MAAM,eAAe,GAAG,uBAAuB,CAAC;AAEnC,QAAA,WAAW,GAAqB;IAC3C,IAAI,EAAE,iBAAiB;IAEvB,GAAG,EAAE,KAAqC,EAAE,4CAAhC,EAAE,eAAe,EAAE,OAAO,EAAE;QACtC,MAAM,gBAAgB,GAAG,cAAI,CAAC,IAAI,CAAC,eAAe,EAAE,MAAM,EAAE,OAAO,CAAC,OAAO,EAAE,oBAAoB,CAAC,CAAC;QACnG,MAAM,YAAY,GAAG,IAAA,2BAAY,EAAC,gBAAgB,CAAC,CAAC;QACpD,YAAY,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QACrC,IAAA,6BAAa,EAAC,gBAAgB,EAAE,YAAY,CAAC,CAAC;QAE9C,IAAA,uCAAkB,EAChB,cAAI,CAAC,IAAI,CAAC,eAAe,EAAE,MAAM,EAAE,OAAO,CAAC,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,KAAK,EAAE,WAAW,CAAC,EAChG,eAAe,EACf,OAAO,CAAC,MAAM,CACf,CAAC;IACJ,CAAC,CAAA;CACF,CAAC","sourcesContent":["import path from 'path';\n\nimport { readJsonFile } from '../lib/readJsonFile';\nimport { replaceInFileExact } from '../lib/replaceInFileExact';\nimport { writeJsonFile } from '../lib/writeJsonFile';\nimport { CreateQpqAppStep } from '../types';\n\n// The template's domain, replaced wherever it's authoritative: the deploy\n// config and the app's domain constant (everything else derives from those).\nconst TEMPLATE_DOMAIN = 'todo.quidproquojs.com';\n\nexport const applyDomain: CreateQpqAppStep = {\n name: 'Applying domain',\n\n run: async ({ targetDirectory, answers }) => {\n const deployConfigPath = path.join(targetDirectory, 'apps', answers.appName, 'deploy.config.json');\n const deployConfig = readJsonFile(deployConfigPath);\n deployConfig.domain = answers.domain;\n writeJsonFile(deployConfigPath, deployConfig);\n\n replaceInFileExact(\n path.join(targetDirectory, 'apps', answers.appName, 'packages', 'constants', 'src', 'domain.ts'),\n TEMPLATE_DOMAIN,\n answers.domain,\n );\n },\n};\n"]}
|
|
@@ -14,16 +14,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.pinRegistryVersions = void 0;
|
|
16
16
|
const path_1 = __importDefault(require("path"));
|
|
17
|
-
const
|
|
17
|
+
const readJsonFile_1 = require("../lib/readJsonFile");
|
|
18
|
+
const writeJsonFile_1 = require("../lib/writeJsonFile");
|
|
18
19
|
// quidproquojs.com lives beside the quidproquo monorepo and consumes it via
|
|
19
20
|
// file:../ refs; a generated app lives anywhere, so those become registry
|
|
20
|
-
// versions pinned to create-qpq-app's own version
|
|
21
|
+
// versions pinned to create-qpq-app's own version; the whole family is
|
|
21
22
|
// published in lockstep, so the versions always exist together.
|
|
22
23
|
exports.pinRegistryVersions = {
|
|
23
24
|
name: 'Pinning quidproquo versions',
|
|
24
25
|
run: (_a) => __awaiter(void 0, [_a], void 0, function* ({ targetDirectory, ownVersion }) {
|
|
25
26
|
const packageJsonPath = path_1.default.join(targetDirectory, 'package.json');
|
|
26
|
-
const packageJson = (0,
|
|
27
|
+
const packageJson = (0, readJsonFile_1.readJsonFile)(packageJsonPath);
|
|
27
28
|
for (const dependencyBlock of [packageJson.dependencies, packageJson.devDependencies]) {
|
|
28
29
|
for (const [name, version] of Object.entries(dependencyBlock !== null && dependencyBlock !== void 0 ? dependencyBlock : {})) {
|
|
29
30
|
if (name.startsWith('quidproquo') && String(version).startsWith('file:')) {
|
|
@@ -31,7 +32,7 @@ exports.pinRegistryVersions = {
|
|
|
31
32
|
}
|
|
32
33
|
}
|
|
33
34
|
}
|
|
34
|
-
(0,
|
|
35
|
+
(0, writeJsonFile_1.writeJsonFile)(packageJsonPath, packageJson);
|
|
35
36
|
}),
|
|
36
37
|
};
|
|
37
38
|
//# sourceMappingURL=007_pinRegistryVersions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"007_pinRegistryVersions.js","sourceRoot":"","sources":["../../../src/steps/007_pinRegistryVersions.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,gDAAwB;AAExB,
|
|
1
|
+
{"version":3,"file":"007_pinRegistryVersions.js","sourceRoot":"","sources":["../../../src/steps/007_pinRegistryVersions.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,gDAAwB;AAExB,sDAAmD;AACnD,wDAAqD;AAGrD,4EAA4E;AAC5E,0EAA0E;AAC1E,uEAAuE;AACvE,gEAAgE;AACnD,QAAA,mBAAmB,GAAqB;IACnD,IAAI,EAAE,6BAA6B;IAEnC,GAAG,EAAE,KAAwC,EAAE,4CAAnC,EAAE,eAAe,EAAE,UAAU,EAAE;QACzC,MAAM,eAAe,GAAG,cAAI,CAAC,IAAI,CAAC,eAAe,EAAE,cAAc,CAAC,CAAC;QACnE,MAAM,WAAW,GAAG,IAAA,2BAAY,EAAC,eAAe,CAAC,CAAC;QAElD,KAAK,MAAM,eAAe,IAAI,CAAC,WAAW,CAAC,YAAY,EAAE,WAAW,CAAC,eAAe,CAAC,EAAE,CAAC;YACtF,KAAK,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,eAAe,aAAf,eAAe,cAAf,eAAe,GAAI,EAAE,CAAC,EAAE,CAAC;gBACpE,IAAI,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;oBACzE,eAAe,CAAC,IAAI,CAAC,GAAG,UAAU,CAAC;gBACrC,CAAC;YACH,CAAC;QACH,CAAC;QAED,IAAA,6BAAa,EAAC,eAAe,EAAE,WAAW,CAAC,CAAC;IAC9C,CAAC,CAAA;CACF,CAAC","sourcesContent":["import path from 'path';\n\nimport { readJsonFile } from '../lib/readJsonFile';\nimport { writeJsonFile } from '../lib/writeJsonFile';\nimport { CreateQpqAppStep } from '../types';\n\n// quidproquojs.com lives beside the quidproquo monorepo and consumes it via\n// file:../ refs; a generated app lives anywhere, so those become registry\n// versions pinned to create-qpq-app's own version; the whole family is\n// published in lockstep, so the versions always exist together.\nexport const pinRegistryVersions: CreateQpqAppStep = {\n name: 'Pinning quidproquo versions',\n\n run: async ({ targetDirectory, ownVersion }) => {\n const packageJsonPath = path.join(targetDirectory, 'package.json');\n const packageJson = readJsonFile(packageJsonPath);\n\n for (const dependencyBlock of [packageJson.dependencies, packageJson.devDependencies]) {\n for (const [name, version] of Object.entries(dependencyBlock ?? {})) {\n if (name.startsWith('quidproquo') && String(version).startsWith('file:')) {\n dependencyBlock[name] = ownVersion;\n }\n }\n }\n\n writeJsonFile(packageJsonPath, packageJson);\n },\n};\n"]}
|
|
@@ -15,7 +15,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
15
15
|
exports.transpileToJavaScript = void 0;
|
|
16
16
|
const fs_1 = __importDefault(require("fs"));
|
|
17
17
|
const path_1 = __importDefault(require("path"));
|
|
18
|
-
const
|
|
18
|
+
const listFilesRecursive_1 = require("../lib/listFilesRecursive");
|
|
19
|
+
const readJsonFile_1 = require("../lib/readJsonFile");
|
|
20
|
+
const writeJsonFile_1 = require("../lib/writeJsonFile");
|
|
19
21
|
const types_1 = require("../types");
|
|
20
22
|
// Convert the scaffolded TypeScript app to JavaScript: per-file type
|
|
21
23
|
// stripping (JSX preserved, comments kept), then remove the TypeScript
|
|
@@ -37,7 +39,7 @@ exports.transpileToJavaScript = {
|
|
|
37
39
|
// The transpiler re-prints files in its own style; format the output with
|
|
38
40
|
// the app's own prettier settings so generated code matches the repo.
|
|
39
41
|
const prettierRcPath = path_1.default.join(targetDirectory, '.prettierrc');
|
|
40
|
-
const prettierOptions = fs_1.default.existsSync(prettierRcPath) ? (0,
|
|
42
|
+
const prettierOptions = fs_1.default.existsSync(prettierRcPath) ? (0, readJsonFile_1.readJsonFile)(prettierRcPath) : {};
|
|
41
43
|
const compilerOptions = {
|
|
42
44
|
target: ts.ScriptTarget.ESNext,
|
|
43
45
|
module: ts.ModuleKind.ESNext, // keep import/export statements as written
|
|
@@ -45,7 +47,7 @@ exports.transpileToJavaScript = {
|
|
|
45
47
|
removeComments: false,
|
|
46
48
|
};
|
|
47
49
|
let converted = 0;
|
|
48
|
-
for (const filePath of (0,
|
|
50
|
+
for (const filePath of (0, listFilesRecursive_1.listFilesRecursive)(targetDirectory)) {
|
|
49
51
|
if (filePath.endsWith('.d.ts')) {
|
|
50
52
|
fs_1.default.rmSync(filePath);
|
|
51
53
|
continue;
|
|
@@ -56,7 +58,7 @@ exports.transpileToJavaScript = {
|
|
|
56
58
|
}
|
|
57
59
|
const source = fs_1.default.readFileSync(filePath, 'utf8');
|
|
58
60
|
const { outputText } = ts.transpileModule(source, { compilerOptions, fileName: filePath });
|
|
59
|
-
// Type-only statements leave blank gaps behind
|
|
61
|
+
// Type-only statements leave blank gaps behind; collapse runs of them.
|
|
60
62
|
const collapsed = outputText.replace(/\n{3,}/g, '\n\n');
|
|
61
63
|
const outputPath = filePath.replace(/\.tsx?$/, isTsx ? '.jsx' : '.js');
|
|
62
64
|
const output = yield prettier.format(collapsed, Object.assign(Object.assign({}, prettierOptions), { filepath: outputPath }));
|
|
@@ -65,17 +67,17 @@ exports.transpileToJavaScript = {
|
|
|
65
67
|
converted += 1;
|
|
66
68
|
}
|
|
67
69
|
// TypeScript build plumbing: tsconfigs, the ambient types/ dir, and the
|
|
68
|
-
// per-package tsc scripts all go. Lib packages no longer build
|
|
70
|
+
// per-package tsc scripts all go. Lib packages no longer build; their
|
|
69
71
|
// package.json main points straight at src.
|
|
70
72
|
let libsRepointed = 0;
|
|
71
|
-
for (const filePath of (0,
|
|
73
|
+
for (const filePath of (0, listFilesRecursive_1.listFilesRecursive)(targetDirectory)) {
|
|
72
74
|
const baseName = path_1.default.basename(filePath);
|
|
73
75
|
if (baseName.startsWith('tsconfig') && baseName.endsWith('.json') && filePath !== path_1.default.join(targetDirectory, 'tsconfig.json')) {
|
|
74
76
|
fs_1.default.rmSync(filePath);
|
|
75
77
|
continue;
|
|
76
78
|
}
|
|
77
79
|
if (baseName === 'package.json' && filePath !== path_1.default.join(targetDirectory, 'package.json')) {
|
|
78
|
-
const packageJson = (0,
|
|
80
|
+
const packageJson = (0, readJsonFile_1.readJsonFile)(filePath);
|
|
79
81
|
let changed = false;
|
|
80
82
|
if ((_b = packageJson.scripts) === null || _b === void 0 ? void 0 : _b['validate-ts']) {
|
|
81
83
|
delete packageJson.scripts['validate-ts'];
|
|
@@ -83,10 +85,10 @@ exports.transpileToJavaScript = {
|
|
|
83
85
|
}
|
|
84
86
|
// Lib packages (identified by their tsc build) get served from
|
|
85
87
|
// source. A tsc build with an unexpected main means the template's
|
|
86
|
-
// conventions moved
|
|
88
|
+
// conventions moved: fail loudly rather than scaffold a broken app.
|
|
87
89
|
if (((_c = packageJson.scripts) === null || _c === void 0 ? void 0 : _c.build) === 'tsc -b') {
|
|
88
90
|
if (packageJson.main !== './dist/src/index.js') {
|
|
89
|
-
throw new Error(`${filePath} has a tsc build but main is "${packageJson.main}" (expected "./dist/src/index.js")
|
|
91
|
+
throw new Error(`${filePath} has a tsc build but main is "${packageJson.main}" (expected "./dist/src/index.js"). Update transpileToJavaScript for the new template convention.`);
|
|
90
92
|
}
|
|
91
93
|
packageJson.main = './src/index.js';
|
|
92
94
|
delete packageJson.typings;
|
|
@@ -97,30 +99,30 @@ exports.transpileToJavaScript = {
|
|
|
97
99
|
libsRepointed += 1;
|
|
98
100
|
}
|
|
99
101
|
if (changed) {
|
|
100
|
-
(0,
|
|
102
|
+
(0, writeJsonFile_1.writeJsonFile)(filePath, packageJson);
|
|
101
103
|
}
|
|
102
104
|
}
|
|
103
105
|
}
|
|
104
106
|
if (converted === 0 || libsRepointed === 0) {
|
|
105
|
-
throw new Error(`JavaScript conversion looks wrong: ${converted} files transpiled, ${libsRepointed} lib packages repointed
|
|
107
|
+
throw new Error(`JavaScript conversion looks wrong: ${converted} files transpiled, ${libsRepointed} lib packages repointed. Has the template changed shape?`);
|
|
106
108
|
}
|
|
107
|
-
// The ROOT tsconfig.json stays
|
|
109
|
+
// The ROOT tsconfig.json stays: the qpq CLI's ts-node require hook reads
|
|
108
110
|
// its ts-node block, and allowJs makes that hook compile the app's
|
|
109
111
|
// ESM-syntax .js files (imports, __dirname) at load time.
|
|
110
112
|
fs_1.default.rmSync(path_1.default.join(targetDirectory, 'types'), { recursive: true, force: true });
|
|
111
113
|
fs_1.default.rmSync(path_1.default.join(targetDirectory, 'tsconfig.base.json'), { force: true });
|
|
112
114
|
const rootTsconfigPath = path_1.default.join(targetDirectory, 'tsconfig.json');
|
|
113
|
-
const rootTsconfig = (0,
|
|
115
|
+
const rootTsconfig = (0, readJsonFile_1.readJsonFile)(rootTsconfigPath);
|
|
114
116
|
rootTsconfig['ts-node'].compilerOptions.allowJs = true;
|
|
115
|
-
// Scope the hook to this repo
|
|
117
|
+
// Scope the hook to this repo: allowJs must never recompile quidproquo
|
|
116
118
|
// libs living outside node_modules (file:-linked dev setups).
|
|
117
119
|
rootTsconfig['ts-node'].scope = true;
|
|
118
120
|
rootTsconfig['ts-node'].scopeDir = '.';
|
|
119
|
-
(0,
|
|
121
|
+
(0, writeJsonFile_1.writeJsonFile)(rootTsconfigPath, rootTsconfig);
|
|
120
122
|
const rootPackageJsonPath = path_1.default.join(targetDirectory, 'package.json');
|
|
121
|
-
const rootPackageJson = (0,
|
|
123
|
+
const rootPackageJson = (0, readJsonFile_1.readJsonFile)(rootPackageJsonPath);
|
|
122
124
|
(_d = rootPackageJson.scripts) === null || _d === void 0 ? true : delete _d['validate-ts'];
|
|
123
|
-
(0,
|
|
125
|
+
(0, writeJsonFile_1.writeJsonFile)(rootPackageJsonPath, rootPackageJson);
|
|
124
126
|
console.log(` Converted ${converted} files to JavaScript.`);
|
|
125
127
|
}),
|
|
126
128
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"008_transpileToJavaScript.js","sourceRoot":"","sources":["../../../src/steps/008_transpileToJavaScript.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,4CAAoB;AACpB,gDAAwB;AAExB,wCAA+E;AAC/E,oCAAyD;AAEzD,qEAAqE;AACrE,uEAAuE;AACvE,0CAA0C;AAC1C,EAAE;AACF,0EAA0E;AAC1E,6EAA6E;AAC7E,oCAAoC;AACvB,QAAA,qBAAqB,GAAqB;IACrD,IAAI,EAAE,0BAA0B;IAEhC,SAAS,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,QAAQ,KAAK,mBAAW,CAAC,UAAU;IAEnE,GAAG,EAAE,KAA4B,EAAE,4CAAvB,EAAE,eAAe,EAAE;;QAC7B,wDAAwD;QACxD,0DAA0D;QAC1D,MAAM,EAAE,GAAG,OAAO,CAAC,YAAY,CAAgC,CAAC;QAChE,MAAM,QAAQ,GAAG,OAAO,CAAC,UAAU,CAA8B,CAAC;QAClE,yDAAyD;QAEzD,0EAA0E;QAC1E,sEAAsE;QACtE,MAAM,cAAc,GAAG,cAAI,CAAC,IAAI,CAAC,eAAe,EAAE,aAAa,CAAC,CAAC;QACjE,MAAM,eAAe,GAAG,YAAE,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,IAAA,oBAAY,EAAC,cAAc,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAE1F,MAAM,eAAe,GAAyC;YAC5D,MAAM,EAAE,EAAE,CAAC,YAAY,CAAC,MAAM;YAC9B,MAAM,EAAE,EAAE,CAAC,UAAU,CAAC,MAAM,EAAE,2CAA2C;YACzE,GAAG,EA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,EAAC,gBAAgB,EAAE,YAAY,CAAC,CAAC;QAE9C,MAAM,mBAAmB,GAAG,cAAI,CAAC,IAAI,CAAC,eAAe,EAAE,cAAc,CAAC,CAAC;QACvE,MAAM,eAAe,GAAG,IAAA,oBAAY,EAAC,mBAAmB,CAAC,CAAC;QACnD,MAAA,eAAe,CAAC,OAAO,+CAAG,aAAa,CAAC,CAAC;QAChD,IAAA,qBAAa,EAAC,mBAAmB,EAAE,eAAe,CAAC,CAAC;QAEpD,OAAO,CAAC,GAAG,CAAC,eAAe,SAAS,uBAAuB,CAAC,CAAC;IAC/D,CAAC,CAAA;CACF,CAAC","sourcesContent":["import fs from 'fs';\nimport path from 'path';\n\nimport { listFilesRecursive, readJsonFile, writeJsonFile } from '../lib/files';\nimport { AppLanguage, CreateQpqAppStep } from '../types';\n\n// Convert the scaffolded TypeScript app to JavaScript: per-file type\n// stripping (JSX preserved, comments kept), then remove the TypeScript\n// build plumbing the app no longer needs.\n//\n// The qpq toolchain runs the result as-is: the CLI's ts-node require hook\n// compiles the app's ESM-syntax .js at load time (allowJs, added below), and\n// rspack bundles .js/.jsx natively.\nexport const transpileToJavaScript: CreateQpqAppStep = {\n name: 'Converting to JavaScript',\n\n shouldRun: (answers) => answers.language === AppLanguage.javascript,\n\n run: async ({ targetDirectory }) => {\n // Lazy so TypeScript scaffolds never load the compiler.\n /* eslint-disable @typescript-eslint/no-require-imports */\n const ts = require('typescript') as typeof import('typescript');\n const prettier = require('prettier') as typeof import('prettier');\n /* eslint-enable @typescript-eslint/no-require-imports */\n\n // The transpiler re-prints files in its own style; format the output with\n // the app's own prettier settings so generated code matches the repo.\n const prettierRcPath = path.join(targetDirectory, '.prettierrc');\n const prettierOptions = fs.existsSync(prettierRcPath) ? readJsonFile(prettierRcPath) : {};\n\n const compilerOptions: import('typescript').CompilerOptions = {\n target: ts.ScriptTarget.ESNext,\n module: ts.ModuleKind.ESNext, // keep import/export statements as written\n jsx: ts.JsxEmit.Preserve,\n removeComments: false,\n };\n\n let converted = 0;\n for (const filePath of listFilesRecursive(targetDirectory)) {\n if (filePath.endsWith('.d.ts')) {\n fs.rmSync(filePath);\n continue;\n }\n\n const isTsx = filePath.endsWith('.tsx');\n if (!isTsx && !filePath.endsWith('.ts')) {\n continue;\n }\n\n const source = fs.readFileSync(filePath, 'utf8');\n const { outputText } = ts.transpileModule(source, { compilerOptions, fileName: filePath });\n\n // Type-only statements leave blank gaps behind — collapse runs of them.\n const collapsed = outputText.replace(/\\n{3,}/g, '\\n\\n');\n\n const outputPath = filePath.replace(/\\.tsx?$/, isTsx ? '.jsx' : '.js');\n const output = await prettier.format(collapsed, { ...prettierOptions, filepath: outputPath });\n\n fs.writeFileSync(outputPath, output);\n fs.rmSync(filePath);\n converted += 1;\n }\n\n // TypeScript build plumbing: tsconfigs, the ambient types/ dir, and the\n // per-package tsc scripts all go. Lib packages no longer build — their\n // package.json main points straight at src.\n let libsRepointed = 0;\n for (const filePath of listFilesRecursive(targetDirectory)) {\n const baseName = path.basename(filePath);\n\n if (baseName.startsWith('tsconfig') && baseName.endsWith('.json') && filePath !== path.join(targetDirectory, 'tsconfig.json')) {\n fs.rmSync(filePath);\n continue;\n }\n\n if (baseName === 'package.json' && filePath !== path.join(targetDirectory, 'package.json')) {\n const packageJson = readJsonFile(filePath);\n let changed = false;\n\n if (packageJson.scripts?.['validate-ts']) {\n delete packageJson.scripts['validate-ts'];\n changed = true;\n }\n\n // Lib packages (identified by their tsc build) get served from\n // source. A tsc build with an unexpected main means the template's\n // conventions moved — fail loudly rather than scaffold a broken app.\n if (packageJson.scripts?.build === 'tsc -b') {\n if (packageJson.main !== './dist/src/index.js') {\n throw new Error(\n `${filePath} has a tsc build but main is \"${packageJson.main}\" (expected \"./dist/src/index.js\") — update transpileToJavaScript for the new template convention.`,\n );\n }\n\n packageJson.main = './src/index.js';\n delete packageJson.typings;\n delete packageJson.scripts.build;\n packageJson.exports = { '.': { default: './src/index.js' } };\n packageJson.files = ['src'];\n changed = true;\n libsRepointed += 1;\n }\n\n if (changed) {\n writeJsonFile(filePath, packageJson);\n }\n }\n }\n\n if (converted === 0 || libsRepointed === 0) {\n throw new Error(\n `JavaScript conversion looks wrong: ${converted} files transpiled, ${libsRepointed} lib packages repointed — has the template changed shape?`,\n );\n }\n\n // The ROOT tsconfig.json stays — the qpq CLI's ts-node require hook reads\n // its ts-node block, and allowJs makes that hook compile the app's\n // ESM-syntax .js files (imports, __dirname) at load time.\n fs.rmSync(path.join(targetDirectory, 'types'), { recursive: true, force: true });\n fs.rmSync(path.join(targetDirectory, 'tsconfig.base.json'), { force: true });\n\n const rootTsconfigPath = path.join(targetDirectory, 'tsconfig.json');\n const rootTsconfig = readJsonFile(rootTsconfigPath);\n rootTsconfig['ts-node'].compilerOptions.allowJs = true;\n // Scope the hook to this repo — allowJs must never recompile quidproquo\n // libs living outside node_modules (file:-linked dev setups).\n rootTsconfig['ts-node'].scope = true;\n rootTsconfig['ts-node'].scopeDir = '.';\n writeJsonFile(rootTsconfigPath, rootTsconfig);\n\n const rootPackageJsonPath = path.join(targetDirectory, 'package.json');\n const rootPackageJson = readJsonFile(rootPackageJsonPath);\n delete rootPackageJson.scripts?.['validate-ts'];\n writeJsonFile(rootPackageJsonPath, rootPackageJson);\n\n console.log(` Converted ${converted} files to JavaScript.`);\n },\n};\n"]}
|
|
1
|
+
{"version":3,"file":"008_transpileToJavaScript.js","sourceRoot":"","sources":["../../../src/steps/008_transpileToJavaScript.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,4CAAoB;AACpB,gDAAwB;AAExB,kEAA+D;AAC/D,sDAAmD;AACnD,wDAAqD;AACrD,oCAAyD;AAEzD,qEAAqE;AACrE,uEAAuE;AACvE,0CAA0C;AAC1C,EAAE;AACF,0EAA0E;AAC1E,6EAA6E;AAC7E,oCAAoC;AACvB,QAAA,qBAAqB,GAAqB;IACrD,IAAI,EAAE,0BAA0B;IAEhC,SAAS,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO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AAE,CAAC,MAAM,CAAC,cAAI,CAAC,IAAI,CAAC,eAAe,EAAE,OAAO,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QACjF,YAAE,CAAC,MAAM,CAAC,cAAI,CAAC,IAAI,CAAC,eAAe,EAAE,oBAAoB,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QAE7E,MAAM,gBAAgB,GAAG,cAAI,CAAC,IAAI,CAAC,eAAe,EAAE,eAAe,CAAC,CAAC;QACrE,MAAM,YAAY,GAAG,IAAA,2BAAY,EAAC,gBAAgB,CAAC,CAAC;QACpD,YAAY,CAAC,SAAS,CAAC,CAAC,eAAe,CAAC,OAAO,GAAG,IAAI,CAAC;QACvD,uEAAuE;QACvE,8DAA8D;QAC9D,YAAY,CAAC,SAAS,CAAC,CAAC,KAAK,GAAG,IAAI,CAAC;QACrC,YAAY,CAAC,SAAS,CAAC,CAAC,QAAQ,GAAG,GAAG,CAAC;QACvC,IAAA,6BAAa,EAAC,gBAAgB,EAAE,YAAY,CAAC,CAAC;QAE9C,MAAM,mBAAmB,GAAG,cAAI,CAAC,IAAI,CAAC,eAAe,EAAE,cAAc,CAAC,CAAC;QACvE,MAAM,eAAe,GAAG,IAAA,2BAAY,EAAC,mBAAmB,CAAC,CAAC;QACnD,MAAA,eAAe,CAAC,OAAO,+CAAG,aAAa,CAAC,CAAC;QAChD,IAAA,6BAAa,EAAC,mBAAmB,EAAE,eAAe,CAAC,CAAC;QAEpD,OAAO,CAAC,GAAG,CAAC,eAAe,SAAS,uBAAuB,CAAC,CAAC;IAC/D,CAAC,CAAA;CACF,CAAC","sourcesContent":["import fs from 'fs';\nimport path from 'path';\n\nimport { listFilesRecursive } from '../lib/listFilesRecursive';\nimport { readJsonFile } from '../lib/readJsonFile';\nimport { writeJsonFile } from '../lib/writeJsonFile';\nimport { AppLanguage, CreateQpqAppStep } from '../types';\n\n// Convert the scaffolded TypeScript app to JavaScript: per-file type\n// stripping (JSX preserved, comments kept), then remove the TypeScript\n// build plumbing the app no longer needs.\n//\n// The qpq toolchain runs the result as-is: the CLI's ts-node require hook\n// compiles the app's ESM-syntax .js at load time (allowJs, added below), and\n// rspack bundles .js/.jsx natively.\nexport const transpileToJavaScript: CreateQpqAppStep = {\n name: 'Converting to JavaScript',\n\n shouldRun: (answers) => answers.language === AppLanguage.javascript,\n\n run: async ({ targetDirectory }) => {\n // Lazy so TypeScript scaffolds never load the compiler.\n /* eslint-disable @typescript-eslint/no-require-imports */\n const ts = require('typescript') as typeof import('typescript');\n const prettier = require('prettier') as typeof import('prettier');\n /* eslint-enable @typescript-eslint/no-require-imports */\n\n // The transpiler re-prints files in its own style; format the output with\n // the app's own prettier settings so generated code matches the repo.\n const prettierRcPath = path.join(targetDirectory, '.prettierrc');\n const prettierOptions = fs.existsSync(prettierRcPath) ? readJsonFile(prettierRcPath) : {};\n\n const compilerOptions: import('typescript').CompilerOptions = {\n target: ts.ScriptTarget.ESNext,\n module: ts.ModuleKind.ESNext, // keep import/export statements as written\n jsx: ts.JsxEmit.Preserve,\n removeComments: false,\n };\n\n let converted = 0;\n for (const filePath of listFilesRecursive(targetDirectory)) {\n if (filePath.endsWith('.d.ts')) {\n fs.rmSync(filePath);\n continue;\n }\n\n const isTsx = filePath.endsWith('.tsx');\n if (!isTsx && !filePath.endsWith('.ts')) {\n continue;\n }\n\n const source = fs.readFileSync(filePath, 'utf8');\n const { outputText } = ts.transpileModule(source, { compilerOptions, fileName: filePath });\n\n // Type-only statements leave blank gaps behind; collapse runs of them.\n const collapsed = outputText.replace(/\\n{3,}/g, '\\n\\n');\n\n const outputPath = filePath.replace(/\\.tsx?$/, isTsx ? '.jsx' : '.js');\n const output = await prettier.format(collapsed, { ...prettierOptions, filepath: outputPath });\n\n fs.writeFileSync(outputPath, output);\n fs.rmSync(filePath);\n converted += 1;\n }\n\n // TypeScript build plumbing: tsconfigs, the ambient types/ dir, and the\n // per-package tsc scripts all go. Lib packages no longer build; their\n // package.json main points straight at src.\n let libsRepointed = 0;\n for (const filePath of listFilesRecursive(targetDirectory)) {\n const baseName = path.basename(filePath);\n\n if (baseName.startsWith('tsconfig') && baseName.endsWith('.json') && filePath !== path.join(targetDirectory, 'tsconfig.json')) {\n fs.rmSync(filePath);\n continue;\n }\n\n if (baseName === 'package.json' && filePath !== path.join(targetDirectory, 'package.json')) {\n const packageJson = readJsonFile(filePath);\n let changed = false;\n\n if (packageJson.scripts?.['validate-ts']) {\n delete packageJson.scripts['validate-ts'];\n changed = true;\n }\n\n // Lib packages (identified by their tsc build) get served from\n // source. A tsc build with an unexpected main means the template's\n // conventions moved: fail loudly rather than scaffold a broken app.\n if (packageJson.scripts?.build === 'tsc -b') {\n if (packageJson.main !== './dist/src/index.js') {\n throw new Error(\n `${filePath} has a tsc build but main is \"${packageJson.main}\" (expected \"./dist/src/index.js\"). Update transpileToJavaScript for the new template convention.`,\n );\n }\n\n packageJson.main = './src/index.js';\n delete packageJson.typings;\n delete packageJson.scripts.build;\n packageJson.exports = { '.': { default: './src/index.js' } };\n packageJson.files = ['src'];\n changed = true;\n libsRepointed += 1;\n }\n\n if (changed) {\n writeJsonFile(filePath, packageJson);\n }\n }\n }\n\n if (converted === 0 || libsRepointed === 0) {\n throw new Error(\n `JavaScript conversion looks wrong: ${converted} files transpiled, ${libsRepointed} lib packages repointed. Has the template changed shape?`,\n );\n }\n\n // The ROOT tsconfig.json stays: the qpq CLI's ts-node require hook reads\n // its ts-node block, and allowJs makes that hook compile the app's\n // ESM-syntax .js files (imports, __dirname) at load time.\n fs.rmSync(path.join(targetDirectory, 'types'), { recursive: true, force: true });\n fs.rmSync(path.join(targetDirectory, 'tsconfig.base.json'), { force: true });\n\n const rootTsconfigPath = path.join(targetDirectory, 'tsconfig.json');\n const rootTsconfig = readJsonFile(rootTsconfigPath);\n rootTsconfig['ts-node'].compilerOptions.allowJs = true;\n // Scope the hook to this repo: allowJs must never recompile quidproquo\n // libs living outside node_modules (file:-linked dev setups).\n rootTsconfig['ts-node'].scope = true;\n rootTsconfig['ts-node'].scopeDir = '.';\n writeJsonFile(rootTsconfigPath, rootTsconfig);\n\n const rootPackageJsonPath = path.join(targetDirectory, 'package.json');\n const rootPackageJson = readJsonFile(rootPackageJsonPath);\n delete rootPackageJson.scripts?.['validate-ts'];\n writeJsonFile(rootPackageJsonPath, rootPackageJson);\n\n console.log(` Converted ${converted} files to JavaScript.`);\n },\n};\n"]}
|
|
@@ -15,13 +15,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
15
15
|
exports.restoreGitignore = void 0;
|
|
16
16
|
const fs_1 = __importDefault(require("fs"));
|
|
17
17
|
const path_1 = __importDefault(require("path"));
|
|
18
|
-
const
|
|
18
|
+
const listFilesRecursive_1 = require("../lib/listFilesRecursive");
|
|
19
19
|
// npm strips .gitignore files from published tarballs, so the snapshot stores
|
|
20
20
|
// them dotless (the create-react-app trick); restore the dots here.
|
|
21
21
|
exports.restoreGitignore = {
|
|
22
22
|
name: 'Restoring .gitignore files',
|
|
23
23
|
run: (_a) => __awaiter(void 0, [_a], void 0, function* ({ targetDirectory }) {
|
|
24
|
-
for (const filePath of (0,
|
|
24
|
+
for (const filePath of (0, listFilesRecursive_1.listFilesRecursive)(targetDirectory)) {
|
|
25
25
|
if (path_1.default.basename(filePath) === 'gitignore') {
|
|
26
26
|
fs_1.default.renameSync(filePath, path_1.default.join(path_1.default.dirname(filePath), '.gitignore'));
|
|
27
27
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"009_restoreGitignore.js","sourceRoot":"","sources":["../../../src/steps/009_restoreGitignore.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,4CAAoB;AACpB,gDAAwB;AAExB,
|
|
1
|
+
{"version":3,"file":"009_restoreGitignore.js","sourceRoot":"","sources":["../../../src/steps/009_restoreGitignore.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,4CAAoB;AACpB,gDAAwB;AAExB,kEAA+D;AAG/D,8EAA8E;AAC9E,oEAAoE;AACvD,QAAA,gBAAgB,GAAqB;IAChD,IAAI,EAAE,4BAA4B;IAElC,GAAG,EAAE,KAA4B,EAAE,4CAAvB,EAAE,eAAe,EAAE;QAC7B,KAAK,MAAM,QAAQ,IAAI,IAAA,uCAAkB,EAAC,eAAe,CAAC,EAAE,CAAC;YAC3D,IAAI,cAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,WAAW,EAAE,CAAC;gBAC5C,YAAE,CAAC,UAAU,CAAC,QAAQ,EAAE,cAAI,CAAC,IAAI,CAAC,cAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC;YAC3E,CAAC;QACH,CAAC;IACH,CAAC,CAAA;CACF,CAAC","sourcesContent":["import fs from 'fs';\nimport path from 'path';\n\nimport { listFilesRecursive } from '../lib/listFilesRecursive';\nimport { CreateQpqAppStep } from '../types';\n\n// npm strips .gitignore files from published tarballs, so the snapshot stores\n// them dotless (the create-react-app trick); restore the dots here.\nexport const restoreGitignore: CreateQpqAppStep = {\n name: 'Restoring .gitignore files',\n\n run: async ({ targetDirectory }) => {\n for (const filePath of listFilesRecursive(targetDirectory)) {\n if (path.basename(filePath) === 'gitignore') {\n fs.renameSync(filePath, path.join(path.dirname(filePath), '.gitignore'));\n }\n }\n },\n};\n"]}
|
|
@@ -12,7 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.gitInit = void 0;
|
|
13
13
|
const runCommand_1 = require("../lib/runCommand");
|
|
14
14
|
// A fresh repo with one clean commit. Failure here (no git installed, odd
|
|
15
|
-
// global config) shouldn't lose the scaffold
|
|
15
|
+
// global config) shouldn't lose the scaffold: warn and carry on.
|
|
16
16
|
exports.gitInit = {
|
|
17
17
|
name: 'Initialising git repository',
|
|
18
18
|
shouldRun: (answers) => answers.initialiseGit,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"010_gitInit.js","sourceRoot":"","sources":["../../../src/steps/010_gitInit.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,kDAA+C;AAG/C,0EAA0E;AAC1E,
|
|
1
|
+
{"version":3,"file":"010_gitInit.js","sourceRoot":"","sources":["../../../src/steps/010_gitInit.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,kDAA+C;AAG/C,0EAA0E;AAC1E,iEAAiE;AACpD,QAAA,OAAO,GAAqB;IACvC,IAAI,EAAE,6BAA6B;IAEnC,SAAS,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,aAAa;IAE7C,GAAG,EAAE,KAA4B,EAAE,4CAAvB,EAAE,eAAe,EAAE;QAC7B,IAAI,CAAC;YACH,MAAM,IAAA,uBAAU,EAAC,KAAK,EAAE,CAAC,MAAM,CAAC,EAAE,EAAE,GAAG,EAAE,eAAe,EAAE,CAAC,CAAC;YAC5D,MAAM,IAAA,uBAAU,EAAC,KAAK,EAAE,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE,EAAE,GAAG,EAAE,eAAe,EAAE,CAAC,CAAC;YACjE,MAAM,IAAA,uBAAU,EAAC,KAAK,EAAE,CAAC,QAAQ,EAAE,IAAI,EAAE,sCAAsC,CAAC,EAAE,EAAE,GAAG,EAAE,eAAe,EAAE,CAAC,CAAC;QAC9G,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,IAAI,CAAC,wBAAyB,KAAe,CAAC,OAAO,EAAE,CAAC,CAAC;QACnE,CAAC;IACH,CAAC,CAAA;CACF,CAAC","sourcesContent":["import { runCommand } from '../lib/runCommand';\nimport { CreateQpqAppStep } from '../types';\n\n// A fresh repo with one clean commit. Failure here (no git installed, odd\n// global config) shouldn't lose the scaffold: warn and carry on.\nexport const gitInit: CreateQpqAppStep = {\n name: 'Initialising git repository',\n\n shouldRun: (answers) => answers.initialiseGit,\n\n run: async ({ targetDirectory }) => {\n try {\n await runCommand('git', ['init'], { cwd: targetDirectory });\n await runCommand('git', ['add', '-A'], { cwd: targetDirectory });\n await runCommand('git', ['commit', '-m', '\"Initial commit from create-qpq-app\"'], { cwd: targetDirectory });\n } catch (error) {\n console.warn(` Skipping git init: ${(error as Error).message}`);\n }\n },\n};\n"]}
|
|
@@ -17,7 +17,7 @@ exports.printNextSteps = {
|
|
|
17
17
|
console.log(`
|
|
18
18
|
Created ${answers.appName}!
|
|
19
19
|
|
|
20
|
-
Your app has five services
|
|
20
|
+
Your app has five services (admin, auth, design, shell and todo) and
|
|
21
21
|
deploys as a single docker image.
|
|
22
22
|
|
|
23
23
|
Next steps:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"013_printNextSteps.js","sourceRoot":"","sources":["../../../src/steps/013_printNextSteps.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEa,QAAA,cAAc,GAAqB;IAC9C,IAAI,EAAE,MAAM;IAEZ,GAAG,EAAE,KAAoB,EAAE,4CAAf,EAAE,OAAO,EAAE;QACrB,MAAM,OAAO,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,kCAAkC,CAAC;QAEtF,OAAO,CAAC,GAAG,CAAC;UACN,OAAO,CAAC,OAAO;;;;;;;OAOlB,OAAO,CAAC,OAAO;EACpB,OAAO;;;8BAGqB,OAAO,CAAC,OAAO,gCAAgC,OAAO,CAAC,MAAM;CAC1F,CAAC,CAAC;IACD,CAAC,CAAA;CACF,CAAC","sourcesContent":["import { CreateQpqAppStep } from '../types';\n\nexport const printNextSteps: CreateQpqAppStep = {\n name: 'Done',\n\n run: async ({ answers }) => {\n const install = answers.installDependencies ? '' : ' npm install\\n npm run build\\n';\n\n console.log(`\nCreated ${answers.appName}!\n\nYour app has five services
|
|
1
|
+
{"version":3,"file":"013_printNextSteps.js","sourceRoot":"","sources":["../../../src/steps/013_printNextSteps.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEa,QAAA,cAAc,GAAqB;IAC9C,IAAI,EAAE,MAAM;IAEZ,GAAG,EAAE,KAAoB,EAAE,4CAAf,EAAE,OAAO,EAAE;QACrB,MAAM,OAAO,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,kCAAkC,CAAC;QAEtF,OAAO,CAAC,GAAG,CAAC;UACN,OAAO,CAAC,OAAO;;;;;;;OAOlB,OAAO,CAAC,OAAO;EACpB,OAAO;;;8BAGqB,OAAO,CAAC,OAAO,gCAAgC,OAAO,CAAC,MAAM;CAC1F,CAAC,CAAC;IACD,CAAC,CAAA;CACF,CAAC","sourcesContent":["import { CreateQpqAppStep } from '../types';\n\nexport const printNextSteps: CreateQpqAppStep = {\n name: 'Done',\n\n run: async ({ answers }) => {\n const install = answers.installDependencies ? '' : ' npm install\\n npm run build\\n';\n\n console.log(`\nCreated ${answers.appName}!\n\nYour app has five services (admin, auth, design, shell and todo) and\ndeploys as a single docker image.\n\nNext steps:\n\n cd ${answers.appName}\n${install} npm run dev # api on http://localhost:8080, web on http://localhost:3080\n npm run deploy # build the docker image (then run the printed docker command)\n\nDeploy config lives in apps/${answers.appName}/deploy.config.json (domain: ${answers.domain}).\n`);\n },\n};\n"]}
|
|
@@ -27,7 +27,7 @@ const _012_buildWorkspaces_1 = require("./012_buildWorkspaces");
|
|
|
27
27
|
Object.defineProperty(exports, "buildWorkspaces", { enumerable: true, get: function () { return _012_buildWorkspaces_1.buildWorkspaces; } });
|
|
28
28
|
const _013_printNextSteps_1 = require("./013_printNextSteps");
|
|
29
29
|
Object.defineProperty(exports, "printNextSteps", { enumerable: true, get: function () { return _013_printNextSteps_1.printNextSteps; } });
|
|
30
|
-
// The pipeline: always this list, always this order
|
|
30
|
+
// The pipeline: always this list, always this order; the numeric file
|
|
31
31
|
// prefixes match, so the steps directory reads top to bottom. Steps decide
|
|
32
32
|
// for themselves (shouldRun) whether the collected answers apply to them.
|
|
33
33
|
exports.createQpqAppSteps = [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/steps/index.ts"],"names":[],"mappings":";;;AACA,oDAA4C;AA2C1C,0FA3CO,0BAAS,OA2CP;AA1CX,0DAAkD;AAoChD,6FApCO,gCAAY,OAoCP;AAnCd,kEAA0D;AAoCxD,iGApCO,wCAAgB,OAoCP;AAnClB,8DAAsD;AAoCpD,+FApCO,oCAAc,OAoCP;AAnChB,kEAA0D;AA8BxD,iGA9BO,wCAAgB,OA8BP;AA7BlB,wDAAgD;AA8B9C,4FA9BO,8BAAW,OA8BP;AA7Bb,wEAAgE;AAoC9D,oGApCO,8CAAmB,OAoCP;AAnCrB,4EAAoE;AAuClE,sGAvCO,kDAAqB,OAuCP;AAtCvB,kEAA0D;AAqCxD,iGArCO,wCAAgB,OAqCP;AApClB,gDAAwC;AA+BtC,wFA/BO,sBAAO,OA+BP;AA9BT,sDAA8C;AA+B5C,2FA/BO,4BAAU,OA+BP;AA9BZ,gEAAwD;AAyBtD,gGAzBO,sCAAe,OAyBP;AAxBjB,8DAAsD;AAgCpD,+FAhCO,oCAAc,OAgCP;AA9BhB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/steps/index.ts"],"names":[],"mappings":";;;AACA,oDAA4C;AA2C1C,0FA3CO,0BAAS,OA2CP;AA1CX,0DAAkD;AAoChD,6FApCO,gCAAY,OAoCP;AAnCd,kEAA0D;AAoCxD,iGApCO,wCAAgB,OAoCP;AAnClB,8DAAsD;AAoCpD,+FApCO,oCAAc,OAoCP;AAnChB,kEAA0D;AA8BxD,iGA9BO,wCAAgB,OA8BP;AA7BlB,wDAAgD;AA8B9C,4FA9BO,8BAAW,OA8BP;AA7Bb,wEAAgE;AAoC9D,oGApCO,8CAAmB,OAoCP;AAnCrB,4EAAoE;AAuClE,sGAvCO,kDAAqB,OAuCP;AAtCvB,kEAA0D;AAqCxD,iGArCO,wCAAgB,OAqCP;AApClB,gDAAwC;AA+BtC,wFA/BO,sBAAO,OA+BP;AA9BT,sDAA8C;AA+B5C,2FA/BO,4BAAU,OA+BP;AA9BZ,gEAAwD;AAyBtD,gGAzBO,sCAAe,OAyBP;AAxBjB,8DAAsD;AAgCpD,+FAhCO,oCAAc,OAgCP;AA9BhB,sEAAsE;AACtE,2EAA2E;AAC3E,0EAA0E;AAC7D,QAAA,iBAAiB,GAAuB;IACnD,0BAAS;IACT,gCAAY;IACZ,wCAAgB;IAChB,oCAAc;IACd,wCAAgB;IAChB,8BAAW;IACX,8CAAmB;IACnB,kDAAqB;IACrB,wCAAgB;IAChB,sBAAO;IACP,4BAAU;IACV,sCAAe;IACf,oCAAc;CACf,CAAC","sourcesContent":["import { CreateQpqAppStep } from '../types';\nimport { preflight } from './001_preflight';\nimport { copyTemplate } from './002_copyTemplate';\nimport { deleteDocusaurus } from './003_deleteDocusaurus';\nimport { deleteQpqjsApp } from './004_deleteQpqjsApp';\nimport { applyAppIdentity } from './005_applyAppIdentity';\nimport { applyDomain } from './006_applyDomain';\nimport { pinRegistryVersions } from './007_pinRegistryVersions';\nimport { transpileToJavaScript } from './008_transpileToJavaScript';\nimport { restoreGitignore } from './009_restoreGitignore';\nimport { gitInit } from './010_gitInit';\nimport { npmInstall } from './011_npmInstall';\nimport { buildWorkspaces } from './012_buildWorkspaces';\nimport { printNextSteps } from './013_printNextSteps';\n\n// The pipeline: always this list, always this order; the numeric file\n// prefixes match, so the steps directory reads top to bottom. Steps decide\n// for themselves (shouldRun) whether the collected answers apply to them.\nexport const createQpqAppSteps: CreateQpqAppStep[] = [\n preflight,\n copyTemplate,\n deleteDocusaurus,\n deleteQpqjsApp,\n applyAppIdentity,\n applyDomain,\n pinRegistryVersions,\n transpileToJavaScript,\n restoreGitignore,\n gitInit,\n npmInstall,\n buildWorkspaces,\n printNextSteps,\n];\n\nexport {\n applyAppIdentity,\n applyDomain,\n buildWorkspaces,\n copyTemplate,\n deleteDocusaurus,\n deleteQpqjsApp,\n gitInit,\n npmInstall,\n pinRegistryVersions,\n preflight,\n printNextSteps,\n restoreGitignore,\n transpileToJavaScript,\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AppLanguage.js","sourceRoot":"","sources":["../../../src/types/AppLanguage.ts"],"names":[],"mappings":";;;AAAA,IAAY,WAGX;AAHD,WAAY,WAAW;IACrB,wCAAyB,CAAA;IACzB,wCAAyB,CAAA;AAC3B,CAAC,EAHW,WAAW,2BAAX,WAAW,QAGtB","sourcesContent":["export enum AppLanguage {\n typescript = 'typescript',\n javascript = 'javascript',\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CreateQpqAppAnswers.js","sourceRoot":"","sources":["../../../src/types/CreateQpqAppAnswers.ts"],"names":[],"mappings":"","sourcesContent":["import { AppLanguage } from './AppLanguage';\n\n// Everything the pipeline needs to know, collected ONCE (flags first, prompts\n// for whatever is still missing) before any step runs: steps never prompt.\nexport type CreateQpqAppAnswers = {\n appName: string;\n language: AppLanguage;\n domain: string;\n initialiseGit: boolean;\n installDependencies: boolean;\n};\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { CreateQpqAppAnswers } from './CreateQpqAppAnswers';
|
|
2
|
+
import { StepContext } from './StepContext';
|
|
3
|
+
export type CreateQpqAppStep = {
|
|
4
|
+
name: string;
|
|
5
|
+
shouldRun?: (answers: CreateQpqAppAnswers) => boolean;
|
|
6
|
+
run: (context: StepContext) => Promise<void>;
|
|
7
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CreateQpqAppStep.js","sourceRoot":"","sources":["../../../src/types/CreateQpqAppStep.ts"],"names":[],"mappings":"","sourcesContent":["import { CreateQpqAppAnswers } from './CreateQpqAppAnswers';\nimport { StepContext } from './StepContext';\n\n// A self-contained scaffolding step. The pipeline always runs the same list\n// top to bottom; each step owns its applicability via shouldRun.\nexport type CreateQpqAppStep = {\n name: string;\n shouldRun?: (answers: CreateQpqAppAnswers) => boolean;\n run: (context: StepContext) => Promise<void>;\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StepContext.js","sourceRoot":"","sources":["../../../src/types/StepContext.ts"],"names":[],"mappings":"","sourcesContent":["import { CreateQpqAppAnswers } from './CreateQpqAppAnswers';\n\nexport type StepContext = {\n // Absolute path of the directory being scaffolded (<cwd>/<appName>).\n targetDirectory: string;\n // Absolute path of the bundled template snapshot (a pruned quidproquojs.com).\n templateDirectory: string;\n // create-qpq-app's own version. The generated app pins its quidproquo-*\n // dependencies to this (the packages are published in lockstep).\n ownVersion: string;\n answers: CreateQpqAppAnswers;\n};\n"]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./AppLanguage"), exports);
|
|
18
|
+
__exportStar(require("./CreateQpqAppAnswers"), exports);
|
|
19
|
+
__exportStar(require("./CreateQpqAppStep"), exports);
|
|
20
|
+
__exportStar(require("./StepContext"), exports);
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B;AAC9B,wDAAsC;AACtC,qDAAmC;AACnC,gDAA8B","sourcesContent":["export * from './AppLanguage';\nexport * from './CreateQpqAppAnswers';\nexport * from './CreateQpqAppStep';\nexport * from './StepContext';\n"]}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import path from 'path';
|
|
2
|
-
import { getArgValue
|
|
3
|
-
import { getOwnPackageRoot
|
|
4
|
-
import {
|
|
2
|
+
import { getArgValue } from '../lib/getArgValue';
|
|
3
|
+
import { getOwnPackageRoot } from '../lib/getOwnPackageRoot';
|
|
4
|
+
import { getOwnVersion } from '../lib/getOwnVersion';
|
|
5
|
+
import { getPositionalArgs } from '../lib/getPositionalArgs';
|
|
6
|
+
import { promptSelect } from '../lib/promptSelect';
|
|
5
7
|
import { createQpqAppSteps } from '../steps';
|
|
6
8
|
import { AppLanguage } from '../types';
|
|
7
9
|
const USAGE = `Usage: npx create-qpq-app <app-name> [options]
|
|
@@ -12,13 +14,13 @@ Options:
|
|
|
12
14
|
--no-git skip git init
|
|
13
15
|
--no-install skip npm install
|
|
14
16
|
`;
|
|
15
|
-
// Resolve the language from a flag when given, otherwise prompt
|
|
17
|
+
// Resolve the language from a flag when given, otherwise prompt. Flags keep
|
|
16
18
|
// CI and tests non-interactive.
|
|
17
19
|
const resolveLanguage = async (argv) => {
|
|
18
20
|
const flagValue = getArgValue(argv, '--language')?.toLowerCase();
|
|
19
21
|
if (flagValue) {
|
|
20
22
|
if (!(flagValue in AppLanguage)) {
|
|
21
|
-
throw new Error(`Unknown --language "${flagValue}"
|
|
23
|
+
throw new Error(`Unknown --language "${flagValue}", use typescript or javascript.`);
|
|
22
24
|
}
|
|
23
25
|
return AppLanguage[flagValue];
|
|
24
26
|
}
|
|
@@ -31,7 +33,7 @@ export const runCreateQpqApp = async (argv) => {
|
|
|
31
33
|
console.log(USAGE);
|
|
32
34
|
process.exit(appName ? 0 : 1);
|
|
33
35
|
}
|
|
34
|
-
// All answers are locked in before the first step runs
|
|
36
|
+
// All answers are locked in before the first step runs, no mid-pipeline
|
|
35
37
|
// prompting, so every step sees the same complete answers object.
|
|
36
38
|
const answers = {
|
|
37
39
|
appName,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runCreateQpqApp.js","sourceRoot":"","sources":["../../../src/cli/runCreateQpqApp.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"runCreateQpqApp.js","sourceRoot":"","sources":["../../../src/cli/runCreateQpqApp.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAoC,MAAM,UAAU,CAAC;AAEzE,MAAM,KAAK,GAAG;;;;;;;CAOb,CAAC;AAEF,4EAA4E;AAC5E,gCAAgC;AAChC,MAAM,eAAe,GAAG,KAAK,EAAE,IAAc,EAAwB,EAAE;IACrE,MAAM,SAAS,GAAG,WAAW,CAAC,IAAI,EAAE,YAAY,CAAC,EAAE,WAAW,EAAE,CAAC;IACjE,IAAI,SAAS,EAAE,CAAC;QACd,IAAI,CAAC,CAAC,SAAS,IAAI,WAAW,CAAC,EAAE,CAAC;YAChC,MAAM,IA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CAAC,IAAI,CAAC,iBAAiB,EAAE,EAAE,UAAU,CAAC;QAC7D,UAAU,EAAE,aAAa,EAAE;QAC3B,OAAO;KACR,CAAC;IAEF,KAAK,MAAM,IAAI,IAAI,iBAAiB,EAAE,CAAC;QACrC,IAAI,IAAI,CAAC,SAAS,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC;YAC/C,SAAS;QACX,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;QAChC,MAAM,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAC1B,CAAC;AACH,CAAC,CAAC","sourcesContent":["import path from 'path';\n\nimport { getArgValue } from '../lib/getArgValue';\nimport { getOwnPackageRoot } from '../lib/getOwnPackageRoot';\nimport { getOwnVersion } from '../lib/getOwnVersion';\nimport { getPositionalArgs } from '../lib/getPositionalArgs';\nimport { promptSelect } from '../lib/promptSelect';\nimport { createQpqAppSteps } from '../steps';\nimport { AppLanguage, CreateQpqAppAnswers, StepContext } from '../types';\n\nconst USAGE = `Usage: npx create-qpq-app <app-name> [options]\n\nOptions:\n --language <typescript|javascript> skip the language prompt\n --domain <domain> app domain (default: <app-name>.example.com)\n --no-git skip git init\n --no-install skip npm install\n`;\n\n// Resolve the language from a flag when given, otherwise prompt. Flags keep\n// CI and tests non-interactive.\nconst resolveLanguage = async (argv: string[]): Promise<AppLanguage> => {\n const flagValue = getArgValue(argv, '--language')?.toLowerCase();\n if (flagValue) {\n if (!(flagValue in AppLanguage)) {\n throw new Error(`Unknown --language \"${flagValue}\", use typescript or javascript.`);\n }\n return AppLanguage[flagValue as keyof typeof AppLanguage];\n }\n\n const selected = await promptSelect('Which language would you like?', ['TypeScript', 'JavaScript'], 'TypeScript');\n return selected === 'JavaScript' ? AppLanguage.javascript : AppLanguage.typescript;\n};\n\nexport const runCreateQpqApp = async (argv: string[]): Promise<void> => {\n const [appName] = getPositionalArgs(argv, ['--language', '--domain']);\n\n if (!appName || argv.includes('--help')) {\n console.log(USAGE);\n process.exit(appName ? 0 : 1);\n }\n\n // All answers are locked in before the first step runs, no mid-pipeline\n // prompting, so every step sees the same complete answers object.\n const answers: CreateQpqAppAnswers = {\n appName,\n language: await resolveLanguage(argv),\n domain: getArgValue(argv, '--domain') ?? `${appName}.example.com`,\n initialiseGit: !argv.includes('--no-git'),\n installDependencies: !argv.includes('--no-install'),\n };\n\n const context: StepContext = {\n targetDirectory: path.resolve(process.cwd(), appName),\n templateDirectory: path.join(getOwnPackageRoot(), 'template'),\n ownVersion: getOwnVersion(),\n answers,\n };\n\n for (const step of createQpqAppSteps) {\n if (step.shouldRun && !step.shouldRun(answers)) {\n continue;\n }\n\n console.log(`\\n▸ ${step.name}`);\n await step.run(context);\n }\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getArgValue: (argv: string[], flag: string) => string | undefined;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// Value of a flag over the command's argv, supporting both `--flag value`
|
|
2
|
+
// and `--flag=value` forms.
|
|
3
|
+
export const getArgValue = (argv, flag) => {
|
|
4
|
+
const eq = argv.find((a) => a.startsWith(`${flag}=`));
|
|
5
|
+
if (eq)
|
|
6
|
+
return eq.slice(`${flag}=`.length);
|
|
7
|
+
const idx = argv.indexOf(flag);
|
|
8
|
+
return idx >= 0 ? argv[idx + 1] : undefined;
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=getArgValue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getArgValue.js","sourceRoot":"","sources":["../../../src/lib/getArgValue.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,4BAA4B;AAC5B,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,IAAc,EAAE,IAAY,EAAsB,EAAE;IAC9E,MAAM,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC;IACtD,IAAI,EAAE;QAAE,OAAO,EAAE,CAAC,KAAK,CAAC,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC;IAC3C,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/B,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAC9C,CAAC,CAAC","sourcesContent":["// Value of a flag over the command's argv, supporting both `--flag value`\n// and `--flag=value` forms.\nexport const getArgValue = (argv: string[], flag: string): string | undefined => {\n const eq = argv.find((a) => a.startsWith(`${flag}=`));\n if (eq) return eq.slice(`${flag}=`.length);\n const idx = argv.indexOf(flag);\n return idx >= 0 ? argv[idx + 1] : undefined;\n};\n"]}
|
|
@@ -11,8 +11,4 @@ export const getOwnPackageRoot = () => {
|
|
|
11
11
|
}
|
|
12
12
|
return dir;
|
|
13
13
|
};
|
|
14
|
-
|
|
15
|
-
const packageJson = JSON.parse(fs.readFileSync(path.join(getOwnPackageRoot(), 'package.json'), 'utf8'));
|
|
16
|
-
return packageJson.version;
|
|
17
|
-
};
|
|
18
|
-
//# sourceMappingURL=packageRoot.js.map
|
|
14
|
+
//# sourceMappingURL=getOwnPackageRoot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getOwnPackageRoot.js","sourceRoot":"","sources":["../../../src/lib/getOwnPackageRoot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,4EAA4E;AAC5E,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAW,EAAE;IAC5C,IAAI,GAAG,GAAG,SAAS,CAAC;IACpB,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC;QACtD,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACjC,IAAI,MAAM,KAAK,GAAG;YAAE,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;QACxF,GAAG,GAAG,MAAM,CAAC;IACf,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC,CAAC","sourcesContent":["import fs from 'fs';\nimport path from 'path';\n\n// This package's root (works from src under ts-node and from lib/commonjs).\nexport const getOwnPackageRoot = (): string => {\n let dir = __dirname;\n while (!fs.existsSync(path.join(dir, 'package.json'))) {\n const parent = path.dirname(dir);\n if (parent === dir) throw new Error('Could not locate the create-qpq-app package root');\n dir = parent;\n }\n return dir;\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getOwnVersion: () => string;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import { getOwnPackageRoot } from './getOwnPackageRoot';
|
|
4
|
+
export const getOwnVersion = () => {
|
|
5
|
+
const packageJson = JSON.parse(fs.readFileSync(path.join(getOwnPackageRoot(), 'package.json'), 'utf8'));
|
|
6
|
+
return packageJson.version;
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=getOwnVersion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getOwnVersion.js","sourceRoot":"","sources":["../../../src/lib/getOwnVersion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,MAAM,CAAC,MAAM,aAAa,GAAG,GAAW,EAAE;IACxC,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,iBAAiB,EAAE,EAAE,cAAc,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;IACxG,OAAO,WAAW,CAAC,OAAO,CAAC;AAC7B,CAAC,CAAC","sourcesContent":["import fs from 'fs';\nimport path from 'path';\n\nimport { getOwnPackageRoot } from './getOwnPackageRoot';\n\nexport const getOwnVersion = (): string => {\n const packageJson = JSON.parse(fs.readFileSync(path.join(getOwnPackageRoot(), 'package.json'), 'utf8'));\n return packageJson.version;\n};\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// Positional args = non-flag args, skipping values consumed by known flags.
|
|
2
|
+
export const getPositionalArgs = (argv, valueFlags) => argv.filter((arg, index) => {
|
|
3
|
+
if (arg.startsWith('--'))
|
|
4
|
+
return false;
|
|
5
|
+
const previous = argv[index - 1];
|
|
6
|
+
return !(previous && valueFlags.includes(previous));
|
|
7
|
+
});
|
|
8
|
+
//# sourceMappingURL=getPositionalArgs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getPositionalArgs.js","sourceRoot":"","sources":["../../../src/lib/getPositionalArgs.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,IAAc,EAAE,UAAoB,EAAY,EAAE,CAClF,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE;IACzB,IAAI,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC;QAAE,OAAO,KAAK,CAAC;IACvC,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;IACjC,OAAO,CAAC,CAAC,QAAQ,IAAI,UAAU,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC;AACtD,CAAC,CAAC,CAAC","sourcesContent":["// Positional args = non-flag args, skipping values consumed by known flags.\nexport const getPositionalArgs = (argv: string[], valueFlags: string[]): string[] =>\n argv.filter((arg, index) => {\n if (arg.startsWith('--')) return false;\n const previous = argv[index - 1];\n return !(previous && valueFlags.includes(previous));\n });\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from './getArgValue';
|
|
2
|
+
export * from './getOwnPackageRoot';
|
|
3
|
+
export * from './getOwnVersion';
|
|
4
|
+
export * from './getPositionalArgs';
|
|
5
|
+
export * from './listFilesRecursive';
|
|
6
|
+
export * from './promptSelect';
|
|
7
|
+
export * from './readJsonFile';
|
|
8
|
+
export * from './replaceInFileExact';
|
|
9
|
+
export * from './replaceInFiles';
|
|
10
|
+
export * from './runCommand';
|
|
11
|
+
export * from './writeJsonFile';
|