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
|
@@ -14,9 +14,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.runCreateQpqApp = void 0;
|
|
16
16
|
const path_1 = __importDefault(require("path"));
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
const
|
|
17
|
+
const getArgValue_1 = require("../lib/getArgValue");
|
|
18
|
+
const getOwnPackageRoot_1 = require("../lib/getOwnPackageRoot");
|
|
19
|
+
const getOwnVersion_1 = require("../lib/getOwnVersion");
|
|
20
|
+
const getPositionalArgs_1 = require("../lib/getPositionalArgs");
|
|
21
|
+
const promptSelect_1 = require("../lib/promptSelect");
|
|
20
22
|
const steps_1 = require("../steps");
|
|
21
23
|
const types_1 = require("../types");
|
|
22
24
|
const USAGE = `Usage: npx create-qpq-app <app-name> [options]
|
|
@@ -27,40 +29,40 @@ Options:
|
|
|
27
29
|
--no-git skip git init
|
|
28
30
|
--no-install skip npm install
|
|
29
31
|
`;
|
|
30
|
-
// Resolve the language from a flag when given, otherwise prompt
|
|
32
|
+
// Resolve the language from a flag when given, otherwise prompt. Flags keep
|
|
31
33
|
// CI and tests non-interactive.
|
|
32
34
|
const resolveLanguage = (argv) => __awaiter(void 0, void 0, void 0, function* () {
|
|
33
35
|
var _a;
|
|
34
|
-
const flagValue = (_a = (0,
|
|
36
|
+
const flagValue = (_a = (0, getArgValue_1.getArgValue)(argv, '--language')) === null || _a === void 0 ? void 0 : _a.toLowerCase();
|
|
35
37
|
if (flagValue) {
|
|
36
38
|
if (!(flagValue in types_1.AppLanguage)) {
|
|
37
|
-
throw new Error(`Unknown --language "${flagValue}"
|
|
39
|
+
throw new Error(`Unknown --language "${flagValue}", use typescript or javascript.`);
|
|
38
40
|
}
|
|
39
41
|
return types_1.AppLanguage[flagValue];
|
|
40
42
|
}
|
|
41
|
-
const selected = yield (0,
|
|
43
|
+
const selected = yield (0, promptSelect_1.promptSelect)('Which language would you like?', ['TypeScript', 'JavaScript'], 'TypeScript');
|
|
42
44
|
return selected === 'JavaScript' ? types_1.AppLanguage.javascript : types_1.AppLanguage.typescript;
|
|
43
45
|
});
|
|
44
46
|
const runCreateQpqApp = (argv) => __awaiter(void 0, void 0, void 0, function* () {
|
|
45
47
|
var _a;
|
|
46
|
-
const [appName] = (0,
|
|
48
|
+
const [appName] = (0, getPositionalArgs_1.getPositionalArgs)(argv, ['--language', '--domain']);
|
|
47
49
|
if (!appName || argv.includes('--help')) {
|
|
48
50
|
console.log(USAGE);
|
|
49
51
|
process.exit(appName ? 0 : 1);
|
|
50
52
|
}
|
|
51
|
-
// All answers are locked in before the first step runs
|
|
53
|
+
// All answers are locked in before the first step runs, no mid-pipeline
|
|
52
54
|
// prompting, so every step sees the same complete answers object.
|
|
53
55
|
const answers = {
|
|
54
56
|
appName,
|
|
55
57
|
language: yield resolveLanguage(argv),
|
|
56
|
-
domain: (_a = (0,
|
|
58
|
+
domain: (_a = (0, getArgValue_1.getArgValue)(argv, '--domain')) !== null && _a !== void 0 ? _a : `${appName}.example.com`,
|
|
57
59
|
initialiseGit: !argv.includes('--no-git'),
|
|
58
60
|
installDependencies: !argv.includes('--no-install'),
|
|
59
61
|
};
|
|
60
62
|
const context = {
|
|
61
63
|
targetDirectory: path_1.default.resolve(process.cwd(), appName),
|
|
62
|
-
templateDirectory: path_1.default.join((0,
|
|
63
|
-
ownVersion: (0,
|
|
64
|
+
templateDirectory: path_1.default.join((0, getOwnPackageRoot_1.getOwnPackageRoot)(), 'template'),
|
|
65
|
+
ownVersion: (0, getOwnVersion_1.getOwnVersion)(),
|
|
64
66
|
answers,
|
|
65
67
|
};
|
|
66
68
|
for (const step of steps_1.createQpqAppSteps) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runCreateQpqApp.js","sourceRoot":"","sources":["../../../src/cli/runCreateQpqApp.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,gDAAwB;AAExB,
|
|
1
|
+
{"version":3,"file":"runCreateQpqApp.js","sourceRoot":"","sources":["../../../src/cli/runCreateQpqApp.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,gDAAwB;AAExB,oDAAiD;AACjD,gEAA6D;AAC7D,wDAAqD;AACrD,gEAA6D;AAC7D,sDAAmD;AACnD,oCAA6C;AAC7C,oCAAyE;AAEzE,MAAM,KAAK,GAAG;;;;;;;CAOb,CAAC;AAEF,4EAA4E;AAC5E,gCAAgC;AAChC,MAAM,eAAe,GAAG,CAAO,IAAc,EAAwB,EAAE;;IACrE,MAAM,SAAS,GAAG,MAAA,IAAA,yBAAW,EAAC,IAAI,EAAE,YAAY,CAAC,0CAAE,WAAW,EAAE,CAAC;IACjE,IAAI,SAAS,EAAE,CAAC;QACd,IAAI,CAAC,CAAC,SAAS,IAAI,mBAAW,CAAC,EAAE,CAAC;YAChC,MAAM,IAAI,KAAK,CAAC,uBAAuB,SAAS,kCAAkC,CAAC,CAAC;QACtF,CAAC;QACD,OAAO,mBAAW,CAAC,SAAqC,CAAC,CAAC;IAC5D,CAAC;IAED,MAAM,QAAQ,GAAG,MAAM,IAAA,2BAAY,EAAC,gCAAgC,EAAE,CAAC,YAAY,EAAE,YAAY,CAAC,EAAE,YAAY,CAAC,CAAC;IAClH,OAAO,QAAQ,KAAK,YAAY,CAAC,CAAC,CAAC,mBAAW,CAAC,UAAU,CAAC,CAAC,CAAC,mBAAW,CAAC,UAAU,CAAC;AACrF,CAAC,CAAA,CAAC;AAEK,MAAM,eAAe,GAAG,CAAO,IAAc,EAAiB,EAAE;;IACrE,MAAM,CAAC,OAAO,CAAC,GAAG,IAAA,qCAAiB,EAAC,IAAI,EAAE,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC,CAAC;IAEtE,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;QACxC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACnB,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAChC,CAAC;IAED,wEAAwE;IACxE,kEAAkE;IAClE,MAAM,OAAO,GAAwB;QACnC,OAAO;QACP,QAAQ,EAAE,MAAM,eAAe,CAAC,IAAI,CAAC;QACrC,MAAM,EAAE,MAAA,IAAA,yBAAW,EAAC,IAAI,EAAE,UAAU,CAAC,mCAAI,GAAG,OAAO,cAAc;QACjE,aAAa,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC;QACzC,mBAAmB,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC;KACpD,CAAC;IAEF,MAAM,OAAO,GAAgB;QAC3B,eAAe,EAAE,cAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,OAAO,CAAC;QACrD,iBAAiB,EAAE,cAAI,CAAC,IAAI,CAAC,IAAA,qCAAiB,GAAE,EAAE,UAAU,CAAC;QAC7D,UAAU,EAAE,IAAA,6BAAa,GAAE;QAC3B,OAAO;KACR,CAAC;IAEF,KAAK,MAAM,IAAI,IAAI,yBAAiB,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,CAAA,CAAC;AAjCW,QAAA,eAAe,mBAiC1B","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,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getArgValue = void 0;
|
|
4
|
+
// Value of a flag over the command's argv, supporting both `--flag value`
|
|
5
|
+
// and `--flag=value` forms.
|
|
6
|
+
const getArgValue = (argv, flag) => {
|
|
7
|
+
const eq = argv.find((a) => a.startsWith(`${flag}=`));
|
|
8
|
+
if (eq)
|
|
9
|
+
return eq.slice(`${flag}=`.length);
|
|
10
|
+
const idx = argv.indexOf(flag);
|
|
11
|
+
return idx >= 0 ? argv[idx + 1] : undefined;
|
|
12
|
+
};
|
|
13
|
+
exports.getArgValue = getArgValue;
|
|
14
|
+
//# 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;AACrB,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;AALW,QAAA,WAAW,eAKtB","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"]}
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.getOwnPackageRoot = void 0;
|
|
7
7
|
const fs_1 = __importDefault(require("fs"));
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
9
|
// This package's root (works from src under ts-node and from lib/commonjs).
|
|
@@ -18,9 +18,4 @@ const getOwnPackageRoot = () => {
|
|
|
18
18
|
return dir;
|
|
19
19
|
};
|
|
20
20
|
exports.getOwnPackageRoot = getOwnPackageRoot;
|
|
21
|
-
|
|
22
|
-
const packageJson = JSON.parse(fs_1.default.readFileSync(path_1.default.join((0, exports.getOwnPackageRoot)(), 'package.json'), 'utf8'));
|
|
23
|
-
return packageJson.version;
|
|
24
|
-
};
|
|
25
|
-
exports.getOwnVersion = getOwnVersion;
|
|
26
|
-
//# sourceMappingURL=packageRoot.js.map
|
|
21
|
+
//# sourceMappingURL=getOwnPackageRoot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getOwnPackageRoot.js","sourceRoot":"","sources":["../../../src/lib/getOwnPackageRoot.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAoB;AACpB,gDAAwB;AAExB,4EAA4E;AACrE,MAAM,iBAAiB,GAAG,GAAW,EAAE;IAC5C,IAAI,GAAG,GAAG,SAAS,CAAC;IACpB,OAAO,CAAC,YAAE,CAAC,UAAU,CAAC,cAAI,CAAC,IAAI,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC;QACtD,MAAM,MAAM,GAAG,cAAI,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;AARW,QAAA,iBAAiB,qBAQ5B","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,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getOwnVersion = void 0;
|
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const getOwnPackageRoot_1 = require("./getOwnPackageRoot");
|
|
10
|
+
const getOwnVersion = () => {
|
|
11
|
+
const packageJson = JSON.parse(fs_1.default.readFileSync(path_1.default.join((0, getOwnPackageRoot_1.getOwnPackageRoot)(), 'package.json'), 'utf8'));
|
|
12
|
+
return packageJson.version;
|
|
13
|
+
};
|
|
14
|
+
exports.getOwnVersion = getOwnVersion;
|
|
15
|
+
//# sourceMappingURL=getOwnVersion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getOwnVersion.js","sourceRoot":"","sources":["../../../src/lib/getOwnVersion.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAoB;AACpB,gDAAwB;AAExB,2DAAwD;AAEjD,MAAM,aAAa,GAAG,GAAW,EAAE;IACxC,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,YAAE,CAAC,YAAY,CAAC,cAAI,CAAC,IAAI,CAAC,IAAA,qCAAiB,GAAE,EAAE,cAAc,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;IACxG,OAAO,WAAW,CAAC,OAAO,CAAC;AAC7B,CAAC,CAAC;AAHW,QAAA,aAAa,iBAGxB","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,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getPositionalArgs = void 0;
|
|
4
|
+
// Positional args = non-flag args, skipping values consumed by known flags.
|
|
5
|
+
const getPositionalArgs = (argv, valueFlags) => argv.filter((arg, index) => {
|
|
6
|
+
if (arg.startsWith('--'))
|
|
7
|
+
return false;
|
|
8
|
+
const previous = argv[index - 1];
|
|
9
|
+
return !(previous && valueFlags.includes(previous));
|
|
10
|
+
});
|
|
11
|
+
exports.getPositionalArgs = getPositionalArgs;
|
|
12
|
+
//# sourceMappingURL=getPositionalArgs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getPositionalArgs.js","sourceRoot":"","sources":["../../../src/lib/getPositionalArgs.ts"],"names":[],"mappings":";;;AAAA,4EAA4E;AACrE,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;AALQ,QAAA,iBAAiB,qBAKzB","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';
|
|
@@ -0,0 +1,28 @@
|
|
|
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("./getArgValue"), exports);
|
|
18
|
+
__exportStar(require("./getOwnPackageRoot"), exports);
|
|
19
|
+
__exportStar(require("./getOwnVersion"), exports);
|
|
20
|
+
__exportStar(require("./getPositionalArgs"), exports);
|
|
21
|
+
__exportStar(require("./listFilesRecursive"), exports);
|
|
22
|
+
__exportStar(require("./promptSelect"), exports);
|
|
23
|
+
__exportStar(require("./readJsonFile"), exports);
|
|
24
|
+
__exportStar(require("./replaceInFileExact"), exports);
|
|
25
|
+
__exportStar(require("./replaceInFiles"), exports);
|
|
26
|
+
__exportStar(require("./runCommand"), exports);
|
|
27
|
+
__exportStar(require("./writeJsonFile"), exports);
|
|
28
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B;AAC9B,sDAAoC;AACpC,kDAAgC;AAChC,sDAAoC;AACpC,uDAAqC;AACrC,iDAA+B;AAC/B,iDAA+B;AAC/B,uDAAqC;AACrC,mDAAiC;AACjC,+CAA6B;AAC7B,kDAAgC","sourcesContent":["export * from './getArgValue';\nexport * from './getOwnPackageRoot';\nexport * from './getOwnVersion';\nexport * from './getPositionalArgs';\nexport * from './listFilesRecursive';\nexport * from './promptSelect';\nexport * from './readJsonFile';\nexport * from './replaceInFileExact';\nexport * from './replaceInFiles';\nexport * from './runCommand';\nexport * from './writeJsonFile';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const listFilesRecursive: (root: string) => string[];
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.listFilesRecursive = void 0;
|
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
// Depth-first list of every file under root (root must exist).
|
|
10
|
+
const listFilesRecursive = (root) => {
|
|
11
|
+
const files = [];
|
|
12
|
+
const walk = (dir) => {
|
|
13
|
+
for (const entry of fs_1.default.readdirSync(dir, { withFileTypes: true })) {
|
|
14
|
+
const fullPath = path_1.default.join(dir, entry.name);
|
|
15
|
+
if (entry.isDirectory()) {
|
|
16
|
+
walk(fullPath);
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
files.push(fullPath);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
walk(root);
|
|
24
|
+
return files;
|
|
25
|
+
};
|
|
26
|
+
exports.listFilesRecursive = listFilesRecursive;
|
|
27
|
+
//# sourceMappingURL=listFilesRecursive.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"listFilesRecursive.js","sourceRoot":"","sources":["../../../src/lib/listFilesRecursive.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAoB;AACpB,gDAAwB;AAExB,+DAA+D;AACxD,MAAM,kBAAkB,GAAG,CAAC,IAAY,EAAY,EAAE;IAC3D,MAAM,KAAK,GAAa,EAAE,CAAC;IAE3B,MAAM,IAAI,GAAG,CAAC,GAAW,EAAQ,EAAE;QACjC,KAAK,MAAM,KAAK,IAAI,YAAE,CAAC,WAAW,CAAC,GAAG,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;YACjE,MAAM,QAAQ,GAAG,cAAI,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;YAC5C,IAAI,KAAK,CAAC,WAAW,EAAE,EAAE,CAAC;gBACxB,IAAI,CAAC,QAAQ,CAAC,CAAC;YACjB,CAAC;iBAAM,CAAC;gBACN,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YACvB,CAAC;QACH,CAAC;IACH,CAAC,CAAC;IAEF,IAAI,CAAC,IAAI,CAAC,CAAC;IACX,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAhBW,QAAA,kBAAkB,sBAgB7B","sourcesContent":["import fs from 'fs';\nimport path from 'path';\n\n// Depth-first list of every file under root (root must exist).\nexport const listFilesRecursive = (root: string): string[] => {\n const files: string[] = [];\n\n const walk = (dir: string): void => {\n for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {\n const fullPath = path.join(dir, entry.name);\n if (entry.isDirectory()) {\n walk(fullPath);\n } else {\n files.push(fullPath);\n }\n }\n };\n\n walk(root);\n return files;\n};\n"]}
|
|
@@ -50,4 +50,4 @@ const promptSelect = (message, choices, defaultChoice) => __awaiter(void 0, void
|
|
|
50
50
|
return select({ message, choices, default: defaultChoice });
|
|
51
51
|
});
|
|
52
52
|
exports.promptSelect = promptSelect;
|
|
53
|
-
//# sourceMappingURL=
|
|
53
|
+
//# sourceMappingURL=promptSelect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"promptSelect.js","sourceRoot":"","sources":["../../../src/lib/promptSelect.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qEAAqE;AACrE,+EAA+E;AACxE,MAAM,YAAY,GAAG,CAAO,OAAe,EAAE,OAAiB,EAAE,aAAsB,EAAmB,EAAE;IAChH,MAAM,EAAE,MAAM,EAAE,GAAG,wDAAa,mBAAmB,GAAC,CAAC;IACrD,OAAO,MAAM,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,CAAC,CAAC;AAC9D,CAAC,CAAA,CAAC;AAHW,QAAA,YAAY,gBAGvB","sourcesContent":["// Present a single-choice list prompt and return the selected value.\n// @inquirer/prompts is imported lazily so fully-flagged runs never pay for it.\nexport const promptSelect = async (message: string, choices: string[], defaultChoice?: string): Promise<string> => {\n const { select } = await import('@inquirer/prompts');\n return select({ message, choices, default: defaultChoice });\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const readJsonFile: <T = any>(filePath: string) => T;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.readJsonFile = void 0;
|
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
|
8
|
+
// Default is any (not unknown) because every caller mutates loosely-shaped
|
|
9
|
+
// JSON (package.json, deploy configs) in place; forcing casts at each call
|
|
10
|
+
// site would add noise without safety.
|
|
11
|
+
const readJsonFile = (filePath) => JSON.parse(fs_1.default.readFileSync(filePath, 'utf8'));
|
|
12
|
+
exports.readJsonFile = readJsonFile;
|
|
13
|
+
//# sourceMappingURL=readJsonFile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"readJsonFile.js","sourceRoot":"","sources":["../../../src/lib/readJsonFile.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAoB;AAEpB,2EAA2E;AAC3E,2EAA2E;AAC3E,uCAAuC;AAChC,MAAM,YAAY,GAAG,CAAU,QAAgB,EAAK,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,YAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC;AAA/F,QAAA,YAAY,gBAAmF","sourcesContent":["import fs from 'fs';\n\n// Default is any (not unknown) because every caller mutates loosely-shaped\n// JSON (package.json, deploy configs) in place; forcing casts at each call\n// site would add noise without safety.\nexport const readJsonFile = <T = any>(filePath: string): T => JSON.parse(fs.readFileSync(filePath, 'utf8'));\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const replaceInFileExact: (filePath: string, from: string, to: string) => void;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.replaceInFileExact = void 0;
|
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
|
8
|
+
// Replace an exact string in one file, throwing if it isn't there. Targeted
|
|
9
|
+
// edits should fail loudly when the template drifts.
|
|
10
|
+
const replaceInFileExact = (filePath, from, to) => {
|
|
11
|
+
const original = fs_1.default.readFileSync(filePath, 'utf8');
|
|
12
|
+
if (!original.includes(from)) {
|
|
13
|
+
throw new Error(`Expected to find "${from}" in ${filePath}. Has the template changed?`);
|
|
14
|
+
}
|
|
15
|
+
fs_1.default.writeFileSync(filePath, original.split(from).join(to));
|
|
16
|
+
};
|
|
17
|
+
exports.replaceInFileExact = replaceInFileExact;
|
|
18
|
+
//# sourceMappingURL=replaceInFileExact.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"replaceInFileExact.js","sourceRoot":"","sources":["../../../src/lib/replaceInFileExact.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAoB;AAEpB,4EAA4E;AAC5E,qDAAqD;AAC9C,MAAM,kBAAkB,GAAG,CAAC,QAAgB,EAAE,IAAY,EAAE,EAAU,EAAQ,EAAE;IACrF,MAAM,QAAQ,GAAG,YAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IACnD,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;QAC7B,MAAM,IAAI,KAAK,CAAC,qBAAqB,IAAI,QAAQ,QAAQ,6BAA6B,CAAC,CAAC;IAC1F,CAAC;IACD,YAAE,CAAC,aAAa,CAAC,QAAQ,EAAE,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;AAC5D,CAAC,CAAC;AANW,QAAA,kBAAkB,sBAM7B","sourcesContent":["import fs from 'fs';\n\n// Replace an exact string in one file, throwing if it isn't there. Targeted\n// edits should fail loudly when the template drifts.\nexport const replaceInFileExact = (filePath: string, from: string, to: string): void => {\n const original = fs.readFileSync(filePath, 'utf8');\n if (!original.includes(from)) {\n throw new Error(`Expected to find \"${from}\" in ${filePath}. Has the template changed?`);\n }\n fs.writeFileSync(filePath, original.split(from).join(to));\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const replaceInFiles: (root: string, replacements: Array<[from: string, to: string]>) => void;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.replaceInFiles = void 0;
|
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const listFilesRecursive_1 = require("./listFilesRecursive");
|
|
10
|
+
// Extensions the rename sweeps are allowed to touch. Everything else
|
|
11
|
+
// (images, favicons, fonts) passes through untouched.
|
|
12
|
+
const TEXT_FILE_EXTENSIONS = new Set(['.ts', '.tsx', '.js', '.jsx', '.mjs', '.cjs', '.json', '.html', '.css', '.md', '.yml', '.yaml']);
|
|
13
|
+
// Apply literal (non-regex) string replacements to every text file under
|
|
14
|
+
// root. Replacement tokens are chosen to be collision-free ('@todo/',
|
|
15
|
+
// 'apps/todo/'), so this is a mechanical sweep, not a heuristic one.
|
|
16
|
+
const replaceInFiles = (root, replacements) => {
|
|
17
|
+
for (const filePath of (0, listFilesRecursive_1.listFilesRecursive)(root)) {
|
|
18
|
+
if (!TEXT_FILE_EXTENSIONS.has(path_1.default.extname(filePath))) {
|
|
19
|
+
continue;
|
|
20
|
+
}
|
|
21
|
+
const original = fs_1.default.readFileSync(filePath, 'utf8');
|
|
22
|
+
let updated = original;
|
|
23
|
+
for (const [from, to] of replacements) {
|
|
24
|
+
updated = updated.split(from).join(to);
|
|
25
|
+
}
|
|
26
|
+
if (updated !== original) {
|
|
27
|
+
fs_1.default.writeFileSync(filePath, updated);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
exports.replaceInFiles = replaceInFiles;
|
|
32
|
+
//# sourceMappingURL=replaceInFiles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"replaceInFiles.js","sourceRoot":"","sources":["../../../src/lib/replaceInFiles.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAoB;AACpB,gDAAwB;AAExB,6DAA0D;AAE1D,qEAAqE;AACrE,sDAAsD;AACtD,MAAM,oBAAoB,GAAG,IAAI,GAAG,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AAEvI,yEAAyE;AACzE,sEAAsE;AACtE,qEAAqE;AAC9D,MAAM,cAAc,GAAG,CAAC,IAAY,EAAE,YAA+C,EAAQ,EAAE;IACpG,KAAK,MAAM,QAAQ,IAAI,IAAA,uCAAkB,EAAC,IAAI,CAAC,EAAE,CAAC;QAChD,IAAI,CAAC,oBAAoB,CAAC,GAAG,CAAC,cAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC;YACtD,SAAS;QACX,CAAC;QAED,MAAM,QAAQ,GAAG,YAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QACnD,IAAI,OAAO,GAAG,QAAQ,CAAC;QACvB,KAAK,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,YAAY,EAAE,CAAC;YACtC,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACzC,CAAC;QAED,IAAI,OAAO,KAAK,QAAQ,EAAE,CAAC;YACzB,YAAE,CAAC,aAAa,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QACtC,CAAC;IACH,CAAC;AACH,CAAC,CAAC;AAhBW,QAAA,cAAc,kBAgBzB","sourcesContent":["import fs from 'fs';\nimport path from 'path';\n\nimport { listFilesRecursive } from './listFilesRecursive';\n\n// Extensions the rename sweeps are allowed to touch. Everything else\n// (images, favicons, fonts) passes through untouched.\nconst TEXT_FILE_EXTENSIONS = new Set(['.ts', '.tsx', '.js', '.jsx', '.mjs', '.cjs', '.json', '.html', '.css', '.md', '.yml', '.yaml']);\n\n// Apply literal (non-regex) string replacements to every text file under\n// root. Replacement tokens are chosen to be collision-free ('@todo/',\n// 'apps/todo/'), so this is a mechanical sweep, not a heuristic one.\nexport const replaceInFiles = (root: string, replacements: Array<[from: string, to: string]>): void => {\n for (const filePath of listFilesRecursive(root)) {\n if (!TEXT_FILE_EXTENSIONS.has(path.extname(filePath))) {\n continue;\n }\n\n const original = fs.readFileSync(filePath, 'utf8');\n let updated = original;\n for (const [from, to] of replacements) {\n updated = updated.split(from).join(to);\n }\n\n if (updated !== original) {\n fs.writeFileSync(filePath, updated);\n }\n }\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const writeJsonFile: (filePath: string, value: unknown) => void;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.writeJsonFile = void 0;
|
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
|
8
|
+
const writeJsonFile = (filePath, value) => {
|
|
9
|
+
fs_1.default.writeFileSync(filePath, `${JSON.stringify(value, null, 2)}\n`);
|
|
10
|
+
};
|
|
11
|
+
exports.writeJsonFile = writeJsonFile;
|
|
12
|
+
//# sourceMappingURL=writeJsonFile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"writeJsonFile.js","sourceRoot":"","sources":["../../../src/lib/writeJsonFile.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAoB;AAEb,MAAM,aAAa,GAAG,CAAC,QAAgB,EAAE,KAAc,EAAQ,EAAE;IACtE,YAAE,CAAC,aAAa,CAAC,QAAQ,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;AACpE,CAAC,CAAC;AAFW,QAAA,aAAa,iBAExB","sourcesContent":["import fs from 'fs';\n\nexport const writeJsonFile = (filePath: string, value: unknown): void => {\n fs.writeFileSync(filePath, `${JSON.stringify(value, null, 2)}\\n`);\n};\n"]}
|
|
@@ -22,14 +22,14 @@ exports.preflight = {
|
|
|
22
22
|
name: 'Checking prerequisites',
|
|
23
23
|
run: (_a) => __awaiter(void 0, [_a], void 0, function* ({ targetDirectory, answers }) {
|
|
24
24
|
if (!VALID_APP_NAME.test(answers.appName)) {
|
|
25
|
-
throw new Error(`"${answers.appName}" is not a valid app name
|
|
25
|
+
throw new Error(`"${answers.appName}" is not a valid app name: use lowercase letters, digits and hyphens, starting with a letter.`);
|
|
26
26
|
}
|
|
27
27
|
const nodeMajor = Number(process.versions.node.split('.')[0]);
|
|
28
28
|
if (nodeMajor < MINIMUM_NODE_MAJOR) {
|
|
29
|
-
throw new Error(`quidproquo apps require node >= ${MINIMUM_NODE_MAJOR} (you are on ${process.versions.node})
|
|
29
|
+
throw new Error(`quidproquo apps require node >= ${MINIMUM_NODE_MAJOR} (you are on ${process.versions.node}). Upgrade node and re-run.`);
|
|
30
30
|
}
|
|
31
31
|
if (fs_1.default.existsSync(targetDirectory)) {
|
|
32
|
-
throw new Error(`${targetDirectory} already exists
|
|
32
|
+
throw new Error(`${targetDirectory} already exists. Pick a different name or remove it first.`);
|
|
33
33
|
}
|
|
34
34
|
}),
|
|
35
35
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"001_preflight.js","sourceRoot":"","sources":["../../../src/steps/001_preflight.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,4CAAoB;AAIpB,qEAAqE;AACrE,+BAA+B;AAC/B,MAAM,cAAc,GAAG,mBAAmB,CAAC;AAE3C,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAEjB,QAAA,SAAS,GAAqB;IACzC,IAAI,EAAE,wBAAwB;IAE9B,GAAG,EAAE,KAAqC,EAAE,4CAAhC,EAAE,eAAe,EAAE,OAAO,EAAE;QACtC,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;YAC1C,MAAM,IAAI,KAAK,CAAC,IAAI,OAAO,CAAC,OAAO,
|
|
1
|
+
{"version":3,"file":"001_preflight.js","sourceRoot":"","sources":["../../../src/steps/001_preflight.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,4CAAoB;AAIpB,qEAAqE;AACrE,+BAA+B;AAC/B,MAAM,cAAc,GAAG,mBAAmB,CAAC;AAE3C,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAEjB,QAAA,SAAS,GAAqB;IACzC,IAAI,EAAE,wBAAwB;IAE9B,GAAG,EAAE,KAAqC,EAAE,4CAAhC,EAAE,eAAe,EAAE,OAAO,EAAE;QACtC,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;YAC1C,MAAM,IAAI,KAAK,CAAC,IAAI,OAAO,CAAC,OAAO,+FAA+F,CAAC,CAAC;QACtI,CAAC;QAED,MAAM,SAAS,GAAG,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC9D,IAAI,SAAS,GAAG,kBAAkB,EAAE,CAAC;YACnC,MAAM,IAAI,KAAK,CAAC,mCAAmC,kBAAkB,gBAAgB,OAAO,CAAC,QAAQ,CAAC,IAAI,6BAA6B,CAAC,CAAC;QAC3I,CAAC;QAED,IAAI,YAAE,CAAC,UAAU,CAAC,eAAe,CAAC,EAAE,CAAC;YACnC,MAAM,IAAI,KAAK,CAAC,GAAG,eAAe,4DAA4D,CAAC,CAAC;QAClG,CAAC;IACH,CAAC,CAAA;CACF,CAAC","sourcesContent":["import fs from 'fs';\n\nimport { CreateQpqAppStep } from '../types';\n\n// npm-safe, unscoped, url-friendly: lowercase, starts with a letter,\n// letters/digits/hyphens only.\nconst VALID_APP_NAME = /^[a-z][a-z0-9-]*$/;\n\nconst MINIMUM_NODE_MAJOR = 22;\n\nexport const preflight: CreateQpqAppStep = {\n name: 'Checking prerequisites',\n\n run: async ({ targetDirectory, answers }) => {\n if (!VALID_APP_NAME.test(answers.appName)) {\n throw new Error(`\"${answers.appName}\" is not a valid app name: use lowercase letters, digits and hyphens, starting with a letter.`);\n }\n\n const nodeMajor = Number(process.versions.node.split('.')[0]);\n if (nodeMajor < MINIMUM_NODE_MAJOR) {\n throw new Error(`quidproquo apps require node >= ${MINIMUM_NODE_MAJOR} (you are on ${process.versions.node}). Upgrade node and re-run.`);\n }\n\n if (fs.existsSync(targetDirectory)) {\n throw new Error(`${targetDirectory} already exists. Pick a different name or remove it first.`);\n }\n },\n};\n"]}
|
|
@@ -21,7 +21,7 @@ exports.copyTemplate = {
|
|
|
21
21
|
name: 'Copying template',
|
|
22
22
|
run: (_a) => __awaiter(void 0, [_a], void 0, function* ({ templateDirectory, targetDirectory }) {
|
|
23
23
|
if (!fs_1.default.existsSync(templateDirectory)) {
|
|
24
|
-
throw new Error(`Template snapshot missing at ${templateDirectory}
|
|
24
|
+
throw new Error(`Template snapshot missing at ${templateDirectory}: run "npm run snapshot-template" (dev checkout only; published packages ship it).`);
|
|
25
25
|
}
|
|
26
26
|
fs_1.default.cpSync(templateDirectory, targetDirectory, { recursive: true });
|
|
27
27
|
}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"002_copyTemplate.js","sourceRoot":"","sources":["../../../src/steps/002_copyTemplate.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,4CAAoB;AAIpB,4EAA4E;AAC5E,2EAA2E;AAC3E,yBAAyB;AACZ,QAAA,YAAY,GAAqB;IAC5C,IAAI,EAAE,kBAAkB;IAExB,GAAG,EAAE,KAA+C,EAAE,4CAA1C,EAAE,iBAAiB,EAAE,eAAe,EAAE;QAChD,IAAI,CAAC,YAAE,CAAC,UAAU,CAAC,iBAAiB,CAAC,EAAE,CAAC;YACtC,MAAM,IAAI,KAAK,CACb,gCAAgC,iBAAiB,
|
|
1
|
+
{"version":3,"file":"002_copyTemplate.js","sourceRoot":"","sources":["../../../src/steps/002_copyTemplate.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,4CAAoB;AAIpB,4EAA4E;AAC5E,2EAA2E;AAC3E,yBAAyB;AACZ,QAAA,YAAY,GAAqB;IAC5C,IAAI,EAAE,kBAAkB;IAExB,GAAG,EAAE,KAA+C,EAAE,4CAA1C,EAAE,iBAAiB,EAAE,eAAe,EAAE;QAChD,IAAI,CAAC,YAAE,CAAC,UAAU,CAAC,iBAAiB,CAAC,EAAE,CAAC;YACtC,MAAM,IAAI,KAAK,CACb,gCAAgC,iBAAiB,oFAAoF,CACtI,CAAC;QACJ,CAAC;QAED,YAAE,CAAC,MAAM,CAAC,iBAAiB,EAAE,eAAe,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACrE,CAAC,CAAA;CACF,CAAC","sourcesContent":["import fs from 'fs';\n\nimport { CreateQpqAppStep } from '../types';\n\n// Dumb copy of the bundled template (a pruned snapshot of quidproquojs.com,\n// taken at publish time) into the target directory. All shaping happens in\n// the steps that follow.\nexport const copyTemplate: CreateQpqAppStep = {\n name: 'Copying template',\n\n run: async ({ templateDirectory, targetDirectory }) => {\n if (!fs.existsSync(templateDirectory)) {\n throw new Error(\n `Template snapshot missing at ${templateDirectory}: run \"npm run snapshot-template\" (dev checkout only; published packages ship it).`,\n );\n }\n\n fs.cpSync(templateDirectory, targetDirectory, { recursive: true });\n },\n};\n"]}
|
|
@@ -15,8 +15,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
15
15
|
exports.deleteDocusaurus = void 0;
|
|
16
16
|
const fs_1 = __importDefault(require("fs"));
|
|
17
17
|
const path_1 = __importDefault(require("path"));
|
|
18
|
-
const
|
|
19
|
-
|
|
18
|
+
const readJsonFile_1 = require("../lib/readJsonFile");
|
|
19
|
+
const writeJsonFile_1 = require("../lib/writeJsonFile");
|
|
20
|
+
// The docusaurus workspace is the quidproquojs.com documentation site; new
|
|
20
21
|
// apps don't want it. Remove the directory and its workspaces entry.
|
|
21
22
|
exports.deleteDocusaurus = {
|
|
22
23
|
name: 'Removing docusaurus docs site',
|
|
@@ -24,9 +25,9 @@ exports.deleteDocusaurus = {
|
|
|
24
25
|
var _b;
|
|
25
26
|
fs_1.default.rmSync(path_1.default.join(targetDirectory, 'docusaurus'), { recursive: true, force: true });
|
|
26
27
|
const packageJsonPath = path_1.default.join(targetDirectory, 'package.json');
|
|
27
|
-
const packageJson = (0,
|
|
28
|
+
const packageJson = (0, readJsonFile_1.readJsonFile)(packageJsonPath);
|
|
28
29
|
packageJson.workspaces = ((_b = packageJson.workspaces) !== null && _b !== void 0 ? _b : []).filter((workspace) => workspace !== 'docusaurus');
|
|
29
|
-
(0,
|
|
30
|
+
(0, writeJsonFile_1.writeJsonFile)(packageJsonPath, packageJson);
|
|
30
31
|
}),
|
|
31
32
|
};
|
|
32
33
|
//# sourceMappingURL=003_deleteDocusaurus.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"003_deleteDocusaurus.js","sourceRoot":"","sources":["../../../src/steps/003_deleteDocusaurus.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,4CAAoB;AACpB,gDAAwB;AAExB,
|
|
1
|
+
{"version":3,"file":"003_deleteDocusaurus.js","sourceRoot":"","sources":["../../../src/steps/003_deleteDocusaurus.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,4CAAoB;AACpB,gDAAwB;AAExB,sDAAmD;AACnD,wDAAqD;AAGrD,2EAA2E;AAC3E,qEAAqE;AACxD,QAAA,gBAAgB,GAAqB;IAChD,IAAI,EAAE,+BAA+B;IAErC,GAAG,EAAE,KAA4B,EAAE,4CAAvB,EAAE,eAAe,EAAE;;QAC7B,YAAE,CAAC,MAAM,CAAC,cAAI,CAAC,IAAI,CAAC,eAAe,EAAE,YAAY,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QAEtF,MAAM,eAAe,GAAG,cAAI,CAAC,IAAI,CAAC,eAAe,EAAE,cAAc,CAAC,CAAC;QACnE,MAAM,WAAW,GAAG,IAAA,2BAAY,EAAC,eAAe,CAAC,CAAC;QAClD,WAAW,CAAC,UAAU,GAAG,CAAC,MAAA,WAAW,CAAC,UAAU,mCAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,SAAiB,EAAE,EAAE,CAAC,SAAS,KAAK,YAAY,CAAC,CAAC;QAClH,IAAA,6BAAa,EAAC,eAAe,EAAE,WAAW,CAAC,CAAC;IAC9C,CAAC,CAAA;CACF,CAAC","sourcesContent":["import fs from 'fs';\nimport path from 'path';\n\nimport { readJsonFile } from '../lib/readJsonFile';\nimport { writeJsonFile } from '../lib/writeJsonFile';\nimport { CreateQpqAppStep } from '../types';\n\n// The docusaurus workspace is the quidproquojs.com documentation site; new\n// apps don't want it. Remove the directory and its workspaces entry.\nexport const deleteDocusaurus: CreateQpqAppStep = {\n name: 'Removing docusaurus docs site',\n\n run: async ({ targetDirectory }) => {\n fs.rmSync(path.join(targetDirectory, 'docusaurus'), { recursive: true, force: true });\n\n const packageJsonPath = path.join(targetDirectory, 'package.json');\n const packageJson = readJsonFile(packageJsonPath);\n packageJson.workspaces = (packageJson.workspaces ?? []).filter((workspace: string) => workspace !== 'docusaurus');\n writeJsonFile(packageJsonPath, packageJson);\n },\n};\n"]}
|
|
@@ -15,9 +15,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
15
15
|
exports.applyAppIdentity = void 0;
|
|
16
16
|
const fs_1 = __importDefault(require("fs"));
|
|
17
17
|
const path_1 = __importDefault(require("path"));
|
|
18
|
-
const
|
|
18
|
+
const readJsonFile_1 = require("../lib/readJsonFile");
|
|
19
|
+
const replaceInFileExact_1 = require("../lib/replaceInFileExact");
|
|
20
|
+
const replaceInFiles_1 = require("../lib/replaceInFiles");
|
|
21
|
+
const writeJsonFile_1 = require("../lib/writeJsonFile");
|
|
19
22
|
// Give the app its identity. Only targeted, collision-free tokens are
|
|
20
|
-
// rewritten
|
|
23
|
+
// rewritten: the app FOLDER, the package SCOPE and the deploy PREFIX take
|
|
21
24
|
// the app name, while template vocabulary (TodoServiceEnum, services/todo,
|
|
22
25
|
// TodoList, TODO comments) is deliberately left alone so every generated app
|
|
23
26
|
// shares the same internal layout.
|
|
@@ -30,22 +33,22 @@ exports.applyAppIdentity = {
|
|
|
30
33
|
if (appName !== 'todo') {
|
|
31
34
|
fs_1.default.renameSync(todoAppDirectory, appDirectory);
|
|
32
35
|
}
|
|
33
|
-
(0,
|
|
36
|
+
(0, replaceInFiles_1.replaceInFiles)(targetDirectory, [
|
|
34
37
|
// Workspace package scope: @todo/constants -> @myapp/constants
|
|
35
38
|
['@todo/', `@${appName}/`],
|
|
36
39
|
// Build/dist and federated-alias paths: dist/apps/todo/... -> dist/apps/myapp/...
|
|
37
40
|
['apps/todo/', `apps/${appName}/`],
|
|
38
41
|
]);
|
|
39
|
-
// The deploy prefix names every stack/resource
|
|
42
|
+
// The deploy prefix names every stack/resource; this is the app name.
|
|
40
43
|
const deployConfigPath = path_1.default.join(targetDirectory, 'apps', appName, 'deploy.config.json');
|
|
41
|
-
const deployConfig = (0,
|
|
44
|
+
const deployConfig = (0, readJsonFile_1.readJsonFile)(deployConfigPath);
|
|
42
45
|
deployConfig.prefix = appName;
|
|
43
|
-
(0,
|
|
44
|
-
(0,
|
|
46
|
+
(0, writeJsonFile_1.writeJsonFile)(deployConfigPath, deployConfig);
|
|
47
|
+
(0, replaceInFileExact_1.replaceInFileExact)(path_1.default.join(appDirectory, 'packages', 'service-utils', 'src', 'defineTodoService.ts'), "const modulePrefix = 'todo';", `const modulePrefix = '${appName}';`);
|
|
45
48
|
const rootPackageJsonPath = path_1.default.join(targetDirectory, 'package.json');
|
|
46
|
-
const rootPackageJson = (0,
|
|
49
|
+
const rootPackageJson = (0, readJsonFile_1.readJsonFile)(rootPackageJsonPath);
|
|
47
50
|
rootPackageJson.name = appName;
|
|
48
|
-
(0,
|
|
51
|
+
(0, writeJsonFile_1.writeJsonFile)(rootPackageJsonPath, rootPackageJson);
|
|
49
52
|
}),
|
|
50
53
|
};
|
|
51
54
|
//# sourceMappingURL=005_applyAppIdentity.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"005_applyAppIdentity.js","sourceRoot":"","sources":["../../../src/steps/005_applyAppIdentity.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,4CAAoB;AACpB,gDAAwB;AAExB,
|
|
1
|
+
{"version":3,"file":"005_applyAppIdentity.js","sourceRoot":"","sources":["../../../src/steps/005_applyAppIdentity.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,4CAAoB;AACpB,gDAAwB;AAExB,sDAAmD;AACnD,kEAA+D;AAC/D,0DAAuD;AACvD,wDAAqD;AAGrD,sEAAsE;AACtE,0EAA0E;AAC1E,2EAA2E;AAC3E,6EAA6E;AAC7E,mCAAmC;AACtB,QAAA,gBAAgB,GAAqB;IAChD,IAAI,EAAE,uBAAuB;IAE7B,GAAG,EAAE,KAAqC,EAAE,4CAAhC,EAAE,eAAe,EAAE,OAAO,EAAE;QACtC,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;QAE5B,MAAM,gBAAgB,GAAG,cAAI,CAAC,IAAI,CAAC,eAAe,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QACpE,MAAM,YAAY,GAAG,cAAI,CAAC,IAAI,CAAC,eAAe,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;QACjE,IAAI,OAAO,KAAK,MAAM,EAAE,CAAC;YACvB,YAAE,CAAC,UAAU,CAAC,gBAAgB,EAAE,YAAY,CAAC,CAAC;QAChD,CAAC;QAED,IAAA,+BAAc,EAAC,eAAe,EAAE;YAC9B,+DAA+D;YAC/D,CAAC,QAAQ,EAAE,IAAI,OAAO,GAAG,CAAC;YAC1B,kFAAkF;YAClF,CAAC,YAAY,EAAE,QAAQ,OAAO,GAAG,CAAC;SACnC,CAAC,CAAC;QAEH,sEAAsE;QACtE,MAAM,gBAAgB,GAAG,cAAI,CAAC,IAAI,CAAC,eAAe,EAAE,MAAM,EAAE,OAAO,EAAE,oBAAoB,CAAC,CAAC;QAC3F,MAAM,YAAY,GAAG,IAAA,2BAAY,EAAC,gBAAgB,CAAC,CAAC;QACpD,YAAY,CAAC,MAAM,GAAG,OAAO,CAAC;QAC9B,IAAA,6BAAa,EAAC,gBAAgB,EAAE,YAAY,CAAC,CAAC;QAE9C,IAAA,uCAAkB,EAChB,cAAI,CAAC,IAAI,CAAC,YAAY,EAAE,UAAU,EAAE,eAAe,EAAE,KAAK,EAAE,sBAAsB,CAAC,EACnF,8BAA8B,EAC9B,yBAAyB,OAAO,IAAI,CACrC,CAAC;QAEF,MAAM,mBAAmB,GAAG,cAAI,CAAC,IAAI,CAAC,eAAe,EAAE,cAAc,CAAC,CAAC;QACvE,MAAM,eAAe,GAAG,IAAA,2BAAY,EAAC,mBAAmB,CAAC,CAAC;QAC1D,eAAe,CAAC,IAAI,GAAG,OAAO,CAAC;QAC/B,IAAA,6BAAa,EAAC,mBAAmB,EAAE,eAAe,CAAC,CAAC;IACtD,CAAC,CAAA;CACF,CAAC","sourcesContent":["import fs from 'fs';\nimport path from 'path';\n\nimport { readJsonFile } from '../lib/readJsonFile';\nimport { replaceInFileExact } from '../lib/replaceInFileExact';\nimport { replaceInFiles } from '../lib/replaceInFiles';\nimport { writeJsonFile } from '../lib/writeJsonFile';\nimport { CreateQpqAppStep } from '../types';\n\n// Give the app its identity. Only targeted, collision-free tokens are\n// rewritten: the app FOLDER, the package SCOPE and the deploy PREFIX take\n// the app name, while template vocabulary (TodoServiceEnum, services/todo,\n// TodoList, TODO comments) is deliberately left alone so every generated app\n// shares the same internal layout.\nexport const applyAppIdentity: CreateQpqAppStep = {\n name: 'Applying app identity',\n\n run: async ({ targetDirectory, answers }) => {\n const { appName } = answers;\n\n const todoAppDirectory = path.join(targetDirectory, 'apps', 'todo');\n const appDirectory = path.join(targetDirectory, 'apps', appName);\n if (appName !== 'todo') {\n fs.renameSync(todoAppDirectory, appDirectory);\n }\n\n replaceInFiles(targetDirectory, [\n // Workspace package scope: @todo/constants -> @myapp/constants\n ['@todo/', `@${appName}/`],\n // Build/dist and federated-alias paths: dist/apps/todo/... -> dist/apps/myapp/...\n ['apps/todo/', `apps/${appName}/`],\n ]);\n\n // The deploy prefix names every stack/resource; this is the app name.\n const deployConfigPath = path.join(targetDirectory, 'apps', appName, 'deploy.config.json');\n const deployConfig = readJsonFile(deployConfigPath);\n deployConfig.prefix = appName;\n writeJsonFile(deployConfigPath, deployConfig);\n\n replaceInFileExact(\n path.join(appDirectory, 'packages', 'service-utils', 'src', 'defineTodoService.ts'),\n \"const modulePrefix = 'todo';\",\n `const modulePrefix = '${appName}';`,\n );\n\n const rootPackageJsonPath = path.join(targetDirectory, 'package.json');\n const rootPackageJson = readJsonFile(rootPackageJsonPath);\n rootPackageJson.name = appName;\n writeJsonFile(rootPackageJsonPath, rootPackageJson);\n },\n};\n"]}
|
|
@@ -14,7 +14,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.applyDomain = void 0;
|
|
16
16
|
const path_1 = __importDefault(require("path"));
|
|
17
|
-
const
|
|
17
|
+
const readJsonFile_1 = require("../lib/readJsonFile");
|
|
18
|
+
const replaceInFileExact_1 = require("../lib/replaceInFileExact");
|
|
19
|
+
const writeJsonFile_1 = require("../lib/writeJsonFile");
|
|
18
20
|
// The template's domain, replaced wherever it's authoritative: the deploy
|
|
19
21
|
// config and the app's domain constant (everything else derives from those).
|
|
20
22
|
const TEMPLATE_DOMAIN = 'todo.quidproquojs.com';
|
|
@@ -22,10 +24,10 @@ exports.applyDomain = {
|
|
|
22
24
|
name: 'Applying domain',
|
|
23
25
|
run: (_a) => __awaiter(void 0, [_a], void 0, function* ({ targetDirectory, answers }) {
|
|
24
26
|
const deployConfigPath = path_1.default.join(targetDirectory, 'apps', answers.appName, 'deploy.config.json');
|
|
25
|
-
const deployConfig = (0,
|
|
27
|
+
const deployConfig = (0, readJsonFile_1.readJsonFile)(deployConfigPath);
|
|
26
28
|
deployConfig.domain = answers.domain;
|
|
27
|
-
(0,
|
|
28
|
-
(0,
|
|
29
|
+
(0, writeJsonFile_1.writeJsonFile)(deployConfigPath, deployConfig);
|
|
30
|
+
(0, replaceInFileExact_1.replaceInFileExact)(path_1.default.join(targetDirectory, 'apps', answers.appName, 'packages', 'constants', 'src', 'domain.ts'), TEMPLATE_DOMAIN, answers.domain);
|
|
29
31
|
}),
|
|
30
32
|
};
|
|
31
33
|
//# sourceMappingURL=006_applyDomain.js.map
|