quidproquo-cli 0.1.7 → 0.1.8
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/docker/dev-server/Dockerfile +7 -9
- package/lib/commonjs/cli/commandMenu.d.ts +2 -0
- package/lib/commonjs/cli/commandMenu.js +81 -0
- package/lib/commonjs/cli/commandMenu.js.map +1 -0
- package/lib/commonjs/cli/commandRegistry.d.ts +10 -0
- package/lib/commonjs/cli/commandRegistry.js +131 -0
- package/lib/commonjs/cli/commandRegistry.js.map +1 -0
- package/lib/commonjs/cli/runCli.js +49 -51
- package/lib/commonjs/cli/runCli.js.map +1 -1
- package/lib/commonjs/commands/clearResources.d.ts +1 -0
- package/lib/commonjs/commands/clearResources.js +36 -0
- package/lib/commonjs/commands/clearResources.js.map +1 -0
- package/lib/commonjs/commands/go.js +3 -1
- package/lib/commonjs/commands/go.js.map +1 -1
- package/lib/commonjs/commands/goDev.js +11 -2
- package/lib/commonjs/commands/goDev.js.map +1 -1
- package/lib/commonjs/commands/goDevApi.js +6 -39
- package/lib/commonjs/commands/goDevApi.js.map +1 -1
- package/lib/commonjs/commands/goDevWeb.js +2 -0
- package/lib/commonjs/commands/goDevWeb.js.map +1 -1
- package/lib/commonjs/commands/goDocker.js +3 -1
- package/lib/commonjs/commands/goDocker.js.map +1 -1
- package/lib/commonjs/commands/hooks.js +23 -5
- package/lib/commonjs/commands/hooks.js.map +1 -1
- package/lib/commonjs/lib/clearResourcesPlan.d.ts +15 -0
- package/lib/commonjs/lib/clearResourcesPlan.js +80 -0
- package/lib/commonjs/lib/clearResourcesPlan.js.map +1 -0
- package/lib/commonjs/lib/deployPrompts.d.ts +1 -0
- package/lib/commonjs/lib/deployPrompts.js +40 -2
- package/lib/commonjs/lib/deployPrompts.js.map +1 -1
- package/lib/commonjs/lib/devServerEntry.js +3 -0
- package/lib/commonjs/lib/devServerEntry.js.map +1 -1
- package/lib/commonjs/lib/hooks.d.ts +2 -1
- package/lib/commonjs/lib/hooks.js +100 -5
- package/lib/commonjs/lib/hooks.js.map +1 -1
- package/lib/commonjs/lib/killStaleListeners.d.ts +3 -0
- package/lib/commonjs/lib/killStaleListeners.js +170 -0
- package/lib/commonjs/lib/killStaleListeners.js.map +1 -0
- package/lib/commonjs/lib/prompts.d.ts +10 -0
- package/lib/commonjs/lib/prompts.js +15 -1
- package/lib/commonjs/lib/prompts.js.map +1 -1
- package/lib/commonjs/lib/qpqConfigs.d.ts +1 -0
- package/lib/commonjs/lib/qpqConfigs.js +9 -1
- package/lib/commonjs/lib/qpqConfigs.js.map +1 -1
- package/lib/commonjs/lib/runTasks.d.ts +5 -0
- package/lib/commonjs/lib/runTasks.js +82 -1
- package/lib/commonjs/lib/runTasks.js.map +1 -1
- package/lib/commonjs/lib/typeWatcher.d.ts +2 -0
- package/lib/commonjs/lib/typeWatcher.js +59 -0
- package/lib/commonjs/lib/typeWatcher.js.map +1 -0
- package/lib/commonjs/platforms/aws/cdkApp.js +5 -1
- package/lib/commonjs/platforms/aws/cdkApp.js.map +1 -1
- package/lib/commonjs/platforms/aws/clearResources.d.ts +2 -0
- package/lib/commonjs/platforms/aws/clearResources.js +167 -0
- package/lib/commonjs/platforms/aws/clearResources.js.map +1 -0
- package/lib/commonjs/platforms/aws/go.js +15 -1
- package/lib/commonjs/platforms/aws/go.js.map +1 -1
- package/lib/commonjs/platforms/aws/goDocker.js +76 -8
- package/lib/commonjs/platforms/aws/goDocker.js.map +1 -1
- package/lib/commonjs/platforms/aws/index.js +2 -0
- package/lib/commonjs/platforms/aws/index.js.map +1 -1
- package/lib/commonjs/platforms/docker/go.js +2 -2
- package/lib/commonjs/platforms/docker/go.js.map +1 -1
- package/lib/commonjs/platforms/types.d.ts +2 -0
- package/lib/commonjs/platforms/types.js.map +1 -1
- package/lib/esm/cli/commandMenu.d.ts +2 -0
- package/lib/esm/cli/commandMenu.js +67 -0
- package/lib/esm/cli/commandMenu.js.map +1 -0
- package/lib/esm/cli/commandRegistry.d.ts +10 -0
- package/lib/esm/cli/commandRegistry.js +115 -0
- package/lib/esm/cli/commandRegistry.js.map +1 -0
- package/lib/esm/cli/runCli.js +49 -51
- package/lib/esm/cli/runCli.js.map +1 -1
- package/lib/esm/commands/clearResources.d.ts +1 -0
- package/lib/esm/commands/clearResources.js +23 -0
- package/lib/esm/commands/clearResources.js.map +1 -0
- package/lib/esm/commands/go.js +3 -2
- package/lib/esm/commands/go.js.map +1 -1
- package/lib/esm/commands/goDev.js +11 -2
- package/lib/esm/commands/goDev.js.map +1 -1
- package/lib/esm/commands/goDevApi.js +7 -40
- package/lib/esm/commands/goDevApi.js.map +1 -1
- package/lib/esm/commands/goDevWeb.js +2 -0
- package/lib/esm/commands/goDevWeb.js.map +1 -1
- package/lib/esm/commands/goDocker.js +3 -2
- package/lib/esm/commands/goDocker.js.map +1 -1
- package/lib/esm/commands/hooks.js +21 -6
- package/lib/esm/commands/hooks.js.map +1 -1
- package/lib/esm/lib/clearResourcesPlan.d.ts +15 -0
- package/lib/esm/lib/clearResourcesPlan.js +66 -0
- package/lib/esm/lib/clearResourcesPlan.js.map +1 -0
- package/lib/esm/lib/deployPrompts.d.ts +1 -0
- package/lib/esm/lib/deployPrompts.js +38 -1
- package/lib/esm/lib/deployPrompts.js.map +1 -1
- package/lib/esm/lib/devServerEntry.js +3 -0
- package/lib/esm/lib/devServerEntry.js.map +1 -1
- package/lib/esm/lib/hooks.d.ts +2 -1
- package/lib/esm/lib/hooks.js +97 -5
- package/lib/esm/lib/hooks.js.map +1 -1
- package/lib/esm/lib/killStaleListeners.d.ts +3 -0
- package/lib/esm/lib/killStaleListeners.js +161 -0
- package/lib/esm/lib/killStaleListeners.js.map +1 -0
- package/lib/esm/lib/prompts.d.ts +10 -0
- package/lib/esm/lib/prompts.js +12 -0
- package/lib/esm/lib/prompts.js.map +1 -1
- package/lib/esm/lib/qpqConfigs.d.ts +1 -0
- package/lib/esm/lib/qpqConfigs.js +7 -0
- package/lib/esm/lib/qpqConfigs.js.map +1 -1
- package/lib/esm/lib/runTasks.d.ts +5 -0
- package/lib/esm/lib/runTasks.js +80 -0
- package/lib/esm/lib/runTasks.js.map +1 -1
- package/lib/esm/lib/typeWatcher.d.ts +2 -0
- package/lib/esm/lib/typeWatcher.js +51 -0
- package/lib/esm/lib/typeWatcher.js.map +1 -0
- package/lib/esm/platforms/aws/cdkApp.js +5 -1
- package/lib/esm/platforms/aws/cdkApp.js.map +1 -1
- package/lib/esm/platforms/aws/clearResources.d.ts +2 -0
- package/lib/esm/platforms/aws/clearResources.js +151 -0
- package/lib/esm/platforms/aws/clearResources.js.map +1 -0
- package/lib/esm/platforms/aws/go.js +16 -2
- package/lib/esm/platforms/aws/go.js.map +1 -1
- package/lib/esm/platforms/aws/goDocker.js +77 -9
- package/lib/esm/platforms/aws/goDocker.js.map +1 -1
- package/lib/esm/platforms/aws/index.js +2 -0
- package/lib/esm/platforms/aws/index.js.map +1 -1
- package/lib/esm/platforms/docker/go.js +2 -2
- package/lib/esm/platforms/docker/go.js.map +1 -1
- package/lib/esm/platforms/types.d.ts +2 -0
- package/lib/esm/platforms/types.js.map +1 -1
- package/package.json +12 -10
package/lib/esm/cli/runCli.js
CHANGED
|
@@ -1,22 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Usage: qpq <command> [--app <name>] [--env <name>] [--platform <name>]
|
|
4
|
-
|
|
5
|
-
Commands:
|
|
6
|
-
go Deploy services (interactive; platform from deploy.config.json, default aws)
|
|
7
|
-
go:docker Same as go, but deploys in parallel via docker
|
|
8
|
-
go:dev Run the full local dev stack (api + web) in one process
|
|
9
|
-
go:dev:api Run the local API dev server (hot reload)
|
|
10
|
-
go:dev:web Run every views microfrontend dev server
|
|
11
|
-
teardown Destroy web/api/inf stacks for selected services (interactive)
|
|
12
|
-
synth [service] Synth QPQ configs to dist/apps/<app>/infrastructure
|
|
13
|
-
prep Regenerate apps/<app>/tsconfig.federated.json
|
|
14
|
-
publish Build + upload + deploy federated remotes
|
|
15
|
-
publish:build Build federated remotes locally
|
|
16
|
-
publish:upload Upload built version dirs (nothing goes live)
|
|
17
|
-
publish:deploy Flip manifests to the uploaded versions
|
|
18
|
-
hooks <name> Run qpq:<name> in every app that defines it
|
|
19
|
-
`;
|
|
1
|
+
import { promptCommandFromMenu } from './commandMenu';
|
|
2
|
+
import { buildUsage, cliCommands } from './commandRegistry';
|
|
20
3
|
// Service infrastructure.ts files (and app config fragments) are TypeScript —
|
|
21
4
|
// register ts-node's transpile-only require hook so the CLI can require them
|
|
22
5
|
// directly, using the consumer root's tsconfig.json ts-node settings.
|
|
@@ -30,45 +13,60 @@ const registerTsNode = () => {
|
|
|
30
13
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
31
14
|
require('ts-node').register({ transpileOnly: true });
|
|
32
15
|
};
|
|
16
|
+
// Inquirer throws ExitPromptError on ctrl-c; treat that as a quiet exit
|
|
17
|
+
// rather than a command failure.
|
|
18
|
+
const isPromptExit = (error) => error instanceof Error && error.name === 'ExitPromptError';
|
|
19
|
+
// Bare `qpq` on a terminal: drill through the command menu, gathering any
|
|
20
|
+
// arguments the picked command needs. Returns null when the user bails out.
|
|
21
|
+
const resolveCommandInteractively = async () => {
|
|
22
|
+
try {
|
|
23
|
+
const command = await promptCommandFromMenu(cliCommands);
|
|
24
|
+
const commandArgv = command.promptArgs ? await command.promptArgs() : [];
|
|
25
|
+
return { command, commandArgv };
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
if (isPromptExit(error)) {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
throw error;
|
|
32
|
+
}
|
|
33
|
+
};
|
|
33
34
|
export const runCli = async (argv) => {
|
|
34
|
-
const [
|
|
35
|
-
if (
|
|
36
|
-
console.log(
|
|
35
|
+
const [commandName, ...argvRest] = argv;
|
|
36
|
+
if (commandName === 'help' || commandName === '--help') {
|
|
37
|
+
console.log(buildUsage());
|
|
37
38
|
return;
|
|
38
39
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
prep: (a) => require('../commands/prep').prepCommand(a),
|
|
53
|
-
publish: (a) => require('../commands/publish').publishCommand(a),
|
|
54
|
-
'publish:build': (a) => require('../commands/publish').publishBuildCommand(a),
|
|
55
|
-
'publish:upload': (a) => require('../commands/publish').publishUploadCommand(a),
|
|
56
|
-
'publish:deploy': (a) => require('../commands/publish').publishDeployCommand(a),
|
|
57
|
-
hooks: (a) => require('../commands/hooks').hooksCommand(a),
|
|
58
|
-
};
|
|
59
|
-
/* eslint-enable @typescript-eslint/no-require-imports */
|
|
60
|
-
const run = commands[command];
|
|
61
|
-
if (!run) {
|
|
62
|
-
console.error(`Unknown command: ${command}`);
|
|
63
|
-
console.log(usage);
|
|
64
|
-
process.exitCode = 1;
|
|
65
|
-
return;
|
|
40
|
+
let command;
|
|
41
|
+
let commandArgv = [];
|
|
42
|
+
if (!commandName) {
|
|
43
|
+
// Only prompt on a real terminal; piped/CI invocations get the usage text.
|
|
44
|
+
if (!process.stdin.isTTY || !process.stdout.isTTY) {
|
|
45
|
+
console.log(buildUsage());
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
const resolved = await resolveCommandInteractively();
|
|
49
|
+
if (!resolved) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
({ command, commandArgv } = resolved);
|
|
66
53
|
}
|
|
54
|
+
else {
|
|
55
|
+
command = cliCommands.find((c) => c.name === commandName);
|
|
56
|
+
commandArgv = argvRest;
|
|
57
|
+
if (!command) {
|
|
58
|
+
console.error(`Unknown command: ${commandName}`);
|
|
59
|
+
console.log(buildUsage());
|
|
60
|
+
process.exitCode = 1;
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
registerTsNode();
|
|
67
65
|
try {
|
|
68
|
-
await run(commandArgv);
|
|
66
|
+
await command.run(commandArgv);
|
|
69
67
|
}
|
|
70
68
|
catch (error) {
|
|
71
|
-
console.error(`qpq ${command} failed:`, error);
|
|
69
|
+
console.error(`qpq ${command.name} failed:`, error);
|
|
72
70
|
process.exitCode = 1;
|
|
73
71
|
}
|
|
74
72
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runCli.js","sourceRoot":"","sources":["../../../src/cli/runCli.ts"],"names":[],"mappings":"AAAA,MAAM,
|
|
1
|
+
{"version":3,"file":"runCli.js","sourceRoot":"","sources":["../../../src/cli/runCli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,UAAU,EAAc,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAExE,8EAA8E;AAC9E,6EAA6E;AAC7E,sEAAsE;AACtE,EAAE;AACF,6EAA6E;AAC7E,0EAA0E;AAC1E,4EAA4E;AAC5E,mEAAmE;AACnE,4EAA4E;AAC5E,MAAM,cAAc,GAAG,GAAS,EAAE;IAChC,iEAAiE;IACjE,OAAO,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;AACvD,CAAC,CAAC;AAEF,wEAAwE;AACxE,iCAAiC;AACjC,MAAM,YAAY,GAAG,CAAC,KAAc,EAAW,EAAE,CAAC,KAAK,YAAY,KAAK,IAAI,KAAK,CAAC,IAAI,KAAK,iBAAiB,CAAC;AAE7G,0EAA0E;AAC1E,4EAA4E;AAC5E,MAAM,2BAA2B,GAAG,KAAK,IAAoE,EAAE;IAC7G,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,MAAM,qBAAqB,CAAC,WAAW,CAAC,CAAC;QACzD,MAAM,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC,CA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B,WAAW,EAAE,CAAC,CAAC;YACjD,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC,CAAC;YAC1B,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;YACrB,OAAO;QACT,CAAC;IACH,CAAC;IAED,cAAc,EAAE,CAAC;IAEjB,IAAI,CAAC;QACH,MAAM,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IACjC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,OAAO,OAAO,CAAC,IAAI,UAAU,EAAE,KAAK,CAAC,CAAC;QACpD,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;IACvB,CAAC;AACH,CAAC,CAAC","sourcesContent":["import { promptCommandFromMenu } from './commandMenu';\nimport { buildUsage, CliCommand, cliCommands } from './commandRegistry';\n\n// Service infrastructure.ts files (and app config fragments) are TypeScript —\n// register ts-node's transpile-only require hook so the CLI can require them\n// directly, using the consumer root's tsconfig.json ts-node settings.\n//\n// CONTRACT: JavaScript apps (create-qpq-app --language javascript) also lean\n// on this hook — their tsconfig.json ts-node block sets allowJs (so their\n// ESM-syntax infrastructure.js compiles at require time) and scope/scopeDir\n// (so the hook never touches quidproquo libs outside the app). Any\n// replacement for ts-node here must honour those consumer tsconfig options.\nconst registerTsNode = (): void => {\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n require('ts-node').register({ transpileOnly: true });\n};\n\n// Inquirer throws ExitPromptError on ctrl-c; treat that as a quiet exit\n// rather than a command failure.\nconst isPromptExit = (error: unknown): boolean => error instanceof Error && error.name === 'ExitPromptError';\n\n// Bare `qpq` on a terminal: drill through the command menu, gathering any\n// arguments the picked command needs. Returns null when the user bails out.\nconst resolveCommandInteractively = async (): Promise<{ command: CliCommand; commandArgv: string[] } | null> => {\n try {\n const command = await promptCommandFromMenu(cliCommands);\n const commandArgv = command.promptArgs ? await command.promptArgs() : [];\n\n return { command, commandArgv };\n } catch (error) {\n if (isPromptExit(error)) {\n return null;\n }\n\n throw error;\n }\n};\n\nexport const runCli = async (argv: string[]): Promise<void> => {\n const [commandName, ...argvRest] = argv;\n\n if (commandName === 'help' || commandName === '--help') {\n console.log(buildUsage());\n return;\n }\n\n let command: CliCommand | undefined;\n let commandArgv: string[] = [];\n\n if (!commandName) {\n // Only prompt on a real terminal; piped/CI invocations get the usage text.\n if (!process.stdin.isTTY || !process.stdout.isTTY) {\n console.log(buildUsage());\n return;\n }\n\n const resolved = await resolveCommandInteractively();\n\n if (!resolved) {\n return;\n }\n\n ({ command, commandArgv } = resolved);\n } else {\n command = cliCommands.find((c) => c.name === commandName);\n commandArgv = argvRest;\n\n if (!command) {\n console.error(`Unknown command: ${commandName}`);\n console.log(buildUsage());\n process.exitCode = 1;\n return;\n }\n }\n\n registerTsNode();\n\n try {\n await command.run(commandArgv);\n } catch (error) {\n console.error(`qpq ${command.name} failed:`, error);\n process.exitCode = 1;\n }\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const clearResourcesCommand: (argv: string[]) => Promise<void>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// `qpq clear-resources` — interactively EMPTY selected data resources (storage
|
|
2
|
+
// drive buckets, key value store tables) without touching the stacks: the
|
|
3
|
+
// "reset my data" counterpart to `qpq teardown`. Resolves the app +
|
|
4
|
+
// environment the same way as go/teardown, enumerates the app's owned
|
|
5
|
+
// resources from its live qpq configs, multi-selects what to empty (with a
|
|
6
|
+
// typed confirmation — this deletes stored data), then hands off to the
|
|
7
|
+
// platform driver.
|
|
8
|
+
import { promptClearResourcesPlan } from '../lib/clearResourcesPlan';
|
|
9
|
+
import { resolveDeployEnvironment } from '../lib/deployEnv';
|
|
10
|
+
import { resolveAppSelection } from '../lib/resolveAppSelection';
|
|
11
|
+
import { getPlatformDriver } from '../platforms';
|
|
12
|
+
export const clearResourcesCommand = async (argv) => {
|
|
13
|
+
const appName = await resolveAppSelection({ argv, envVar: 'DEPLOY_APP_NAME' });
|
|
14
|
+
const { platform } = await resolveDeployEnvironment(argv, appName);
|
|
15
|
+
const driver = getPlatformDriver(platform);
|
|
16
|
+
if (!driver.clearResources) {
|
|
17
|
+
console.error(`The '${platform}' platform has no clear-resources strategy.`);
|
|
18
|
+
process.exit(1);
|
|
19
|
+
}
|
|
20
|
+
const plan = await promptClearResourcesPlan(appName);
|
|
21
|
+
await driver.clearResources(appName, plan);
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=clearResources.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clearResources.js","sourceRoot":"","sources":["../../../src/commands/clearResources.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,0EAA0E;AAC1E,oEAAoE;AACpE,sEAAsE;AACtE,2EAA2E;AAC3E,wEAAwE;AACxE,mBAAmB;AACnB,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEjD,MAAM,CAAC,MAAM,qBAAqB,GAAG,KAAK,EAAE,IAAc,EAAiB,EAAE;IAC3E,MAAM,OAAO,GAAG,MAAM,mBAAmB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,iBAAiB,EAAE,CAAC,CAAC;IAC/E,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,wBAAwB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACnE,MAAM,MAAM,GAAG,iBAAiB,CAAC,QAAQ,CAAC,CAAC;IAE3C,IAAI,CAAC,MAAM,CAAC,cAAc,EAAE,CAAC;QAC3B,OAAO,CAAC,KAAK,CAAC,QAAQ,QAAQ,6CAA6C,CAAC,CAAC;QAC7E,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,MAAM,IAAI,GAAG,MAAM,wBAAwB,CAAC,OAAO,CAAC,CAAC;IAErD,MAAM,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;AAC7C,CAAC,CAAC","sourcesContent":["// `qpq clear-resources` — interactively EMPTY selected data resources (storage\n// drive buckets, key value store tables) without touching the stacks: the\n// \"reset my data\" counterpart to `qpq teardown`. Resolves the app +\n// environment the same way as go/teardown, enumerates the app's owned\n// resources from its live qpq configs, multi-selects what to empty (with a\n// typed confirmation — this deletes stored data), then hands off to the\n// platform driver.\nimport { promptClearResourcesPlan } from '../lib/clearResourcesPlan';\nimport { resolveDeployEnvironment } from '../lib/deployEnv';\nimport { resolveAppSelection } from '../lib/resolveAppSelection';\nimport { getPlatformDriver } from '../platforms';\n\nexport const clearResourcesCommand = async (argv: string[]): Promise<void> => {\n const appName = await resolveAppSelection({ argv, envVar: 'DEPLOY_APP_NAME' });\n const { platform } = await resolveDeployEnvironment(argv, appName);\n const driver = getPlatformDriver(platform);\n\n if (!driver.clearResources) {\n console.error(`The '${platform}' platform has no clear-resources strategy.`);\n process.exit(1);\n }\n\n const plan = await promptClearResourcesPlan(appName);\n\n await driver.clearResources(appName, plan);\n};\n"]}
|
package/lib/esm/commands/go.js
CHANGED
|
@@ -2,14 +2,15 @@
|
|
|
2
2
|
// the deploy platform in apps/<app>/deploy.config.json, default aws), asks the
|
|
3
3
|
// deploy plan, then hands off to the platform driver.
|
|
4
4
|
import { resolveDeployEnvironment } from '../lib/deployEnv';
|
|
5
|
-
import { promptDeployPlan } from '../lib/deployPrompts';
|
|
5
|
+
import { buildDeployPlanFromArgs, promptDeployPlan } from '../lib/deployPrompts';
|
|
6
6
|
import { resolveAppSelection } from '../lib/resolveAppSelection';
|
|
7
7
|
import { getPlatformDriver } from '../platforms';
|
|
8
8
|
export const goCommand = async (argv) => {
|
|
9
9
|
const appName = await resolveAppSelection({ argv, envVar: 'DEPLOY_APP_NAME' });
|
|
10
10
|
const { platform } = await resolveDeployEnvironment(argv, appName);
|
|
11
11
|
const driver = getPlatformDriver(platform);
|
|
12
|
-
|
|
12
|
+
// Positional args (`qpq go all all`) run prompt-free; otherwise ask.
|
|
13
|
+
const plan = buildDeployPlanFromArgs(appName, argv) ?? (await promptDeployPlan(appName));
|
|
13
14
|
await driver.go(appName, plan);
|
|
14
15
|
};
|
|
15
16
|
//# sourceMappingURL=go.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"go.js","sourceRoot":"","sources":["../../../src/commands/go.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,+EAA+E;AAC/E,sDAAsD;AACtD,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"go.js","sourceRoot":"","sources":["../../../src/commands/go.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,+EAA+E;AAC/E,sDAAsD;AACtD,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACjF,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEjD,MAAM,CAAC,MAAM,SAAS,GAAG,KAAK,EAAE,IAAc,EAAiB,EAAE;IAC/D,MAAM,OAAO,GAAG,MAAM,mBAAmB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,iBAAiB,EAAE,CAAC,CAAC;IAC/E,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,wBAAwB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACnE,MAAM,MAAM,GAAG,iBAAiB,CAAC,QAAQ,CAAC,CAAC;IAE3C,qEAAqE;IACrE,MAAM,IAAI,GAAG,uBAAuB,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC;IAEzF,MAAM,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;AACjC,CAAC,CAAC","sourcesContent":["// `qpq go` — interactive deploy. Resolves the app + environment (which names\n// the deploy platform in apps/<app>/deploy.config.json, default aws), asks the\n// deploy plan, then hands off to the platform driver.\nimport { resolveDeployEnvironment } from '../lib/deployEnv';\nimport { buildDeployPlanFromArgs, promptDeployPlan } from '../lib/deployPrompts';\nimport { resolveAppSelection } from '../lib/resolveAppSelection';\nimport { getPlatformDriver } from '../platforms';\n\nexport const goCommand = async (argv: string[]): Promise<void> => {\n const appName = await resolveAppSelection({ argv, envVar: 'DEPLOY_APP_NAME' });\n const { platform } = await resolveDeployEnvironment(argv, appName);\n const driver = getPlatformDriver(platform);\n\n // Positional args (`qpq go all all`) run prompt-free; otherwise ask.\n const plan = buildDeployPlanFromArgs(appName, argv) ?? (await promptDeployPlan(appName));\n\n await driver.go(appName, plan);\n};\n"]}
|
|
@@ -1,15 +1,24 @@
|
|
|
1
1
|
// `qpq go:dev` — the whole local dev stack in one process: the API dev server
|
|
2
2
|
// (go:dev:api) plus every views dev server (go:dev:web), so a single ctrl+c
|
|
3
|
-
// tears it all down.
|
|
4
|
-
//
|
|
3
|
+
// tears it all down. A background tsc watcher keeps workspace declaration
|
|
4
|
+
// output fresh for the editor (--no-types to skip it). The app is resolved
|
|
5
|
+
// once here and handed to both sub-commands via QPQ_DEV_APP; their output
|
|
6
|
+
// shares the terminal.
|
|
5
7
|
import { getAllViews } from 'quidproquo-deploy-rspack';
|
|
6
8
|
import { getRoot } from '../lib/discovery';
|
|
7
9
|
import { resolveAppSelection } from '../lib/resolveAppSelection';
|
|
10
|
+
import { startTypeWatcher } from '../lib/typeWatcher';
|
|
8
11
|
import { goDevApiCommand } from './goDevApi';
|
|
9
12
|
import { goDevWebCommand } from './goDevWeb';
|
|
10
13
|
export const goDevCommand = async (argv) => {
|
|
11
14
|
const appName = await resolveAppSelection({ argv, envVar: 'QPQ_DEV_APP' });
|
|
12
15
|
process.env.QPQ_DEV_APP = appName;
|
|
16
|
+
// Editor/type freshness only: the rspack builds below bundle workspace
|
|
17
|
+
// source directly, so the dev loop itself never waits on tsc.
|
|
18
|
+
const typeWatcher = argv.includes('--no-types') ? null : startTypeWatcher(getRoot());
|
|
19
|
+
if (typeWatcher) {
|
|
20
|
+
process.on('exit', () => typeWatcher.kill());
|
|
21
|
+
}
|
|
13
22
|
// Kicks off the rspack watch and returns; the API server keeps running in
|
|
14
23
|
// the background of this process.
|
|
15
24
|
await goDevApiCommand(argv);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"goDev.js","sourceRoot":"","sources":["../../../src/commands/goDev.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,4EAA4E;AAC5E,
|
|
1
|
+
{"version":3,"file":"goDev.js","sourceRoot":"","sources":["../../../src/commands/goDev.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,4EAA4E;AAC5E,0EAA0E;AAC1E,2EAA2E;AAC3E,0EAA0E;AAC1E,uBAAuB;AACvB,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE7C,MAAM,CAAC,MAAM,YAAY,GAAG,KAAK,EAAE,IAAc,EAAiB,EAAE;IAClE,MAAM,OAAO,GAAG,MAAM,mBAAmB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,aAAa,EAAE,CAAC,CAAC;IAC3E,OAAO,CAAC,GAAG,CAAC,WAAW,GAAG,OAAO,CAAC;IAElC,uEAAuE;IACvE,8DAA8D;IAC9D,MAAM,WAAW,GAAG,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,gBAAgB,CAAC,OAAO,EAAE,CAAC,CAAC;IACrF,IAAI,WAAW,EAAE,CAAC;QAChB,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC,CAAC;IAC/C,CAAC;IAED,0EAA0E;IAC1E,kCAAkC;IAClC,MAAM,eAAe,CAAC,IAAI,CAAC,CAAC;IAE5B,IAAI,WAAW,CAAC,OAAO,EAAE,EAAE,OAAO,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACjD,OAAO,CAAC,GAAG,CAAC,2DAA2D,CAAC,CAAC;QACzE,OAAO;IACT,CAAC;IAED,MAAM,eAAe,CAAC,IAAI,EAAE,EAAE,gBAAgB,EAAE,IAAI,EAAE,CAAC,CAAC;AAC1D,CAAC,CAAC","sourcesContent":["// `qpq go:dev` — the whole local dev stack in one process: the API dev server\n// (go:dev:api) plus every views dev server (go:dev:web), so a single ctrl+c\n// tears it all down. A background tsc watcher keeps workspace declaration\n// output fresh for the editor (--no-types to skip it). The app is resolved\n// once here and handed to both sub-commands via QPQ_DEV_APP; their output\n// shares the terminal.\nimport { getAllViews } from 'quidproquo-deploy-rspack';\n\nimport { getRoot } from '../lib/discovery';\nimport { resolveAppSelection } from '../lib/resolveAppSelection';\nimport { startTypeWatcher } from '../lib/typeWatcher';\nimport { goDevApiCommand } from './goDevApi';\nimport { goDevWebCommand } from './goDevWeb';\n\nexport const goDevCommand = async (argv: string[]): Promise<void> => {\n const appName = await resolveAppSelection({ argv, envVar: 'QPQ_DEV_APP' });\n process.env.QPQ_DEV_APP = appName;\n\n // Editor/type freshness only: the rspack builds below bundle workspace\n // source directly, so the dev loop itself never waits on tsc.\n const typeWatcher = argv.includes('--no-types') ? null : startTypeWatcher(getRoot());\n if (typeWatcher) {\n process.on('exit', () => typeWatcher.kill());\n }\n\n // Kicks off the rspack watch and returns; the API server keeps running in\n // the background of this process.\n await goDevApiCommand(argv);\n\n if (getAllViews(getRoot(), appName).length === 0) {\n console.log('No views projects found. Running the API dev server only.');\n return;\n }\n\n await goDevWebCommand(argv, { plainStatusLines: true });\n};\n"]}
|
|
@@ -7,62 +7,29 @@
|
|
|
7
7
|
// `quidproquo-dynamic-loader` virtual module — config changes need a full
|
|
8
8
|
// `go:dev:api` restart.
|
|
9
9
|
import { getAppServiceQpqConfigs, getDevServerRspackConfig } from 'quidproquo-deploy-rspack';
|
|
10
|
-
import {
|
|
10
|
+
import { spawn } from 'child_process';
|
|
11
11
|
import path from 'path';
|
|
12
12
|
import { rspack } from '@rspack/core';
|
|
13
13
|
import { primeDeployEnvFromConfig } from '../lib/deployEnv';
|
|
14
14
|
import { writeDevServerEntry } from '../lib/devServerEntry';
|
|
15
15
|
import { getRoot } from '../lib/discovery';
|
|
16
|
+
import { killOtherQpqDevProcesses, killStaleListeners } from '../lib/killStaleListeners';
|
|
16
17
|
import { resolveAppSelection } from '../lib/resolveAppSelection';
|
|
17
18
|
// 8080/8888 are set in the generated entry; 3001 is the quidproquo-dev-server
|
|
18
19
|
// file-storage (secure URL) default port.
|
|
19
20
|
const DEV_SERVER_PORTS = [8080, 8888, 3001];
|
|
20
21
|
const DEV_SERVER_BUNDLE_PATH = path.join('dist', 'qpq', 'dev-server', 'main.js');
|
|
21
|
-
// Pre-start sweep: a previous `go:dev:api` whose wrapper died without killing its
|
|
22
|
-
// child (closed terminal, SIGKILL) leaves an orphaned server process holding
|
|
23
|
-
// the dev ports, and the next launch dies with EADDRINUSE. Before starting,
|
|
24
|
-
// kill any listener on those ports that is running the dev-server bundle.
|
|
25
|
-
// Anything else on the ports is left alone and reported — it's not ours.
|
|
26
|
-
const killStaleDevServers = () => {
|
|
27
|
-
for (const port of DEV_SERVER_PORTS) {
|
|
28
|
-
let pids = [];
|
|
29
|
-
try {
|
|
30
|
-
pids = execSync(`lsof -t -iTCP:${port} -sTCP:LISTEN`, {
|
|
31
|
-
stdio: ['ignore', 'pipe', 'ignore'],
|
|
32
|
-
})
|
|
33
|
-
.toString()
|
|
34
|
-
.split('\n')
|
|
35
|
-
.map((line) => Number(line.trim()))
|
|
36
|
-
.filter(Boolean);
|
|
37
|
-
}
|
|
38
|
-
catch {
|
|
39
|
-
continue; // lsof exits non-zero when nothing is listening
|
|
40
|
-
}
|
|
41
|
-
for (const pid of pids) {
|
|
42
|
-
let command = '';
|
|
43
|
-
try {
|
|
44
|
-
command = execSync(`ps -p ${pid} -o command=`).toString().trim();
|
|
45
|
-
}
|
|
46
|
-
catch {
|
|
47
|
-
continue; // already gone
|
|
48
|
-
}
|
|
49
|
-
if (command.includes(DEV_SERVER_BUNDLE_PATH)) {
|
|
50
|
-
console.log(`Killing stale dev server on port ${port} (pid ${pid})`);
|
|
51
|
-
process.kill(pid);
|
|
52
|
-
}
|
|
53
|
-
else {
|
|
54
|
-
console.warn(`Port ${port} is in use by an unrelated process (pid ${pid}: ${command}) — not killing it.`);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
22
|
export const goDevApiCommand = async (argv) => {
|
|
60
23
|
const root = getRoot();
|
|
61
24
|
const appName = await resolveAppSelection({ argv, envVar: 'QPQ_DEV_APP' });
|
|
62
25
|
process.env.QPQ_DEV_APP = appName;
|
|
63
26
|
primeDeployEnvFromConfig(appName);
|
|
64
27
|
console.log(`Dev server for app [${appName}]`);
|
|
65
|
-
|
|
28
|
+
// Catches a lingering watcher from a previous run even if its spawned
|
|
29
|
+
// child already exited (see killOtherQpqDevProcesses) — then the usual
|
|
30
|
+
// port-based sweep for anything else still bound to our ports.
|
|
31
|
+
killOtherQpqDevProcesses(root);
|
|
32
|
+
killStaleListeners(DEV_SERVER_PORTS, (command) => command.includes(DEV_SERVER_BUNDLE_PATH));
|
|
66
33
|
const qpqConfigs = getAppServiceQpqConfigs(root, appName);
|
|
67
34
|
const entry = writeDevServerEntry(root, appName);
|
|
68
35
|
const rspackConfig = getDevServerRspackConfig({ root, entry, qpqConfigs });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"goDevApi.js","sourceRoot":"","sources":["../../../src/commands/goDevApi.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,6EAA6E;AAC7E,4EAA4E;AAC5E,EAAE;AACF,+EAA+E;AAC/E,mEAAmE;AACnE,0EAA0E;AAC1E,wBAAwB;AACxB,OAAO,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AAE7F,OAAO,EAAgB,
|
|
1
|
+
{"version":3,"file":"goDevApi.js","sourceRoot":"","sources":["../../../src/commands/goDevApi.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,6EAA6E;AAC7E,4EAA4E;AAC5E,EAAE;AACF,+EAA+E;AAC/E,mEAAmE;AACnE,0EAA0E;AAC1E,wBAAwB;AACxB,OAAO,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AAE7F,OAAO,EAAgB,KAAK,EAAE,MAAM,eAAe,CAAC;AAEpD,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,wBAAwB,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AACzF,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEjE,8EAA8E;AAC9E,0CAA0C;AAC1C,MAAM,gBAAgB,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IA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AE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;YAC/E,OAAO,CAAC,GAAG,CAAC,wEAAwE,CAAC,CAAC;YACtF,OAAO;QACT,CAAC;QACD,2EAA2E;QAC3E,2DAA2D;QAC3D,IAAI,KAAK,EAAE,IAAI,KAAK,QAAQ,IAAI,KAAK,EAAE,CAAC;YACtC,OAAO;QACT,CAAC;QACD,QAAQ,GAAG,KAAK,EAAE,IAAI,CAAC;QACvB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,mCAAmC,CAAC,CAAC,CAAC,iCAAiC,CAAC,CAAC;QAC7F,aAAa,EAAE,CAAC;IAClB,CAAC,CAAC,CAAC;IAEH,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE;QACxB,aAAa,GAAG,IAAI,CAAC,CAAC,2DAA2D;QACjF,KAAK,EAAE,IAAI,EAAE,CAAC;QACd,QAAQ,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IACxC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC","sourcesContent":["// `qpq go:dev:api` — boots the QPQ local dev server. Resolves the app,\n// generates the dev-server entry, builds the rspack config, then runs rspack\n// in watch mode, restarting the server process on every successful rebuild.\n//\n// The one thing NOT hot-reloaded is the qpq configs themselves: each service's\n// infrastructure.ts is evaluated once at launch and baked into the\n// `quidproquo-dynamic-loader` virtual module — config changes need a full\n// `go:dev:api` restart.\nimport { getAppServiceQpqConfigs, getDevServerRspackConfig } from 'quidproquo-deploy-rspack';\n\nimport { ChildProcess, spawn } from 'child_process';\nimport fs from 'fs';\nimport path from 'path';\nimport { rspack } from '@rspack/core';\n\nimport { primeDeployEnvFromConfig } from '../lib/deployEnv';\nimport { writeDevServerEntry } from '../lib/devServerEntry';\nimport { getRoot } from '../lib/discovery';\nimport { killOtherQpqDevProcesses, killStaleListeners } from '../lib/killStaleListeners';\nimport { resolveAppSelection } from '../lib/resolveAppSelection';\n\n// 8080/8888 are set in the generated entry; 3001 is the quidproquo-dev-server\n// file-storage (secure URL) default port.\nconst DEV_SERVER_PORTS = [8080, 8888, 3001];\nconst DEV_SERVER_BUNDLE_PATH = path.join('dist', 'qpq', 'dev-server', 'main.js');\n\nexport const goDevApiCommand = 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 primeDeployEnvFromConfig(appName);\n console.log(`Dev server for app [${appName}]`);\n\n // Catches a lingering watcher from a previous run even if its spawned\n // child already exited (see killOtherQpqDevProcesses) — then the usual\n // port-based sweep for anything else still bound to our ports.\n killOtherQpqDevProcesses(root);\n killStaleListeners(DEV_SERVER_PORTS, (command) => command.includes(DEV_SERVER_BUNDLE_PATH));\n\n const qpqConfigs = getAppServiceQpqConfigs(root, appName);\n const entry = writeDevServerEntry(root, appName);\n const rspackConfig = getDevServerRspackConfig({ root, entry, qpqConfigs });\n const bundlePath = path.join(root, DEV_SERVER_BUNDLE_PATH);\n const env = { ...process.env, QPQ_DEV_APP: appName };\n\n // The long-lived server process (HTTP 8080 / WS 8888), restarted per rebuild.\n let child: ChildProcess | null = null;\n let restartQueued = false;\n\n const startServer = (): void => {\n child = spawn('node', [bundlePath], { stdio: 'inherit', env });\n child.on('exit', (code) => {\n child = null;\n if (!restartQueued) {\n // Crashed (or exited) on its own — leave it down; the next successful\n // rebuild (i.e. the next file save) brings it back up.\n console.log(`Dev server exited with code ${code}. Save a file to restart it.`);\n }\n });\n };\n\n const restartServer = (): void => {\n if (restartQueued) return;\n if (!child) {\n startServer();\n return;\n }\n restartQueued = true;\n child.once('exit', () => {\n restartQueued = false;\n startServer();\n });\n child.kill();\n };\n\n console.log('Bundling dev server (watch mode)...');\n let lastHash: string | null | undefined;\n const compiler = rspack(rspackConfig);\n compiler.watch({ aggregateTimeout: 200 }, (err, stats) => {\n if (err) {\n console.error(err);\n return;\n }\n if (stats?.hasErrors()) {\n console.error(stats.toString({ colors: true, chunks: false, modules: false }));\n console.log('Build failed — dev server not restarted. Fix the error and save again.');\n return;\n }\n // Skip no-op rebuilds (e.g. the virtual-module-triggered second compile at\n // startup): only restart when the output actually changed.\n if (stats?.hash === lastHash && child) {\n return;\n }\n lastHash = stats?.hash;\n console.log(child ? 'Rebuilt. Restarting dev server...' : 'Dev server bundled. Starting...');\n restartServer();\n });\n\n process.on('SIGINT', () => {\n restartQueued = true; // suppress the crash log / rebuild-restart on our own kill\n child?.kill();\n compiler.close(() => process.exit(0));\n });\n};\n"]}
|
|
@@ -15,6 +15,7 @@ import { RspackDevServer } from '@rspack/dev-server';
|
|
|
15
15
|
import { getArgValue } from '../lib/args';
|
|
16
16
|
import { primeDeployEnvFromConfig } from '../lib/deployEnv';
|
|
17
17
|
import { getRoot } from '../lib/discovery';
|
|
18
|
+
import { isQpqCliCommand, killStaleListeners } from '../lib/killStaleListeners';
|
|
18
19
|
import { resolveAppSelection } from '../lib/resolveAppSelection';
|
|
19
20
|
export const goDevWebCommand = async (argv, options = {}) => {
|
|
20
21
|
const root = getRoot();
|
|
@@ -32,6 +33,7 @@ export const goDevWebCommand = async (argv, options = {}) => {
|
|
|
32
33
|
console.error('No views projects found.');
|
|
33
34
|
process.exit(1);
|
|
34
35
|
}
|
|
36
|
+
killStaleListeners(views.map((v) => v.port), isQpqCliCommand);
|
|
35
37
|
// Every RspackDevServer.start() registers its own SIGINT/SIGTERM handler on
|
|
36
38
|
// process — with a dozen views servers in one process that trips node's
|
|
37
39
|
// default 10-listener warning. Size the limit to the fleet.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"goDevWeb.js","sourceRoot":"","sources":["../../../src/commands/goDevWeb.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,8EAA8E;AAC9E,mEAAmE;AACnE,mEAAmE;AACnE,+CAA+C;AAC/C,EAAE;AACF,SAAS;AACT,mBAAm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on their own ports).\n// Everything is served dynamically; remotes resolve at runtime via\n// mf-manifest.json on localhost ports. Programmatic — no per-views\n// rspack.config.ts or npm serve script needed.\n//\n// Usage:\n// qpq go:dev:web\n// qpq go:dev:web --only shell,design\n// qpq go:dev:web --app <name>\nimport { getAllViews, getViewsRspackConfig } from 'quidproquo-deploy-rspack';\n\nimport http from 'http';\nimport { rspack } from '@rspack/core';\nimport { RspackDevServer } from '@rspack/dev-server';\n\nimport { getArgValue } from '../lib/args';\nimport { primeDeployEnvFromConfig } from '../lib/deployEnv';\nimport { getRoot } from '../lib/discovery';\nimport { resolveAppSelection } from '../lib/resolveAppSelection';\n\nexport type GoDevWebOptions = {\n // The in-place \"(started)\" chip rewrite assumes this command owns the\n // terminal; when stdout is shared with the API dev server (combined\n // `qpq go:dev`) the cursor math breaks, so fall back to plain lines.\n plainStatusLines?: boolean;\n};\n\nexport const goDevWebCommand = async (argv: string[], options: GoDevWebOptions = {}): Promise<void> => {\n const root = getRoot();\n const appName = await resolveAppSelection({ argv, envVar: 'QPQ_DEV_APP' });\n\n process.env.LOCAL_DEV_SERVER = 'true';\n process.env.NODE_ENV = 'development';\n primeDeployEnvFromConfig(appName);\n\n const only = getArgValue(argv, '--only')\n ?.split(',')\n .map((s) => s.trim());\n\n let views = getAllViews(root, appName);\n if (only) views = views.filter((v) => only.includes(v.service));\n if (views.length === 0) {\n console.error('No views projects found.');\n process.exit(1);\n }\n\n // Every RspackDevServer.start() registers its own SIGINT/SIGTERM handler on\n // process — with a dozen views servers in one process that trips node's\n // default 10-listener warning. Size the limit to the fleet.\n process.setMaxListeners(Math.max(process.getMaxListeners(), views.length * 2 + 10));\n\n // Service names are padded to a common width so the \"(started)\" chips align.\n const serviceColumnWidth = Math.max(...views.map((v) => v.service.length));\n\n console.log(`Starting ${views.length} views dev servers for [${appName}]:`);\n for (const v of views) console.log(` http://localhost:${v.port} ${v.service.padEnd(serviceColumnWidth)}`);\n\n const servers: RspackDevServer[] = [];\n let shuttingDown = false;\n\n const shutdown = (code: number): void => {\n if (shuttingDown) return;\n shuttingDown = true;\n Promise.allSettled(servers.map((server) => server.stop())).then(() => process.exit(code));\n };\n\n // The URL list above gets a yellow \"(started)\" chip appended in place as\n // each dev server begins answering HTTP. The in-place rewrite moves the\n // cursor up past everything printed since the list, so every line printed\n // below it MUST go through logBelowList to keep the offset accurate.\n let linesBelowList = 0;\n\n const logBelowList = (line: string): void => {\n console.log(line);\n linesBelowList += 1;\n };\n\n const markStarted = (index: number): void => {\n const v = views[index];\n if (!process.stdout.isTTY || options.plainStatusLines) {\n logBelowList(` ${v.service} started`);\n return;\n }\n const line = ` http://localhost:${v.port} ${v.service.padEnd(serviceColumnWidth)} \\x1b[33m(started)\\x1b[0m`;\n const up = linesBelowList + (views.length - index);\n process.stdout.write(`\\x1b[${up}F\\x1b[2K${line}\\x1b[${up}E`);\n };\n\n const pollUntilStarted = (index: number): void => {\n const attempt = (): void => {\n if (shuttingDown) return;\n const req = http.get(\n {\n host: 'localhost',\n port: views[index].port,\n path: '/',\n timeout: 1000,\n },\n (res) => {\n res.resume();\n markStarted(index);\n },\n );\n req.on('error', () => setTimeout(attempt, 500));\n req.on('timeout', () => req.destroy());\n };\n attempt();\n };\n\n for (const [index, view] of views.entries()) {\n const config = getViewsRspackConfig(view.viewsDir);\n const compiler = rspack(config);\n const server = new RspackDevServer(config.devServer || { port: view.port }, compiler);\n servers.push(server);\n\n try {\n await server.start();\n } catch (e) {\n logBelowList(` [${view.service}] failed to start: ${(e as Error).message} — shutting down all views servers.`);\n shutdown(1);\n return;\n }\n\n pollUntilStarted(index);\n }\n\n process.on('SIGINT', () => shutdown(0));\n process.on('SIGTERM', () => shutdown(0));\n};\n"]}
|
|
1
|
+
{"version":3,"file":"goDevWeb.js","sourceRoot":"","sources":["../../../src/commands/goDevWeb.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,8EAA8E;AAC9E,mEAAmE;AACnE,mEAAmE;AACnE,+CAA+C;AAC/C,EAAE;AACF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AAC,CAAC,CAAC;IACxC,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;AAC3C,CAAC,CAAC","sourcesContent":["// `qpq go:dev:web` — boots every views microfrontend's Rspack dev server\n// in-process (shell is the MF host app, plus all remotes on their own ports).\n// Everything is served dynamically; remotes resolve at runtime via\n// mf-manifest.json on localhost ports. Programmatic — no per-views\n// rspack.config.ts or npm serve script needed.\n//\n// Usage:\n// qpq go:dev:web\n// qpq go:dev:web --only shell,design\n// qpq go:dev:web --app <name>\nimport { getAllViews, getViewsRspackConfig } from 'quidproquo-deploy-rspack';\n\nimport http from 'http';\nimport { rspack } from '@rspack/core';\nimport { RspackDevServer } from '@rspack/dev-server';\n\nimport { getArgValue } from '../lib/args';\nimport { primeDeployEnvFromConfig } from '../lib/deployEnv';\nimport { getRoot } from '../lib/discovery';\nimport { isQpqCliCommand, killStaleListeners } from '../lib/killStaleListeners';\nimport { resolveAppSelection } from '../lib/resolveAppSelection';\n\nexport type GoDevWebOptions = {\n // The in-place \"(started)\" chip rewrite assumes this command owns the\n // terminal; when stdout is shared with the API dev server (combined\n // `qpq go:dev`) the cursor math breaks, so fall back to plain lines.\n plainStatusLines?: boolean;\n};\n\nexport const goDevWebCommand = async (argv: string[], options: GoDevWebOptions = {}): Promise<void> => {\n const root = getRoot();\n const appName = await resolveAppSelection({ argv, envVar: 'QPQ_DEV_APP' });\n\n process.env.LOCAL_DEV_SERVER = 'true';\n process.env.NODE_ENV = 'development';\n primeDeployEnvFromConfig(appName);\n\n const only = getArgValue(argv, '--only')\n ?.split(',')\n .map((s) => s.trim());\n\n let views = getAllViews(root, appName);\n if (only) views = views.filter((v) => only.includes(v.service));\n if (views.length === 0) {\n console.error('No views projects found.');\n process.exit(1);\n }\n\n killStaleListeners(\n views.map((v) => v.port),\n isQpqCliCommand,\n );\n\n // Every RspackDevServer.start() registers its own SIGINT/SIGTERM handler on\n // process — with a dozen views servers in one process that trips node's\n // default 10-listener warning. Size the limit to the fleet.\n process.setMaxListeners(Math.max(process.getMaxListeners(), views.length * 2 + 10));\n\n // Service names are padded to a common width so the \"(started)\" chips align.\n const serviceColumnWidth = Math.max(...views.map((v) => v.service.length));\n\n console.log(`Starting ${views.length} views dev servers for [${appName}]:`);\n for (const v of views) console.log(` http://localhost:${v.port} ${v.service.padEnd(serviceColumnWidth)}`);\n\n const servers: RspackDevServer[] = [];\n let shuttingDown = false;\n\n const shutdown = (code: number): void => {\n if (shuttingDown) return;\n shuttingDown = true;\n Promise.allSettled(servers.map((server) => server.stop())).then(() => process.exit(code));\n };\n\n // The URL list above gets a yellow \"(started)\" chip appended in place as\n // each dev server begins answering HTTP. The in-place rewrite moves the\n // cursor up past everything printed since the list, so every line printed\n // below it MUST go through logBelowList to keep the offset accurate.\n let linesBelowList = 0;\n\n const logBelowList = (line: string): void => {\n console.log(line);\n linesBelowList += 1;\n };\n\n const markStarted = (index: number): void => {\n const v = views[index];\n if (!process.stdout.isTTY || options.plainStatusLines) {\n logBelowList(` ${v.service} started`);\n return;\n }\n const line = ` http://localhost:${v.port} ${v.service.padEnd(serviceColumnWidth)} \\x1b[33m(started)\\x1b[0m`;\n const up = linesBelowList + (views.length - index);\n process.stdout.write(`\\x1b[${up}F\\x1b[2K${line}\\x1b[${up}E`);\n };\n\n const pollUntilStarted = (index: number): void => {\n const attempt = (): void => {\n if (shuttingDown) return;\n const req = http.get(\n {\n host: 'localhost',\n port: views[index].port,\n path: '/',\n timeout: 1000,\n },\n (res) => {\n res.resume();\n markStarted(index);\n },\n );\n req.on('error', () => setTimeout(attempt, 500));\n req.on('timeout', () => req.destroy());\n };\n attempt();\n };\n\n for (const [index, view] of views.entries()) {\n const config = getViewsRspackConfig(view.viewsDir);\n const compiler = rspack(config);\n const server = new RspackDevServer(config.devServer || { port: view.port }, compiler);\n servers.push(server);\n\n try {\n await server.start();\n } catch (e) {\n logBelowList(` [${view.service}] failed to start: ${(e as Error).message} — shutting down all views servers.`);\n shutdown(1);\n return;\n }\n\n pollUntilStarted(index);\n }\n\n process.on('SIGINT', () => shutdown(0));\n process.on('SIGTERM', () => shutdown(0));\n};\n"]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// platform driver's parallel containerized deploy (drivers without a docker
|
|
3
3
|
// strategy don't offer one).
|
|
4
4
|
import { resolveDeployEnvironment } from '../lib/deployEnv';
|
|
5
|
-
import { promptDeployPlan } from '../lib/deployPrompts';
|
|
5
|
+
import { buildDeployPlanFromArgs, promptDeployPlan } from '../lib/deployPrompts';
|
|
6
6
|
import { resolveAppSelection } from '../lib/resolveAppSelection';
|
|
7
7
|
import { getPlatformDriver } from '../platforms';
|
|
8
8
|
export const goDockerCommand = async (argv) => {
|
|
@@ -13,7 +13,8 @@ export const goDockerCommand = async (argv) => {
|
|
|
13
13
|
console.error(`Platform '${platform}' has no dockerized deploy — use qpq go instead.`);
|
|
14
14
|
process.exit(1);
|
|
15
15
|
}
|
|
16
|
-
|
|
16
|
+
// Positional args (`qpq go:docker all all`) run prompt-free; otherwise ask.
|
|
17
|
+
const plan = buildDeployPlanFromArgs(appName, argv) ?? (await promptDeployPlan(appName));
|
|
17
18
|
await driver.goDocker(appName, plan);
|
|
18
19
|
};
|
|
19
20
|
//# sourceMappingURL=goDocker.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"goDocker.js","sourceRoot":"","sources":["../../../src/commands/goDocker.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,4EAA4E;AAC5E,6BAA6B;AAC7B,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"goDocker.js","sourceRoot":"","sources":["../../../src/commands/goDocker.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,4EAA4E;AAC5E,6BAA6B;AAC7B,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACjF,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEjD,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,EAAE,IAAc,EAAiB,EAAE;IACrE,MAAM,OAAO,GAAG,MAAM,mBAAmB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,iBAAiB,EAAE,CAAC,CAAC;IAC/E,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,wBAAwB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACnE,MAAM,MAAM,GAAG,iBAAiB,CAAC,QAAQ,CAAC,CAAC;IAE3C,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;QACrB,OAAO,CAAC,KAAK,CAAC,aAAa,QAAQ,kDAAkD,CAAC,CAAC;QACvF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,4EAA4E;IAC5E,MAAM,IAAI,GAAG,uBAAuB,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC;IAEzF,MAAM,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;AACvC,CAAC,CAAC","sourcesContent":["// `qpq go:docker` — asks the same questions as `qpq go`, then runs the\n// platform driver's parallel containerized deploy (drivers without a docker\n// strategy don't offer one).\nimport { resolveDeployEnvironment } from '../lib/deployEnv';\nimport { buildDeployPlanFromArgs, promptDeployPlan } from '../lib/deployPrompts';\nimport { resolveAppSelection } from '../lib/resolveAppSelection';\nimport { getPlatformDriver } from '../platforms';\n\nexport const goDockerCommand = async (argv: string[]): Promise<void> => {\n const appName = await resolveAppSelection({ argv, envVar: 'DEPLOY_APP_NAME' });\n const { platform } = await resolveDeployEnvironment(argv, appName);\n const driver = getPlatformDriver(platform);\n\n if (!driver.goDocker) {\n console.error(`Platform '${platform}' has no dockerized deploy — use qpq go instead.`);\n process.exit(1);\n }\n\n // Positional args (`qpq go:docker all all`) run prompt-free; otherwise ask.\n const plan = buildDeployPlanFromArgs(appName, argv) ?? (await promptDeployPlan(appName));\n\n await driver.goDocker(appName, plan);\n};\n"]}
|
|
@@ -1,13 +1,28 @@
|
|
|
1
|
-
// `qpq hooks <name>` — run the `qpq:<name>` script
|
|
2
|
-
// one
|
|
3
|
-
//
|
|
4
|
-
|
|
1
|
+
// `qpq hooks <name>` — run the `qpq:<name>` script (or the plain `<name>`
|
|
2
|
+
// script when no qpq:-prefixed one exists) of every app and workspace package
|
|
3
|
+
// that defines one, in dependency order with parallel execution.
|
|
4
|
+
// Wire the root package.json's lifecycle to it, e.g.
|
|
5
|
+
// "postinstall": "qpq hooks postinstall". Use --jobs=1 to force serial runs.
|
|
6
|
+
import os from 'os';
|
|
7
|
+
import { getArgValue } from '../lib/args';
|
|
8
|
+
import { runHookForAllPackages } from '../lib/hooks';
|
|
9
|
+
import { assertNoFailures } from '../lib/runTasks';
|
|
10
|
+
// Leave a core for the rest of the machine, capped so a wide dependency level
|
|
11
|
+
// doesn't stack up too many concurrent npm processes.
|
|
12
|
+
const getJobs = (argv) => {
|
|
13
|
+
const parsed = Number(getArgValue(argv, '--jobs'));
|
|
14
|
+
if (Number.isFinite(parsed) && parsed >= 1) {
|
|
15
|
+
return Math.floor(parsed);
|
|
16
|
+
}
|
|
17
|
+
return Math.max(1, Math.min(8, os.availableParallelism() - 1));
|
|
18
|
+
};
|
|
5
19
|
export const hooksCommand = async (argv) => {
|
|
6
20
|
const [hook] = argv.filter((a) => !a.startsWith('--'));
|
|
7
21
|
if (!hook) {
|
|
8
|
-
console.error('Usage: qpq hooks <name> (runs qpq:<name
|
|
22
|
+
console.error('Usage: qpq hooks <name> [--jobs=N] (runs qpq:<name>, or plain <name>, in every app/package that defines it)');
|
|
9
23
|
process.exit(1);
|
|
10
24
|
}
|
|
11
|
-
await
|
|
25
|
+
const failures = await runHookForAllPackages(hook, getJobs(argv));
|
|
26
|
+
assertNoFailures(`hooks ${hook}`, failures);
|
|
12
27
|
};
|
|
13
28
|
//# sourceMappingURL=hooks.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.js","sourceRoot":"","sources":["../../../src/commands/hooks.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E
|
|
1
|
+
{"version":3,"file":"hooks.js","sourceRoot":"","sources":["../../../src/commands/hooks.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,8EAA8E;AAC9E,iEAAiE;AACjE,qDAAqD;AACrD,6EAA6E;AAC7E,OAAO,EAAE,MAAM,IAAI,CAAC;AAEpB,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAEnD,8EAA8E;AAC9E,sDAAsD;AACtD,MAAM,OAAO,GAAG,CAAC,IAAc,EAAU,EAAE;IACzC,MAAM,MAAM,GAAG,MAAM,CAAC,WAAW,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC;IACnD,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,MAAM,IAAI,CAAC,EAAE,CAAC;QAC3C,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAC5B,CAAC;IACD,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,oBAAoB,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC;AACjE,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG,KAAK,EAAE,IAAc,EAAiB,EAAE;IAClE,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC;IAEvD,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,OAAO,CAAC,KAAK,CAAC,+GAA+G,CAAC,CAAC;QAC/H,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,MAAM,QAAQ,GAAG,MAAM,qBAAqB,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IAClE,gBAAgB,CAAC,SAAS,IAAI,EAAE,EAAE,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 os from 'os';\n\nimport { getArgValue } from '../lib/args';\nimport { runHookForAllPackages } from '../lib/hooks';\nimport { assertNoFailures } from '../lib/runTasks';\n\n// Leave a core for the rest of the machine, capped so a wide dependency level\n// doesn't stack up too many concurrent npm processes.\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 Math.max(1, Math.min(8, os.availableParallelism() - 1));\n};\n\nexport const hooksCommand = async (argv: string[]): Promise<void> => {\n const [hook] = argv.filter((a) => !a.startsWith('--'));\n\n if (!hook) {\n console.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"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type ClearableResourceKind = 'storageDrive' | 'keyValueStore';
|
|
2
|
+
export type ClearableResource = {
|
|
3
|
+
service: string;
|
|
4
|
+
kind: ClearableResourceKind;
|
|
5
|
+
resourceName: string;
|
|
6
|
+
};
|
|
7
|
+
export type ClearResourcesPlan = {
|
|
8
|
+
kind: 'cancelled';
|
|
9
|
+
} | {
|
|
10
|
+
kind: 'resources';
|
|
11
|
+
appName: string;
|
|
12
|
+
resources: ClearableResource[];
|
|
13
|
+
};
|
|
14
|
+
export declare const getClearableResources: (appName: string) => ClearableResource[];
|
|
15
|
+
export declare const promptClearResourcesPlan: (appName: string) => Promise<ClearResourcesPlan>;
|