@qpqjs/cli 0.3.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/cli/commandMenu.js +5 -4
- package/lib/commonjs/cli/commandMenu.js.map +1 -1
- package/lib/commonjs/cli/runCli.js +15 -7
- package/lib/commonjs/cli/runCli.js.map +1 -1
- package/lib/commonjs/commands/checkCircular.js +15 -7
- package/lib/commonjs/commands/checkCircular.js.map +1 -1
- package/lib/commonjs/commands/clearResources.js +8 -14
- package/lib/commonjs/commands/clearResources.js.map +1 -1
- package/lib/commonjs/commands/go.js +3 -7
- package/lib/commonjs/commands/go.js.map +1 -1
- package/lib/commonjs/commands/goDev.js +4 -2
- package/lib/commonjs/commands/goDev.js.map +1 -1
- package/lib/commonjs/commands/goDevApi.js +27 -23
- package/lib/commonjs/commands/goDevApi.js.map +1 -1
- package/lib/commonjs/commands/goDevWeb.js +14 -9
- package/lib/commonjs/commands/goDevWeb.js.map +1 -1
- package/lib/commonjs/commands/goDocker.js +10 -13
- package/lib/commonjs/commands/goDocker.js.map +1 -1
- package/lib/commonjs/commands/hooks.js +4 -2
- package/lib/commonjs/commands/hooks.js.map +1 -1
- package/lib/commonjs/commands/migrate.js +11 -9
- package/lib/commonjs/commands/migrate.js.map +1 -1
- package/lib/commonjs/commands/prep.js +4 -2
- package/lib/commonjs/commands/prep.js.map +1 -1
- package/lib/commonjs/commands/publish.js +4 -7
- package/lib/commonjs/commands/publish.js.map +1 -1
- package/lib/commonjs/commands/scriptBuild.js +7 -5
- package/lib/commonjs/commands/scriptBuild.js.map +1 -1
- package/lib/commonjs/commands/scriptBuilderLayer.js +6 -4
- package/lib/commonjs/commands/scriptBuilderLayer.js.map +1 -1
- package/lib/commonjs/commands/scriptNew.js +7 -5
- package/lib/commonjs/commands/scriptNew.js.map +1 -1
- package/lib/commonjs/commands/setup.js +14 -22
- package/lib/commonjs/commands/setup.js.map +1 -1
- package/lib/commonjs/commands/synth.js +16 -20
- package/lib/commonjs/commands/synth.js.map +1 -1
- package/lib/commonjs/commands/teardown.js +8 -14
- package/lib/commonjs/commands/teardown.js.map +1 -1
- package/lib/commonjs/lib/CliError.d.ts +4 -0
- package/lib/commonjs/lib/CliError.js +14 -0
- package/lib/commonjs/lib/CliError.js.map +1 -0
- package/lib/commonjs/lib/Output.d.ts +12 -0
- package/lib/commonjs/lib/Output.js +3 -0
- package/lib/commonjs/lib/Output.js.map +1 -0
- package/lib/commonjs/lib/circularImports.d.ts +0 -1
- package/lib/commonjs/lib/circularImports.js +5 -6
- package/lib/commonjs/lib/circularImports.js.map +1 -1
- package/lib/commonjs/lib/clearResourcesPlan.d.ts +0 -1
- package/lib/commonjs/lib/clearResourcesPlan.js +12 -13
- package/lib/commonjs/lib/clearResourcesPlan.js.map +1 -1
- package/lib/commonjs/lib/createOutput.d.ts +2 -0
- package/lib/commonjs/lib/createOutput.js +39 -0
- package/lib/commonjs/lib/createOutput.js.map +1 -0
- package/lib/commonjs/lib/deployPrompts.d.ts +2 -1
- package/lib/commonjs/lib/deployPrompts.js +16 -16
- package/lib/commonjs/lib/deployPrompts.js.map +1 -1
- package/lib/commonjs/lib/devServerEntry.js +5 -4
- package/lib/commonjs/lib/devServerEntry.js.map +1 -1
- package/lib/commonjs/lib/devServerPorts.js +2 -4
- package/lib/commonjs/lib/devServerPorts.js.map +1 -1
- package/lib/commonjs/lib/discovery.d.ts +0 -2
- package/lib/commonjs/lib/discovery.js +11 -44
- package/lib/commonjs/lib/discovery.js.map +1 -1
- package/lib/commonjs/lib/hooks.js +5 -3
- package/lib/commonjs/lib/hooks.js.map +1 -1
- package/lib/commonjs/lib/killChildWithEscalation.js +3 -1
- package/lib/commonjs/lib/killChildWithEscalation.js.map +1 -1
- package/lib/commonjs/lib/killStaleListeners.js +24 -37
- package/lib/commonjs/lib/killStaleListeners.js.map +1 -1
- package/lib/commonjs/lib/prompts.d.ts +1 -0
- package/lib/commonjs/lib/prompts.js +15 -2
- package/lib/commonjs/lib/prompts.js.map +1 -1
- package/lib/commonjs/lib/qpqConfigs.d.ts +1 -0
- package/lib/commonjs/lib/qpqConfigs.js +11 -6
- package/lib/commonjs/lib/qpqConfigs.js.map +1 -1
- package/lib/commonjs/lib/requireDriverCapability.d.ts +7 -0
- package/lib/commonjs/lib/requireDriverCapability.js +17 -0
- package/lib/commonjs/lib/requireDriverCapability.js.map +1 -0
- package/lib/commonjs/lib/resolveAppSelection.d.ts +1 -0
- package/lib/commonjs/lib/resolveAppSelection.js +19 -12
- package/lib/commonjs/lib/resolveAppSelection.js.map +1 -1
- package/lib/commonjs/lib/resolveCommandContext.d.ts +12 -0
- package/lib/commonjs/lib/resolveCommandContext.js +26 -0
- package/lib/commonjs/lib/resolveCommandContext.js.map +1 -0
- package/lib/commonjs/lib/resolveDeployment.d.ts +0 -1
- package/lib/commonjs/lib/resolveDeployment.js +15 -10
- package/lib/commonjs/lib/resolveDeployment.js.map +1 -1
- package/lib/commonjs/lib/runCommand.d.ts +20 -0
- package/lib/commonjs/lib/runCommand.js +64 -34
- package/lib/commonjs/lib/runCommand.js.map +1 -1
- package/lib/commonjs/lib/runTasks.js +8 -4
- package/lib/commonjs/lib/runTasks.js.map +1 -1
- package/lib/commonjs/lib/timing.js +5 -3
- package/lib/commonjs/lib/timing.js.map +1 -1
- package/lib/commonjs/lib/typeWatcher.d.ts +2 -1
- package/lib/commonjs/lib/typeWatcher.js +6 -13
- package/lib/commonjs/lib/typeWatcher.js.map +1 -1
- package/lib/commonjs/lib/userScriptBuilderLayer.d.ts +0 -2
- package/lib/commonjs/lib/userScriptBuilderLayer.js +7 -8
- package/lib/commonjs/lib/userScriptBuilderLayer.js.map +1 -1
- package/lib/commonjs/lib/views.js +3 -2
- package/lib/commonjs/lib/views.js.map +1 -1
- package/lib/commonjs/lib/webAddressingEnv.d.ts +0 -2
- package/lib/commonjs/lib/webAddressingEnv.js +4 -4
- package/lib/commonjs/lib/webAddressingEnv.js.map +1 -1
- package/lib/commonjs/platforms/aws/awsCredentials.js +3 -1
- package/lib/commonjs/platforms/aws/awsCredentials.js.map +1 -1
- package/lib/commonjs/platforms/aws/cdkApp.js +1 -1
- package/lib/commonjs/platforms/aws/cdkApp.js.map +1 -1
- package/lib/commonjs/platforms/aws/clearResources.js +17 -26
- package/lib/commonjs/platforms/aws/clearResources.js.map +1 -1
- package/lib/commonjs/platforms/aws/getDeployEnv.d.ts +1 -0
- package/lib/commonjs/platforms/aws/getDeployEnv.js +12 -0
- package/lib/commonjs/platforms/aws/getDeployEnv.js.map +1 -0
- package/lib/commonjs/platforms/aws/go.js +17 -15
- package/lib/commonjs/platforms/aws/go.js.map +1 -1
- package/lib/commonjs/platforms/aws/goDocker.js +29 -26
- package/lib/commonjs/platforms/aws/goDocker.js.map +1 -1
- package/lib/commonjs/platforms/aws/goDockerManifest.js +6 -1
- package/lib/commonjs/platforms/aws/goDockerManifest.js.map +1 -1
- package/lib/commonjs/platforms/aws/publish.js +13 -11
- package/lib/commonjs/platforms/aws/publish.js.map +1 -1
- package/lib/commonjs/platforms/aws/remote.js +8 -7
- package/lib/commonjs/platforms/aws/remote.js.map +1 -1
- package/lib/commonjs/platforms/aws/setup/buildBucketNamesStep.js +4 -4
- package/lib/commonjs/platforms/aws/setup/buildBucketNamesStep.js.map +1 -1
- package/lib/commonjs/platforms/aws/setup/buildGithubDeployRoleStep.js +4 -3
- package/lib/commonjs/platforms/aws/setup/buildGithubDeployRoleStep.js.map +1 -1
- package/lib/commonjs/platforms/aws/stacks.d.ts +0 -1
- package/lib/commonjs/platforms/aws/stacks.js +17 -33
- package/lib/commonjs/platforms/aws/stacks.js.map +1 -1
- package/lib/commonjs/platforms/aws/teardown.js +9 -7
- package/lib/commonjs/platforms/aws/teardown.js.map +1 -1
- package/lib/commonjs/platforms/aws/viewsSync.js +23 -11
- package/lib/commonjs/platforms/aws/viewsSync.js.map +1 -1
- package/lib/commonjs/platforms/docker/go.js +20 -18
- package/lib/commonjs/platforms/docker/go.js.map +1 -1
- package/lib/commonjs/platforms/docker/index.js +5 -4
- package/lib/commonjs/platforms/docker/index.js.map +1 -1
- package/lib/commonjs/platforms/docker/parseMounts.js +3 -2
- package/lib/commonjs/platforms/docker/parseMounts.js.map +1 -1
- package/lib/commonjs/platforms/index.js +4 -2
- package/lib/commonjs/platforms/index.js.map +1 -1
- package/lib/commonjs/platforms/types.d.ts +2 -2
- package/lib/commonjs/platforms/types.js.map +1 -1
- package/lib/esm/cli/commandMenu.js +5 -4
- package/lib/esm/cli/commandMenu.js.map +1 -1
- package/lib/esm/cli/runCli.js +15 -7
- package/lib/esm/cli/runCli.js.map +1 -1
- package/lib/esm/commands/checkCircular.js +15 -7
- package/lib/esm/commands/checkCircular.js.map +1 -1
- package/lib/esm/commands/clearResources.js +8 -14
- package/lib/esm/commands/clearResources.js.map +1 -1
- package/lib/esm/commands/go.js +3 -7
- package/lib/esm/commands/go.js.map +1 -1
- package/lib/esm/commands/goDev.js +4 -2
- package/lib/esm/commands/goDev.js.map +1 -1
- package/lib/esm/commands/goDevApi.js +24 -21
- package/lib/esm/commands/goDevApi.js.map +1 -1
- package/lib/esm/commands/goDevWeb.js +13 -9
- package/lib/esm/commands/goDevWeb.js.map +1 -1
- package/lib/esm/commands/goDocker.js +10 -13
- package/lib/esm/commands/goDocker.js.map +1 -1
- package/lib/esm/commands/hooks.js +4 -2
- package/lib/esm/commands/hooks.js.map +1 -1
- package/lib/esm/commands/migrate.js +9 -7
- package/lib/esm/commands/migrate.js.map +1 -1
- package/lib/esm/commands/prep.js +4 -2
- package/lib/esm/commands/prep.js.map +1 -1
- package/lib/esm/commands/publish.js +4 -7
- package/lib/esm/commands/publish.js.map +1 -1
- package/lib/esm/commands/scriptBuild.js +7 -5
- package/lib/esm/commands/scriptBuild.js.map +1 -1
- package/lib/esm/commands/scriptBuilderLayer.js +6 -4
- package/lib/esm/commands/scriptBuilderLayer.js.map +1 -1
- package/lib/esm/commands/scriptNew.js +7 -5
- package/lib/esm/commands/scriptNew.js.map +1 -1
- package/lib/esm/commands/setup.js +14 -22
- package/lib/esm/commands/setup.js.map +1 -1
- package/lib/esm/commands/synth.js +18 -22
- package/lib/esm/commands/synth.js.map +1 -1
- package/lib/esm/commands/teardown.js +8 -14
- package/lib/esm/commands/teardown.js.map +1 -1
- package/lib/esm/lib/CliError.d.ts +4 -0
- package/lib/esm/lib/CliError.js +11 -0
- package/lib/esm/lib/CliError.js.map +1 -0
- package/lib/esm/lib/Output.d.ts +12 -0
- package/lib/esm/lib/Output.js +2 -0
- package/lib/esm/lib/Output.js.map +1 -0
- package/lib/esm/lib/circularImports.d.ts +0 -1
- package/lib/esm/lib/circularImports.js +4 -4
- package/lib/esm/lib/circularImports.js.map +1 -1
- package/lib/esm/lib/clearResourcesPlan.d.ts +0 -1
- package/lib/esm/lib/clearResourcesPlan.js +12 -12
- package/lib/esm/lib/clearResourcesPlan.js.map +1 -1
- package/lib/esm/lib/createOutput.d.ts +2 -0
- package/lib/esm/lib/createOutput.js +35 -0
- package/lib/esm/lib/createOutput.js.map +1 -0
- package/lib/esm/lib/deployPrompts.d.ts +2 -1
- package/lib/esm/lib/deployPrompts.js +17 -17
- package/lib/esm/lib/deployPrompts.js.map +1 -1
- package/lib/esm/lib/devServerEntry.js +5 -4
- package/lib/esm/lib/devServerEntry.js.map +1 -1
- package/lib/esm/lib/devServerPorts.js +2 -3
- package/lib/esm/lib/devServerPorts.js.map +1 -1
- package/lib/esm/lib/discovery.d.ts +0 -2
- package/lib/esm/lib/discovery.js +10 -38
- package/lib/esm/lib/discovery.js.map +1 -1
- package/lib/esm/lib/hooks.js +5 -3
- package/lib/esm/lib/hooks.js.map +1 -1
- package/lib/esm/lib/killChildWithEscalation.js +3 -1
- package/lib/esm/lib/killChildWithEscalation.js.map +1 -1
- package/lib/esm/lib/killStaleListeners.js +24 -37
- package/lib/esm/lib/killStaleListeners.js.map +1 -1
- package/lib/esm/lib/prompts.d.ts +1 -0
- package/lib/esm/lib/prompts.js +13 -1
- package/lib/esm/lib/prompts.js.map +1 -1
- package/lib/esm/lib/qpqConfigs.d.ts +1 -0
- package/lib/esm/lib/qpqConfigs.js +9 -5
- package/lib/esm/lib/qpqConfigs.js.map +1 -1
- package/lib/esm/lib/requireDriverCapability.d.ts +7 -0
- package/lib/esm/lib/requireDriverCapability.js +13 -0
- package/lib/esm/lib/requireDriverCapability.js.map +1 -0
- package/lib/esm/lib/resolveAppSelection.d.ts +1 -0
- package/lib/esm/lib/resolveAppSelection.js +17 -11
- package/lib/esm/lib/resolveAppSelection.js.map +1 -1
- package/lib/esm/lib/resolveCommandContext.d.ts +12 -0
- package/lib/esm/lib/resolveCommandContext.js +12 -0
- package/lib/esm/lib/resolveCommandContext.js.map +1 -0
- package/lib/esm/lib/resolveDeployment.d.ts +0 -1
- package/lib/esm/lib/resolveDeployment.js +13 -8
- package/lib/esm/lib/resolveDeployment.js.map +1 -1
- package/lib/esm/lib/runCommand.d.ts +20 -0
- package/lib/esm/lib/runCommand.js +52 -31
- package/lib/esm/lib/runCommand.js.map +1 -1
- package/lib/esm/lib/runTasks.js +8 -4
- package/lib/esm/lib/runTasks.js.map +1 -1
- package/lib/esm/lib/timing.js +5 -3
- package/lib/esm/lib/timing.js.map +1 -1
- package/lib/esm/lib/typeWatcher.d.ts +2 -1
- package/lib/esm/lib/typeWatcher.js +6 -13
- package/lib/esm/lib/typeWatcher.js.map +1 -1
- package/lib/esm/lib/userScriptBuilderLayer.d.ts +0 -2
- package/lib/esm/lib/userScriptBuilderLayer.js +5 -5
- package/lib/esm/lib/userScriptBuilderLayer.js.map +1 -1
- package/lib/esm/lib/views.js +3 -2
- package/lib/esm/lib/views.js.map +1 -1
- package/lib/esm/lib/webAddressingEnv.d.ts +0 -2
- package/lib/esm/lib/webAddressingEnv.js +1 -1
- package/lib/esm/lib/webAddressingEnv.js.map +1 -1
- package/lib/esm/platforms/aws/awsCredentials.js +3 -1
- package/lib/esm/platforms/aws/awsCredentials.js.map +1 -1
- package/lib/esm/platforms/aws/cdkApp.js +1 -1
- package/lib/esm/platforms/aws/cdkApp.js.map +1 -1
- package/lib/esm/platforms/aws/clearResources.js +18 -26
- package/lib/esm/platforms/aws/clearResources.js.map +1 -1
- package/lib/esm/platforms/aws/getDeployEnv.d.ts +1 -0
- package/lib/esm/platforms/aws/getDeployEnv.js +8 -0
- package/lib/esm/platforms/aws/getDeployEnv.js.map +1 -0
- package/lib/esm/platforms/aws/go.js +17 -15
- package/lib/esm/platforms/aws/go.js.map +1 -1
- package/lib/esm/platforms/aws/goDocker.js +29 -26
- package/lib/esm/platforms/aws/goDocker.js.map +1 -1
- package/lib/esm/platforms/aws/goDockerManifest.js +6 -1
- package/lib/esm/platforms/aws/goDockerManifest.js.map +1 -1
- package/lib/esm/platforms/aws/publish.js +13 -11
- package/lib/esm/platforms/aws/publish.js.map +1 -1
- package/lib/esm/platforms/aws/remote.js +9 -7
- package/lib/esm/platforms/aws/remote.js.map +1 -1
- package/lib/esm/platforms/aws/setup/buildBucketNamesStep.js +2 -2
- package/lib/esm/platforms/aws/setup/buildBucketNamesStep.js.map +1 -1
- package/lib/esm/platforms/aws/setup/buildGithubDeployRoleStep.js +4 -3
- package/lib/esm/platforms/aws/setup/buildGithubDeployRoleStep.js.map +1 -1
- package/lib/esm/platforms/aws/stacks.d.ts +0 -1
- package/lib/esm/platforms/aws/stacks.js +20 -32
- package/lib/esm/platforms/aws/stacks.js.map +1 -1
- package/lib/esm/platforms/aws/teardown.js +9 -7
- package/lib/esm/platforms/aws/teardown.js.map +1 -1
- package/lib/esm/platforms/aws/viewsSync.js +22 -10
- package/lib/esm/platforms/aws/viewsSync.js.map +1 -1
- package/lib/esm/platforms/docker/go.js +21 -19
- package/lib/esm/platforms/docker/go.js.map +1 -1
- package/lib/esm/platforms/docker/index.js +5 -4
- package/lib/esm/platforms/docker/index.js.map +1 -1
- package/lib/esm/platforms/docker/parseMounts.js +3 -2
- package/lib/esm/platforms/docker/parseMounts.js.map +1 -1
- package/lib/esm/platforms/index.js +4 -2
- package/lib/esm/platforms/index.js.map +1 -1
- package/lib/esm/platforms/types.d.ts +2 -2
- package/lib/esm/platforms/types.js.map +1 -1
- package/package.json +28 -15
- package/templates/user-script/README.md +1 -1
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
// `qpq hooks <name
|
|
1
|
+
// `qpq hooks <name>`, run the `qpq:<name>` script (or the plain `<name>`
|
|
2
2
|
// script when no qpq:-prefixed one exists) of every app and workspace package
|
|
3
3
|
// that defines one, in dependency order with parallel execution.
|
|
4
4
|
// Wire the root package.json's lifecycle to it, e.g.
|
|
5
5
|
// "postinstall": "qpq hooks postinstall". Use --jobs=1 to force serial runs.
|
|
6
6
|
import { getArgValue } from '../lib/args';
|
|
7
|
+
import { createOutput } from '../lib/createOutput';
|
|
7
8
|
import { getDefaultHookJobs } from '../lib/getDefaultHookJobs';
|
|
8
9
|
import { runHookForAllPackages } from '../lib/hooks';
|
|
9
10
|
import { assertNoFailures } from '../lib/runTasks';
|
|
11
|
+
const out = createOutput('hooks');
|
|
10
12
|
const getJobs = (argv) => {
|
|
11
13
|
const parsed = Number(getArgValue(argv, '--jobs'));
|
|
12
14
|
if (Number.isFinite(parsed) && parsed >= 1) {
|
|
@@ -17,7 +19,7 @@ const getJobs = (argv) => {
|
|
|
17
19
|
export const hooksCommand = async (argv) => {
|
|
18
20
|
const [hook] = argv.filter((a) => !a.startsWith('--'));
|
|
19
21
|
if (!hook) {
|
|
20
|
-
|
|
22
|
+
out.error('Usage: qpq hooks <name> [--jobs=N] (runs qpq:<name>, or plain <name>, in every app/package that defines it)');
|
|
21
23
|
process.exit(1);
|
|
22
24
|
}
|
|
23
25
|
const failures = await runHookForAllPackages(hook, getJobs(argv));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.js","sourceRoot":"","sources":["../../../src/commands/hooks.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"hooks.js","sourceRoot":"","sources":["../../../src/commands/hooks.ts"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AAE,QAAQ,CAAC,CAAC;AAC9C,CAAC,CAAC","sourcesContent":["// `qpq hooks <name>`, run the `qpq:<name>` script (or the plain `<name>`\n// script when no qpq:-prefixed one exists) of every app and workspace package\n// that defines one, in dependency order with parallel execution.\n// Wire the root package.json's lifecycle to it, e.g.\n// \"postinstall\": \"qpq hooks postinstall\". Use --jobs=1 to force serial runs.\nimport { getArgValue } from '../lib/args';\nimport { createOutput } from '../lib/createOutput';\nimport { getDefaultHookJobs } from '../lib/getDefaultHookJobs';\nimport { runHookForAllPackages } from '../lib/hooks';\nimport { assertNoFailures } from '../lib/runTasks';\n\nconst out = createOutput('hooks');\n\nconst getJobs = (argv: string[]): number => {\n const parsed = Number(getArgValue(argv, '--jobs'));\n if (Number.isFinite(parsed) && parsed >= 1) {\n return Math.floor(parsed);\n }\n return getDefaultHookJobs();\n};\n\nexport const hooksCommand = async (argv: string[]): Promise<void> => {\n const [hook] = argv.filter((a) => !a.startsWith('--'));\n\n if (!hook) {\n out.error('Usage: qpq hooks <name> [--jobs=N] (runs qpq:<name>, or plain <name>, in every app/package that defines it)');\n process.exit(1);\n }\n\n const failures = await runHookForAllPackages(hook, getJobs(argv));\n assertNoFailures(`hooks ${hook}`, failures);\n};\n"]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { getDevServerDistPath } from '@qpqjs/core';
|
|
2
|
+
// `qpq migrate`, run every pending migration against the LOCAL dev store, once, then exit.
|
|
2
3
|
//
|
|
3
4
|
// Deployed, migrations are triggered by a stack update. Nothing locally ever deploys, so
|
|
4
5
|
// without this a migration is first executed in a real environment, which is a poor place to
|
|
@@ -8,26 +9,27 @@
|
|
|
8
9
|
// Migrations are recorded as they run, in the same store the deploy path uses, so running
|
|
9
10
|
// this twice is a no-op the second time.
|
|
10
11
|
import { getAppServiceQpqConfigs, getDevServerRspackConfig } from '@qpqjs/deploy-rspack';
|
|
11
|
-
import { spawn } from 'child_process';
|
|
12
12
|
import path from 'path';
|
|
13
13
|
import { rspack } from '@rspack/core';
|
|
14
|
+
import { createOutput } from '../lib/createOutput';
|
|
14
15
|
import { writeDevServerEntry } from '../lib/devServerEntry';
|
|
15
16
|
import { getRoot } from '../lib/discovery';
|
|
16
17
|
import { resolveAppSelection } from '../lib/resolveAppSelection';
|
|
17
18
|
import { resolveDeployment } from '../lib/resolveDeployment';
|
|
18
|
-
|
|
19
|
+
import { spawnCommand } from '../lib/runCommand';
|
|
20
|
+
const out = createOutput('migrate');
|
|
19
21
|
export const migrateCommand = async (argv) => {
|
|
20
22
|
const root = getRoot();
|
|
21
23
|
const appName = await resolveAppSelection({ argv, envVar: 'QPQ_DEV_APP' });
|
|
22
24
|
process.env.QPQ_DEV_APP = appName;
|
|
23
25
|
await resolveDeployment(argv, appName);
|
|
24
|
-
|
|
26
|
+
out.log(`Running local migrations for app [${appName}]`);
|
|
25
27
|
const qpqConfigs = getAppServiceQpqConfigs(root, appName);
|
|
26
28
|
const entry = writeDevServerEntry(root, appName, 'migrate');
|
|
27
29
|
const rspackConfig = getDevServerRspackConfig({ root, entry, qpqConfigs });
|
|
28
30
|
// Same bundle shape as the dev server, different output name so a running `go:dev:api`
|
|
29
31
|
// watcher does not fight over the file.
|
|
30
|
-
const bundlePath = path.join(root,
|
|
32
|
+
const bundlePath = path.join(getDevServerDistPath(root), 'migrate.js');
|
|
31
33
|
const migrateConfig = {
|
|
32
34
|
...rspackConfig,
|
|
33
35
|
output: { ...rspackConfig.output, filename: 'migrate.js' },
|
|
@@ -38,7 +40,7 @@ export const migrateCommand = async (argv) => {
|
|
|
38
40
|
return reject(error);
|
|
39
41
|
}
|
|
40
42
|
if (stats?.hasErrors()) {
|
|
41
|
-
|
|
43
|
+
out.error(stats.toString({ colors: true, all: false, errors: true }));
|
|
42
44
|
return reject(new Error('Failed to bundle migrations'));
|
|
43
45
|
}
|
|
44
46
|
resolve();
|
|
@@ -47,7 +49,7 @@ export const migrateCommand = async (argv) => {
|
|
|
47
49
|
// The bundle exits non-zero on failure; mirror that so a shell chain or CI notices instead
|
|
48
50
|
// of carrying on as though the data were migrated.
|
|
49
51
|
const exitCode = await new Promise((resolve) => {
|
|
50
|
-
const child =
|
|
52
|
+
const child = spawnCommand('node', [bundlePath], { env: { QPQ_DEV_APP: appName } });
|
|
51
53
|
child.on('exit', (code) => resolve(code ?? 1));
|
|
52
54
|
});
|
|
53
55
|
if (exitCode !== 0) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migrate.js","sourceRoot":"","sources":["../../../src/commands/migrate.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"migrate.js","sourceRoot":"","sources":["../../../src/commands/migrate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACnD,2FAA2F;AAC3F,EAAE;AACF,yFAAyF;AACzF,6FAA6F;AAC7F,0FAA0F;AAC1F,4FAA4F;AAC5F,EAAE;AACF,0FAA0F;AAC1F,yCAAyC;AACzC,OAAO,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAEzF,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,MAAM,GAAG,GAAG,YAAY,CAAC,SAAS,CAAC,CAAC;AAEpC,MAAM,CAAC,MAAM,cAAc,GAAG,KAAK,EAAE,IAAc,EAAiB,EAAE;IACpE,MAAM,IAAI,GAA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AO,MAAM,CAAC,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC,CAAC;YAC1D,CAAC;YAED,OAAO,EAAE,CAAC;QACZ,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,2FAA2F;IAC3F,mDAAmD;IACnD,MAAM,QAAQ,GAAG,MAAM,IAAI,OAAO,CAAS,CAAC,OAAO,EAAE,EAAE;QACrD,MAAM,KAAK,GAAG,YAAY,CAAC,MAAM,EAAE,CAAC,UAAU,CAAC,EAAE,EAAE,GAAG,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,EAAE,CAAC,CAAC;QACpF,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC;IACjD,CAAC,CAAC,CAAC;IAEH,IAAI,QAAQ,KAAK,CAAC,EAAE,CAAC;QACnB,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC9B,CAAC;AACH,CAAC,CAAC","sourcesContent":["import { getDevServerDistPath } from '@qpqjs/core';\n// `qpq migrate`, run every pending migration against the LOCAL dev store, once, then exit.\n//\n// Deployed, migrations are triggered by a stack update. Nothing locally ever deploys, so\n// without this a migration is first executed in a real environment, which is a poor place to\n// discover what it does. This bundles exactly what `go:dev:api` bundles and runs the same\n// queue path, so a local run rehearses the deployed one rather than a convenient lookalike.\n//\n// Migrations are recorded as they run, in the same store the deploy path uses, so running\n// this twice is a no-op the second time.\nimport { getAppServiceQpqConfigs, getDevServerRspackConfig } from '@qpqjs/deploy-rspack';\n\nimport path from 'path';\nimport { rspack } from '@rspack/core';\n\nimport { createOutput } from '../lib/createOutput';\nimport { writeDevServerEntry } from '../lib/devServerEntry';\nimport { getRoot } from '../lib/discovery';\nimport { resolveAppSelection } from '../lib/resolveAppSelection';\nimport { resolveDeployment } from '../lib/resolveDeployment';\nimport { spawnCommand } from '../lib/runCommand';\n\nconst out = createOutput('migrate');\n\nexport const migrateCommand = async (argv: string[]): Promise<void> => {\n const root = getRoot();\n const appName = await resolveAppSelection({ argv, envVar: 'QPQ_DEV_APP' });\n process.env.QPQ_DEV_APP = appName;\n await resolveDeployment(argv, appName);\n\n out.log(`Running local migrations for app [${appName}]`);\n\n const qpqConfigs = getAppServiceQpqConfigs(root, appName);\n const entry = writeDevServerEntry(root, appName, 'migrate');\n const rspackConfig = getDevServerRspackConfig({ root, entry, qpqConfigs });\n\n // Same bundle shape as the dev server, different output name so a running `go:dev:api`\n // watcher does not fight over the file.\n const bundlePath = path.join(getDevServerDistPath(root), 'migrate.js');\n const migrateConfig = {\n ...rspackConfig,\n output: { ...rspackConfig.output, filename: 'migrate.js' },\n };\n\n await new Promise<void>((resolve, reject) => {\n rspack(migrateConfig as any, (error, stats) => {\n if (error) {\n return reject(error);\n }\n\n if (stats?.hasErrors()) {\n out.error(stats.toString({ colors: true, all: false, errors: true }));\n return reject(new Error('Failed to bundle migrations'));\n }\n\n resolve();\n });\n });\n\n // The bundle exits non-zero on failure; mirror that so a shell chain or CI notices instead\n // of carrying on as though the data were migrated.\n const exitCode = await new Promise<number>((resolve) => {\n const child = spawnCommand('node', [bundlePath], { env: { QPQ_DEV_APP: appName } });\n child.on('exit', (code) => resolve(code ?? 1));\n });\n\n if (exitCode !== 0) {\n process.exitCode = exitCode;\n }\n};\n"]}
|
package/lib/esm/commands/prep.js
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
// `qpq prep
|
|
1
|
+
// `qpq prep`, regenerates apps/<app>/tsconfig.federated.json (the TypeScript
|
|
2
2
|
// path aliases for cross-view federated imports). Run after adding/removing a
|
|
3
3
|
// `// federated.export` marker.
|
|
4
4
|
import { writeFederatedTsconfigForApp } from '@qpqjs/deploy-rspack';
|
|
5
|
+
import { createOutput } from '../lib/createOutput';
|
|
5
6
|
import { getAvailableApps, getRoot } from '../lib/discovery';
|
|
6
7
|
import { resolveAppSelection } from '../lib/resolveAppSelection';
|
|
8
|
+
const out = createOutput('prep');
|
|
7
9
|
export const prepCommand = async (argv) => {
|
|
8
10
|
const selection = await resolveAppSelection({ argv, allowAll: true });
|
|
9
11
|
const appNames = selection === 'all' ? getAvailableApps() : [selection];
|
|
10
12
|
for (const appName of appNames) {
|
|
11
13
|
const exposeCount = writeFederatedTsconfigForApp(getRoot(), appName);
|
|
12
|
-
|
|
14
|
+
out.log(`prep: wrote ${exposeCount} federated aliases to apps/${appName}/tsconfig.federated.json`);
|
|
13
15
|
}
|
|
14
16
|
};
|
|
15
17
|
//# sourceMappingURL=prep.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prep.js","sourceRoot":"","sources":["../../../src/commands/prep.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"prep.js","sourceRoot":"","sources":["../../../src/commands/prep.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,8EAA8E;AAC9E,gCAAgC;AAChC,OAAO,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AAEpE,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEjE,MAAM,GAAG,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;AAEjC,MAAM,CAAC,MAAM,WAAW,GAAG,KAAK,EAAE,IAAc,EAAiB,EAAE;IACjE,MAAM,SAAS,GAAG,MAAM,mBAAmB,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;IACtE,MAAM,QAAQ,GAAG,SAAS,KAAK,KAAK,CAAC,CAAC,CAAC,gBAAgB,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IAExE,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAC/B,MAAM,WAAW,GAAG,4BAA4B,CAAC,OAAO,EAAE,EAAE,OAAO,CAAC,CAAC;QACrE,GAAG,CAAC,GAAG,CAAC,eAAe,WAAW,8BAA8B,OAAO,0BAA0B,CAAC,CAAC;IACrG,CAAC;AACH,CAAC,CAAC","sourcesContent":["// `qpq prep`, regenerates apps/<app>/tsconfig.federated.json (the TypeScript\n// path aliases for cross-view federated imports). Run after adding/removing a\n// `// federated.export` marker.\nimport { writeFederatedTsconfigForApp } from '@qpqjs/deploy-rspack';\n\nimport { createOutput } from '../lib/createOutput';\nimport { getAvailableApps, getRoot } from '../lib/discovery';\nimport { resolveAppSelection } from '../lib/resolveAppSelection';\n\nconst out = createOutput('prep');\n\nexport const prepCommand = async (argv: string[]): Promise<void> => {\n const selection = await resolveAppSelection({ argv, allowAll: true });\n const appNames = selection === 'all' ? getAvailableApps() : [selection];\n\n for (const appName of appNames) {\n const exposeCount = writeFederatedTsconfigForApp(getRoot(), appName);\n out.log(`prep: wrote ${exposeCount} federated aliases to apps/${appName}/tsconfig.federated.json`);\n }\n};\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// `qpq publish[:build|:upload|:deploy]
|
|
1
|
+
// `qpq publish[:build|:upload|:deploy]`, build each backend service as a
|
|
2
2
|
// module-federation remote and publish it into the platform's federated code
|
|
3
3
|
// store, so the deployed backends federate their story code instead of running
|
|
4
4
|
// the bundled copy. The mechanics live in the platform driver (AWS: S3-backed,
|
|
@@ -9,15 +9,12 @@
|
|
|
9
9
|
// qpq publish --app docgen --service template
|
|
10
10
|
import { getArgValue } from '../lib/args';
|
|
11
11
|
import { getServiceNames } from '../lib/discovery';
|
|
12
|
-
import {
|
|
13
|
-
import { resolveDeployment } from '../lib/resolveDeployment';
|
|
14
|
-
import { getPlatformDriver } from '../platforms';
|
|
12
|
+
import { resolveCommandContext } from '../lib/resolveCommandContext';
|
|
15
13
|
const resolvePublishSelection = async (argv) => {
|
|
16
|
-
const appName = await
|
|
17
|
-
const { deployment } = await resolveDeployment(argv, appName);
|
|
14
|
+
const { appName, driver } = await resolveCommandContext(argv);
|
|
18
15
|
const requestedService = getArgValue(argv, '--service');
|
|
19
16
|
const serviceNames = requestedService ? [requestedService] : getServiceNames(appName);
|
|
20
|
-
return { driver
|
|
17
|
+
return { driver, appName, serviceNames };
|
|
21
18
|
};
|
|
22
19
|
export const publishCommand = async (argv) => {
|
|
23
20
|
const { driver, appName, serviceNames } = await resolvePublishSelection(argv);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publish.js","sourceRoot":"","sources":["../../../src/commands/publish.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"publish.js","sourceRoot":"","sources":["../../../src/commands/publish.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,6EAA6E;AAC7E,+EAA+E;AAC/E,+EAA+E;AAC/E,8BAA8B;AAC9B,EAAE;AACF,SAAS;AACT,+DAA+D;AAC/D,gDAAgD;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AASrE,MAAM,uBAAuB,GAAG,KAAK,EAAE,IAAc,EAA6B,EAAE;IAClF,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,MAAM,qBAAqB,CAAC,IAAI,CAAC,CAAC;IAE9D,MAAM,gBAAgB,GAAG,WAAW,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;IACxD,MAAM,YAAY,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;IAEtF,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,CAAC;AAC3C,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,KAAK,EAAE,IAAc,EAAiB,EAAE;IACpE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,GAAG,MAAM,uBAAuB,CAAC,IAAI,CAAC,CAAC;IAC9E,MAAM,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;AAC9C,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG,KAAK,EAAE,IAAc,EAAiB,EAAE;IACzE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,GAAG,MAAM,uBAAuB,CAAC,IAAI,CAAC,CAAC;IAC9E,MAAM,MAAM,CAAC,YAAY,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;AACnD,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAG,KAAK,EAAE,IAAc,EAAiB,EAAE;IAC1E,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,GAAG,MAAM,uBAAuB,CAAC,IAAI,CAAC,CAAC;IAC9E,MAAM,MAAM,CAAC,aAAa,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;AACpD,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAG,KAAK,EAAE,IAAc,EAAiB,EAAE;IAC1E,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,GAAG,MAAM,uBAAuB,CAAC,IAAI,CAAC,CAAC;IAC9E,MAAM,MAAM,CAAC,aAAa,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;AACpD,CAAC,CAAC","sourcesContent":["// `qpq publish[:build|:upload|:deploy]`, build each backend service as a\n// module-federation remote and publish it into the platform's federated code\n// store, so the deployed backends federate their story code instead of running\n// the bundled copy. The mechanics live in the platform driver (AWS: S3-backed,\n// see platforms/aws/publish).\n//\n// Usage:\n// qpq publish --app docgen (all services)\n// qpq publish --app docgen --service template\nimport { getArgValue } from '../lib/args';\nimport { getServiceNames } from '../lib/discovery';\nimport { resolveCommandContext } from '../lib/resolveCommandContext';\nimport { QpqPlatformDriver } from '../platforms';\n\ntype PublishSelection = {\n driver: QpqPlatformDriver;\n appName: string;\n serviceNames: string[];\n};\n\nconst resolvePublishSelection = async (argv: string[]): Promise<PublishSelection> => {\n const { appName, driver } = await resolveCommandContext(argv);\n\n const requestedService = getArgValue(argv, '--service');\n const serviceNames = requestedService ? [requestedService] : getServiceNames(appName);\n\n return { driver, appName, serviceNames };\n};\n\nexport const publishCommand = async (argv: string[]): Promise<void> => {\n const { driver, appName, serviceNames } = await resolvePublishSelection(argv);\n await driver.publish(appName, serviceNames);\n};\n\nexport const publishBuildCommand = async (argv: string[]): Promise<void> => {\n const { driver, appName, serviceNames } = await resolvePublishSelection(argv);\n await driver.publishBuild(appName, serviceNames);\n};\n\nexport const publishUploadCommand = async (argv: string[]): Promise<void> => {\n const { driver, appName, serviceNames } = await resolvePublishSelection(argv);\n await driver.publishUpload(appName, serviceNames);\n};\n\nexport const publishDeployCommand = async (argv: string[]): Promise<void> => {\n const { driver, appName, serviceNames } = await resolvePublishSelection(argv);\n await driver.publishDeploy(appName, serviceNames);\n};\n"]}
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
// `qpq script:build <dir> [--out <dir>] [--source-map]
|
|
1
|
+
// `qpq script:build <dir> [--out <dir>] [--source-map]`, bundle a user-script project
|
|
2
2
|
// into one main.js that askUserScriptExecute can load from a drive. `--source-map`
|
|
3
3
|
// embeds the map in main.js; no separate .map file is ever written.
|
|
4
4
|
import { buildUserScript, checkUserScriptOutput, UserScriptBuildError } from '@qpqjs/user-script';
|
|
5
5
|
import path from 'path';
|
|
6
6
|
import { getArgValue, getPositionalArgs, hasArgFlag } from '../lib/args';
|
|
7
|
+
import { createOutput } from '../lib/createOutput';
|
|
8
|
+
const out = createOutput('script:build');
|
|
7
9
|
export const scriptBuildCommand = async (argv) => {
|
|
8
10
|
const [projectDir] = getPositionalArgs(argv, ['--out']);
|
|
9
11
|
if (!projectDir) {
|
|
10
|
-
|
|
12
|
+
out.error('Usage: qpq script:build <dir> [--out <dir>] [--source-map]');
|
|
11
13
|
process.exit(1);
|
|
12
14
|
}
|
|
13
15
|
const outDir = getArgValue(argv, '--out') ?? path.join(projectDir, 'dist');
|
|
@@ -15,12 +17,12 @@ export const scriptBuildCommand = async (argv) => {
|
|
|
15
17
|
const result = await buildUserScript({ projectDir, outDir, sourceMap: hasArgFlag(argv, '--source-map') });
|
|
16
18
|
// A developer's own build is checked in this process; a platform build asks the sandbox.
|
|
17
19
|
const exports = checkUserScriptOutput(result.entryPath);
|
|
18
|
-
|
|
19
|
-
|
|
20
|
+
out.log(`script:build: wrote ${result.entryPath}`);
|
|
21
|
+
out.log(` exports: ${exports.join(', ')}`);
|
|
20
22
|
}
|
|
21
23
|
catch (error) {
|
|
22
24
|
if (error instanceof UserScriptBuildError) {
|
|
23
|
-
|
|
25
|
+
out.error(`script:build: ${error.code}: ${error.message}`);
|
|
24
26
|
process.exit(1);
|
|
25
27
|
}
|
|
26
28
|
throw error;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scriptBuild.js","sourceRoot":"","sources":["../../../src/commands/scriptBuild.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"scriptBuild.js","sourceRoot":"","sources":["../../../src/commands/scriptBuild.ts"],"names":[],"mappings":"AAAA,sFAAsF;AACtF,mFAAmF;AACnF,oEAAoE;AACpE,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAElG,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,MAAM,GAAG,GAAG,YAAY,CAAC,cAAc,CAAC,CAAC;AAEzC,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,EAAE,IAAc,EAAiB,EAAE;IACxE,MAAM,CAAC,UAAU,CAAC,GAAG,iBAAiB,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IACxD,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,GAAG,CAAC,KAAK,CAAC,4DAA4D,CAAC,CAAC;QACxE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,MAAM,MAAM,GAAG,WAAW,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;IAE3E,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,eAAe,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU,CAAC,IAAI,EAAE,cAAc,CAAC,EAAE,CAAC,CAAC;QAC1G,yFAAyF;QACzF,MAAM,OAAO,GAAG,qBAAqB,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QACxD,GAAG,CAAC,GAAG,CAAC,uBAAuB,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC;QACnD,GAAG,CAAC,GAAG,CAAC,cAAc,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC9C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,KAAK,YAAY,oBAAoB,EAAE,CAAC;YAC1C,GAAG,CAAC,KAAK,CAAC,iBAAiB,KAAK,CAAC,IAAI,KAAK,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;YAC3D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QACD,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC,CAAC","sourcesContent":["// `qpq script:build <dir> [--out <dir>] [--source-map]`, bundle a user-script project\n// into one main.js that askUserScriptExecute can load from a drive. `--source-map`\n// embeds the map in main.js; no separate .map file is ever written.\nimport { buildUserScript, checkUserScriptOutput, UserScriptBuildError } from '@qpqjs/user-script';\n\nimport path from 'path';\n\nimport { getArgValue, getPositionalArgs, hasArgFlag } from '../lib/args';\nimport { createOutput } from '../lib/createOutput';\n\nconst out = createOutput('script:build');\n\nexport const scriptBuildCommand = async (argv: string[]): Promise<void> => {\n const [projectDir] = getPositionalArgs(argv, ['--out']);\n if (!projectDir) {\n out.error('Usage: qpq script:build <dir> [--out <dir>] [--source-map]');\n process.exit(1);\n }\n\n const outDir = getArgValue(argv, '--out') ?? path.join(projectDir, 'dist');\n\n try {\n const result = await buildUserScript({ projectDir, outDir, sourceMap: hasArgFlag(argv, '--source-map') });\n // A developer's own build is checked in this process; a platform build asks the sandbox.\n const exports = checkUserScriptOutput(result.entryPath);\n out.log(`script:build: wrote ${result.entryPath}`);\n out.log(` exports: ${exports.join(', ')}`);\n } catch (error) {\n if (error instanceof UserScriptBuildError) {\n out.error(`script:build: ${error.code}: ${error.message}`);\n process.exit(1);\n }\n throw error;\n }\n};\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// `qpq script:builder-layer [--arch arm64|x86_64]
|
|
1
|
+
// `qpq script:builder-layer [--arch arm64|x86_64]`, produce the lambda layer that gives
|
|
2
2
|
// a service rspack, for services that registered defineUserScriptBuilder. The directory
|
|
3
3
|
// is the one getUserScriptBuilderApiLayer points at, so nothing is told a path. Run from
|
|
4
4
|
// the app's qpq:predeploy hook, which go:docker fires before the workspace is built, so
|
|
@@ -7,7 +7,9 @@
|
|
|
7
7
|
import { JavascriptRuntimeArchitecture } from '@qpqjs/core';
|
|
8
8
|
import { getUserScriptBuilderLayerDir } from '@qpqjs/user-script';
|
|
9
9
|
import { getArgValue } from '../lib/args';
|
|
10
|
+
import { createOutput } from '../lib/createOutput';
|
|
10
11
|
import { buildUserScriptBuilderLayer } from '../lib/userScriptBuilderLayer';
|
|
12
|
+
const out = createOutput('script:builder-layer');
|
|
11
13
|
const ARCH_FLAG = '--arch';
|
|
12
14
|
const DEFAULT_ARCHITECTURE = JavascriptRuntimeArchitecture.Arm64;
|
|
13
15
|
/* eslint-disable @typescript-eslint/no-require-imports */
|
|
@@ -18,7 +20,7 @@ const parseArchitecture = (argv) => {
|
|
|
18
20
|
const requested = getArgValue(argv, ARCH_FLAG) ?? DEFAULT_ARCHITECTURE;
|
|
19
21
|
const known = Object.values(JavascriptRuntimeArchitecture);
|
|
20
22
|
if (!known.includes(requested)) {
|
|
21
|
-
|
|
23
|
+
out.error(`script:builder-layer: unknown ${ARCH_FLAG} [${requested}]; expected one of ${known.join(', ')}`);
|
|
22
24
|
process.exit(1);
|
|
23
25
|
}
|
|
24
26
|
return requested;
|
|
@@ -27,8 +29,8 @@ export const scriptBuilderLayerCommand = async (argv) => {
|
|
|
27
29
|
const architecture = parseArchitecture(argv);
|
|
28
30
|
const rspackVersion = getRspackVersion();
|
|
29
31
|
const outDir = getUserScriptBuilderLayerDir();
|
|
30
|
-
|
|
32
|
+
out.log(`script:builder-layer: installing @rspack/core@${rspackVersion} for linux ${architecture} into ${outDir}`);
|
|
31
33
|
const nodeDir = buildUserScriptBuilderLayer({ outDir, architecture, rspackVersion });
|
|
32
|
-
|
|
34
|
+
out.log(`script:builder-layer: wrote ${nodeDir}`);
|
|
33
35
|
};
|
|
34
36
|
//# sourceMappingURL=scriptBuilderLayer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scriptBuilderLayer.js","sourceRoot":"","sources":["../../../src/commands/scriptBuilderLayer.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"scriptBuilderLayer.js","sourceRoot":"","sources":["../../../src/commands/scriptBuilderLayer.ts"],"names":[],"mappings":"AAAA,wFAAwF;AACxF,wFAAwF;AACxF,yFAAyF;AACzF,wFAAwF;AACxF,yFAAyF;AACzF,uDAAuD;AACvD,OAAO,EAAE,6BAA6B,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAE,4BAA4B,EAAE,MAAM,oBAAoB,CAAC;AAElE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1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MAAM,EAAE,YAAY,EAAE,aAAa,EAAE,CAAC,CAAC;IACrF,GAAG,CAAC,GAAG,CAAC,+BAA+B,OAAO,EAAE,CAAC,CAAC;AACpD,CAAC,CAAC","sourcesContent":["// `qpq script:builder-layer [--arch arm64|x86_64]`, produce the lambda layer that gives\n// a service rspack, for services that registered defineUserScriptBuilder. The directory\n// is the one getUserScriptBuilderApiLayer points at, so nothing is told a path. Run from\n// the app's qpq:predeploy hook, which go:docker fires before the workspace is built, so\n// this command deliberately loads no service config (that would import unbuilt packages)\n// and takes the lambda architecture as a flag instead.\nimport { JavascriptRuntimeArchitecture } from '@qpqjs/core';\nimport { getUserScriptBuilderLayerDir } from '@qpqjs/user-script';\n\nimport { getArgValue } from '../lib/args';\nimport { createOutput } from '../lib/createOutput';\nimport { buildUserScriptBuilderLayer } from '../lib/userScriptBuilderLayer';\n\nconst out = createOutput('script:builder-layer');\n\nconst ARCH_FLAG = '--arch';\nconst DEFAULT_ARCHITECTURE = JavascriptRuntimeArchitecture.Arm64;\n\n/* eslint-disable @typescript-eslint/no-require-imports */\n// The rspack the CLI itself resolves is the one the dev server builds with; the layer\n// pins the same version so a script builds identically on both runtimes.\nconst getRspackVersion = (): string => require('@rspack/core/package.json').version as string;\n\nconst parseArchitecture = (argv: string[]): JavascriptRuntimeArchitecture => {\n const requested = getArgValue(argv, ARCH_FLAG) ?? DEFAULT_ARCHITECTURE;\n const known = Object.values(JavascriptRuntimeArchitecture);\n if (!known.includes(requested as JavascriptRuntimeArchitecture)) {\n out.error(`script:builder-layer: unknown ${ARCH_FLAG} [${requested}]; expected one of ${known.join(', ')}`);\n process.exit(1);\n }\n return requested as JavascriptRuntimeArchitecture;\n};\n\nexport const scriptBuilderLayerCommand = async (argv: string[]): Promise<void> => {\n const architecture = parseArchitecture(argv);\n const rspackVersion = getRspackVersion();\n const outDir = getUserScriptBuilderLayerDir();\n\n out.log(`script:builder-layer: installing @rspack/core@${rspackVersion} for linux ${architecture} into ${outDir}`);\n const nodeDir = buildUserScriptBuilderLayer({ outDir, architecture, rspackVersion });\n out.log(`script:builder-layer: wrote ${nodeDir}`);\n};\n"]}
|
|
@@ -1,19 +1,21 @@
|
|
|
1
|
-
// `qpq script:new <dir
|
|
1
|
+
// `qpq script:new <dir>`, write the user-script template project into a new
|
|
2
2
|
// directory. See templates/user-script/README.md for what a script is.
|
|
3
3
|
import path from 'path';
|
|
4
4
|
import { getPositionalArgs } from '../lib/args';
|
|
5
|
+
import { createOutput } from '../lib/createOutput';
|
|
5
6
|
import { createUserScriptProject } from '../lib/userScriptTemplate';
|
|
7
|
+
const out = createOutput('script:new');
|
|
6
8
|
export const scriptNewCommand = async (argv) => {
|
|
7
9
|
const [targetDir] = getPositionalArgs(argv, []);
|
|
8
10
|
if (!targetDir) {
|
|
9
|
-
|
|
11
|
+
out.error('Usage: qpq script:new <dir>');
|
|
10
12
|
process.exit(1);
|
|
11
13
|
}
|
|
12
14
|
const written = createUserScriptProject(targetDir);
|
|
13
|
-
|
|
15
|
+
out.log(`script:new: wrote ${written.length} files to ${path.resolve(targetDir)}`);
|
|
14
16
|
for (const file of written) {
|
|
15
|
-
|
|
17
|
+
out.log(` ${file}`);
|
|
16
18
|
}
|
|
17
|
-
|
|
19
|
+
out.log(`Next: cd ${targetDir} && npm run build`);
|
|
18
20
|
};
|
|
19
21
|
//# sourceMappingURL=scriptNew.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scriptNew.js","sourceRoot":"","sources":["../../../src/commands/scriptNew.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"scriptNew.js","sourceRoot":"","sources":["../../../src/commands/scriptNew.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,uEAAuE;AACvE,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAEpE,MAAM,GAAG,GAAG,YAAY,CAAC,YAAY,CAAC,CAAC;AAEvC,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,EAAE,IAAc,EAAiB,EAAE;IACtE,MAAM,CAAC,SAAS,CAAC,GAAG,iBAAiB,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IAChD,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,GAAG,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAC;QACzC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,MAAM,OAAO,GAAG,uBAAuB,CAAC,SAAS,CAAC,CAAC;IAEnD,GAAG,CAAC,GAAG,CAAC,qBAAqB,OAAO,CAAC,MAAM,aAAa,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;IACnF,KAAK,MAAM,IAAI,IAAI,OAAO,EAAE,CAAC;QAC3B,GAAG,CAAC,GAAG,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC;IACvB,CAAC;IACD,GAAG,CAAC,GAAG,CAAC,YAAY,SAAS,mBAAmB,CAAC,CAAC;AACpD,CAAC,CAAC","sourcesContent":["// `qpq script:new <dir>`, write the user-script template project into a new\n// directory. See templates/user-script/README.md for what a script is.\nimport path from 'path';\n\nimport { getPositionalArgs } from '../lib/args';\nimport { createOutput } from '../lib/createOutput';\nimport { createUserScriptProject } from '../lib/userScriptTemplate';\n\nconst out = createOutput('script:new');\n\nexport const scriptNewCommand = async (argv: string[]): Promise<void> => {\n const [targetDir] = getPositionalArgs(argv, []);\n if (!targetDir) {\n out.error('Usage: qpq script:new <dir>');\n process.exit(1);\n }\n\n const written = createUserScriptProject(targetDir);\n\n out.log(`script:new: wrote ${written.length} files to ${path.resolve(targetDir)}`);\n for (const file of written) {\n out.log(` ${file}`);\n }\n out.log(`Next: cd ${targetDir} && npm run build`);\n};\n"]}
|
|
@@ -1,20 +1,13 @@
|
|
|
1
|
-
// `qpq setup` — takes a cloud environment from empty to deployed, in order, with
|
|
2
|
-
// every step checked first so the menu shows what is already in place and a
|
|
3
|
-
// rerun on a half-set-up account is safe. The platform (from the deployment's
|
|
4
|
-
// entry in deploy.config.json) contributes the steps.
|
|
5
|
-
// --check print each step's status and exit, run nothing
|
|
6
|
-
// --yes run every step without the menu
|
|
7
|
-
// --only a,b run only the named step ids (no menu)
|
|
8
1
|
import { getArgValue } from '../lib/args';
|
|
2
|
+
import { createOutput } from '../lib/createOutput';
|
|
9
3
|
import { promptCheckbox } from '../lib/prompts';
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
import { getPlatformDriver } from '../platforms';
|
|
4
|
+
import { resolveCommandContext } from '../lib/resolveCommandContext';
|
|
5
|
+
const out = createOutput('setup');
|
|
13
6
|
const statusLabel = (result) => (result === null ? '?' : result.done ? 'done' : 'todo');
|
|
14
7
|
const printChecklist = (checked) => {
|
|
15
8
|
for (const { step, result } of checked) {
|
|
16
9
|
const detail = result?.detail ? ` ${result.detail}` : '';
|
|
17
|
-
|
|
10
|
+
out.log(` [${statusLabel(result).padEnd(4)}] ${step.name}${detail}`);
|
|
18
11
|
}
|
|
19
12
|
};
|
|
20
13
|
const checkAll = async (steps) => {
|
|
@@ -51,38 +44,37 @@ const selectFromArgs = (steps, argv) => {
|
|
|
51
44
|
const ids = only.split(',').map((id) => id.trim());
|
|
52
45
|
const unknown = ids.filter((id) => !steps.some((step) => step.id === id));
|
|
53
46
|
if (unknown.length > 0) {
|
|
54
|
-
|
|
47
|
+
out.error(`Unknown setup step id(s): ${unknown.join(', ')}. Known: ${steps.map((step) => step.id).join(', ')}`);
|
|
55
48
|
process.exit(1);
|
|
56
49
|
}
|
|
57
50
|
return steps.filter((step) => ids.includes(step.id));
|
|
58
51
|
};
|
|
59
52
|
export const setupCommand = async (argv) => {
|
|
60
|
-
const appName = await
|
|
61
|
-
|
|
62
|
-
const driver = getPlatformDriver(deployment.platform);
|
|
53
|
+
const { appName, deploymentName, deployment, driver } = await resolveCommandContext(argv);
|
|
54
|
+
// Nothing to set up is a normal outcome here, not a refused command.
|
|
63
55
|
if (!driver.setupSteps) {
|
|
64
|
-
|
|
56
|
+
out.log(`The '${deployment.platform}' platform has nothing to set up for deployment '${deploymentName}'.`);
|
|
65
57
|
return;
|
|
66
58
|
}
|
|
67
59
|
const steps = await driver.setupSteps(appName, deploymentName);
|
|
68
|
-
|
|
60
|
+
out.log(`\nSetup for app '${appName}', deployment '${deploymentName}' (${deployment.platform})\n`);
|
|
69
61
|
const checked = await checkAll(steps);
|
|
70
62
|
printChecklist(checked);
|
|
71
|
-
|
|
63
|
+
out.log('');
|
|
72
64
|
if (argv.includes('--check')) {
|
|
73
65
|
return;
|
|
74
66
|
}
|
|
75
67
|
const toRun = selectFromArgs(steps, argv) ?? (await chooseSteps(checked));
|
|
76
68
|
if (toRun.length === 0) {
|
|
77
|
-
|
|
69
|
+
out.log('Nothing selected.');
|
|
78
70
|
return;
|
|
79
71
|
}
|
|
80
72
|
for (const step of toRun) {
|
|
81
|
-
|
|
73
|
+
out.log(`\n== ${step.name}\n`);
|
|
82
74
|
await step.run();
|
|
83
75
|
}
|
|
84
|
-
|
|
76
|
+
out.log('\nSetup complete. Final state:\n');
|
|
85
77
|
printChecklist(await checkAll(steps));
|
|
86
|
-
|
|
78
|
+
out.log(`\nNext: deploy the services with npx qpq go:docker all all --app ${appName} --deployment ${deploymentName}`);
|
|
87
79
|
};
|
|
88
80
|
//# sourceMappingURL=setup.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup.js","sourceRoot":"","sources":["../../../src/commands/setup.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"setup.js","sourceRoot":"","sources":["../../../src/commands/setup.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAA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C;IACnG,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,KAAK,CAAC,CAAC;IACtC,cAAc,CAAC,OAAO,CAAC,CAAC;IACxB,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAEZ,IAAI,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;QAC7B,OAAO;IACT,CAAC;IAED,MAAM,KAAK,GAAG,cAAc,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC;IAC1E,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,GAAG,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;QAC7B,OAAO;IACT,CAAC;IAED,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,GAAG,CAAC,GAAG,CAAC,QAAQ,IAAI,CAAC,IAAI,IAAI,CAAC,CAAC;QAC/B,MAAM,IAAI,CAAC,GAAG,EAAE,CAAC;IACnB,CAAC;IAED,GAAG,CAAC,GAAG,CAAC,kCAAkC,CAAC,CAAC;IAC5C,cAAc,CAAC,MAAM,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;IACtC,GAAG,CAAC,GAAG,CAAC,qEAAqE,OAAO,iBAAiB,cAAc,EAAE,CAAC,CAAC;AACzH,CAAC,CAAC","sourcesContent":["// `qpq setup`, takes a cloud environment from empty to deployed, in order, with\n// every step checked first so the menu shows what is already in place and a\n// rerun on a half-set-up account is safe. The platform (from the deployment's\n// entry in deploy.config.json) contributes the steps.\n// --check print each step's status and exit, run nothing\n// --yes run every step without the menu\n// --only a,b run only the named step ids (no menu)\nimport { Nullable } from '@qpqjs/core';\n\nimport { getArgValue } from '../lib/args';\nimport { createOutput } from '../lib/createOutput';\nimport { promptCheckbox } from '../lib/prompts';\nimport { resolveCommandContext } from '../lib/resolveCommandContext';\nimport { SetupCheckResult, SetupStep } from '../lib/setupStep';\n\nconst out = createOutput('setup');\n\ntype CheckedStep = { step: SetupStep; result: Nullable<SetupCheckResult> };\n\nconst statusLabel = (result: Nullable<SetupCheckResult>): string => (result === null ? '?' : result.done ? 'done' : 'todo');\n\nconst printChecklist = (checked: CheckedStep[]): void => {\n for (const { step, result } of checked) {\n const detail = result?.detail ? ` ${result.detail}` : '';\n out.log(` [${statusLabel(result).padEnd(4)}] ${step.name}${detail}`);\n }\n};\n\nconst checkAll = async (steps: SetupStep[]): Promise<CheckedStep[]> => {\n const checked: CheckedStep[] = [];\n for (const step of steps) {\n try {\n checked.push({ step, result: await step.check() });\n } catch (error) {\n checked.push({ step, result: { done: false, detail: `check failed: ${error instanceof Error ? error.message : String(error)}` } });\n }\n }\n return checked;\n};\n\n// Steps not yet done are preselected; done ones can still be picked to rerun.\nconst chooseSteps = async (checked: CheckedStep[]): Promise<SetupStep[]> => {\n const chosen = await promptCheckbox(\n 'Setup steps to run (space toggles, enter runs in order)',\n checked.map(({ step, result }) => ({\n name: `[${statusLabel(result).padEnd(4)}] ${step.name}`,\n value: step,\n checked: !result?.done,\n description: result?.detail,\n })),\n );\n\n // Always run in checklist order, whatever order they were ticked in.\n return checked.map(({ step }) => step).filter((step) => chosen.includes(step));\n};\n\nconst selectFromArgs = (steps: SetupStep[], argv: string[]): Nullable<SetupStep[]> => {\n if (argv.includes('--yes')) {\n return steps;\n }\n\n const only = getArgValue(argv, '--only');\n if (!only) {\n return null;\n }\n\n const ids = only.split(',').map((id) => id.trim());\n const unknown = ids.filter((id) => !steps.some((step) => step.id === id));\n if (unknown.length > 0) {\n out.error(`Unknown setup step id(s): ${unknown.join(', ')}. Known: ${steps.map((step) => step.id).join(', ')}`);\n process.exit(1);\n }\n\n return steps.filter((step) => ids.includes(step.id));\n};\n\nexport const setupCommand = async (argv: string[]): Promise<void> => {\n const { appName, deploymentName, deployment, driver } = await resolveCommandContext(argv);\n\n // Nothing to set up is a normal outcome here, not a refused command.\n if (!driver.setupSteps) {\n out.log(`The '${deployment.platform}' platform has nothing to set up for deployment '${deploymentName}'.`);\n return;\n }\n\n const steps = await driver.setupSteps(appName, deploymentName);\n\n out.log(`\\nSetup for app '${appName}', deployment '${deploymentName}' (${deployment.platform})\\n`);\n const checked = await checkAll(steps);\n printChecklist(checked);\n out.log('');\n\n if (argv.includes('--check')) {\n return;\n }\n\n const toRun = selectFromArgs(steps, argv) ?? (await chooseSteps(checked));\n if (toRun.length === 0) {\n out.log('Nothing selected.');\n return;\n }\n\n for (const step of toRun) {\n out.log(`\\n== ${step.name}\\n`);\n await step.run();\n }\n\n out.log('\\nSetup complete. Final state:\\n');\n printChecklist(await checkAll(steps));\n out.log(`\\nNext: deploy the services with npx qpq go:docker all all --app ${appName} --deployment ${deploymentName}`);\n};\n"]}
|
|
@@ -1,60 +1,56 @@
|
|
|
1
|
-
// `qpq synth [service]
|
|
1
|
+
// `qpq synth [service]`, synthesizes each backend service's QPQ config to
|
|
2
2
|
// dist/apps/<app>/infrastructure/<module>-config.json.
|
|
3
3
|
//
|
|
4
4
|
// Runs with ts-node hooks registered (see runCli), which transpiles each
|
|
5
5
|
// service's infrastructure.ts on require. Cross-package `@scope/*` imports
|
|
6
6
|
// resolve through the workspace node_modules symlinks to already-built dist.
|
|
7
|
-
import { qpqCoreUtils } from '@qpqjs/core';
|
|
7
|
+
import { getInfrastructureConfigPath, qpqCoreUtils, QpqDeployEnvVar } from '@qpqjs/core';
|
|
8
8
|
import fs from 'fs';
|
|
9
9
|
import path from 'path';
|
|
10
10
|
import { getPositionalArgs } from '../lib/args';
|
|
11
|
+
import { createOutput } from '../lib/createOutput';
|
|
11
12
|
import { getAvailableApps, getRoot, getServiceNamesWithSubdir } from '../lib/discovery';
|
|
12
13
|
import { loadServiceQpqConfig } from '../lib/qpqConfigs';
|
|
13
|
-
import { resolveAppSelection } from '../lib/resolveAppSelection';
|
|
14
|
+
import { getRequestedAppName, resolveAppSelection } from '../lib/resolveAppSelection';
|
|
14
15
|
import { resolveDeployment } from '../lib/resolveDeployment';
|
|
16
|
+
const out = createOutput('synth');
|
|
15
17
|
const processConfig = (folderName, appName) => {
|
|
16
|
-
|
|
18
|
+
out.log(`Processing infrastructure: [${folderName}] for app [${appName}]`);
|
|
17
19
|
const qpqConfig = loadServiceQpqConfig(appName, folderName);
|
|
18
20
|
const moduleName = qpqCoreUtils.getApplicationModuleName(qpqConfig);
|
|
19
|
-
const directoryPath =
|
|
21
|
+
const directoryPath = getInfrastructureConfigPath(getRoot(), appName);
|
|
20
22
|
fs.mkdirSync(directoryPath, { recursive: true });
|
|
21
23
|
fs.writeFileSync(path.join(directoryPath, `${moduleName}-config.json`), JSON.stringify(qpqConfig, null, 2));
|
|
22
|
-
|
|
24
|
+
out.log(` -> ${appName}/infrastructure/${moduleName}-config.json`);
|
|
23
25
|
};
|
|
24
26
|
export const synthCommand = async (argv) => {
|
|
25
27
|
const [specifiedServiceName] = getPositionalArgs(argv, ['--app', '--deployment']);
|
|
26
|
-
const hasExplicitApp = argv.includes('--app') || argv.some((a) => a.startsWith('--app=')) || !!process.env.npm_config_app || !!process.env.DEPLOY_APP_NAME;
|
|
27
28
|
let appNames;
|
|
28
|
-
if (specifiedServiceName && !
|
|
29
|
-
// A bare service name is unambiguous
|
|
29
|
+
if (specifiedServiceName && !getRequestedAppName(argv, QpqDeployEnvVar.deployAppName)) {
|
|
30
|
+
// A bare service name is unambiguous, synth it in whichever app owns it.
|
|
30
31
|
const appWithService = getAvailableApps().find((appName) => getServiceNamesWithSubdir(appName, 'service').includes(specifiedServiceName));
|
|
31
32
|
if (!appWithService) {
|
|
32
|
-
|
|
33
|
+
out.error(`Service '${specifiedServiceName}' not found in any app`);
|
|
33
34
|
process.exit(1);
|
|
34
35
|
}
|
|
35
36
|
appNames = [appWithService];
|
|
36
37
|
}
|
|
37
38
|
else {
|
|
38
|
-
const selection = await resolveAppSelection({
|
|
39
|
-
argv,
|
|
40
|
-
envVar: 'DEPLOY_APP_NAME',
|
|
41
|
-
allowAll: true,
|
|
42
|
-
});
|
|
39
|
+
const selection = await resolveAppSelection({ argv, envVar: QpqDeployEnvVar.deployAppName, allowAll: true });
|
|
43
40
|
appNames = selection === 'all' ? getAvailableApps() : [selection];
|
|
44
41
|
}
|
|
45
|
-
|
|
42
|
+
out.log(`QPQ synthesizing apps: ${appNames.join(', ')}`);
|
|
46
43
|
for (const appName of appNames) {
|
|
47
44
|
// Service configs read the deployment env vars at require time, so the
|
|
48
45
|
// deployment is resolved (and primed) before any infrastructure.ts loads.
|
|
49
46
|
await resolveDeployment(argv, appName);
|
|
50
47
|
// Validate a specified service against the app's discovered services before it
|
|
51
|
-
// reaches loadServiceQpqConfig -> require
|
|
52
|
-
//
|
|
53
|
-
//
|
|
54
|
-
// require target. Both paths now validate identically.
|
|
48
|
+
// reaches loadServiceQpqConfig -> require, exactly as the bare-service-name branch
|
|
49
|
+
// above does: an unchecked typo hits a cryptic module-resolution error and a `../`
|
|
50
|
+
// value normalizes into an arbitrary require target.
|
|
55
51
|
const appServices = getServiceNamesWithSubdir(appName, 'service');
|
|
56
52
|
if (specifiedServiceName && !appServices.includes(specifiedServiceName)) {
|
|
57
|
-
|
|
53
|
+
out.error(`Service '${specifiedServiceName}' not found in app '${appName}'`);
|
|
58
54
|
process.exitCode = 1;
|
|
59
55
|
continue;
|
|
60
56
|
}
|
|
@@ -64,7 +60,7 @@ export const synthCommand = async (argv) => {
|
|
|
64
60
|
processConfig(folderName, appName);
|
|
65
61
|
}
|
|
66
62
|
catch (error) {
|
|
67
|
-
|
|
63
|
+
out.error(`Failed to process ${folderName} in ${appName}:`, error);
|
|
68
64
|
process.exitCode = 1;
|
|
69
65
|
}
|
|
70
66
|
}
|