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
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.writeDevServerEntry = void 0;
|
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const discovery_1 = require("./discovery");
|
|
10
|
+
// The dev-server bootstrap, generated per build so it can import an optional
|
|
11
|
+
// app-owned overrides file (apps/<app>/devServer.config.ts, default-exporting
|
|
12
|
+
// DevServerConfigOverrides). The `quidproquo-dynamic-loader` import is a
|
|
13
|
+
// virtual module injected by QpqPlugin at bundle time. QPQ_WEB_ROOT (set in
|
|
14
|
+
// the docker platform image) turns on static views serving.
|
|
15
|
+
const writeDevServerEntry = (root, appName) => {
|
|
16
|
+
const entryDir = path_1.default.join(root, 'dist', 'qpq', 'dev-server');
|
|
17
|
+
const entryPath = path_1.default.join(entryDir, 'entry.ts');
|
|
18
|
+
const overridesPath = path_1.default.join((0, discovery_1.getAppDirectory)(appName), 'devServer.config.ts');
|
|
19
|
+
const overridesImport = fs_1.default.existsSync(overridesPath)
|
|
20
|
+
? `import devServerConfigOverrides from ${JSON.stringify(overridesPath.replace(/\.ts$/, ''))};`
|
|
21
|
+
: 'const devServerConfigOverrides = {};';
|
|
22
|
+
fs_1.default.mkdirSync(entryDir, { recursive: true });
|
|
23
|
+
fs_1.default.writeFileSync(entryPath, `// GENERATED by qpq — do not edit.
|
|
24
|
+
import { startDevServer } from 'quidproquo-dev-server';
|
|
25
|
+
import {
|
|
26
|
+
qpqConfigs,
|
|
27
|
+
qpqDynamicModuleLoaderForService,
|
|
28
|
+
// @ts-ignore - Special build-time virtual module
|
|
29
|
+
} from 'quidproquo-dynamic-loader';
|
|
30
|
+
|
|
31
|
+
${overridesImport}
|
|
32
|
+
|
|
33
|
+
startDevServer(
|
|
34
|
+
{
|
|
35
|
+
serverDomain: 'localhost',
|
|
36
|
+
serverPort: 8080,
|
|
37
|
+
webSocketPort: 8888,
|
|
38
|
+
fileStorageConfig: {
|
|
39
|
+
secureUrlSecret: 'dev-secure-url-secret',
|
|
40
|
+
},
|
|
41
|
+
qpqConfigs,
|
|
42
|
+
dynamicModuleLoader: qpqDynamicModuleLoaderForService,
|
|
43
|
+
webRoot: process.env.QPQ_WEB_ROOT,
|
|
44
|
+
logServiceName: 'admin',
|
|
45
|
+
delay: { default: 0 },
|
|
46
|
+
},
|
|
47
|
+
devServerConfigOverrides,
|
|
48
|
+
);
|
|
49
|
+
`);
|
|
50
|
+
return entryPath;
|
|
51
|
+
};
|
|
52
|
+
exports.writeDevServerEntry = writeDevServerEntry;
|
|
53
|
+
//# sourceMappingURL=devServerEntry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"devServerEntry.js","sourceRoot":"","sources":["../../../src/lib/devServerEntry.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAoB;AACpB,gDAAwB;AAExB,2CAA8C;AAE9C,6EAA6E;AAC7E,8EAA8E;AAC9E,yEAAyE;AACzE,4EAA4E;AAC5E,4DAA4D;AACrD,MAAM,mBAAmB,GAAG,CAAC,IAAY,EAAE,OAAe,EAAU,EAAE;IAC3E,MAAM,QAAQ,GAAG,cAAI,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,CAAC,CAAC;IAC9D,MAAM,SAAS,GAAG,cAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;IAElD,MAAM,aAAa,GAAG,cAAI,CAAC,IAAI,CAAC,IAAA,2BAAe,EAAC,OAAO,CAAC,EAAE,qBAAqB,CAAC,CAAC;IACjF,MAAM,eAAe,GAAG,YAAE,CAAC,UAAU,CAAC,aAAa,CAAC;QAClD,CAAC,CAAC,wCAAwC,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,GAAG;QAC/F,CAAC,CAAC,sCAAsC,CAAC;IAE3C,YAAE,CAAC,SAAS,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC5C,YAAE,CAAC,aAAa,CACd,SAAS,EACT;;;;;;;;EAQF,eAAe;;;;;;;;;;;;;;;;;;CAkBhB,CACE,CAAC;IAEF,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AA1CW,QAAA,mBAAmB,uBA0C9B","sourcesContent":["import fs from 'fs';\nimport path from 'path';\n\nimport { getAppDirectory } from './discovery';\n\n// The dev-server bootstrap, generated per build so it can import an optional\n// app-owned overrides file (apps/<app>/devServer.config.ts, default-exporting\n// DevServerConfigOverrides). The `quidproquo-dynamic-loader` import is a\n// virtual module injected by QpqPlugin at bundle time. QPQ_WEB_ROOT (set in\n// the docker platform image) turns on static views serving.\nexport const writeDevServerEntry = (root: string, appName: string): string => {\n const entryDir = path.join(root, 'dist', 'qpq', 'dev-server');\n const entryPath = path.join(entryDir, 'entry.ts');\n\n const overridesPath = path.join(getAppDirectory(appName), 'devServer.config.ts');\n const overridesImport = fs.existsSync(overridesPath)\n ? `import devServerConfigOverrides from ${JSON.stringify(overridesPath.replace(/\\.ts$/, ''))};`\n : 'const devServerConfigOverrides = {};';\n\n fs.mkdirSync(entryDir, { recursive: true });\n fs.writeFileSync(\n entryPath,\n `// GENERATED by qpq — do not edit.\nimport { startDevServer } from 'quidproquo-dev-server';\nimport {\n qpqConfigs,\n qpqDynamicModuleLoaderForService,\n // @ts-ignore - Special build-time virtual module\n} from 'quidproquo-dynamic-loader';\n\n${overridesImport}\n\nstartDevServer(\n {\n serverDomain: 'localhost',\n serverPort: 8080,\n webSocketPort: 8888,\n fileStorageConfig: {\n secureUrlSecret: 'dev-secure-url-secret',\n },\n qpqConfigs,\n dynamicModuleLoader: qpqDynamicModuleLoaderForService,\n webRoot: process.env.QPQ_WEB_ROOT,\n logServiceName: 'admin',\n delay: { default: 0 },\n },\n devServerConfigOverrides,\n);\n`,\n );\n\n return entryPath;\n};\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const getRoot: () => string;
|
|
2
|
+
export declare const getAppsDirectory: () => string;
|
|
3
|
+
export declare const getAppDirectory: (appName: string) => string;
|
|
4
|
+
export declare const getServiceDirectory: (appName: string, service: string) => string;
|
|
5
|
+
export declare const getAvailableApps: () => string[];
|
|
6
|
+
export declare const getAllServiceNames: (appName: string) => string[];
|
|
7
|
+
export declare const serviceHasSubdir: (appName: string, service: string, subdir: string) => boolean;
|
|
8
|
+
export declare const getServiceNamesWithSubdir: (appName: string, subdir: string) => string[];
|
|
9
|
+
export declare const getServiceNames: (appName: string) => string[];
|
|
10
|
+
export declare const getServiceNamesWithViews: (appName: string) => string[];
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getServiceNamesWithViews = exports.getServiceNames = exports.getServiceNamesWithSubdir = exports.serviceHasSubdir = exports.getAllServiceNames = exports.getAvailableApps = exports.getServiceDirectory = exports.getAppDirectory = exports.getAppsDirectory = exports.getRoot = void 0;
|
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
// The consumer repo root — qpq always runs from the workspace root (npm
|
|
10
|
+
// scripts set cwd there).
|
|
11
|
+
const getRoot = () => process.cwd();
|
|
12
|
+
exports.getRoot = getRoot;
|
|
13
|
+
const getAppsDirectory = () => path_1.default.join((0, exports.getRoot)(), 'apps');
|
|
14
|
+
exports.getAppsDirectory = getAppsDirectory;
|
|
15
|
+
const getAppDirectory = (appName) => path_1.default.join((0, exports.getAppsDirectory)(), appName);
|
|
16
|
+
exports.getAppDirectory = getAppDirectory;
|
|
17
|
+
const getServiceDirectory = (appName, service) => path_1.default.join((0, exports.getAppDirectory)(appName), 'services', service);
|
|
18
|
+
exports.getServiceDirectory = getServiceDirectory;
|
|
19
|
+
// Apps are the directories under apps/ that contain a services/ directory.
|
|
20
|
+
const getAvailableApps = () => {
|
|
21
|
+
const appsPath = (0, exports.getAppsDirectory)();
|
|
22
|
+
if (!fs_1.default.existsSync(appsPath)) {
|
|
23
|
+
return [];
|
|
24
|
+
}
|
|
25
|
+
return fs_1.default.readdirSync(appsPath).filter((name) => {
|
|
26
|
+
const servicesPath = path_1.default.join((0, exports.getAppDirectory)(name), 'services');
|
|
27
|
+
return fs_1.default.statSync((0, exports.getAppDirectory)(name)).isDirectory() && fs_1.default.existsSync(servicesPath) && fs_1.default.statSync(servicesPath).isDirectory();
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
exports.getAvailableApps = getAvailableApps;
|
|
31
|
+
// Every service directory under an app's services/ folder (no subdir filter).
|
|
32
|
+
const getAllServiceNames = (appName) => {
|
|
33
|
+
const directoryPath = path_1.default.join((0, exports.getAppDirectory)(appName), 'services');
|
|
34
|
+
if (!fs_1.default.existsSync(directoryPath)) {
|
|
35
|
+
return [];
|
|
36
|
+
}
|
|
37
|
+
return fs_1.default.readdirSync(directoryPath).filter((name) => fs_1.default.statSync((0, exports.getServiceDirectory)(appName, name)).isDirectory());
|
|
38
|
+
};
|
|
39
|
+
exports.getAllServiceNames = getAllServiceNames;
|
|
40
|
+
// True when a service contains the given child directory (e.g. 'service' for a
|
|
41
|
+
// backend, 'views' for a frontend).
|
|
42
|
+
const serviceHasSubdir = (appName, service, subdir) => {
|
|
43
|
+
const subdirPath = path_1.default.join((0, exports.getServiceDirectory)(appName, service), subdir);
|
|
44
|
+
return fs_1.default.existsSync(subdirPath) && fs_1.default.statSync(subdirPath).isDirectory();
|
|
45
|
+
};
|
|
46
|
+
exports.serviceHasSubdir = serviceHasSubdir;
|
|
47
|
+
// Services that contain a given child directory.
|
|
48
|
+
const getServiceNamesWithSubdir = (appName, subdir) => (0, exports.getAllServiceNames)(appName).filter((service) => (0, exports.serviceHasSubdir)(appName, service, subdir));
|
|
49
|
+
exports.getServiceNamesWithSubdir = getServiceNamesWithSubdir;
|
|
50
|
+
// Backend services — those with a service/ subdir.
|
|
51
|
+
const getServiceNames = (appName) => (0, exports.getServiceNamesWithSubdir)(appName, 'service');
|
|
52
|
+
exports.getServiceNames = getServiceNames;
|
|
53
|
+
// Backend services that also ship a frontend (views/ subdir).
|
|
54
|
+
const getServiceNamesWithViews = (appName) => (0, exports.getServiceNames)(appName).filter((service) => (0, exports.serviceHasSubdir)(appName, service, 'views'));
|
|
55
|
+
exports.getServiceNamesWithViews = getServiceNamesWithViews;
|
|
56
|
+
//# sourceMappingURL=discovery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discovery.js","sourceRoot":"","sources":["../../../src/lib/discovery.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAoB;AACpB,gDAAwB;AAExB,wEAAwE;AACxE,0BAA0B;AACnB,MAAM,OAAO,GAAG,GAAW,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC;AAAtC,QAAA,OAAO,WAA+B;AAE5C,MAAM,gBAAgB,GAAG,GAAW,EAAE,CAAC,cAAI,CAAC,IAAI,CAAC,IAAA,eAAO,GAAE,EAAE,MAAM,CAAC,CAAC;AAA9D,QAAA,gBAAgB,oBAA8C;AACpE,MAAM,eAAe,GAAG,CAAC,OAAe,EAAU,EAAE,CAAC,cAAI,CAAC,IAAI,CAAC,IAAA,wBAAgB,GAAE,EAAE,O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AAA,wBAAwB,4BACuD","sourcesContent":["import fs from 'fs';\nimport path from 'path';\n\n// The consumer repo root — qpq always runs from the workspace root (npm\n// scripts set cwd there).\nexport const getRoot = (): string => process.cwd();\n\nexport const getAppsDirectory = (): string => path.join(getRoot(), 'apps');\nexport const getAppDirectory = (appName: string): string => path.join(getAppsDirectory(), appName);\nexport const getServiceDirectory = (appName: string, service: string): string => path.join(getAppDirectory(appName), 'services', service);\n\n// Apps are the directories under apps/ that contain a services/ directory.\nexport const getAvailableApps = (): string[] => {\n const appsPath = getAppsDirectory();\n\n if (!fs.existsSync(appsPath)) {\n return [];\n }\n\n return fs.readdirSync(appsPath).filter((name) => {\n const servicesPath = path.join(getAppDirectory(name), 'services');\n return fs.statSync(getAppDirectory(name)).isDirectory() && fs.existsSync(servicesPath) && fs.statSync(servicesPath).isDirectory();\n });\n};\n\n// Every service directory under an app's services/ folder (no subdir filter).\nexport const getAllServiceNames = (appName: string): string[] => {\n const directoryPath = path.join(getAppDirectory(appName), 'services');\n\n if (!fs.existsSync(directoryPath)) {\n return [];\n }\n\n return fs.readdirSync(directoryPath).filter((name) => fs.statSync(getServiceDirectory(appName, name)).isDirectory());\n};\n\n// True when a service contains the given child directory (e.g. 'service' for a\n// backend, 'views' for a frontend).\nexport const serviceHasSubdir = (appName: string, service: string, subdir: string): boolean => {\n const subdirPath = path.join(getServiceDirectory(appName, service), subdir);\n return fs.existsSync(subdirPath) && fs.statSync(subdirPath).isDirectory();\n};\n\n// Services that contain a given child directory.\nexport const getServiceNamesWithSubdir = (appName: string, subdir: string): string[] =>\n getAllServiceNames(appName).filter((service) => serviceHasSubdir(appName, service, subdir));\n\n// Backend services — those with a service/ subdir.\nexport const getServiceNames = (appName: string): string[] => getServiceNamesWithSubdir(appName, 'service');\n\n// Backend services that also ship a frontend (views/ subdir).\nexport const getServiceNamesWithViews = (appName: string): string[] =>\n getServiceNames(appName).filter((service) => serviceHasSubdir(appName, service, 'views'));\n"]}
|
|
@@ -0,0 +1,45 @@
|
|
|
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.runAppHookForAllApps = exports.runAppHook = void 0;
|
|
16
|
+
const fs_1 = __importDefault(require("fs"));
|
|
17
|
+
const path_1 = __importDefault(require("path"));
|
|
18
|
+
const discovery_1 = require("./discovery");
|
|
19
|
+
const runCommand_1 = require("./runCommand");
|
|
20
|
+
// App lifecycle hooks: apps/<app>/package.json scripts named `qpq:<hook>`
|
|
21
|
+
// (e.g. qpq:postinstall, qpq:prebuild). The CLI invokes them when present;
|
|
22
|
+
// apps without the hook are skipped silently.
|
|
23
|
+
const runAppHook = (appName, hook) => __awaiter(void 0, void 0, void 0, function* () {
|
|
24
|
+
var _a;
|
|
25
|
+
const packageJsonPath = path_1.default.join((0, discovery_1.getAppDirectory)(appName), 'package.json');
|
|
26
|
+
if (!fs_1.default.existsSync(packageJsonPath)) {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
const packageJson = JSON.parse(fs_1.default.readFileSync(packageJsonPath, 'utf-8'));
|
|
30
|
+
const scriptName = `qpq:${hook}`;
|
|
31
|
+
if (!((_a = packageJson.scripts) === null || _a === void 0 ? void 0 : _a[scriptName])) {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
console.log(`Running ${scriptName} for [${appName}]`);
|
|
35
|
+
yield (0, runCommand_1.runCommand)('npm', ['run', scriptName], { cwd: (0, discovery_1.getAppDirectory)(appName) });
|
|
36
|
+
return true;
|
|
37
|
+
});
|
|
38
|
+
exports.runAppHook = runAppHook;
|
|
39
|
+
const runAppHookForAllApps = (hook) => __awaiter(void 0, void 0, void 0, function* () {
|
|
40
|
+
for (const appName of (0, discovery_1.getAvailableApps)()) {
|
|
41
|
+
yield (0, exports.runAppHook)(appName, hook);
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
exports.runAppHookForAllApps = runAppHookForAllApps;
|
|
45
|
+
//# sourceMappingURL=hooks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hooks.js","sourceRoot":"","sources":["../../../src/lib/hooks.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,4CAAoB;AACpB,gDAAwB;AAExB,2CAAgE;AAChE,6CAA0C;AAE1C,0EAA0E;AAC1E,2EAA2E;AAC3E,8CAA8C;AACvC,MAAM,UAAU,GAAG,CAAO,OAAe,EAAE,IAAY,EAAoB,EAAE;;IAClF,MAAM,eAAe,GAAG,cAAI,CAAC,IAAI,CAAC,IAAA,2BAAe,EAAC,OAAO,CAAC,EAAE,cAAc,CAAC,CAAC;IAC5E,IAAI,CAAC,YAAE,CAAC,UAAU,CAAC,eAAe,CAAC,EAAE,CAAC;QACpC,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,YAAE,CAAC,YAAY,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC,CAAC;IAC1E,MAAM,UAAU,GAAG,OAAO,IAAI,EAAE,CAAC;IACjC,IAAI,CAAC,CAAA,MAAA,WAAW,CAAC,OAAO,0CAAG,UAAU,CAAC,CAAA,EAAE,CAAC;QACvC,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,WAAW,UAAU,SAAS,OAAO,GAAG,CAAC,CAAC;IACtD,MAAM,IAAA,uBAAU,EAAC,KAAK,EAAE,CAAC,KAAK,EAAE,UAAU,CAAC,EAAE,EAAE,GAAG,EAAE,IAAA,2BAAe,EAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IAChF,OAAO,IAAI,CAAC;AACd,CAAC,CAAA,CAAC;AAfW,QAAA,UAAU,cAerB;AAEK,MAAM,oBAAoB,GAAG,CAAO,IAAY,EAAiB,EAAE;IACxE,KAAK,MAAM,OAAO,IAAI,IAAA,4BAAgB,GAAE,EAAE,CAAC;QACzC,MAAM,IAAA,kBAAU,EAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IAClC,CAAC;AACH,CAAC,CAAA,CAAC;AAJW,QAAA,oBAAoB,wBAI/B","sourcesContent":["import fs from 'fs';\nimport path from 'path';\n\nimport { getAppDirectory, getAvailableApps } from './discovery';\nimport { runCommand } from './runCommand';\n\n// App lifecycle hooks: apps/<app>/package.json scripts named `qpq:<hook>`\n// (e.g. qpq:postinstall, qpq:prebuild). The CLI invokes them when present;\n// apps without the hook are skipped silently.\nexport const runAppHook = async (appName: string, hook: string): Promise<boolean> => {\n const packageJsonPath = path.join(getAppDirectory(appName), 'package.json');\n if (!fs.existsSync(packageJsonPath)) {\n return false;\n }\n\n const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));\n const scriptName = `qpq:${hook}`;\n if (!packageJson.scripts?.[scriptName]) {\n return false;\n }\n\n console.log(`Running ${scriptName} for [${appName}]`);\n await runCommand('npm', ['run', scriptName], { cwd: getAppDirectory(appName) });\n return true;\n};\n\nexport const runAppHookForAllApps = async (hook: string): Promise<void> => {\n for (const appName of getAvailableApps()) {\n await runAppHook(appName, hook);\n }\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getOwnPackageRoot: () => string;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getOwnPackageRoot = void 0;
|
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
// This package's root (works from src under ts-node and from lib/commonjs).
|
|
10
|
+
const getOwnPackageRoot = () => {
|
|
11
|
+
let dir = __dirname;
|
|
12
|
+
while (!fs_1.default.existsSync(path_1.default.join(dir, 'package.json'))) {
|
|
13
|
+
const parent = path_1.default.dirname(dir);
|
|
14
|
+
if (parent === dir)
|
|
15
|
+
throw new Error('Could not locate the quidproquo-cli package root');
|
|
16
|
+
dir = parent;
|
|
17
|
+
}
|
|
18
|
+
return dir;
|
|
19
|
+
};
|
|
20
|
+
exports.getOwnPackageRoot = getOwnPackageRoot;
|
|
21
|
+
//# sourceMappingURL=packageRoot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"packageRoot.js","sourceRoot":"","sources":["../../../src/lib/packageRoot.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAoB;AACpB,gDAAwB;AAExB,4EAA4E;AACrE,MAAM,iBAAiB,GAAG,GAAW,EAAE;IAC5C,IAAI,GAAG,GAAG,SAAS,CAAC;IACpB,OAAO,CAAC,YAAE,CAAC,UAAU,CAAC,cAAI,CAAC,IAAI,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC;QACtD,MAAM,MAAM,GAAG,cAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACjC,IAAI,MAAM,KAAK,GAAG;YAAE,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;QACxF,GAAG,GAAG,MAAM,CAAC;IACf,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC,CAAC;AARW,QAAA,iBAAiB,qBAQ5B","sourcesContent":["import fs from 'fs';\nimport path from 'path';\n\n// This package's root (works from src under ts-node and from lib/commonjs).\nexport const getOwnPackageRoot = (): string => {\n let dir = __dirname;\n while (!fs.existsSync(path.join(dir, 'package.json'))) {\n const parent = path.dirname(dir);\n if (parent === dir) throw new Error('Could not locate the quidproquo-cli package root');\n dir = parent;\n }\n return dir;\n};\n"]}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
36
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
38
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
39
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
40
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
41
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
+
exports.promptText = exports.promptYesNo = exports.promptSelect = void 0;
|
|
46
|
+
// Present a single-choice list prompt and return the selected value.
|
|
47
|
+
// @inquirer/prompts is imported lazily so commands only pay for it when
|
|
48
|
+
// actually prompting.
|
|
49
|
+
const promptSelect = (message, choices, defaultChoice) => __awaiter(void 0, void 0, void 0, function* () {
|
|
50
|
+
const { select } = yield Promise.resolve().then(() => __importStar(require('@inquirer/prompts')));
|
|
51
|
+
return select({ message, choices, default: defaultChoice });
|
|
52
|
+
});
|
|
53
|
+
exports.promptSelect = promptSelect;
|
|
54
|
+
// A yes/no list prompt, returning true for "Yes".
|
|
55
|
+
const promptYesNo = (message) => __awaiter(void 0, void 0, void 0, function* () { return (yield (0, exports.promptSelect)(message, ['No', 'Yes'])) === 'Yes'; });
|
|
56
|
+
exports.promptYesNo = promptYesNo;
|
|
57
|
+
// A free-text prompt — used where a y/n is too easy to fat-finger (destructive
|
|
58
|
+
// confirmations that require typing the target name back).
|
|
59
|
+
const promptText = (message) => __awaiter(void 0, void 0, void 0, function* () {
|
|
60
|
+
const { input } = yield Promise.resolve().then(() => __importStar(require('@inquirer/prompts')));
|
|
61
|
+
return input({ message });
|
|
62
|
+
});
|
|
63
|
+
exports.promptText = promptText;
|
|
64
|
+
//# sourceMappingURL=prompts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompts.js","sourceRoot":"","sources":["../../../src/lib/prompts.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qEAAqE;AACrE,wEAAwE;AACxE,sBAAsB;AACf,MAAM,YAAY,GAAG,CAAO,OAAe,EAAE,OAAiB,EAAE,aAAsB,EAAmB,EAAE;IAChH,MAAM,EAAE,MAAM,EAAE,GAAG,wDAAa,mBAAmB,GAAC,CAAC;IACrD,OAAO,MAAM,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,CAAC,CAAC;AAC9D,CAAC,CAAA,CAAC;AAHW,QAAA,YAAY,gBAGvB;AAEF,kDAAkD;AAC3C,MAAM,WAAW,GAAG,CAAO,OAAe,EAAoB,EAAE,kDAAC,OAAA,CAAC,MAAM,IAAA,oBAAY,EAAC,OAAO,EAAE,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,KAAK,KAAK,CAAA,GAAA,CAAC;AAAlH,QAAA,WAAW,eAAuG;AAE/H,+EAA+E;AAC/E,2DAA2D;AACpD,MAAM,UAAU,GAAG,CAAO,OAAe,EAAmB,EAAE;IACnE,MAAM,EAAE,KAAK,EAAE,GAAG,wDAAa,mBAAmB,GAAC,CAAC;IACpD,OAAO,KAAK,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC;AAC5B,CAAC,CAAA,CAAC;AAHW,QAAA,UAAU,cAGrB","sourcesContent":["// Present a single-choice list prompt and return the selected value.\n// @inquirer/prompts is imported lazily so commands only pay for it when\n// actually prompting.\nexport const promptSelect = async (message: string, choices: string[], defaultChoice?: string): Promise<string> => {\n const { select } = await import('@inquirer/prompts');\n return select({ message, choices, default: defaultChoice });\n};\n\n// A yes/no list prompt, returning true for \"Yes\".\nexport const promptYesNo = async (message: string): Promise<boolean> => (await promptSelect(message, ['No', 'Yes'])) === 'Yes';\n\n// A free-text prompt — used where a y/n is too easy to fat-finger (destructive\n// confirmations that require typing the target name back).\nexport const promptText = async (message: string): Promise<string> => {\n const { input } = await import('@inquirer/prompts');\n return input({ message });\n};\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getAppPrefix = exports.loadServiceQpqConfig = void 0;
|
|
4
|
+
const quidproquo_core_1 = require("quidproquo-core");
|
|
5
|
+
const quidproquo_deploy_awscdk_1 = require("quidproquo-deploy-awscdk");
|
|
6
|
+
const discovery_1 = require("./discovery");
|
|
7
|
+
// Loads a service's live infrastructure.ts (qpq runs with ts-node hooks
|
|
8
|
+
// registered, so requiring TS works and `@scope/*` imports resolve through
|
|
9
|
+
// workspace symlinks).
|
|
10
|
+
const loadServiceQpqConfig = (appName, service) => (0, quidproquo_deploy_awscdk_1.getWorkspaceServiceQpqConfig)((0, discovery_1.getRoot)(), appName, service);
|
|
11
|
+
exports.loadServiceQpqConfig = loadServiceQpqConfig;
|
|
12
|
+
const getAppPrefix = (appName) => {
|
|
13
|
+
const services = (0, discovery_1.getServiceNames)(appName);
|
|
14
|
+
if (services.length === 0)
|
|
15
|
+
throw new Error(`No services found for app ${appName}`);
|
|
16
|
+
return quidproquo_core_1.qpqCoreUtils.getApplicationName((0, exports.loadServiceQpqConfig)(appName, services[0]));
|
|
17
|
+
};
|
|
18
|
+
exports.getAppPrefix = getAppPrefix;
|
|
19
|
+
//# sourceMappingURL=qpqConfigs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"qpqConfigs.js","sourceRoot":"","sources":["../../../src/lib/qpqConfigs.ts"],"names":[],"mappings":";;;AAAA,qDAA+D;AAC/D,uEAAwE;AAExE,2CAAuD;AAEvD,wEAAwE;AACxE,2EAA2E;AAC3E,uBAAuB;AAChB,MAAM,oBAAoB,GAAG,CAAC,OAAe,EAAE,OAAe,EAAa,EAAE,CAAC,IAAA,uDAA4B,EAAC,IAAA,mBAAO,GAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;AAAlI,QAAA,oBAAoB,wBAA8G;AAExI,MAAM,YAAY,GAAG,CAAC,OAAe,EAAU,EAAE;IACtD,MAAM,QAAQ,GAAG,IAAA,2BAAe,EAAC,OAAO,CAAC,CAAC;IAC1C,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,6BAA6B,OAAO,EAAE,CAAC,CAAC;IACnF,OAAO,8BAAY,CAAC,kBAAkB,CAAC,IAAA,4BAAoB,EAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACrF,CAAC,CAAC;AAJW,QAAA,YAAY,gBAIvB","sourcesContent":["import { type QPQConfig, qpqCoreUtils } from 'quidproquo-core';\nimport { getWorkspaceServiceQpqConfig } from 'quidproquo-deploy-awscdk';\n\nimport { getRoot, getServiceNames } from './discovery';\n\n// Loads a service's live infrastructure.ts (qpq runs with ts-node hooks\n// registered, so requiring TS works and `@scope/*` imports resolve through\n// workspace symlinks).\nexport const loadServiceQpqConfig = (appName: string, service: string): QPQConfig => getWorkspaceServiceQpqConfig(getRoot(), appName, service);\n\nexport const getAppPrefix = (appName: string): string => {\n const services = getServiceNames(appName);\n if (services.length === 0) throw new Error(`No services found for app ${appName}`);\n return qpqCoreUtils.getApplicationName(loadServiceQpqConfig(appName, services[0]));\n};\n"]}
|
|
@@ -0,0 +1,58 @@
|
|
|
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.resolveAppSelection = void 0;
|
|
13
|
+
// One app-selection contract for every app-facing command (prep / synth / go /
|
|
14
|
+
// go:dev / go:dev:web / publish). Resolution order:
|
|
15
|
+
// 1. --app <name> / --app=<name> on argv
|
|
16
|
+
// 2. npm_config_app (npm run x --app foo, no --)
|
|
17
|
+
// 3. an env var the command already honours (QPQ_DEV_APP / DEPLOY_APP_NAME)
|
|
18
|
+
// 4. exactly one app under apps/ -> auto-select
|
|
19
|
+
// 5. interactive prompt (TTY only)
|
|
20
|
+
// 6. otherwise: print the valid app list and exit non-zero
|
|
21
|
+
// An unknown name (from any source) also prints the list and exits non-zero.
|
|
22
|
+
// Commands that can meaningfully run for every app may pass allowAll to accept
|
|
23
|
+
// `--app all` (returned as the literal 'all').
|
|
24
|
+
const args_1 = require("./args");
|
|
25
|
+
const discovery_1 = require("./discovery");
|
|
26
|
+
const prompts_1 = require("./prompts");
|
|
27
|
+
const exitWithAppList = (requested, availableApps) => {
|
|
28
|
+
if (requested)
|
|
29
|
+
console.error(`Unknown app '${requested}'.`);
|
|
30
|
+
console.error(`Valid apps: ${availableApps.join(', ')}`);
|
|
31
|
+
console.error(`Pass one with --app <name> (e.g. qpq <command> --app ${availableApps[0]}).`);
|
|
32
|
+
process.exit(1);
|
|
33
|
+
};
|
|
34
|
+
const resolveAppSelection = (options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
35
|
+
const availableApps = (0, discovery_1.getAvailableApps)();
|
|
36
|
+
if (availableApps.length === 0) {
|
|
37
|
+
console.error('No apps found under apps/.');
|
|
38
|
+
process.exit(1);
|
|
39
|
+
}
|
|
40
|
+
const requested = (0, args_1.getArgValue)(options.argv, '--app') || process.env.npm_config_app || (options.envVar ? process.env[options.envVar] : undefined);
|
|
41
|
+
if (requested) {
|
|
42
|
+
if (options.allowAll && requested === 'all')
|
|
43
|
+
return 'all';
|
|
44
|
+
if (!availableApps.includes(requested))
|
|
45
|
+
exitWithAppList(requested, availableApps);
|
|
46
|
+
return requested;
|
|
47
|
+
}
|
|
48
|
+
if (availableApps.length === 1) {
|
|
49
|
+
console.log(`Using app: ${availableApps[0]}`);
|
|
50
|
+
return availableApps[0];
|
|
51
|
+
}
|
|
52
|
+
if (process.stdin.isTTY) {
|
|
53
|
+
return (0, prompts_1.promptSelect)('Select app', options.allowAll ? [...availableApps, 'all'] : availableApps);
|
|
54
|
+
}
|
|
55
|
+
return exitWithAppList(undefined, availableApps);
|
|
56
|
+
});
|
|
57
|
+
exports.resolveAppSelection = resolveAppSelection;
|
|
58
|
+
//# sourceMappingURL=resolveAppSelection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveAppSelection.js","sourceRoot":"","sources":["../../../src/lib/resolveAppSelection.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+EAA+E;AAC/E,oDAAoD;AACpD,2CAA2C;AAC3C,+EAA+E;AAC/E,kFAAkF;AAClF,kDAAkD;AAClD,qCAAqC;AACrC,6DAA6D;AAC7D,6EAA6E;AAC7E,+EAA+E;AAC/E,+CAA+C;AAC/C,iCAAqC;AACrC,2CAA+C;AAC/C,uCAAyC;AAUzC,MAAM,eAAe,GAAG,CAAC,SAA6B,EAAE,aAAuB,EAAS,EAAE;IACxF,IAAI,SAAS;QAAE,OAAO,CAAC,KAAK,CAAC,gBAAgB,SAAS,IAAI,CAAC,CAAC;IAC5D,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E,CAAC;QACxB,OAAO,IAAA,sBAAY,EAAC,YAAY,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,aAAa,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC;IAClG,CAAC;IAED,OAAO,eAAe,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC;AACnD,CAAC,CAAA,CAAC;AA1BW,QAAA,mBAAmB,uBA0B9B","sourcesContent":["// One app-selection contract for every app-facing command (prep / synth / go /\n// go:dev / go:dev:web / publish). Resolution order:\n// 1. --app <name> / --app=<name> on argv\n// 2. npm_config_app (npm run x --app foo, no --)\n// 3. an env var the command already honours (QPQ_DEV_APP / DEPLOY_APP_NAME)\n// 4. exactly one app under apps/ -> auto-select\n// 5. interactive prompt (TTY only)\n// 6. otherwise: print the valid app list and exit non-zero\n// An unknown name (from any source) also prints the list and exits non-zero.\n// Commands that can meaningfully run for every app may pass allowAll to accept\n// `--app all` (returned as the literal 'all').\nimport { getArgValue } from './args';\nimport { getAvailableApps } from './discovery';\nimport { promptSelect } from './prompts';\n\nexport type ResolveAppOptions = {\n argv: string[];\n // Env var this command historically honours (e.g. QPQ_DEV_APP, DEPLOY_APP_NAME).\n envVar?: string;\n // Accept `--app all` and return 'all'.\n allowAll?: boolean;\n};\n\nconst exitWithAppList = (requested: string | undefined, availableApps: string[]): never => {\n if (requested) console.error(`Unknown app '${requested}'.`);\n console.error(`Valid apps: ${availableApps.join(', ')}`);\n console.error(`Pass one with --app <name> (e.g. qpq <command> --app ${availableApps[0]}).`);\n process.exit(1);\n};\n\nexport const resolveAppSelection = async (options: ResolveAppOptions): Promise<string> => {\n const availableApps = getAvailableApps();\n if (availableApps.length === 0) {\n console.error('No apps found under apps/.');\n process.exit(1);\n }\n\n const requested =\n getArgValue(options.argv, '--app') || process.env.npm_config_app || (options.envVar ? process.env[options.envVar] : undefined);\n\n if (requested) {\n if (options.allowAll && requested === 'all') return 'all';\n if (!availableApps.includes(requested)) exitWithAppList(requested, availableApps);\n return requested;\n }\n\n if (availableApps.length === 1) {\n console.log(`Using app: ${availableApps[0]}`);\n return availableApps[0];\n }\n\n if (process.stdin.isTTY) {\n return promptSelect('Select app', options.allowAll ? [...availableApps, 'all'] : availableApps);\n }\n\n return exitWithAppList(undefined, availableApps);\n};\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.runRspack = void 0;
|
|
4
|
+
const core_1 = require("@rspack/core");
|
|
5
|
+
// One-shot rspack build as a promise. Rejects on compiler error or stats
|
|
6
|
+
// errors so a failed bundle stops the run.
|
|
7
|
+
const runRspack = (config) => new Promise((resolve, reject) => {
|
|
8
|
+
(0, core_1.rspack)(config, (err, stats) => {
|
|
9
|
+
if (err)
|
|
10
|
+
return reject(err);
|
|
11
|
+
if (stats === null || stats === void 0 ? void 0 : stats.hasErrors())
|
|
12
|
+
return reject(new Error(stats.toString({ errors: true, colors: false })));
|
|
13
|
+
console.log(stats === null || stats === void 0 ? void 0 : stats.toString({
|
|
14
|
+
colors: false,
|
|
15
|
+
chunks: false,
|
|
16
|
+
modules: false,
|
|
17
|
+
assets: true,
|
|
18
|
+
}));
|
|
19
|
+
return resolve();
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
exports.runRspack = runRspack;
|
|
23
|
+
//# sourceMappingURL=rspackRun.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rspackRun.js","sourceRoot":"","sources":["../../../src/lib/rspackRun.ts"],"names":[],"mappings":";;;AAAA,uCAAqD;AAErD,yEAAyE;AACzE,2CAA2C;AACpC,MAAM,SAAS,GAAG,CAAC,MAAqB,EAAiB,EAAE,CAChE,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;IAC9B,IAAA,aAAM,EAAC,MAAM,EAAE,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE;QAC5B,IAAI,GAAG;YAAE,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;QAC5B,IAAI,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,SAAS,EAAE;YAAE,OAAO,MAAM,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC;QAClG,OAAO,CAAC,GAAG,CACT,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,QAAQ,CAAC;YACd,MAAM,EAAE,KAAK;YACb,MAAM,EAAE,KAAK;YACb,OAAO,EAAE,KAAK;YACd,MAAM,EAAE,IAAI;SACb,CAAC,CACH,CAAC;QACF,OAAO,OAAO,EAAE,CAAC;IACnB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAfQ,QAAA,SAAS,aAejB","sourcesContent":["import { Configuration, rspack } from '@rspack/core';\n\n// One-shot rspack build as a promise. Rejects on compiler error or stats\n// errors so a failed bundle stops the run.\nexport const runRspack = (config: Configuration): Promise<void> =>\n new Promise((resolve, reject) => {\n rspack(config, (err, stats) => {\n if (err) return reject(err);\n if (stats?.hasErrors()) return reject(new Error(stats.toString({ errors: true, colors: false })));\n console.log(\n stats?.toString({\n colors: false,\n chunks: false,\n modules: false,\n assets: true,\n }),\n );\n return resolve();\n });\n });\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type RunCommandOptions = {
|
|
2
|
+
env?: Record<string, string>;
|
|
3
|
+
cwd?: string;
|
|
4
|
+
logCommand?: boolean;
|
|
5
|
+
};
|
|
6
|
+
export declare const runCommand: (command: string, args: string[], options?: RunCommandOptions) => Promise<void>;
|
|
7
|
+
export type RunCommandPrefixedOptions = {
|
|
8
|
+
env?: Record<string, string>;
|
|
9
|
+
cwd?: string;
|
|
10
|
+
color?: number;
|
|
11
|
+
};
|
|
12
|
+
export declare const nextPrefixColor: () => number;
|
|
13
|
+
export declare const runCommandPrefixed: (label: string, command: string, args: string[], options?: RunCommandPrefixedOptions) => Promise<void>;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.runCommandPrefixed = exports.nextPrefixColor = exports.runCommand = void 0;
|
|
4
|
+
const child_process_1 = require("child_process");
|
|
5
|
+
// Spawn a command, inheriting stdio, resolving on success. A non-zero exit
|
|
6
|
+
// REJECTS so a failed build/deploy stops the run.
|
|
7
|
+
const runCommand = (command, args, options = {}) => new Promise((resolve, reject) => {
|
|
8
|
+
var _a, _b;
|
|
9
|
+
const validArgs = args.filter((a) => !!a);
|
|
10
|
+
if (options.logCommand) {
|
|
11
|
+
console.log(`Running command: ${command} ${validArgs.join(' ')}`);
|
|
12
|
+
}
|
|
13
|
+
const child = (0, child_process_1.spawn)(command, validArgs, {
|
|
14
|
+
stdio: 'inherit',
|
|
15
|
+
shell: true,
|
|
16
|
+
cwd: (_a = options.cwd) !== null && _a !== void 0 ? _a : process.cwd(),
|
|
17
|
+
env: Object.assign(Object.assign({}, process.env), ((_b = options.env) !== null && _b !== void 0 ? _b : {})),
|
|
18
|
+
});
|
|
19
|
+
child.on('error', (error) => reject(error));
|
|
20
|
+
child.on('exit', (code, signal) => {
|
|
21
|
+
if (signal)
|
|
22
|
+
return reject(new Error(`${command} was killed with signal ${signal}`));
|
|
23
|
+
if (code)
|
|
24
|
+
return reject(new Error(`${command} ${validArgs.join(' ')} exited with code ${code}`));
|
|
25
|
+
return resolve();
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
exports.runCommand = runCommand;
|
|
29
|
+
const PREFIX_COLORS = [36, 32, 33, 35, 34, 96, 92, 93, 95, 94];
|
|
30
|
+
let colorIndex = 0;
|
|
31
|
+
// Hand each concurrent task a distinct prefix color so interleaved output is
|
|
32
|
+
// scannable.
|
|
33
|
+
const nextPrefixColor = () => {
|
|
34
|
+
const color = PREFIX_COLORS[colorIndex % PREFIX_COLORS.length];
|
|
35
|
+
colorIndex += 1;
|
|
36
|
+
return color;
|
|
37
|
+
};
|
|
38
|
+
exports.nextPrefixColor = nextPrefixColor;
|
|
39
|
+
// Like runCommand, but pipes output and prefixes every line with a colored
|
|
40
|
+
// [label] — for running many commands concurrently without unreadable
|
|
41
|
+
// interleaving. Rejects on non-zero exit.
|
|
42
|
+
const runCommandPrefixed = (label, command, args, options = {}) => new Promise((resolve, reject) => {
|
|
43
|
+
var _a, _b, _c;
|
|
44
|
+
const validArgs = args.filter((a) => !!a);
|
|
45
|
+
const prefix = `\x1b[${(_a = options.color) !== null && _a !== void 0 ? _a : 36}m[${label}]\x1b[0m `;
|
|
46
|
+
const child = (0, child_process_1.spawn)(command, validArgs, {
|
|
47
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
48
|
+
shell: true,
|
|
49
|
+
cwd: (_b = options.cwd) !== null && _b !== void 0 ? _b : process.cwd(),
|
|
50
|
+
env: Object.assign(Object.assign({}, process.env), ((_c = options.env) !== null && _c !== void 0 ? _c : {})),
|
|
51
|
+
});
|
|
52
|
+
const attach = (stream, out) => {
|
|
53
|
+
let buffered = '';
|
|
54
|
+
stream.on('data', (chunk) => {
|
|
55
|
+
var _a;
|
|
56
|
+
buffered += chunk.toString();
|
|
57
|
+
const lines = buffered.split('\n');
|
|
58
|
+
buffered = (_a = lines.pop()) !== null && _a !== void 0 ? _a : '';
|
|
59
|
+
lines.forEach((line) => out.write(`${prefix}${line}\n`));
|
|
60
|
+
});
|
|
61
|
+
stream.on('end', () => {
|
|
62
|
+
if (buffered)
|
|
63
|
+
out.write(`${prefix}${buffered}\n`);
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
attach(child.stdout, process.stdout);
|
|
67
|
+
attach(child.stderr, process.stderr);
|
|
68
|
+
child.on('error', (error) => reject(error));
|
|
69
|
+
child.on('exit', (code, signal) => {
|
|
70
|
+
if (signal)
|
|
71
|
+
return reject(new Error(`[${label}] ${command} was killed with signal ${signal}`));
|
|
72
|
+
if (code)
|
|
73
|
+
return reject(new Error(`[${label}] ${command} exited with code ${code}`));
|
|
74
|
+
return resolve();
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
exports.runCommandPrefixed = runCommandPrefixed;
|
|
78
|
+
//# sourceMappingURL=runCommand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runCommand.js","sourceRoot":"","sources":["../../../src/lib/runCommand.ts"],"names":[],"mappings":";;;AAAA,iDAAsC;AAYtC,2EAA2E;AAC3E,kDAAkD;AAC3C,MAAM,UAAU,GAAG,CAAC,OAAe,EAAE,IAAc,EAAE,UAA6B,EAAE,EAAiB,EAAE,CAC5G,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;;IAC9B,MAAM,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAE1C,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;QACvB,OAAO,CAAC,GAAG,CAAC,oBAAoB,OAAO,IAAI,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IACpE,CAAC;IAED,MAAM,KAAK,GAAG,IAAA,qBAAK,EAAC,OAAO,EAAE,SAAS,EAAE;QACtC,KAAK,EAAE,SAAS;QAChB,KAAK,EAAE,IAAI;QACX,GAAG,EAAE,MAAA,OAAO,CAAC,GAAG,mCAAI,OAAO,CAAC,GAAG,EAAE;QACjC,GAAG,kCAAO,OAAO,CAAC,GAAG,GAAK,CAAC,MAAA,OAAO,CAAC,GAAG,mCAAI,EAAE,CAAC,CAAE;KAChD,CAAC,CAAC;IAEH,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IAE5C,KAAK,CAAC,EAAE,CAAC,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AAC,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IAE5C,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE;QAChC,IAAI,MAAM;YAAE,OAAO,MAAM,CAAC,IAAI,KAAK,CAAC,IAAI,KAAK,KAAK,OAAO,2BAA2B,MAAM,EAAE,CAAC,CAAC,CAAC;QAC/F,IAAI,IAAI;YAAE,OAAO,MAAM,CAAC,IAAI,KAAK,CAAC,IAAI,KAAK,KAAK,OAAO,qBAAqB,IAAI,EAAE,CAAC,CAAC,CAAC;QACrF,OAAO,OAAO,EAAE,CAAC;IACnB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAnCQ,QAAA,kBAAkB,sBAmC1B","sourcesContent":["import { spawn } from 'child_process';\nimport type { Readable } from 'stream';\n\nexport type RunCommandOptions = {\n // Extra environment variables merged over the parent process env.\n env?: Record<string, string>;\n // Working directory for the child (defaults to cwd).\n cwd?: string;\n // Echo the command before running it.\n logCommand?: boolean;\n};\n\n// Spawn a command, inheriting stdio, resolving on success. A non-zero exit\n// REJECTS so a failed build/deploy stops the run.\nexport const runCommand = (command: string, args: string[], options: RunCommandOptions = {}): Promise<void> =>\n new Promise((resolve, reject) => {\n const validArgs = args.filter((a) => !!a);\n\n if (options.logCommand) {\n console.log(`Running command: ${command} ${validArgs.join(' ')}`);\n }\n\n const child = spawn(command, validArgs, {\n stdio: 'inherit',\n shell: true,\n cwd: options.cwd ?? process.cwd(),\n env: { ...process.env, ...(options.env ?? {}) },\n });\n\n child.on('error', (error) => reject(error));\n\n child.on('exit', (code, signal) => {\n if (signal) return reject(new Error(`${command} was killed with signal ${signal}`));\n if (code) return reject(new Error(`${command} ${validArgs.join(' ')} exited with code ${code}`));\n return resolve();\n });\n });\n\nexport type RunCommandPrefixedOptions = {\n env?: Record<string, string>;\n cwd?: string;\n // ANSI color code for the prefix (see nextPrefixColor).\n color?: number;\n};\n\nconst PREFIX_COLORS = [36, 32, 33, 35, 34, 96, 92, 93, 95, 94];\nlet colorIndex = 0;\n\n// Hand each concurrent task a distinct prefix color so interleaved output is\n// scannable.\nexport const nextPrefixColor = (): number => {\n const color = PREFIX_COLORS[colorIndex % PREFIX_COLORS.length];\n colorIndex += 1;\n return color;\n};\n\n// Like runCommand, but pipes output and prefixes every line with a colored\n// [label] — for running many commands concurrently without unreadable\n// interleaving. Rejects on non-zero exit.\nexport const runCommandPrefixed = (label: string, command: string, args: string[], options: RunCommandPrefixedOptions = {}): Promise<void> =>\n new Promise((resolve, reject) => {\n const validArgs = args.filter((a) => !!a);\n const prefix = `\\x1b[${options.color ?? 36}m[${label}]\\x1b[0m `;\n\n const child = spawn(command, validArgs, {\n stdio: ['ignore', 'pipe', 'pipe'],\n shell: true,\n cwd: options.cwd ?? process.cwd(),\n env: { ...process.env, ...(options.env ?? {}) },\n });\n\n const attach = (stream: Readable, out: NodeJS.WriteStream): void => {\n let buffered = '';\n stream.on('data', (chunk: Buffer) => {\n buffered += chunk.toString();\n const lines = buffered.split('\\n');\n buffered = lines.pop() ?? '';\n lines.forEach((line) => out.write(`${prefix}${line}\\n`));\n });\n stream.on('end', () => {\n if (buffered) out.write(`${prefix}${buffered}\\n`);\n });\n };\n\n attach(child.stdout as Readable, process.stdout);\n attach(child.stderr as Readable, process.stderr);\n\n child.on('error', (error) => reject(error));\n\n child.on('exit', (code, signal) => {\n if (signal) return reject(new Error(`[${label}] ${command} was killed with signal ${signal}`));\n if (code) return reject(new Error(`[${label}] ${command} exited with code ${code}`));\n return resolve();\n });\n });\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type Task = {
|
|
2
|
+
label: string;
|
|
3
|
+
run: () => Promise<void>;
|
|
4
|
+
};
|
|
5
|
+
export type TaskFailure = {
|
|
6
|
+
label: string;
|
|
7
|
+
error: Error;
|
|
8
|
+
};
|
|
9
|
+
export declare const runTasks: (tasks: Task[], limit: number) => Promise<TaskFailure[]>;
|
|
10
|
+
export declare const assertNoFailures: (phaseName: string, failures: TaskFailure[]) => void;
|
|
@@ -0,0 +1,42 @@
|
|
|
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.assertNoFailures = exports.runTasks = void 0;
|
|
13
|
+
// Run tasks with at most `limit` in flight; never rejects — failures come back
|
|
14
|
+
// labelled so a whole wave can finish before we report what broke.
|
|
15
|
+
const runTasks = (tasks, limit) => __awaiter(void 0, void 0, void 0, function* () {
|
|
16
|
+
const failures = [];
|
|
17
|
+
let nextIndex = 0;
|
|
18
|
+
const workerCount = Math.max(1, Math.min(limit, tasks.length));
|
|
19
|
+
yield Promise.all(Array.from({ length: workerCount }, () => __awaiter(void 0, void 0, void 0, function* () {
|
|
20
|
+
while (nextIndex < tasks.length) {
|
|
21
|
+
const task = tasks[nextIndex];
|
|
22
|
+
nextIndex += 1;
|
|
23
|
+
try {
|
|
24
|
+
yield task.run();
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
failures.push({ label: task.label, error: error });
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
})));
|
|
31
|
+
return failures;
|
|
32
|
+
});
|
|
33
|
+
exports.runTasks = runTasks;
|
|
34
|
+
const assertNoFailures = (phaseName, failures) => {
|
|
35
|
+
if (failures.length === 0)
|
|
36
|
+
return;
|
|
37
|
+
console.error(`\n${phaseName} failed for:`);
|
|
38
|
+
failures.forEach((failure) => console.error(` ${failure.label}: ${failure.error.message}`));
|
|
39
|
+
throw new Error(`${phaseName}: ${failures.length} task(s) failed`);
|
|
40
|
+
};
|
|
41
|
+
exports.assertNoFailures = assertNoFailures;
|
|
42
|
+
//# sourceMappingURL=runTasks.js.map
|