quidproquo-cli 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/docker/cdk-deployer/Dockerfile +13 -0
- package/docker/dev-server/Dockerfile +48 -0
- package/lib/commonjs/bin/qpq.d.ts +2 -0
- package/lib/commonjs/bin/qpq.js +6 -0
- package/lib/commonjs/bin/qpq.js.map +1 -0
- package/lib/commonjs/bin/qpqCdkApp.d.ts +1 -0
- package/lib/commonjs/bin/qpqCdkApp.js +8 -0
- package/lib/commonjs/bin/qpqCdkApp.js.map +1 -0
- package/lib/commonjs/cli/index.d.ts +1 -0
- package/lib/commonjs/cli/index.js +18 -0
- package/lib/commonjs/cli/index.js.map +1 -0
- package/lib/commonjs/cli/runCli.d.ts +1 -0
- package/lib/commonjs/cli/runCli.js +80 -0
- package/lib/commonjs/cli/runCli.js.map +1 -0
- package/lib/commonjs/commands/go.d.ts +1 -0
- package/lib/commonjs/commands/go.js +28 -0
- package/lib/commonjs/commands/go.js.map +1 -0
- package/lib/commonjs/commands/goDev.d.ts +1 -0
- package/lib/commonjs/commands/goDev.js +143 -0
- package/lib/commonjs/commands/goDev.js.map +1 -0
- package/lib/commonjs/commands/goDevWeb.d.ts +1 -0
- package/lib/commonjs/commands/goDevWeb.js +122 -0
- package/lib/commonjs/commands/goDevWeb.js.map +1 -0
- package/lib/commonjs/commands/goDocker.d.ts +1 -0
- package/lib/commonjs/commands/goDocker.js +32 -0
- package/lib/commonjs/commands/goDocker.js.map +1 -0
- package/lib/commonjs/commands/hooks.d.ts +1 -0
- package/lib/commonjs/commands/hooks.js +26 -0
- package/lib/commonjs/commands/hooks.js.map +1 -0
- package/lib/commonjs/commands/prep.d.ts +1 -0
- package/lib/commonjs/commands/prep.js +28 -0
- package/lib/commonjs/commands/prep.js.map +1 -0
- package/lib/commonjs/commands/publish.d.ts +4 -0
- package/lib/commonjs/commands/publish.js +54 -0
- package/lib/commonjs/commands/publish.js.map +1 -0
- package/lib/commonjs/commands/synth.d.ts +1 -0
- package/lib/commonjs/commands/synth.js +79 -0
- package/lib/commonjs/commands/synth.js.map +1 -0
- package/lib/commonjs/commands/teardown.d.ts +1 -0
- package/lib/commonjs/commands/teardown.js +33 -0
- package/lib/commonjs/commands/teardown.js.map +1 -0
- package/lib/commonjs/index.d.ts +1 -0
- package/lib/commonjs/index.js +18 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/lib/args.d.ts +2 -0
- package/lib/commonjs/lib/args.js +21 -0
- package/lib/commonjs/lib/args.js.map +1 -0
- package/lib/commonjs/lib/deployEnv.d.ts +6 -0
- package/lib/commonjs/lib/deployEnv.js +76 -0
- package/lib/commonjs/lib/deployEnv.js.map +1 -0
- package/lib/commonjs/lib/deployPrompts.d.ts +25 -0
- package/lib/commonjs/lib/deployPrompts.js +83 -0
- package/lib/commonjs/lib/deployPrompts.js.map +1 -0
- package/lib/commonjs/lib/devServerEntry.d.ts +1 -0
- package/lib/commonjs/lib/devServerEntry.js +53 -0
- package/lib/commonjs/lib/devServerEntry.js.map +1 -0
- package/lib/commonjs/lib/discovery.d.ts +10 -0
- package/lib/commonjs/lib/discovery.js +56 -0
- package/lib/commonjs/lib/discovery.js.map +1 -0
- package/lib/commonjs/lib/hooks.d.ts +2 -0
- package/lib/commonjs/lib/hooks.js +45 -0
- package/lib/commonjs/lib/hooks.js.map +1 -0
- package/lib/commonjs/lib/packageRoot.d.ts +1 -0
- package/lib/commonjs/lib/packageRoot.js +21 -0
- package/lib/commonjs/lib/packageRoot.js.map +1 -0
- package/lib/commonjs/lib/prompts.d.ts +3 -0
- package/lib/commonjs/lib/prompts.js +64 -0
- package/lib/commonjs/lib/prompts.js.map +1 -0
- package/lib/commonjs/lib/qpqConfigs.d.ts +3 -0
- package/lib/commonjs/lib/qpqConfigs.js +19 -0
- package/lib/commonjs/lib/qpqConfigs.js.map +1 -0
- package/lib/commonjs/lib/resolveAppSelection.d.ts +6 -0
- package/lib/commonjs/lib/resolveAppSelection.js +58 -0
- package/lib/commonjs/lib/resolveAppSelection.js.map +1 -0
- package/lib/commonjs/lib/rspackRun.d.ts +2 -0
- package/lib/commonjs/lib/rspackRun.js +23 -0
- package/lib/commonjs/lib/rspackRun.js.map +1 -0
- package/lib/commonjs/lib/runCommand.d.ts +13 -0
- package/lib/commonjs/lib/runCommand.js +78 -0
- package/lib/commonjs/lib/runCommand.js.map +1 -0
- package/lib/commonjs/lib/runTasks.d.ts +10 -0
- package/lib/commonjs/lib/runTasks.js +42 -0
- package/lib/commonjs/lib/runTasks.js.map +1 -0
- package/lib/commonjs/lib/timing.d.ts +2 -0
- package/lib/commonjs/lib/timing.js +11 -0
- package/lib/commonjs/lib/timing.js.map +1 -0
- package/lib/commonjs/lib/views.d.ts +2 -0
- package/lib/commonjs/lib/views.js +32 -0
- package/lib/commonjs/lib/views.js.map +1 -0
- package/lib/commonjs/platforms/aws/awsCredentials.d.ts +1 -0
- package/lib/commonjs/platforms/aws/awsCredentials.js +28 -0
- package/lib/commonjs/platforms/aws/awsCredentials.js.map +1 -0
- package/lib/commonjs/platforms/aws/cdkApp.d.ts +2 -0
- package/lib/commonjs/platforms/aws/cdkApp.js +19 -0
- package/lib/commonjs/platforms/aws/cdkApp.js.map +1 -0
- package/lib/commonjs/platforms/aws/go.d.ts +2 -0
- package/lib/commonjs/platforms/aws/go.js +116 -0
- package/lib/commonjs/platforms/aws/go.js.map +1 -0
- package/lib/commonjs/platforms/aws/goDocker.d.ts +2 -0
- package/lib/commonjs/platforms/aws/goDocker.js +287 -0
- package/lib/commonjs/platforms/aws/goDocker.js.map +1 -0
- package/lib/commonjs/platforms/aws/identity.d.ts +2 -0
- package/lib/commonjs/platforms/aws/identity.js +26 -0
- package/lib/commonjs/platforms/aws/identity.js.map +1 -0
- package/lib/commonjs/platforms/aws/index.d.ts +2 -0
- package/lib/commonjs/platforms/aws/index.js +19 -0
- package/lib/commonjs/platforms/aws/index.js.map +1 -0
- package/lib/commonjs/platforms/aws/publish.d.ts +4 -0
- package/lib/commonjs/platforms/aws/publish.js +66 -0
- package/lib/commonjs/platforms/aws/publish.js.map +1 -0
- package/lib/commonjs/platforms/aws/remote.d.ts +11 -0
- package/lib/commonjs/platforms/aws/remote.js +106 -0
- package/lib/commonjs/platforms/aws/remote.js.map +1 -0
- package/lib/commonjs/platforms/aws/stacks.d.ts +7 -0
- package/lib/commonjs/platforms/aws/stacks.js +91 -0
- package/lib/commonjs/platforms/aws/stacks.js.map +1 -0
- package/lib/commonjs/platforms/aws/teardown.d.ts +2 -0
- package/lib/commonjs/platforms/aws/teardown.js +59 -0
- package/lib/commonjs/platforms/aws/teardown.js.map +1 -0
- package/lib/commonjs/platforms/aws/viewsSync.d.ts +2 -0
- package/lib/commonjs/platforms/aws/viewsSync.js +39 -0
- package/lib/commonjs/platforms/aws/viewsSync.js.map +1 -0
- package/lib/commonjs/platforms/docker/go.d.ts +2 -0
- package/lib/commonjs/platforms/docker/go.js +160 -0
- package/lib/commonjs/platforms/docker/go.js.map +1 -0
- package/lib/commonjs/platforms/docker/index.d.ts +2 -0
- package/lib/commonjs/platforms/docker/index.js +27 -0
- package/lib/commonjs/platforms/docker/index.js.map +1 -0
- package/lib/commonjs/platforms/index.d.ts +4 -0
- package/lib/commonjs/platforms/index.js +39 -0
- package/lib/commonjs/platforms/index.js.map +1 -0
- package/lib/commonjs/platforms/types.d.ts +16 -0
- package/lib/commonjs/platforms/types.js +9 -0
- package/lib/commonjs/platforms/types.js.map +1 -0
- package/lib/esm/bin/qpq.d.ts +2 -0
- package/lib/esm/bin/qpq.js +4 -0
- package/lib/esm/bin/qpq.js.map +1 -0
- package/lib/esm/bin/qpqCdkApp.d.ts +1 -0
- package/lib/esm/bin/qpqCdkApp.js +6 -0
- package/lib/esm/bin/qpqCdkApp.js.map +1 -0
- package/lib/esm/cli/index.d.ts +1 -0
- package/lib/esm/cli/index.js +2 -0
- package/lib/esm/cli/index.js.map +1 -0
- package/lib/esm/cli/runCli.d.ts +1 -0
- package/lib/esm/cli/runCli.js +67 -0
- package/lib/esm/cli/runCli.js.map +1 -0
- package/lib/esm/commands/go.d.ts +1 -0
- package/lib/esm/commands/go.js +15 -0
- package/lib/esm/commands/go.js.map +1 -0
- package/lib/esm/commands/goDev.d.ts +1 -0
- package/lib/esm/commands/goDev.js +127 -0
- package/lib/esm/commands/goDev.js.map +1 -0
- package/lib/esm/commands/goDevWeb.d.ts +1 -0
- package/lib/esm/commands/goDevWeb.js +107 -0
- package/lib/esm/commands/goDevWeb.js.map +1 -0
- package/lib/esm/commands/goDocker.d.ts +1 -0
- package/lib/esm/commands/goDocker.js +19 -0
- package/lib/esm/commands/goDocker.js.map +1 -0
- package/lib/esm/commands/hooks.d.ts +1 -0
- package/lib/esm/commands/hooks.js +13 -0
- package/lib/esm/commands/hooks.js.map +1 -0
- package/lib/esm/commands/prep.d.ts +1 -0
- package/lib/esm/commands/prep.js +15 -0
- package/lib/esm/commands/prep.js.map +1 -0
- package/lib/esm/commands/publish.d.ts +4 -0
- package/lib/esm/commands/publish.js +38 -0
- package/lib/esm/commands/publish.js.map +1 -0
- package/lib/esm/commands/synth.d.ts +1 -0
- package/lib/esm/commands/synth.js +63 -0
- package/lib/esm/commands/synth.js.map +1 -0
- package/lib/esm/commands/teardown.d.ts +1 -0
- package/lib/esm/commands/teardown.js +20 -0
- package/lib/esm/commands/teardown.js.map +1 -0
- package/lib/esm/index.d.ts +1 -0
- package/lib/esm/index.js +2 -0
- package/lib/esm/index.js.map +1 -0
- package/lib/esm/lib/args.d.ts +2 -0
- package/lib/esm/lib/args.js +16 -0
- package/lib/esm/lib/args.js.map +1 -0
- package/lib/esm/lib/deployEnv.d.ts +6 -0
- package/lib/esm/lib/deployEnv.js +60 -0
- package/lib/esm/lib/deployEnv.js.map +1 -0
- package/lib/esm/lib/deployPrompts.d.ts +25 -0
- package/lib/esm/lib/deployPrompts.js +69 -0
- package/lib/esm/lib/deployPrompts.js.map +1 -0
- package/lib/esm/lib/devServerEntry.d.ts +1 -0
- package/lib/esm/lib/devServerEntry.js +46 -0
- package/lib/esm/lib/devServerEntry.js.map +1 -0
- package/lib/esm/lib/discovery.d.ts +10 -0
- package/lib/esm/lib/discovery.js +40 -0
- package/lib/esm/lib/discovery.js.map +1 -0
- package/lib/esm/lib/hooks.d.ts +2 -0
- package/lib/esm/lib/hooks.js +27 -0
- package/lib/esm/lib/hooks.js.map +1 -0
- package/lib/esm/lib/packageRoot.d.ts +1 -0
- package/lib/esm/lib/packageRoot.js +14 -0
- package/lib/esm/lib/packageRoot.js.map +1 -0
- package/lib/esm/lib/prompts.d.ts +3 -0
- package/lib/esm/lib/prompts.js +16 -0
- package/lib/esm/lib/prompts.js.map +1 -0
- package/lib/esm/lib/qpqConfigs.d.ts +3 -0
- package/lib/esm/lib/qpqConfigs.js +14 -0
- package/lib/esm/lib/qpqConfigs.js.map +1 -0
- package/lib/esm/lib/resolveAppSelection.d.ts +6 -0
- package/lib/esm/lib/resolveAppSelection.js +45 -0
- package/lib/esm/lib/resolveAppSelection.js.map +1 -0
- package/lib/esm/lib/rspackRun.d.ts +2 -0
- package/lib/esm/lib/rspackRun.js +19 -0
- package/lib/esm/lib/rspackRun.js.map +1 -0
- package/lib/esm/lib/runCommand.d.ts +13 -0
- package/lib/esm/lib/runCommand.js +69 -0
- package/lib/esm/lib/runCommand.js.map +1 -0
- package/lib/esm/lib/runTasks.d.ts +10 -0
- package/lib/esm/lib/runTasks.js +28 -0
- package/lib/esm/lib/runTasks.js.map +1 -0
- package/lib/esm/lib/timing.d.ts +2 -0
- package/lib/esm/lib/timing.js +6 -0
- package/lib/esm/lib/timing.js.map +1 -0
- package/lib/esm/lib/views.d.ts +2 -0
- package/lib/esm/lib/views.js +15 -0
- package/lib/esm/lib/views.js.map +1 -0
- package/lib/esm/platforms/aws/awsCredentials.d.ts +1 -0
- package/lib/esm/platforms/aws/awsCredentials.js +15 -0
- package/lib/esm/platforms/aws/awsCredentials.js.map +1 -0
- package/lib/esm/platforms/aws/cdkApp.d.ts +2 -0
- package/lib/esm/platforms/aws/cdkApp.js +11 -0
- package/lib/esm/platforms/aws/cdkApp.js.map +1 -0
- package/lib/esm/platforms/aws/go.d.ts +2 -0
- package/lib/esm/platforms/aws/go.js +100 -0
- package/lib/esm/platforms/aws/go.js.map +1 -0
- package/lib/esm/platforms/aws/goDocker.d.ts +2 -0
- package/lib/esm/platforms/aws/goDocker.js +271 -0
- package/lib/esm/platforms/aws/goDocker.js.map +1 -0
- package/lib/esm/platforms/aws/identity.d.ts +2 -0
- package/lib/esm/platforms/aws/identity.js +22 -0
- package/lib/esm/platforms/aws/identity.js.map +1 -0
- package/lib/esm/platforms/aws/index.d.ts +2 -0
- package/lib/esm/platforms/aws/index.js +16 -0
- package/lib/esm/platforms/aws/index.js.map +1 -0
- package/lib/esm/platforms/aws/publish.d.ts +4 -0
- package/lib/esm/platforms/aws/publish.js +50 -0
- package/lib/esm/platforms/aws/publish.js.map +1 -0
- package/lib/esm/platforms/aws/remote.d.ts +11 -0
- package/lib/esm/platforms/aws/remote.js +90 -0
- package/lib/esm/platforms/aws/remote.js.map +1 -0
- package/lib/esm/platforms/aws/stacks.d.ts +7 -0
- package/lib/esm/platforms/aws/stacks.js +69 -0
- package/lib/esm/platforms/aws/stacks.js.map +1 -0
- package/lib/esm/platforms/aws/teardown.d.ts +2 -0
- package/lib/esm/platforms/aws/teardown.js +46 -0
- package/lib/esm/platforms/aws/teardown.js.map +1 -0
- package/lib/esm/platforms/aws/viewsSync.d.ts +2 -0
- package/lib/esm/platforms/aws/viewsSync.js +25 -0
- package/lib/esm/platforms/aws/viewsSync.js.map +1 -0
- package/lib/esm/platforms/docker/go.d.ts +2 -0
- package/lib/esm/platforms/docker/go.js +143 -0
- package/lib/esm/platforms/docker/go.js.map +1 -0
- package/lib/esm/platforms/docker/index.d.ts +2 -0
- package/lib/esm/platforms/docker/index.js +15 -0
- package/lib/esm/platforms/docker/index.js.map +1 -0
- package/lib/esm/platforms/index.d.ts +4 -0
- package/lib/esm/platforms/index.js +20 -0
- package/lib/esm/platforms/index.js.map +1 -0
- package/lib/esm/platforms/types.d.ts +16 -0
- package/lib/esm/platforms/types.js +6 -0
- package/lib/esm/platforms/types.js.map +1 -0
- package/package.json +63 -0
package/README.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Deploy runner for `qpq go:docker`. Containers deploy PRE-SYNTHESIZED
|
|
2
|
+
# cloud assemblies (`cdk deploy --app /assembly <stack>`), so the image needs
|
|
3
|
+
# only the CDK CLI — not the workspace, its npm-linked quidproquo packages, or
|
|
4
|
+
# any platform-specific node_modules.
|
|
5
|
+
#
|
|
6
|
+
# CDK_VERSION is passed at build time to match the workspace's aws-cdk, so the
|
|
7
|
+
# CLI can always read the assembly schema the host synthesized.
|
|
8
|
+
FROM node:24-slim
|
|
9
|
+
|
|
10
|
+
ARG CDK_VERSION=2
|
|
11
|
+
RUN npm install -g aws-cdk@${CDK_VERSION}
|
|
12
|
+
|
|
13
|
+
WORKDIR /work
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Runtime image for `qpq go` on the docker platform: the QPQ dev server
|
|
2
|
+
# (a full local platform emulation — sqlite KVS, file storage, queues,
|
|
3
|
+
# websockets) hosting every service of the app, plus the pre-built views.
|
|
4
|
+
#
|
|
5
|
+
# The server bundle externalizes bare packages (native modules like sqlite3
|
|
6
|
+
# must load from a real install), so runtime deps are npm-installed in the
|
|
7
|
+
# image, then the locally-built quidproquo packages are overlaid so the image
|
|
8
|
+
# runs the same qpq code the bundle was built against.
|
|
9
|
+
# trixie (glibc 2.41): sqlite3's prebuilt binaries are built against glibc
|
|
10
|
+
# 2.38, which bookworm-based node:24-slim (glibc 2.36) can't load.
|
|
11
|
+
FROM node:24-trixie-slim
|
|
12
|
+
|
|
13
|
+
WORKDIR /app
|
|
14
|
+
|
|
15
|
+
# Runtime deps (package.json is the consumer root's, with workspaces/scripts
|
|
16
|
+
# stripped by the assemble step). Slow but correct: natives compile for linux.
|
|
17
|
+
# vendor/ must be present before the install: consumers on file: refs have
|
|
18
|
+
# their quidproquo deps rewritten to file:./vendor/<pkg> so npm can resolve
|
|
19
|
+
# them (and their transitive deps) inside the context.
|
|
20
|
+
COPY vendor/ ./vendor/
|
|
21
|
+
COPY package.json ./
|
|
22
|
+
RUN npm install --omit=dev
|
|
23
|
+
|
|
24
|
+
# Overlay the locally-built quidproquo packages over the installed ones.
|
|
25
|
+
# npm leaves file:./vendor deps as symlinks and registry deps as real
|
|
26
|
+
# directories — rm+cp replaces either shape with the vendored code (a plain
|
|
27
|
+
# COPY cannot write a directory over a symlink).
|
|
28
|
+
RUN set -e; for d in ./vendor/*/; do \
|
|
29
|
+
[ -d "$d" ] || continue; \
|
|
30
|
+
pkg="$(basename "$d")"; \
|
|
31
|
+
rm -rf "./node_modules/$pkg"; \
|
|
32
|
+
cp -a "$d" "./node_modules/$pkg"; \
|
|
33
|
+
done
|
|
34
|
+
|
|
35
|
+
COPY server/ ./server/
|
|
36
|
+
COPY web/ ./web/
|
|
37
|
+
|
|
38
|
+
ENV QPQ_WEB_ROOT=/app/web
|
|
39
|
+
ENV NODE_ENV=production
|
|
40
|
+
|
|
41
|
+
# api / websocket / file-storage secure urls
|
|
42
|
+
EXPOSE 8080 8888 3001
|
|
43
|
+
|
|
44
|
+
# Emulated platform state (sqlite + file storage) lives here — mount a volume
|
|
45
|
+
# to persist it across container restarts.
|
|
46
|
+
VOLUME /app/.qpq-runtime
|
|
47
|
+
|
|
48
|
+
CMD ["node", "server/main.js"]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"qpq.js","sourceRoot":"","sources":["../../../src/bin/qpq.ts"],"names":[],"mappings":";;;AACA,gCAAgC;AAEhC,IAAA,YAAM,EAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC","sourcesContent":["#!/usr/bin/env node\nimport { runCli } from '../cli';\n\nrunCli(process.argv.slice(2));\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
// The CDK app command (`cdk ... --app "node -r ts-node/register/transpile-only <this file>"`).
|
|
4
|
+
// Runs under ts-node hooks so per-app TS config fragments and service
|
|
5
|
+
// infrastructure.ts files can be required directly.
|
|
6
|
+
const quidproquo_deploy_awscdk_1 = require("quidproquo-deploy-awscdk");
|
|
7
|
+
(0, quidproquo_deploy_awscdk_1.createWorkspaceQpqCdkApp)();
|
|
8
|
+
//# sourceMappingURL=qpqCdkApp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"qpqCdkApp.js","sourceRoot":"","sources":["../../../src/bin/qpqCdkApp.ts"],"names":[],"mappings":";;AAAA,+FAA+F;AAC/F,sEAAsE;AACtE,oDAAoD;AACpD,uEAAoE;AAEpE,IAAA,mDAAwB,GAAE,CAAC","sourcesContent":["// The CDK app command (`cdk ... --app \"node -r ts-node/register/transpile-only <this file>\"`).\n// Runs under ts-node hooks so per-app TS config fragments and service\n// infrastructure.ts files can be required directly.\nimport { createWorkspaceQpqCdkApp } from 'quidproquo-deploy-awscdk';\n\ncreateWorkspaceQpqCdkApp();\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './runCli';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./runCli"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/cli/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB","sourcesContent":["export * from './runCli';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const runCli: (argv: string[]) => Promise<void>;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.runCli = void 0;
|
|
13
|
+
const usage = `qpq — build, dev and deploy orchestration for QPQ apps
|
|
14
|
+
|
|
15
|
+
Usage: qpq <command> [--app <name>] [--env <name>] [--platform <name>]
|
|
16
|
+
|
|
17
|
+
Commands:
|
|
18
|
+
go Deploy services (interactive; platform from deploy.config.json, default aws)
|
|
19
|
+
go:docker Same as go, but deploys in parallel via docker
|
|
20
|
+
go:dev Run the local dev server (hot reload)
|
|
21
|
+
go:dev:web Run every views microfrontend dev server
|
|
22
|
+
teardown Destroy web/api/inf stacks for selected services (interactive)
|
|
23
|
+
synth [service] Synth QPQ configs to dist/apps/<app>/infrastructure
|
|
24
|
+
prep Regenerate apps/<app>/tsconfig.federated.json
|
|
25
|
+
publish Build + upload + deploy federated remotes
|
|
26
|
+
publish:build Build federated remotes locally
|
|
27
|
+
publish:upload Upload built version dirs (nothing goes live)
|
|
28
|
+
publish:deploy Flip manifests to the uploaded versions
|
|
29
|
+
hooks <name> Run qpq:<name> in every app that defines it
|
|
30
|
+
`;
|
|
31
|
+
// Service infrastructure.ts files (and app config fragments) are TypeScript —
|
|
32
|
+
// register ts-node's transpile-only require hook so the CLI can require them
|
|
33
|
+
// directly, using the consumer root's tsconfig.json ts-node settings.
|
|
34
|
+
const registerTsNode = () => {
|
|
35
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
36
|
+
require('ts-node').register({ transpileOnly: true });
|
|
37
|
+
};
|
|
38
|
+
const runCli = (argv) => __awaiter(void 0, void 0, void 0, function* () {
|
|
39
|
+
const [command, ...commandArgv] = argv;
|
|
40
|
+
if (!command || command === 'help' || command === '--help') {
|
|
41
|
+
console.log(usage);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
registerTsNode();
|
|
45
|
+
// Commands are required lazily so a simple `qpq help` doesn't pay for the
|
|
46
|
+
// whole toolchain, and so ts-node is registered before any command module
|
|
47
|
+
// (or anything it requires) loads.
|
|
48
|
+
/* eslint-disable @typescript-eslint/no-require-imports */
|
|
49
|
+
const commands = {
|
|
50
|
+
go: (a) => require('../commands/go').goCommand(a),
|
|
51
|
+
'go:docker': (a) => require('../commands/goDocker').goDockerCommand(a),
|
|
52
|
+
'go:dev': (a) => require('../commands/goDev').goDevCommand(a),
|
|
53
|
+
'go:dev:web': (a) => require('../commands/goDevWeb').goDevWebCommand(a),
|
|
54
|
+
teardown: (a) => require('../commands/teardown').teardownCommand(a),
|
|
55
|
+
synth: (a) => require('../commands/synth').synthCommand(a),
|
|
56
|
+
prep: (a) => require('../commands/prep').prepCommand(a),
|
|
57
|
+
publish: (a) => require('../commands/publish').publishCommand(a),
|
|
58
|
+
'publish:build': (a) => require('../commands/publish').publishBuildCommand(a),
|
|
59
|
+
'publish:upload': (a) => require('../commands/publish').publishUploadCommand(a),
|
|
60
|
+
'publish:deploy': (a) => require('../commands/publish').publishDeployCommand(a),
|
|
61
|
+
hooks: (a) => require('../commands/hooks').hooksCommand(a),
|
|
62
|
+
};
|
|
63
|
+
/* eslint-enable @typescript-eslint/no-require-imports */
|
|
64
|
+
const run = commands[command];
|
|
65
|
+
if (!run) {
|
|
66
|
+
console.error(`Unknown command: ${command}`);
|
|
67
|
+
console.log(usage);
|
|
68
|
+
process.exitCode = 1;
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
try {
|
|
72
|
+
yield run(commandArgv);
|
|
73
|
+
}
|
|
74
|
+
catch (error) {
|
|
75
|
+
console.error(`qpq ${command} failed:`, error);
|
|
76
|
+
process.exitCode = 1;
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
exports.runCli = runCli;
|
|
80
|
+
//# sourceMappingURL=runCli.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runCli.js","sourceRoot":"","sources":["../../../src/cli/runCli.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,MAAM,KAAK,GAAG;;;;;;;;;;;;;;;;;CAiBb,CAAC;AAEF,8EAA8E;AAC9E,6EAA6E;AAC7E,sEAAsE;AACtE,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;AAEK,MAAM,MAAM,GA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,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC;QAC7E,gBAAgB,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC;QAC/E,gBAAgB,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC;QAC/E,KAAK,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC;KAC3D,CAAC;IACF,yDAAyD;IAEzD,MAAM,GAAG,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC;IAE9B,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,OAAO,CAAC,KAAK,CAAC,oBAAoB,OAAO,EAAE,CAAC,CAAC;QAC7C,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACnB,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;QACrB,OAAO;IACT,CAAC;IAED,IAAI,CAAC;QACH,MAAM,GAAG,CAAC,WAAW,CAAC,CAAC;IACzB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,OAAO,OAAO,UAAU,EAAE,KAAK,CAAC,CAAC;QAC/C,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;IACvB,CAAC;AACH,CAAC,CAAA,CAAC;AA7CW,QAAA,MAAM,UA6CjB","sourcesContent":["const usage = `qpq — build, dev and deploy orchestration for QPQ apps\n\nUsage: qpq <command> [--app <name>] [--env <name>] [--platform <name>]\n\nCommands:\n go Deploy services (interactive; platform from deploy.config.json, default aws)\n go:docker Same as go, but deploys in parallel via docker\n go:dev Run the local dev server (hot reload)\n go:dev:web Run every views microfrontend dev server\n teardown Destroy web/api/inf stacks for selected services (interactive)\n synth [service] Synth QPQ configs to dist/apps/<app>/infrastructure\n prep Regenerate apps/<app>/tsconfig.federated.json\n publish Build + upload + deploy federated remotes\n publish:build Build federated remotes locally\n publish:upload Upload built version dirs (nothing goes live)\n publish:deploy Flip manifests to the uploaded versions\n hooks <name> Run qpq:<name> in every app that defines it\n`;\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.\nconst registerTsNode = (): void => {\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n require('ts-node').register({ transpileOnly: true });\n};\n\nexport const runCli = async (argv: string[]): Promise<void> => {\n const [command, ...commandArgv] = argv;\n\n if (!command || command === 'help' || command === '--help') {\n console.log(usage);\n return;\n }\n\n registerTsNode();\n\n // Commands are required lazily so a simple `qpq help` doesn't pay for the\n // whole toolchain, and so ts-node is registered before any command module\n // (or anything it requires) loads.\n /* eslint-disable @typescript-eslint/no-require-imports */\n const commands: Record<string, (commandArgv: string[]) => Promise<void>> = {\n go: (a) => require('../commands/go').goCommand(a),\n 'go:docker': (a) => require('../commands/goDocker').goDockerCommand(a),\n 'go:dev': (a) => require('../commands/goDev').goDevCommand(a),\n 'go:dev:web': (a) => require('../commands/goDevWeb').goDevWebCommand(a),\n teardown: (a) => require('../commands/teardown').teardownCommand(a),\n synth: (a) => require('../commands/synth').synthCommand(a),\n prep: (a) => require('../commands/prep').prepCommand(a),\n publish: (a) => require('../commands/publish').publishCommand(a),\n 'publish:build': (a) => require('../commands/publish').publishBuildCommand(a),\n 'publish:upload': (a) => require('../commands/publish').publishUploadCommand(a),\n 'publish:deploy': (a) => require('../commands/publish').publishDeployCommand(a),\n hooks: (a) => require('../commands/hooks').hooksCommand(a),\n };\n /* eslint-enable @typescript-eslint/no-require-imports */\n\n const run = commands[command];\n\n if (!run) {\n console.error(`Unknown command: ${command}`);\n console.log(usage);\n process.exitCode = 1;\n return;\n }\n\n try {\n await run(commandArgv);\n } catch (error) {\n console.error(`qpq ${command} failed:`, error);\n process.exitCode = 1;\n }\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const goCommand: (argv: string[]) => Promise<void>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.goCommand = void 0;
|
|
13
|
+
// `qpq go` — interactive deploy. Resolves the app + environment (which names
|
|
14
|
+
// the deploy platform in apps/<app>/deploy.config.json, default aws), asks the
|
|
15
|
+
// deploy plan, then hands off to the platform driver.
|
|
16
|
+
const deployEnv_1 = require("../lib/deployEnv");
|
|
17
|
+
const deployPrompts_1 = require("../lib/deployPrompts");
|
|
18
|
+
const resolveAppSelection_1 = require("../lib/resolveAppSelection");
|
|
19
|
+
const platforms_1 = require("../platforms");
|
|
20
|
+
const goCommand = (argv) => __awaiter(void 0, void 0, void 0, function* () {
|
|
21
|
+
const appName = yield (0, resolveAppSelection_1.resolveAppSelection)({ argv, envVar: 'DEPLOY_APP_NAME' });
|
|
22
|
+
const { platform } = yield (0, deployEnv_1.resolveDeployEnvironment)(argv, appName);
|
|
23
|
+
const driver = (0, platforms_1.getPlatformDriver)(platform);
|
|
24
|
+
const plan = yield (0, deployPrompts_1.promptDeployPlan)(appName);
|
|
25
|
+
yield driver.go(appName, plan);
|
|
26
|
+
});
|
|
27
|
+
exports.goCommand = goCommand;
|
|
28
|
+
//# sourceMappingURL=go.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"go.js","sourceRoot":"","sources":["../../../src/commands/go.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6EAA6E;AAC7E,+EAA+E;AAC/E,sDAAsD;AACtD,gDAA4D;AAC5D,wDAAwD;AACxD,oEAAiE;AACjE,4CAAiD;AAE1C,MAAM,SAAS,GAAG,CAAO,IAAc,EAAiB,EAAE;IAC/D,MAAM,OAAO,GAAG,MAAM,IAAA,yCAAmB,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,iBAAiB,EAAE,CAAC,CAAC;IAC/E,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,IAAA,oCAAwB,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACnE,MAAM,MAAM,GAAG,IAAA,6BAAiB,EAAC,QAAQ,CAAC,CAAC;IAE3C,MAAM,IAAI,GAAG,MAAM,IAAA,gCAAgB,EAAC,OAAO,CAAC,CAAC;IAE7C,MAAM,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;AACjC,CAAC,CAAA,CAAC;AARW,QAAA,SAAS,aAQpB","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 { 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 const plan = await promptDeployPlan(appName);\n\n await driver.go(appName, plan);\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const goDevCommand: (argv: string[]) => Promise<void>;
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.goDevCommand = void 0;
|
|
16
|
+
// `qpq go:dev` — boots the QPQ local dev server. Resolves the app, generates
|
|
17
|
+
// the dev-server entry, builds the rspack config, then runs rspack in watch
|
|
18
|
+
// mode, restarting the server process on every successful rebuild.
|
|
19
|
+
//
|
|
20
|
+
// The one thing NOT hot-reloaded is the qpq configs themselves: each service's
|
|
21
|
+
// infrastructure.ts is evaluated once at launch and baked into the
|
|
22
|
+
// `quidproquo-dynamic-loader` virtual module — config changes need a full
|
|
23
|
+
// `go:dev` restart.
|
|
24
|
+
const quidproquo_deploy_rspack_1 = require("quidproquo-deploy-rspack");
|
|
25
|
+
const child_process_1 = require("child_process");
|
|
26
|
+
const path_1 = __importDefault(require("path"));
|
|
27
|
+
const core_1 = require("@rspack/core");
|
|
28
|
+
const deployEnv_1 = require("../lib/deployEnv");
|
|
29
|
+
const devServerEntry_1 = require("../lib/devServerEntry");
|
|
30
|
+
const discovery_1 = require("../lib/discovery");
|
|
31
|
+
const resolveAppSelection_1 = require("../lib/resolveAppSelection");
|
|
32
|
+
// 8080/8888 are set in the generated entry; 3001 is the quidproquo-dev-server
|
|
33
|
+
// file-storage (secure URL) default port.
|
|
34
|
+
const DEV_SERVER_PORTS = [8080, 8888, 3001];
|
|
35
|
+
const DEV_SERVER_BUNDLE_PATH = path_1.default.join('dist', 'qpq', 'dev-server', 'main.js');
|
|
36
|
+
// Pre-start sweep: a previous `go:dev` whose wrapper died without killing its
|
|
37
|
+
// child (closed terminal, SIGKILL) leaves an orphaned server process holding
|
|
38
|
+
// the dev ports, and the next launch dies with EADDRINUSE. Before starting,
|
|
39
|
+
// kill any listener on those ports that is running the dev-server bundle.
|
|
40
|
+
// Anything else on the ports is left alone and reported — it's not ours.
|
|
41
|
+
const killStaleDevServers = () => {
|
|
42
|
+
for (const port of DEV_SERVER_PORTS) {
|
|
43
|
+
let pids = [];
|
|
44
|
+
try {
|
|
45
|
+
pids = (0, child_process_1.execSync)(`lsof -t -iTCP:${port} -sTCP:LISTEN`, {
|
|
46
|
+
stdio: ['ignore', 'pipe', 'ignore'],
|
|
47
|
+
})
|
|
48
|
+
.toString()
|
|
49
|
+
.split('\n')
|
|
50
|
+
.map((line) => Number(line.trim()))
|
|
51
|
+
.filter(Boolean);
|
|
52
|
+
}
|
|
53
|
+
catch (_a) {
|
|
54
|
+
continue; // lsof exits non-zero when nothing is listening
|
|
55
|
+
}
|
|
56
|
+
for (const pid of pids) {
|
|
57
|
+
let command = '';
|
|
58
|
+
try {
|
|
59
|
+
command = (0, child_process_1.execSync)(`ps -p ${pid} -o command=`).toString().trim();
|
|
60
|
+
}
|
|
61
|
+
catch (_b) {
|
|
62
|
+
continue; // already gone
|
|
63
|
+
}
|
|
64
|
+
if (command.includes(DEV_SERVER_BUNDLE_PATH)) {
|
|
65
|
+
console.log(`Killing stale dev server on port ${port} (pid ${pid})`);
|
|
66
|
+
process.kill(pid);
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
console.warn(`Port ${port} is in use by an unrelated process (pid ${pid}: ${command}) — not killing it.`);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
const goDevCommand = (argv) => __awaiter(void 0, void 0, void 0, function* () {
|
|
75
|
+
const root = (0, discovery_1.getRoot)();
|
|
76
|
+
const appName = yield (0, resolveAppSelection_1.resolveAppSelection)({ argv, envVar: 'QPQ_DEV_APP' });
|
|
77
|
+
process.env.QPQ_DEV_APP = appName;
|
|
78
|
+
(0, deployEnv_1.primeDeployEnvFromConfig)(appName);
|
|
79
|
+
console.log(`Dev server for app [${appName}]`);
|
|
80
|
+
killStaleDevServers();
|
|
81
|
+
const qpqConfigs = (0, quidproquo_deploy_rspack_1.getAppServiceQpqConfigs)(root, appName);
|
|
82
|
+
const entry = (0, devServerEntry_1.writeDevServerEntry)(root, appName);
|
|
83
|
+
const rspackConfig = (0, quidproquo_deploy_rspack_1.getDevServerRspackConfig)({ root, entry, qpqConfigs });
|
|
84
|
+
const bundlePath = path_1.default.join(root, DEV_SERVER_BUNDLE_PATH);
|
|
85
|
+
const env = Object.assign(Object.assign({}, process.env), { QPQ_DEV_APP: appName });
|
|
86
|
+
// The long-lived server process (HTTP 8080 / WS 8888), restarted per rebuild.
|
|
87
|
+
let child = null;
|
|
88
|
+
let restartQueued = false;
|
|
89
|
+
const startServer = () => {
|
|
90
|
+
child = (0, child_process_1.spawn)('node', [bundlePath], { stdio: 'inherit', env });
|
|
91
|
+
child.on('exit', (code) => {
|
|
92
|
+
child = null;
|
|
93
|
+
if (!restartQueued) {
|
|
94
|
+
// Crashed (or exited) on its own — leave it down; the next successful
|
|
95
|
+
// rebuild (i.e. the next file save) brings it back up.
|
|
96
|
+
console.log(`Dev server exited with code ${code}. Save a file to restart it.`);
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
};
|
|
100
|
+
const restartServer = () => {
|
|
101
|
+
if (restartQueued)
|
|
102
|
+
return;
|
|
103
|
+
if (!child) {
|
|
104
|
+
startServer();
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
restartQueued = true;
|
|
108
|
+
child.once('exit', () => {
|
|
109
|
+
restartQueued = false;
|
|
110
|
+
startServer();
|
|
111
|
+
});
|
|
112
|
+
child.kill();
|
|
113
|
+
};
|
|
114
|
+
console.log('Bundling dev server (watch mode)...');
|
|
115
|
+
let lastHash;
|
|
116
|
+
const compiler = (0, core_1.rspack)(rspackConfig);
|
|
117
|
+
compiler.watch({ aggregateTimeout: 200 }, (err, stats) => {
|
|
118
|
+
if (err) {
|
|
119
|
+
console.error(err);
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
if (stats === null || stats === void 0 ? void 0 : stats.hasErrors()) {
|
|
123
|
+
console.error(stats.toString({ colors: true, chunks: false, modules: false }));
|
|
124
|
+
console.log('Build failed — dev server not restarted. Fix the error and save again.');
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
// Skip no-op rebuilds (e.g. the virtual-module-triggered second compile at
|
|
128
|
+
// startup): only restart when the output actually changed.
|
|
129
|
+
if ((stats === null || stats === void 0 ? void 0 : stats.hash) === lastHash && child) {
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
lastHash = stats === null || stats === void 0 ? void 0 : stats.hash;
|
|
133
|
+
console.log(child ? 'Rebuilt. Restarting dev server...' : 'Dev server bundled. Starting...');
|
|
134
|
+
restartServer();
|
|
135
|
+
});
|
|
136
|
+
process.on('SIGINT', () => {
|
|
137
|
+
restartQueued = true; // suppress the crash log / rebuild-restart on our own kill
|
|
138
|
+
child === null || child === void 0 ? void 0 : child.kill();
|
|
139
|
+
compiler.close(() => process.exit(0));
|
|
140
|
+
});
|
|
141
|
+
});
|
|
142
|
+
exports.goDevCommand = goDevCommand;
|
|
143
|
+
//# sourceMappingURL=goDev.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file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AAE,KAAK,EAAE,EAAE;QACvD,IAAI,GAAG,EAAE,CAAC;YACR,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YACnB,OAAO;QACT,CAAC;QACD,IAAI,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,SAAS,EAAE,EAAE,CAAC;YACvB,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,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,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,IAAI,MAAK,QAAQ,IAAI,KAAK,EAAE,CAAC;YACtC,OAAO;QACT,CAAC;QACD,QAAQ,GAAG,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,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,aAAL,KAAK,uBAAL,KAAK,CAAE,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,CAAA,CAAC;AAzEW,QAAA,YAAY,gBAyEvB","sourcesContent":["// `qpq go:dev` — boots the QPQ local dev server. Resolves the app, generates\n// the dev-server entry, builds the rspack config, then runs rspack in watch\n// 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` restart.\nimport { getAppServiceQpqConfigs, getDevServerRspackConfig } from 'quidproquo-deploy-rspack';\n\nimport { ChildProcess, execSync, 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 { 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\n// Pre-start sweep: a previous `go:dev` whose wrapper died without killing its\n// child (closed terminal, SIGKILL) leaves an orphaned server process holding\n// the dev ports, and the next launch dies with EADDRINUSE. Before starting,\n// kill any listener on those ports that is running the dev-server bundle.\n// Anything else on the ports is left alone and reported — it's not ours.\nconst killStaleDevServers = (): void => {\n for (const port of DEV_SERVER_PORTS) {\n let pids: number[] = [];\n try {\n pids = execSync(`lsof -t -iTCP:${port} -sTCP:LISTEN`, {\n stdio: ['ignore', 'pipe', 'ignore'],\n })\n .toString()\n .split('\\n')\n .map((line) => Number(line.trim()))\n .filter(Boolean);\n } catch {\n continue; // lsof exits non-zero when nothing is listening\n }\n\n for (const pid of pids) {\n let command = '';\n try {\n command = execSync(`ps -p ${pid} -o command=`).toString().trim();\n } catch {\n continue; // already gone\n }\n if (command.includes(DEV_SERVER_BUNDLE_PATH)) {\n console.log(`Killing stale dev server on port ${port} (pid ${pid})`);\n process.kill(pid);\n } else {\n console.warn(`Port ${port} is in use by an unrelated process (pid ${pid}: ${command}) — not killing it.`);\n }\n }\n }\n};\n\nexport const goDevCommand = 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 killStaleDevServers();\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"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const goDevWebCommand: (argv: string[]) => Promise<void>;
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.goDevWebCommand = void 0;
|
|
16
|
+
// `qpq go:dev:web` — boots every views microfrontend's Rspack dev server
|
|
17
|
+
// in-process (shell is the MF host app, plus all remotes on their own ports).
|
|
18
|
+
// Everything is served dynamically; remotes resolve at runtime via
|
|
19
|
+
// mf-manifest.json on localhost ports. Programmatic — no per-views
|
|
20
|
+
// rspack.config.ts or npm serve script needed.
|
|
21
|
+
//
|
|
22
|
+
// Usage:
|
|
23
|
+
// qpq go:dev:web
|
|
24
|
+
// qpq go:dev:web --only shell,design
|
|
25
|
+
// qpq go:dev:web --app <name>
|
|
26
|
+
const quidproquo_deploy_rspack_1 = require("quidproquo-deploy-rspack");
|
|
27
|
+
const http_1 = __importDefault(require("http"));
|
|
28
|
+
const core_1 = require("@rspack/core");
|
|
29
|
+
const dev_server_1 = require("@rspack/dev-server");
|
|
30
|
+
const args_1 = require("../lib/args");
|
|
31
|
+
const deployEnv_1 = require("../lib/deployEnv");
|
|
32
|
+
const discovery_1 = require("../lib/discovery");
|
|
33
|
+
const resolveAppSelection_1 = require("../lib/resolveAppSelection");
|
|
34
|
+
const goDevWebCommand = (argv) => __awaiter(void 0, void 0, void 0, function* () {
|
|
35
|
+
var _a;
|
|
36
|
+
const root = (0, discovery_1.getRoot)();
|
|
37
|
+
const appName = yield (0, resolveAppSelection_1.resolveAppSelection)({ argv, envVar: 'QPQ_DEV_APP' });
|
|
38
|
+
process.env.LOCAL_DEV_SERVER = 'true';
|
|
39
|
+
process.env.NODE_ENV = 'development';
|
|
40
|
+
(0, deployEnv_1.primeDeployEnvFromConfig)(appName);
|
|
41
|
+
const only = (_a = (0, args_1.getArgValue)(argv, '--only')) === null || _a === void 0 ? void 0 : _a.split(',').map((s) => s.trim());
|
|
42
|
+
let views = (0, quidproquo_deploy_rspack_1.getAllViews)(root, appName);
|
|
43
|
+
if (only)
|
|
44
|
+
views = views.filter((v) => only.includes(v.service));
|
|
45
|
+
if (views.length === 0) {
|
|
46
|
+
console.error('No views projects found.');
|
|
47
|
+
process.exit(1);
|
|
48
|
+
}
|
|
49
|
+
// Every RspackDevServer.start() registers its own SIGINT/SIGTERM handler on
|
|
50
|
+
// process — with a dozen views servers in one process that trips node's
|
|
51
|
+
// default 10-listener warning. Size the limit to the fleet.
|
|
52
|
+
process.setMaxListeners(Math.max(process.getMaxListeners(), views.length * 2 + 10));
|
|
53
|
+
// Service names are padded to a common width so the "(started)" chips align.
|
|
54
|
+
const serviceColumnWidth = Math.max(...views.map((v) => v.service.length));
|
|
55
|
+
console.log(`Starting ${views.length} views dev servers for [${appName}]:`);
|
|
56
|
+
for (const v of views)
|
|
57
|
+
console.log(` http://localhost:${v.port} ${v.service.padEnd(serviceColumnWidth)}`);
|
|
58
|
+
const servers = [];
|
|
59
|
+
let shuttingDown = false;
|
|
60
|
+
const shutdown = (code) => {
|
|
61
|
+
if (shuttingDown)
|
|
62
|
+
return;
|
|
63
|
+
shuttingDown = true;
|
|
64
|
+
Promise.allSettled(servers.map((server) => server.stop())).then(() => process.exit(code));
|
|
65
|
+
};
|
|
66
|
+
// The URL list above gets a yellow "(started)" chip appended in place as
|
|
67
|
+
// each dev server begins answering HTTP. The in-place rewrite moves the
|
|
68
|
+
// cursor up past everything printed since the list, so every line printed
|
|
69
|
+
// below it MUST go through logBelowList to keep the offset accurate.
|
|
70
|
+
let linesBelowList = 0;
|
|
71
|
+
const logBelowList = (line) => {
|
|
72
|
+
console.log(line);
|
|
73
|
+
linesBelowList += 1;
|
|
74
|
+
};
|
|
75
|
+
const markStarted = (index) => {
|
|
76
|
+
const v = views[index];
|
|
77
|
+
if (!process.stdout.isTTY) {
|
|
78
|
+
logBelowList(` ${v.service} started`);
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
const line = ` http://localhost:${v.port} ${v.service.padEnd(serviceColumnWidth)} \x1b[33m(started)\x1b[0m`;
|
|
82
|
+
const up = linesBelowList + (views.length - index);
|
|
83
|
+
process.stdout.write(`\x1b[${up}F\x1b[2K${line}\x1b[${up}E`);
|
|
84
|
+
};
|
|
85
|
+
const pollUntilStarted = (index) => {
|
|
86
|
+
const attempt = () => {
|
|
87
|
+
if (shuttingDown)
|
|
88
|
+
return;
|
|
89
|
+
const req = http_1.default.get({
|
|
90
|
+
host: 'localhost',
|
|
91
|
+
port: views[index].port,
|
|
92
|
+
path: '/',
|
|
93
|
+
timeout: 1000,
|
|
94
|
+
}, (res) => {
|
|
95
|
+
res.resume();
|
|
96
|
+
markStarted(index);
|
|
97
|
+
});
|
|
98
|
+
req.on('error', () => setTimeout(attempt, 500));
|
|
99
|
+
req.on('timeout', () => req.destroy());
|
|
100
|
+
};
|
|
101
|
+
attempt();
|
|
102
|
+
};
|
|
103
|
+
for (const [index, view] of views.entries()) {
|
|
104
|
+
const config = (0, quidproquo_deploy_rspack_1.getViewsRspackConfig)(view.viewsDir);
|
|
105
|
+
const compiler = (0, core_1.rspack)(config);
|
|
106
|
+
const server = new dev_server_1.RspackDevServer(config.devServer || { port: view.port }, compiler);
|
|
107
|
+
servers.push(server);
|
|
108
|
+
try {
|
|
109
|
+
yield server.start();
|
|
110
|
+
}
|
|
111
|
+
catch (e) {
|
|
112
|
+
logBelowList(` [${view.service}] failed to start: ${e.message} — shutting down all views servers.`);
|
|
113
|
+
shutdown(1);
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
pollUntilStarted(index);
|
|
117
|
+
}
|
|
118
|
+
process.on('SIGINT', () => shutdown(0));
|
|
119
|
+
process.on('SIGTERM', () => shutdown(0));
|
|
120
|
+
});
|
|
121
|
+
exports.goDevWebCommand = goDevWebCommand;
|
|
122
|
+
//# sourceMappingURL=goDevWeb.js.map
|
|
@@ -0,0 +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,mBAAmB;AACnB,uCAAuC;AACvC,gCAAgC;AAChC,uEAA6E;AAE7E,gDAAwB;AACxB,uCAAsC;AACtC,mDAAqD;AAErD,sCAA0C;AAC1C,gDAA4D;AAC5D,gDAA2C;AAC3C,oEAAiE;AAE1D,MAAM,eAAe,GAAG,CAAO,IAAc,EAAiB,EAAE;;IACrE,MAAM,IAAI,GAAG,IAAA,mBAAO,GAAE,CAAC;IACvB,MAAM,OAAO,GAAG,MAAM,IAAA,yCAAmB,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,aAAa,EAAE,CAAC,CAAC;IAE3E,OAAO,CAAC,GAAG,CAAC,gBAAgB,GAAG,MAAM,CAAC;IACtC,OAAO,CAAC,GAAG,CAAC,QAAQ,GAAG,aAAa,CAAC;IACrC,IAAA,oCAAwB,EAAC,OAAO,CAAC,CAAC;IAElC,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,CAAC;YAChH,QAAQ,CAAC,CAAC,CAAC,CAAC;YACZ,OAAO;QACT,CAAC;QAED,gBAAgB,CAAC,KAAK,CAAC,CAAC;IAC1B,CAAC;IAED,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;IACxC,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;AAC3C,CAAC,CAAA,CAAC;AArGW,QAAA,eAAe,mBAqG1B","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 { resolveAppSelection } from '../lib/resolveAppSelection';\n\nexport const goDevWebCommand = async (argv: string[]): 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) {\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"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const goDockerCommand: (argv: string[]) => Promise<void>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.goDockerCommand = void 0;
|
|
13
|
+
// `qpq go:docker` — asks the same questions as `qpq go`, then runs the
|
|
14
|
+
// platform driver's parallel containerized deploy (drivers without a docker
|
|
15
|
+
// strategy don't offer one).
|
|
16
|
+
const deployEnv_1 = require("../lib/deployEnv");
|
|
17
|
+
const deployPrompts_1 = require("../lib/deployPrompts");
|
|
18
|
+
const resolveAppSelection_1 = require("../lib/resolveAppSelection");
|
|
19
|
+
const platforms_1 = require("../platforms");
|
|
20
|
+
const goDockerCommand = (argv) => __awaiter(void 0, void 0, void 0, function* () {
|
|
21
|
+
const appName = yield (0, resolveAppSelection_1.resolveAppSelection)({ argv, envVar: 'DEPLOY_APP_NAME' });
|
|
22
|
+
const { platform } = yield (0, deployEnv_1.resolveDeployEnvironment)(argv, appName);
|
|
23
|
+
const driver = (0, platforms_1.getPlatformDriver)(platform);
|
|
24
|
+
if (!driver.goDocker) {
|
|
25
|
+
console.error(`Platform '${platform}' has no dockerized deploy — use qpq go instead.`);
|
|
26
|
+
process.exit(1);
|
|
27
|
+
}
|
|
28
|
+
const plan = yield (0, deployPrompts_1.promptDeployPlan)(appName);
|
|
29
|
+
yield driver.goDocker(appName, plan);
|
|
30
|
+
});
|
|
31
|
+
exports.goDockerCommand = goDockerCommand;
|
|
32
|
+
//# sourceMappingURL=goDocker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"goDocker.js","sourceRoot":"","sources":["../../../src/commands/goDocker.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,uEAAuE;AACvE,4EAA4E;AAC5E,6BAA6B;AAC7B,gDAA4D;AAC5D,wDAAwD;AACxD,oEAAiE;AACjE,4CAAiD;AAE1C,MAAM,eAAe,GAAG,CAAO,IAAc,EAAiB,EAAE;IACrE,MAAM,OAAO,GAAG,MAAM,IAAA,yCAAmB,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,iBAAiB,EAAE,CAAC,CAAC;IAC/E,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,IAAA,oCAAwB,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACnE,MAAM,MAAM,GAAG,IAAA,6BAAiB,EAAC,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,MAAM,IAAI,GAAG,MAAM,IAAA,gCAAgB,EAAC,OAAO,CAAC,CAAC;IAE7C,MAAM,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;AACvC,CAAC,CAAA,CAAC;AAbW,QAAA,eAAe,mBAa1B","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 { 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 const plan = await promptDeployPlan(appName);\n\n await driver.goDocker(appName, plan);\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const hooksCommand: (argv: string[]) => Promise<void>;
|