create-qpq-app 0.1.27 → 0.1.29
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/README.md +4 -0
- package/lib/commonjs/cli/runCreateQpqApp.js +15 -1
- package/lib/commonjs/cli/runCreateQpqApp.js.map +1 -1
- package/lib/commonjs/lib/index.d.ts +1 -1
- package/lib/commonjs/lib/index.js +1 -1
- package/lib/commonjs/lib/index.js.map +1 -1
- package/lib/commonjs/lib/promptText.d.ts +1 -0
- package/lib/commonjs/lib/promptText.js +53 -0
- package/lib/commonjs/lib/promptText.js.map +1 -0
- package/lib/commonjs/steps/005_applyAppIdentity.js +6 -5
- package/lib/commonjs/steps/005_applyAppIdentity.js.map +1 -1
- package/lib/commonjs/steps/006_applyDomain.js +11 -6
- package/lib/commonjs/steps/006_applyDomain.js.map +1 -1
- package/lib/commonjs/steps/007_applyDockerHost.d.ts +2 -0
- package/lib/commonjs/steps/007_applyDockerHost.js +40 -0
- package/lib/commonjs/steps/007_applyDockerHost.js.map +1 -0
- package/lib/commonjs/steps/{007_pinRegistryVersions.js → 008_pinRegistryVersions.js} +1 -1
- package/lib/commonjs/steps/{007_pinRegistryVersions.js.map → 008_pinRegistryVersions.js.map} +1 -1
- package/lib/commonjs/steps/{008_transpileToJavaScript.js → 009_transpileToJavaScript.js} +1 -1
- package/lib/commonjs/steps/{008_transpileToJavaScript.js.map → 009_transpileToJavaScript.js.map} +1 -1
- package/lib/commonjs/steps/{009_restoreGitignore.js → 010_restoreGitignore.js} +1 -1
- package/lib/commonjs/steps/{009_restoreGitignore.js.map → 010_restoreGitignore.js.map} +1 -1
- package/lib/commonjs/steps/{010_gitInit.js → 011_gitInit.js} +1 -1
- package/lib/commonjs/steps/{010_gitInit.js.map → 011_gitInit.js.map} +1 -1
- package/lib/commonjs/steps/{011_npmInstall.js → 012_npmInstall.js} +1 -1
- package/lib/commonjs/steps/{011_npmInstall.js.map → 012_npmInstall.js.map} +1 -1
- package/lib/commonjs/steps/{012_buildWorkspaces.js → 013_buildWorkspaces.js} +1 -1
- package/lib/commonjs/steps/{012_buildWorkspaces.js.map → 013_buildWorkspaces.js.map} +1 -1
- package/lib/commonjs/steps/{013_printNextSteps.js → 014_printNextSteps.js} +6 -3
- package/lib/commonjs/steps/014_printNextSteps.js.map +1 -0
- package/lib/commonjs/steps/index.d.ts +9 -8
- package/lib/commonjs/steps/index.js +25 -22
- package/lib/commonjs/steps/index.js.map +1 -1
- package/lib/commonjs/types/CreateQpqAppAnswers.d.ts +2 -0
- package/lib/commonjs/types/CreateQpqAppAnswers.js.map +1 -1
- package/lib/esm/cli/runCreateQpqApp.js +15 -1
- package/lib/esm/cli/runCreateQpqApp.js.map +1 -1
- package/lib/esm/lib/index.d.ts +1 -1
- package/lib/esm/lib/index.js +1 -1
- package/lib/esm/lib/index.js.map +1 -1
- package/lib/esm/lib/promptText.d.ts +1 -0
- package/lib/esm/lib/promptText.js +7 -0
- package/lib/esm/lib/promptText.js.map +1 -0
- package/lib/esm/steps/005_applyAppIdentity.js +6 -5
- package/lib/esm/steps/005_applyAppIdentity.js.map +1 -1
- package/lib/esm/steps/006_applyDomain.js +11 -6
- package/lib/esm/steps/006_applyDomain.js.map +1 -1
- package/lib/esm/steps/007_applyDockerHost.d.ts +2 -0
- package/lib/esm/steps/007_applyDockerHost.js +30 -0
- package/lib/esm/steps/007_applyDockerHost.js.map +1 -0
- package/lib/esm/steps/{007_pinRegistryVersions.js → 008_pinRegistryVersions.js} +1 -1
- package/lib/esm/steps/{007_pinRegistryVersions.js.map → 008_pinRegistryVersions.js.map} +1 -1
- package/lib/esm/steps/{008_transpileToJavaScript.js → 009_transpileToJavaScript.js} +1 -1
- package/lib/esm/steps/{008_transpileToJavaScript.js.map → 009_transpileToJavaScript.js.map} +1 -1
- package/lib/esm/steps/{009_restoreGitignore.js → 010_restoreGitignore.js} +1 -1
- package/lib/esm/steps/{009_restoreGitignore.js.map → 010_restoreGitignore.js.map} +1 -1
- package/lib/esm/steps/{010_gitInit.js → 011_gitInit.js} +1 -1
- package/lib/esm/steps/{010_gitInit.js.map → 011_gitInit.js.map} +1 -1
- package/lib/esm/steps/{011_npmInstall.js → 012_npmInstall.js} +1 -1
- package/lib/esm/steps/{011_npmInstall.js.map → 012_npmInstall.js.map} +1 -1
- package/lib/esm/steps/{012_buildWorkspaces.js → 013_buildWorkspaces.js} +1 -1
- package/lib/esm/steps/{012_buildWorkspaces.js.map → 013_buildWorkspaces.js.map} +1 -1
- package/lib/esm/steps/014_printNextSteps.js +24 -0
- package/lib/esm/steps/014_printNextSteps.js.map +1 -0
- package/lib/esm/steps/index.d.ts +9 -8
- package/lib/esm/steps/index.js +10 -8
- package/lib/esm/steps/index.js.map +1 -1
- package/lib/esm/types/CreateQpqAppAnswers.d.ts +2 -0
- package/lib/esm/types/CreateQpqAppAnswers.js.map +1 -1
- package/package.json +2 -2
- package/template/README.md +4 -3
- package/template/apps/qpqjs/bootstrap.qpq.ts +3 -2
- package/template/apps/qpqjs/deploy.config.json +42 -9
- package/template/apps/qpqjs/devServer.config.ts +13 -0
- package/template/apps/qpqjs/packages/constants/src/index.ts +0 -1
- package/template/apps/qpqjs/packages/service-utils/src/defineQpqjsService.ts +12 -29
- package/template/apps/qpqjs/services/admin/service/src/infrastructure.ts +1 -1
- package/template/apps/qpqjs/services/admin/views/src/app/app.tsx +9 -19
- package/template/apps/qpqjs/services/design/service/src/infrastructure.ts +1 -1
- package/template/apps/qpqjs/services/design/views/src/components/LandingPage/components/NavBar.tsx +2 -10
- package/template/apps/qpqjs/services/design/views/src/components/WelcomeScreen/WelcomeScreen.tsx +3 -11
- package/template/apps/qpqjs/services/shell/service/src/infrastructure.ts +5 -1
- package/template/apps/qpqjs/services/test/service/src/infrastructure.ts +1 -1
- package/template/apps/qpqjs/services/testa/service/src/infrastructure.ts +1 -1
- package/template/apps/todo/deploy.config.json +13 -4
- package/template/apps/todo/packages/constants/src/index.ts +0 -1
- package/template/apps/todo/packages/service-utils/src/defineTodoService.ts +9 -7
- package/template/apps/todo/services/admin/service/src/infrastructure.ts +1 -1
- package/template/apps/todo/services/admin/views/src/app/app.tsx +9 -19
- package/template/apps/todo/services/auth/service/src/infrastructure.ts +1 -1
- package/template/apps/todo/services/design/service/src/infrastructure.ts +1 -1
- package/template/apps/todo/services/shell/service/src/infrastructure.ts +1 -1
- package/template/apps/todo/services/todo/service/src/infrastructure.ts +1 -1
- package/template/docusaurus/docs/getting-started.md +5 -5
- package/template/scripts/deployedSmoke.mjs +27 -22
- package/template/scripts/localSmoke.mjs +7 -7
- package/lib/commonjs/lib/replaceInFileExact.d.ts +0 -1
- package/lib/commonjs/lib/replaceInFileExact.js +0 -18
- package/lib/commonjs/lib/replaceInFileExact.js.map +0 -1
- package/lib/commonjs/steps/013_printNextSteps.js.map +0 -1
- package/lib/esm/lib/replaceInFileExact.d.ts +0 -1
- package/lib/esm/lib/replaceInFileExact.js +0 -11
- package/lib/esm/lib/replaceInFileExact.js.map +0 -1
- package/lib/esm/steps/013_printNextSteps.js +0 -21
- package/lib/esm/steps/013_printNextSteps.js.map +0 -1
- package/template/apps/qpqjs/packages/constants/src/domain.ts +0 -3
- package/template/apps/todo/packages/constants/src/domain.ts +0 -2
- /package/lib/commonjs/steps/{007_pinRegistryVersions.d.ts → 008_pinRegistryVersions.d.ts} +0 -0
- /package/lib/commonjs/steps/{008_transpileToJavaScript.d.ts → 009_transpileToJavaScript.d.ts} +0 -0
- /package/lib/commonjs/steps/{009_restoreGitignore.d.ts → 010_restoreGitignore.d.ts} +0 -0
- /package/lib/commonjs/steps/{010_gitInit.d.ts → 011_gitInit.d.ts} +0 -0
- /package/lib/commonjs/steps/{011_npmInstall.d.ts → 012_npmInstall.d.ts} +0 -0
- /package/lib/commonjs/steps/{012_buildWorkspaces.d.ts → 013_buildWorkspaces.d.ts} +0 -0
- /package/lib/commonjs/steps/{013_printNextSteps.d.ts → 014_printNextSteps.d.ts} +0 -0
- /package/lib/esm/steps/{007_pinRegistryVersions.d.ts → 008_pinRegistryVersions.d.ts} +0 -0
- /package/lib/esm/steps/{008_transpileToJavaScript.d.ts → 009_transpileToJavaScript.d.ts} +0 -0
- /package/lib/esm/steps/{009_restoreGitignore.d.ts → 010_restoreGitignore.d.ts} +0 -0
- /package/lib/esm/steps/{010_gitInit.d.ts → 011_gitInit.d.ts} +0 -0
- /package/lib/esm/steps/{011_npmInstall.d.ts → 012_npmInstall.d.ts} +0 -0
- /package/lib/esm/steps/{012_buildWorkspaces.d.ts → 013_buildWorkspaces.d.ts} +0 -0
- /package/lib/esm/steps/{013_printNextSteps.d.ts → 014_printNextSteps.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -26,12 +26,16 @@ npx create-qpq-app <app-name> [options]
|
|
|
26
26
|
|
|
27
27
|
--language <typescript|javascript> skip the language prompt
|
|
28
28
|
--domain <domain> app domain (default: <app-name>.example.com)
|
|
29
|
+
--docker-registry <host[:port]> registry qpq go pushes the image to (e.g. 192.168.8.88:5000)
|
|
30
|
+
--docker-host <address> address browsers use for the docker host (e.g. 192.168.8.88)
|
|
29
31
|
--no-git skip git init
|
|
30
32
|
--no-install skip npm install
|
|
31
33
|
```
|
|
32
34
|
|
|
33
35
|
Pass `--language javascript` and you get the same app with type annotations stripped and JSX preserved, running on the same toolchain.
|
|
34
36
|
|
|
37
|
+
The two docker flags are asked for when you run interactively and can be left blank. They fill the docker deployments' `platformSettings` in `apps/<app>/deploy.config.json` (registry, `linux/amd64`, `publicHost`, and an appdata `dataPath`), so `npm run deploy` pushes an image and writes a `docker-compose.yml` that runs on a self-hosting box like Unraid as is. Edit the file later to change any of it.
|
|
38
|
+
|
|
35
39
|
## How it works
|
|
36
40
|
|
|
37
41
|
The template is a snapshot of quidproquojs.com, a real and continuously built qpq workspace, captured into this package at publish time. Scaffolding runs a pipeline of self-contained steps: prune the docs site, prune the website app, apply your app's identity and domain, pin the quidproquo versions, git init, install.
|
|
@@ -19,6 +19,7 @@ const getOwnPackageRoot_1 = require("../lib/getOwnPackageRoot");
|
|
|
19
19
|
const getOwnVersion_1 = require("../lib/getOwnVersion");
|
|
20
20
|
const getPositionalArgs_1 = require("../lib/getPositionalArgs");
|
|
21
21
|
const promptSelect_1 = require("../lib/promptSelect");
|
|
22
|
+
const promptText_1 = require("../lib/promptText");
|
|
22
23
|
const steps_1 = require("../steps");
|
|
23
24
|
const types_1 = require("../types");
|
|
24
25
|
const USAGE = `Usage: npx create-qpq-app <app-name> [options]
|
|
@@ -26,6 +27,8 @@ const USAGE = `Usage: npx create-qpq-app <app-name> [options]
|
|
|
26
27
|
Options:
|
|
27
28
|
--language <typescript|javascript> skip the language prompt
|
|
28
29
|
--domain <domain> app domain (default: <app-name>.example.com)
|
|
30
|
+
--docker-registry <host[:port]> registry qpq go pushes the image to (e.g. 192.168.8.88:5000)
|
|
31
|
+
--docker-host <address> address browsers use for the docker host (e.g. 192.168.8.88)
|
|
29
32
|
--no-git skip git init
|
|
30
33
|
--no-install skip npm install
|
|
31
34
|
`;
|
|
@@ -43,9 +46,18 @@ const resolveLanguage = (argv) => __awaiter(void 0, void 0, void 0, function* ()
|
|
|
43
46
|
const selected = yield (0, promptSelect_1.promptSelect)('Which language would you like?', ['TypeScript', 'JavaScript'], 'TypeScript');
|
|
44
47
|
return selected === 'JavaScript' ? types_1.AppLanguage.javascript : types_1.AppLanguage.typescript;
|
|
45
48
|
});
|
|
49
|
+
// Where the app will be self-hosted. A flag wins; an interactive terminal is asked, with blank
|
|
50
|
+
// meaning "not yet"; a script or CI run without the flag gets blank without a prompt.
|
|
51
|
+
const resolveDockerSetting = (argv, flag, question) => __awaiter(void 0, void 0, void 0, function* () {
|
|
52
|
+
const flagValue = (0, getArgValue_1.getArgValue)(argv, flag);
|
|
53
|
+
if (flagValue !== undefined) {
|
|
54
|
+
return flagValue.trim();
|
|
55
|
+
}
|
|
56
|
+
return process.stdin.isTTY ? (0, promptText_1.promptText)(question) : '';
|
|
57
|
+
});
|
|
46
58
|
const runCreateQpqApp = (argv) => __awaiter(void 0, void 0, void 0, function* () {
|
|
47
59
|
var _a;
|
|
48
|
-
const [appName] = (0, getPositionalArgs_1.getPositionalArgs)(argv, ['--language', '--domain']);
|
|
60
|
+
const [appName] = (0, getPositionalArgs_1.getPositionalArgs)(argv, ['--language', '--domain', '--docker-registry', '--docker-host']);
|
|
49
61
|
if (!appName || argv.includes('--help')) {
|
|
50
62
|
console.log(USAGE);
|
|
51
63
|
process.exit(appName ? 0 : 1);
|
|
@@ -56,6 +68,8 @@ const runCreateQpqApp = (argv) => __awaiter(void 0, void 0, void 0, function* ()
|
|
|
56
68
|
appName,
|
|
57
69
|
language: yield resolveLanguage(argv),
|
|
58
70
|
domain: (_a = (0, getArgValue_1.getArgValue)(argv, '--domain')) !== null && _a !== void 0 ? _a : `${appName}.example.com`,
|
|
71
|
+
dockerRegistry: yield resolveDockerSetting(argv, '--docker-registry', 'Docker registry to push images to (blank for none, e.g. 192.168.8.88:5000)'),
|
|
72
|
+
dockerHost: yield resolveDockerSetting(argv, '--docker-host', 'Address browsers will use for the docker host (blank for localhost, e.g. 192.168.8.88)'),
|
|
59
73
|
initialiseGit: !argv.includes('--no-git'),
|
|
60
74
|
installDependencies: !argv.includes('--no-install'),
|
|
61
75
|
};
|
|
@@ -1 +1 @@
|
|
|
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
|
|
1
|
+
{"version":3,"file":"runCreateQpqApp.js","sourceRoot":"","sources":["../../../src/cli/runCreateQpqApp.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,gDAAwB;AAExB,oDAAiD;AACjD,gEAA6D;AAC7D,wDAAqD;AACrD,gEAA6D;AAC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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;AA3CW,QAAA,eAAe,mBA2C1B","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 { promptText } from '../lib/promptText';\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 --docker-registry <host[:port]> registry qpq go pushes the image to (e.g. 192.168.8.88:5000)\n --docker-host <address> address browsers use for the docker host (e.g. 192.168.8.88)\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\n// Where the app will be self-hosted. A flag wins; an interactive terminal is asked, with blank\n// meaning \"not yet\"; a script or CI run without the flag gets blank without a prompt.\nconst resolveDockerSetting = async (argv: string[], flag: string, question: string): Promise<string> => {\n const flagValue = getArgValue(argv, flag);\n if (flagValue !== undefined) {\n return flagValue.trim();\n }\n return process.stdin.isTTY ? promptText(question) : '';\n};\n\nexport const runCreateQpqApp = async (argv: string[]): Promise<void> => {\n const [appName] = getPositionalArgs(argv, ['--language', '--domain', '--docker-registry', '--docker-host']);\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 dockerRegistry: await resolveDockerSetting(\n argv,\n '--docker-registry',\n 'Docker registry to push images to (blank for none, e.g. 192.168.8.88:5000)',\n ),\n dockerHost: await resolveDockerSetting(\n argv,\n '--docker-host',\n 'Address browsers will use for the docker host (blank for localhost, e.g. 192.168.8.88)',\n ),\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"]}
|
|
@@ -4,8 +4,8 @@ export * from './getOwnVersion';
|
|
|
4
4
|
export * from './getPositionalArgs';
|
|
5
5
|
export * from './listFilesRecursive';
|
|
6
6
|
export * from './promptSelect';
|
|
7
|
+
export * from './promptText';
|
|
7
8
|
export * from './readJsonFile';
|
|
8
|
-
export * from './replaceInFileExact';
|
|
9
9
|
export * from './replaceInFiles';
|
|
10
10
|
export * from './runCommand';
|
|
11
11
|
export * from './writeJsonFile';
|
|
@@ -20,8 +20,8 @@ __exportStar(require("./getOwnVersion"), exports);
|
|
|
20
20
|
__exportStar(require("./getPositionalArgs"), exports);
|
|
21
21
|
__exportStar(require("./listFilesRecursive"), exports);
|
|
22
22
|
__exportStar(require("./promptSelect"), exports);
|
|
23
|
+
__exportStar(require("./promptText"), exports);
|
|
23
24
|
__exportStar(require("./readJsonFile"), exports);
|
|
24
|
-
__exportStar(require("./replaceInFileExact"), exports);
|
|
25
25
|
__exportStar(require("./replaceInFiles"), exports);
|
|
26
26
|
__exportStar(require("./runCommand"), exports);
|
|
27
27
|
__exportStar(require("./writeJsonFile"), exports);
|
|
@@ -1 +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,
|
|
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,+CAA6B;AAC7B,iDAA+B;AAC/B,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 './promptText';\nexport * from './readJsonFile';\nexport * from './replaceInFiles';\nexport * from './runCommand';\nexport * from './writeJsonFile';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const promptText: (message: string, defaultValue?: string) => Promise<string>;
|
|
@@ -0,0 +1,53 @@
|
|
|
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
36
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
38
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
39
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
40
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
41
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
+
exports.promptText = void 0;
|
|
46
|
+
// Present a free-text prompt and return the trimmed answer ('' when left blank).
|
|
47
|
+
// @inquirer/prompts is imported lazily so fully-flagged runs never pay for it.
|
|
48
|
+
const promptText = (message_1, ...args_1) => __awaiter(void 0, [message_1, ...args_1], void 0, function* (message, defaultValue = '') {
|
|
49
|
+
const { input } = yield Promise.resolve().then(() => __importStar(require('@inquirer/prompts')));
|
|
50
|
+
return (yield input({ message, default: defaultValue })).trim();
|
|
51
|
+
});
|
|
52
|
+
exports.promptText = promptText;
|
|
53
|
+
//# sourceMappingURL=promptText.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"promptText.js","sourceRoot":"","sources":["../../../src/lib/promptText.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iFAAiF;AACjF,+EAA+E;AACxE,MAAM,UAAU,GAAG,uBAA4D,EAAE,8DAAvD,OAAe,EAAE,YAAY,GAAG,EAAE;IACjE,MAAM,EAAE,KAAK,EAAE,GAAG,wDAAa,mBAAmB,GAAC,CAAC;IACpD,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;AAClE,CAAC,CAAA,CAAC;AAHW,QAAA,UAAU,cAGrB","sourcesContent":["// Present a free-text prompt and return the trimmed answer ('' when left blank).\n// @inquirer/prompts is imported lazily so fully-flagged runs never pay for it.\nexport const promptText = async (message: string, defaultValue = ''): Promise<string> => {\n const { input } = await import('@inquirer/prompts');\n return (await input({ message, default: defaultValue })).trim();\n};\n"]}
|
|
@@ -16,11 +16,10 @@ exports.applyAppIdentity = void 0;
|
|
|
16
16
|
const fs_1 = __importDefault(require("fs"));
|
|
17
17
|
const path_1 = __importDefault(require("path"));
|
|
18
18
|
const readJsonFile_1 = require("../lib/readJsonFile");
|
|
19
|
-
const replaceInFileExact_1 = require("../lib/replaceInFileExact");
|
|
20
19
|
const replaceInFiles_1 = require("../lib/replaceInFiles");
|
|
21
20
|
const writeJsonFile_1 = require("../lib/writeJsonFile");
|
|
22
21
|
// Give the app its identity. Only targeted, collision-free tokens are
|
|
23
|
-
// rewritten: the app FOLDER, the package SCOPE and
|
|
22
|
+
// rewritten: the app FOLDER, the package SCOPE and each deployment's NAME take
|
|
24
23
|
// the app name, while template vocabulary (TodoServiceEnum, services/todo,
|
|
25
24
|
// TodoList, TODO comments) is deliberately left alone so every generated app
|
|
26
25
|
// shares the same internal layout.
|
|
@@ -39,12 +38,14 @@ exports.applyAppIdentity = {
|
|
|
39
38
|
// Build/dist and federated-alias paths: dist/apps/todo/... -> dist/apps/myapp/...
|
|
40
39
|
['apps/todo/', `apps/${appName}/`],
|
|
41
40
|
]);
|
|
42
|
-
//
|
|
41
|
+
// A deployment's name prefixes every stack/resource; service configs read it
|
|
42
|
+
// from the primed APPLICATION_NAME, so the JSON is the only place it's set.
|
|
43
43
|
const deployConfigPath = path_1.default.join(targetDirectory, 'apps', appName, 'deploy.config.json');
|
|
44
44
|
const deployConfig = (0, readJsonFile_1.readJsonFile)(deployConfigPath);
|
|
45
|
-
deployConfig.
|
|
45
|
+
for (const deployment of Object.values(deployConfig.deployments)) {
|
|
46
|
+
deployment.name = appName;
|
|
47
|
+
}
|
|
46
48
|
(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}';`);
|
|
48
49
|
const rootPackageJsonPath = path_1.default.join(targetDirectory, 'package.json');
|
|
49
50
|
const rootPackageJson = (0, readJsonFile_1.readJsonFile)(rootPackageJsonPath);
|
|
50
51
|
rootPackageJson.name = appName;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"005_applyAppIdentity.js","sourceRoot":"","sources":["../../../src/steps/005_applyAppIdentity.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,4CAAoB;AACpB,gDAAwB;AAExB,sDAAmD;AACnD,
|
|
1
|
+
{"version":3,"file":"005_applyAppIdentity.js","sourceRoot":"","sources":["../../../src/steps/005_applyAppIdentity.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,4CAAoB;AACpB,gDAAwB;AAExB,sDAAmD;AACnD,0DAAuD;AACvD,wDAAqD;AAGrD,sEAAsE;AACtE,+EAA+E;AAC/E,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,6EAA6E;QAC7E,4EAA4E;QAC5E,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,KAAK,MAAM,UAAU,IAAI,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,WAAW,CAAuB,EAAE,CAAC;YACvF,UAAU,CAAC,IAAI,GAAG,OAAO,CAAC;QAC5B,CAAC;QACD,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;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 { 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 each deployment's NAME 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 // A deployment's name prefixes every stack/resource; service configs read it\n // from the primed APPLICATION_NAME, so the JSON is the only place it's set.\n const deployConfigPath = path.join(targetDirectory, 'apps', appName, 'deploy.config.json');\n const deployConfig = readJsonFile(deployConfigPath);\n for (const deployment of Object.values(deployConfig.deployments) as { name: string }[]) {\n deployment.name = appName;\n }\n writeJsonFile(deployConfigPath, deployConfig);\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,15 +14,20 @@ 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
|
|
18
|
-
|
|
19
|
-
//
|
|
20
|
-
//
|
|
21
|
-
|
|
17
|
+
const readJsonFile_1 = require("../lib/readJsonFile");
|
|
18
|
+
const writeJsonFile_1 = require("../lib/writeJsonFile");
|
|
19
|
+
// The domain is a deployment setting (ROOT_DOMAINS, read by every defineDns), so
|
|
20
|
+
// it is set on each generated deployment. One root at scaffold time; more can
|
|
21
|
+
// be appended later, comma separated, primary first.
|
|
22
22
|
exports.applyDomain = {
|
|
23
23
|
name: 'Applying domain',
|
|
24
24
|
run: (_a) => __awaiter(void 0, [_a], void 0, function* ({ targetDirectory, answers }) {
|
|
25
|
-
|
|
25
|
+
const deployConfigPath = path_1.default.join(targetDirectory, 'apps', answers.appName, 'deploy.config.json');
|
|
26
|
+
const deployConfig = (0, readJsonFile_1.readJsonFile)(deployConfigPath);
|
|
27
|
+
for (const deployment of Object.values(deployConfig.deployments)) {
|
|
28
|
+
deployment.settings = Object.assign(Object.assign({}, deployment.settings), { ROOT_DOMAINS: answers.domain });
|
|
29
|
+
}
|
|
30
|
+
(0, writeJsonFile_1.writeJsonFile)(deployConfigPath, deployConfig);
|
|
26
31
|
}),
|
|
27
32
|
};
|
|
28
33
|
//# sourceMappingURL=006_applyDomain.js.map
|
|
@@ -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,wDAAqD;AAGrD,iFAAiF;AACjF,8EAA8E;AAC9E,qDAAqD;AACxC,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,KAAK,MAAM,UAAU,IAAI,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,WAAW,CAA4C,EAAE,CAAC;YAC5G,UAAU,CAAC,QAAQ,mCAAQ,UAAU,CAAC,QAAQ,KAAE,YAAY,EAAE,OAAO,CAAC,MAAM,GAAE,CAAC;QACjF,CAAC;QACD,IAAA,6BAAa,EAAC,gBAAgB,EAAE,YAAY,CAAC,CAAC;IAChD,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// The domain is a deployment setting (ROOT_DOMAINS, read by every defineDns), so\n// it is set on each generated deployment. One root at scaffold time; more can\n// be appended later, comma separated, primary first.\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 for (const deployment of Object.values(deployConfig.deployments) as { settings?: Record<string, string> }[]) {\n deployment.settings = { ...deployment.settings, ROOT_DOMAINS: answers.domain };\n }\n writeJsonFile(deployConfigPath, deployConfig);\n },\n};\n"]}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.applyDockerHost = void 0;
|
|
16
|
+
const path_1 = __importDefault(require("path"));
|
|
17
|
+
const readJsonFile_1 = require("../lib/readJsonFile");
|
|
18
|
+
const writeJsonFile_1 = require("../lib/writeJsonFile");
|
|
19
|
+
// A self-hosting box like Unraid is the expected target: x86, an appdata folder per
|
|
20
|
+
// deployment (so development and production never share state), images pulled from
|
|
21
|
+
// a registry on the LAN.
|
|
22
|
+
const DOCKER_ARCH = 'linux/amd64';
|
|
23
|
+
const getDataPath = (appName, environment) => `/mnt/user/appdata/qpq-${appName}-${environment}`;
|
|
24
|
+
// Fills each docker deployment's platformSettings from the answers so the first
|
|
25
|
+
// `qpq go` builds, pushes and writes a compose file that runs on the host as is.
|
|
26
|
+
exports.applyDockerHost = {
|
|
27
|
+
name: 'Applying docker host settings',
|
|
28
|
+
run: (_a) => __awaiter(void 0, [_a], void 0, function* ({ targetDirectory, answers }) {
|
|
29
|
+
const deployConfigPath = path_1.default.join(targetDirectory, 'apps', answers.appName, 'deploy.config.json');
|
|
30
|
+
const deployConfig = (0, readJsonFile_1.readJsonFile)(deployConfigPath);
|
|
31
|
+
for (const deployment of Object.values(deployConfig.deployments)) {
|
|
32
|
+
if (deployment.platform !== 'docker') {
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
deployment.platformSettings = Object.assign(Object.assign(Object.assign(Object.assign({}, deployment.platformSettings), (answers.dockerRegistry ? { registry: answers.dockerRegistry, arch: DOCKER_ARCH } : {})), (answers.dockerHost ? { publicHost: answers.dockerHost } : {})), { dataPath: getDataPath(answers.appName, deployment.environment) });
|
|
36
|
+
}
|
|
37
|
+
(0, writeJsonFile_1.writeJsonFile)(deployConfigPath, deployConfig);
|
|
38
|
+
}),
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=007_applyDockerHost.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"007_applyDockerHost.js","sourceRoot":"","sources":["../../../src/steps/007_applyDockerHost.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,gDAAwB;AAExB,sDAAmD;AACnD,wDAAqD;AASrD,oFAAoF;AACpF,mFAAmF;AACnF,yBAAyB;AACzB,MAAM,WAAW,GAAG,aAAa,CAAC;AAClC,MAAM,WAAW,GAAG,CAAC,OAAe,EAAE,WAAmB,EAAU,EAAE,CAAC,yBAAyB,OAAO,IAAI,WAAW,EAAE,CAAC;AAExH,gFAAgF;AAChF,iFAAiF;AACpE,QAAA,eAAe,GAAqB;IAC/C,IAAI,EAAE,+BAA+B;IAErC,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;QAEpD,KAAK,MAAM,UAAU,IAAI,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,WAAW,CAAuB,EAAE,CAAC;YACvF,IAAI,UAAU,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;gBACrC,SAAS;YACX,CAAC;YAED,UAAU,CAAC,gBAAgB,+DACtB,UAAU,CAAC,gBAAgB,GAC3B,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,OAAO,CAAC,cAAc,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,GACvF,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,KACjE,QAAQ,EAAE,WAAW,CAAC,OAAO,CAAC,OAAO,EAAE,UAAU,CAAC,WAAW,CAAC,GAC/D,CAAC;QACJ,CAAC;QAED,IAAA,6BAAa,EAAC,gBAAgB,EAAE,YAAY,CAAC,CAAC;IAChD,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\ntype DockerDeployment = {\n platform: string;\n environment: string;\n platformSettings?: Record<string, string>;\n};\n\n// A self-hosting box like Unraid is the expected target: x86, an appdata folder per\n// deployment (so development and production never share state), images pulled from\n// a registry on the LAN.\nconst DOCKER_ARCH = 'linux/amd64';\nconst getDataPath = (appName: string, environment: string): string => `/mnt/user/appdata/qpq-${appName}-${environment}`;\n\n// Fills each docker deployment's platformSettings from the answers so the first\n// `qpq go` builds, pushes and writes a compose file that runs on the host as is.\nexport const applyDockerHost: CreateQpqAppStep = {\n name: 'Applying docker host settings',\n\n run: async ({ targetDirectory, answers }) => {\n const deployConfigPath = path.join(targetDirectory, 'apps', answers.appName, 'deploy.config.json');\n const deployConfig = readJsonFile(deployConfigPath);\n\n for (const deployment of Object.values(deployConfig.deployments) as DockerDeployment[]) {\n if (deployment.platform !== 'docker') {\n continue;\n }\n\n deployment.platformSettings = {\n ...deployment.platformSettings,\n ...(answers.dockerRegistry ? { registry: answers.dockerRegistry, arch: DOCKER_ARCH } : {}),\n ...(answers.dockerHost ? { publicHost: answers.dockerHost } : {}),\n dataPath: getDataPath(answers.appName, deployment.environment),\n };\n }\n\n writeJsonFile(deployConfigPath, deployConfig);\n },\n};\n"]}
|
package/lib/commonjs/steps/{007_pinRegistryVersions.js.map → 008_pinRegistryVersions.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"
|
|
1
|
+
{"version":3,"file":"008_pinRegistryVersions.js","sourceRoot":"","sources":["../../../src/steps/008_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"]}
|
package/lib/commonjs/steps/{008_transpileToJavaScript.js.map → 009_transpileToJavaScript.js.map}
RENAMED
|
@@ -1 +1 @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AAY,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"]}
|
|
1
|
+
{"version":3,"file":"009_transpileToJavaScript.js","sourceRoot":"","sources":["../../../src/steps/009_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,CAAC,QAAQ,KAAK,mBAAW,CAAC,UAAU;IAEnE,GAAG,EAAE,KAA4B,EAAE,4CAAvB,EAAE,eAAe,EAAE;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I,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"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"
|
|
1
|
+
{"version":3,"file":"010_restoreGitignore.js","sourceRoot":"","sources":["../../../src/steps/010_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"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"
|
|
1
|
+
{"version":3,"file":"011_gitInit.js","sourceRoot":"","sources":["../../../src/steps/011_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"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"
|
|
1
|
+
{"version":3,"file":"012_npmInstall.js","sourceRoot":"","sources":["../../../src/steps/012_npmInstall.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,kDAA+C;AAGlC,QAAA,UAAU,GAAqB;IAC1C,IAAI,EAAE,yBAAyB;IAE/B,SAAS,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,mBAAmB;IAEnD,GAAG,EAAE,KAA4B,EAAE,4CAAvB,EAAE,eAAe,EAAE;QAC7B,MAAM,IAAA,uBAAU,EAAC,KAAK,EAAE,CAAC,SAAS,CAAC,EAAE,EAAE,GAAG,EAAE,eAAe,EAAE,CAAC,CAAC;IACjE,CAAC,CAAA;CACF,CAAC","sourcesContent":["import { runCommand } from '../lib/runCommand';\nimport { CreateQpqAppStep } from '../types';\n\nexport const npmInstall: CreateQpqAppStep = {\n name: 'Installing dependencies',\n\n shouldRun: (answers) => answers.installDependencies,\n\n run: async ({ targetDirectory }) => {\n await runCommand('npm', ['install'], { cwd: targetDirectory });\n },\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"
|
|
1
|
+
{"version":3,"file":"013_buildWorkspaces.js","sourceRoot":"","sources":["../../../src/steps/013_buildWorkspaces.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,kDAA+C;AAG/C,6EAA6E;AAC7E,2EAA2E;AAC3E,6CAA6C;AAChC,QAAA,eAAe,GAAqB;IAC/C,IAAI,EAAE,6BAA6B;IAEnC,SAAS,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,mBAAmB;IAEnD,GAAG,EAAE,KAA4B,EAAE,4CAAvB,EAAE,eAAe,EAAE;QAC7B,MAAM,IAAA,uBAAU,EAAC,KAAK,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,EAAE,EAAE,GAAG,EAAE,eAAe,EAAE,CAAC,CAAC;IACtE,CAAC,CAAA;CACF,CAAC","sourcesContent":["import { runCommand } from '../lib/runCommand';\nimport { CreateQpqAppStep } from '../types';\n\n// The workspace lib packages resolve through their built dist/ (package.json\n// main), so a fresh scaffold can't `go:dev` until they're tsc'd once. Only\n// possible when dependencies were installed.\nexport const buildWorkspaces: CreateQpqAppStep = {\n name: 'Building workspace packages',\n\n shouldRun: (answers) => answers.installDependencies,\n\n run: async ({ targetDirectory }) => {\n await runCommand('npm', ['run', 'build'], { cwd: targetDirectory });\n },\n};\n"]}
|
|
@@ -14,6 +14,9 @@ exports.printNextSteps = {
|
|
|
14
14
|
name: 'Done',
|
|
15
15
|
run: (_a) => __awaiter(void 0, [_a], void 0, function* ({ answers }) {
|
|
16
16
|
const install = answers.installDependencies ? '' : ' npm install\n npm run build\n';
|
|
17
|
+
const deployNote = answers.dockerRegistry
|
|
18
|
+
? `builds the image for ${answers.dockerRegistry} and writes a docker-compose.yml to run it on the host`
|
|
19
|
+
: 'builds the docker image and writes a docker-compose.yml to run it (add a registry in deploy.config.json to push it to another host)';
|
|
17
20
|
console.log(`
|
|
18
21
|
Created ${answers.appName}!
|
|
19
22
|
|
|
@@ -24,10 +27,10 @@ Next steps:
|
|
|
24
27
|
|
|
25
28
|
cd ${answers.appName}
|
|
26
29
|
${install} npm run dev # api on http://localhost:8080, web on http://localhost:3080
|
|
27
|
-
npm run deploy #
|
|
30
|
+
npm run deploy # ${deployNote}
|
|
28
31
|
|
|
29
|
-
|
|
32
|
+
Deployments live in apps/${answers.appName}/deploy.config.json (pick one when prompted, or pass --deployment <name>); the domain (${answers.domain}) is each deployment's ROOT_DOMAINS setting there, and the docker host details (registry, publicHost, dataPath) are its platformSettings.
|
|
30
33
|
`);
|
|
31
34
|
}),
|
|
32
35
|
};
|
|
33
|
-
//# sourceMappingURL=
|
|
36
|
+
//# sourceMappingURL=014_printNextSteps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"014_printNextSteps.js","sourceRoot":"","sources":["../../../src/steps/014_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;QACtF,MAAM,UAAU,GAAG,OAAO,CAAC,cAAc;YACvC,CAAC,CAAC,wBAAwB,OAAO,CAAC,cAAc,wDAAwD;YACxG,CAAC,CAAC,qIAAqI,CAAC;QAE1I,OAAO,CAAC,GAAG,CAAC;UACN,OAAO,CAAC,OAAO;;;;;;;OAOlB,OAAO,CAAC,OAAO;EACpB,OAAO;yBACgB,UAAU;;2BAER,OAAO,CAAC,OAAO,0FAA0F,OAAO,CAAC,MAAM;CACjJ,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 const deployNote = answers.dockerRegistry\n ? `builds the image for ${answers.dockerRegistry} and writes a docker-compose.yml to run it on the host`\n : 'builds the docker image and writes a docker-compose.yml to run it (add a registry in deploy.config.json to push it to another host)';\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 # ${deployNote}\n\nDeployments live in apps/${answers.appName}/deploy.config.json (pick one when prompted, or pass --deployment <name>); the domain (${answers.domain}) is each deployment's ROOT_DOMAINS setting there, and the docker host details (registry, publicHost, dataPath) are its platformSettings.\n`);\n },\n};\n"]}
|
|
@@ -5,12 +5,13 @@ import { deleteDocusaurus } from './003_deleteDocusaurus';
|
|
|
5
5
|
import { deleteQpqjsApp } from './004_deleteQpqjsApp';
|
|
6
6
|
import { applyAppIdentity } from './005_applyAppIdentity';
|
|
7
7
|
import { applyDomain } from './006_applyDomain';
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
8
|
+
import { applyDockerHost } from './007_applyDockerHost';
|
|
9
|
+
import { pinRegistryVersions } from './008_pinRegistryVersions';
|
|
10
|
+
import { transpileToJavaScript } from './009_transpileToJavaScript';
|
|
11
|
+
import { restoreGitignore } from './010_restoreGitignore';
|
|
12
|
+
import { gitInit } from './011_gitInit';
|
|
13
|
+
import { npmInstall } from './012_npmInstall';
|
|
14
|
+
import { buildWorkspaces } from './013_buildWorkspaces';
|
|
15
|
+
import { printNextSteps } from './014_printNextSteps';
|
|
15
16
|
export declare const createQpqAppSteps: CreateQpqAppStep[];
|
|
16
|
-
export { applyAppIdentity, applyDomain, buildWorkspaces, copyTemplate, deleteDocusaurus, deleteQpqjsApp, gitInit, npmInstall, pinRegistryVersions, preflight, printNextSteps, restoreGitignore, transpileToJavaScript, };
|
|
17
|
+
export { applyAppIdentity, applyDockerHost, applyDomain, buildWorkspaces, copyTemplate, deleteDocusaurus, deleteQpqjsApp, gitInit, npmInstall, pinRegistryVersions, preflight, printNextSteps, restoreGitignore, transpileToJavaScript, };
|