@qpqjs/cli 0.0.0-stage → 0.2.1
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 +92 -2
- package/docker/cdk-deployer/Dockerfile +13 -0
- package/docker/dev-server/Dockerfile +47 -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/commandMenu.d.ts +2 -0
- package/lib/commonjs/cli/commandMenu.js +81 -0
- package/lib/commonjs/cli/commandMenu.js.map +1 -0
- package/lib/commonjs/cli/commandRegistry.d.ts +10 -0
- package/lib/commonjs/cli/commandRegistry.js +177 -0
- package/lib/commonjs/cli/commandRegistry.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 +86 -0
- package/lib/commonjs/cli/runCli.js.map +1 -0
- package/lib/commonjs/commands/checkCircular.d.ts +1 -0
- package/lib/commonjs/commands/checkCircular.js +70 -0
- package/lib/commonjs/commands/checkCircular.js.map +1 -0
- package/lib/commonjs/commands/clearResources.d.ts +1 -0
- package/lib/commonjs/commands/clearResources.js +36 -0
- package/lib/commonjs/commands/clearResources.js.map +1 -0
- package/lib/commonjs/commands/go.d.ts +1 -0
- package/lib/commonjs/commands/go.js +30 -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 +46 -0
- package/lib/commonjs/commands/goDev.js.map +1 -0
- package/lib/commonjs/commands/goDevApi.d.ts +1 -0
- package/lib/commonjs/commands/goDevApi.js +158 -0
- package/lib/commonjs/commands/goDevApi.js.map +1 -0
- package/lib/commonjs/commands/goDevWeb.d.ts +4 -0
- package/lib/commonjs/commands/goDevWeb.js +144 -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 +43 -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 +39 -0
- package/lib/commonjs/commands/hooks.js.map +1 -0
- package/lib/commonjs/commands/migrate.d.ts +1 -0
- package/lib/commonjs/commands/migrate.js +70 -0
- package/lib/commonjs/commands/migrate.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/scriptBuild.d.ts +1 -0
- package/lib/commonjs/commands/scriptBuild.js +46 -0
- package/lib/commonjs/commands/scriptBuild.js.map +1 -0
- package/lib/commonjs/commands/scriptBuilderLayer.d.ts +1 -0
- package/lib/commonjs/commands/scriptBuilderLayer.js +48 -0
- package/lib/commonjs/commands/scriptBuilderLayer.js.map +1 -0
- package/lib/commonjs/commands/scriptNew.d.ts +1 -0
- package/lib/commonjs/commands/scriptNew.js +35 -0
- package/lib/commonjs/commands/scriptNew.js.map +1 -0
- package/lib/commonjs/commands/setup.d.ts +1 -0
- package/lib/commonjs/commands/setup.js +102 -0
- package/lib/commonjs/commands/setup.js.map +1 -0
- package/lib/commonjs/commands/synth.d.ts +1 -0
- package/lib/commonjs/commands/synth.js +89 -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 +3 -0
- package/lib/commonjs/lib/args.js +31 -0
- package/lib/commonjs/lib/args.js.map +1 -0
- package/lib/commonjs/lib/circularImports.d.ts +3 -0
- package/lib/commonjs/lib/circularImports.js +79 -0
- package/lib/commonjs/lib/circularImports.js.map +1 -0
- package/lib/commonjs/lib/clearResourcesPlan.d.ts +15 -0
- package/lib/commonjs/lib/clearResourcesPlan.js +79 -0
- package/lib/commonjs/lib/clearResourcesPlan.js.map +1 -0
- package/lib/commonjs/lib/deployPrompts.d.ts +26 -0
- package/lib/commonjs/lib/deployPrompts.js +118 -0
- package/lib/commonjs/lib/deployPrompts.js.map +1 -0
- package/lib/commonjs/lib/devServerEntry.d.ts +22 -0
- package/lib/commonjs/lib/devServerEntry.js +135 -0
- package/lib/commonjs/lib/devServerEntry.js.map +1 -0
- package/lib/commonjs/lib/devServerPorts.d.ts +13 -0
- package/lib/commonjs/lib/devServerPorts.js +36 -0
- package/lib/commonjs/lib/devServerPorts.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/getDefaultHookJobs.d.ts +2 -0
- package/lib/commonjs/lib/getDefaultHookJobs.js +11 -0
- package/lib/commonjs/lib/getDefaultHookJobs.js.map +1 -0
- package/lib/commonjs/lib/getDeployTargetLabel.d.ts +2 -0
- package/lib/commonjs/lib/getDeployTargetLabel.js +12 -0
- package/lib/commonjs/lib/getDeployTargetLabel.js.map +1 -0
- package/lib/commonjs/lib/goDockerMode.d.ts +6 -0
- package/lib/commonjs/lib/goDockerMode.js +23 -0
- package/lib/commonjs/lib/goDockerMode.js.map +1 -0
- package/lib/commonjs/lib/hooks.d.ts +9 -0
- package/lib/commonjs/lib/hooks.js +178 -0
- package/lib/commonjs/lib/hooks.js.map +1 -0
- package/lib/commonjs/lib/keepOtherDevServersFlag.d.ts +1 -0
- package/lib/commonjs/lib/keepOtherDevServersFlag.js +11 -0
- package/lib/commonjs/lib/keepOtherDevServersFlag.js.map +1 -0
- package/lib/commonjs/lib/killChildWithEscalation.d.ts +10 -0
- package/lib/commonjs/lib/killChildWithEscalation.js +33 -0
- package/lib/commonjs/lib/killChildWithEscalation.js.map +1 -0
- package/lib/commonjs/lib/killStaleListeners.d.ts +17 -0
- package/lib/commonjs/lib/killStaleListeners.js +220 -0
- package/lib/commonjs/lib/killStaleListeners.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 +15 -0
- package/lib/commonjs/lib/prompts.js +78 -0
- package/lib/commonjs/lib/prompts.js.map +1 -0
- package/lib/commonjs/lib/qpqConfigs.d.ts +4 -0
- package/lib/commonjs/lib/qpqConfigs.js +27 -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/resolveDeployment.d.ts +14 -0
- package/lib/commonjs/lib/resolveDeployment.js +58 -0
- package/lib/commonjs/lib/resolveDeployment.js.map +1 -0
- package/lib/commonjs/lib/runCommand.d.ts +14 -0
- package/lib/commonjs/lib/runCommand.js +103 -0
- package/lib/commonjs/lib/runCommand.js.map +1 -0
- package/lib/commonjs/lib/runTasks.d.ts +15 -0
- package/lib/commonjs/lib/runTasks.js +123 -0
- package/lib/commonjs/lib/runTasks.js.map +1 -0
- package/lib/commonjs/lib/setupStep.d.ts +16 -0
- package/lib/commonjs/lib/setupStep.js +3 -0
- package/lib/commonjs/lib/setupStep.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/typeWatcher.d.ts +2 -0
- package/lib/commonjs/lib/typeWatcher.js +59 -0
- package/lib/commonjs/lib/typeWatcher.js.map +1 -0
- package/lib/commonjs/lib/userScriptBuilderLayer.d.ts +23 -0
- package/lib/commonjs/lib/userScriptBuilderLayer.js +74 -0
- package/lib/commonjs/lib/userScriptBuilderLayer.js.map +1 -0
- package/lib/commonjs/lib/userScriptTemplate.d.ts +6 -0
- package/lib/commonjs/lib/userScriptTemplate.js +47 -0
- package/lib/commonjs/lib/userScriptTemplate.js.map +1 -0
- package/lib/commonjs/lib/views.d.ts +2 -0
- package/lib/commonjs/lib/views.js +31 -0
- package/lib/commonjs/lib/views.js.map +1 -0
- package/lib/commonjs/lib/webAddressingEnv.d.ts +7 -0
- package/lib/commonjs/lib/webAddressingEnv.js +16 -0
- package/lib/commonjs/lib/webAddressingEnv.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 +3 -0
- package/lib/commonjs/platforms/aws/cdkApp.js +31 -0
- package/lib/commonjs/platforms/aws/cdkApp.js.map +1 -0
- package/lib/commonjs/platforms/aws/clearResources.d.ts +2 -0
- package/lib/commonjs/platforms/aws/clearResources.js +167 -0
- package/lib/commonjs/platforms/aws/clearResources.js.map +1 -0
- package/lib/commonjs/platforms/aws/go.d.ts +2 -0
- package/lib/commonjs/platforms/aws/go.js +131 -0
- package/lib/commonjs/platforms/aws/go.js.map +1 -0
- package/lib/commonjs/platforms/aws/goDocker.d.ts +3 -0
- package/lib/commonjs/platforms/aws/goDocker.js +457 -0
- package/lib/commonjs/platforms/aws/goDocker.js.map +1 -0
- package/lib/commonjs/platforms/aws/goDockerManifest.d.ts +44 -0
- package/lib/commonjs/platforms/aws/goDockerManifest.js +38 -0
- package/lib/commonjs/platforms/aws/goDockerManifest.js.map +1 -0
- package/lib/commonjs/platforms/aws/index.d.ts +2 -0
- package/lib/commonjs/platforms/aws/index.js +23 -0
- package/lib/commonjs/platforms/aws/index.js.map +1 -0
- package/lib/commonjs/platforms/aws/prepareDeployment.d.ts +3 -0
- package/lib/commonjs/platforms/aws/prepareDeployment.js +10 -0
- package/lib/commonjs/platforms/aws/prepareDeployment.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 +105 -0
- package/lib/commonjs/platforms/aws/remote.js.map +1 -0
- package/lib/commonjs/platforms/aws/setup/awsSetupContext.d.ts +12 -0
- package/lib/commonjs/platforms/aws/setup/awsSetupContext.js +20 -0
- package/lib/commonjs/platforms/aws/setup/awsSetupContext.js.map +1 -0
- package/lib/commonjs/platforms/aws/setup/awsSetupSteps.d.ts +8 -0
- package/lib/commonjs/platforms/aws/setup/awsSetupSteps.js +44 -0
- package/lib/commonjs/platforms/aws/setup/awsSetupSteps.js.map +1 -0
- package/lib/commonjs/platforms/aws/setup/buildBucketNamesStep.d.ts +4 -0
- package/lib/commonjs/platforms/aws/setup/buildBucketNamesStep.js +77 -0
- package/lib/commonjs/platforms/aws/setup/buildBucketNamesStep.js.map +1 -0
- package/lib/commonjs/platforms/aws/setup/buildCdkBootstrapSteps.d.ts +5 -0
- package/lib/commonjs/platforms/aws/setup/buildCdkBootstrapSteps.js +38 -0
- package/lib/commonjs/platforms/aws/setup/buildCdkBootstrapSteps.js.map +1 -0
- package/lib/commonjs/platforms/aws/setup/buildGithubDeployRoleStep.d.ts +4 -0
- package/lib/commonjs/platforms/aws/setup/buildGithubDeployRoleStep.js +55 -0
- package/lib/commonjs/platforms/aws/setup/buildGithubDeployRoleStep.js.map +1 -0
- package/lib/commonjs/platforms/aws/setup/buildGithubOidcProviderStep.d.ts +4 -0
- package/lib/commonjs/platforms/aws/setup/buildGithubOidcProviderStep.js +54 -0
- package/lib/commonjs/platforms/aws/setup/buildGithubOidcProviderStep.js.map +1 -0
- package/lib/commonjs/platforms/aws/setup/buildHostedZonesStep.d.ts +4 -0
- package/lib/commonjs/platforms/aws/setup/buildHostedZonesStep.js +63 -0
- package/lib/commonjs/platforms/aws/setup/buildHostedZonesStep.js.map +1 -0
- package/lib/commonjs/platforms/aws/setup/buildIamCapabilityStep.d.ts +4 -0
- package/lib/commonjs/platforms/aws/setup/buildIamCapabilityStep.js +48 -0
- package/lib/commonjs/platforms/aws/setup/buildIamCapabilityStep.js.map +1 -0
- package/lib/commonjs/platforms/aws/setup/buildIdentityStep.d.ts +4 -0
- package/lib/commonjs/platforms/aws/setup/buildIdentityStep.js +39 -0
- package/lib/commonjs/platforms/aws/setup/buildIdentityStep.js.map +1 -0
- package/lib/commonjs/platforms/aws/setup/buildStackSteps.d.ts +5 -0
- package/lib/commonjs/platforms/aws/setup/buildStackSteps.js +32 -0
- package/lib/commonjs/platforms/aws/setup/buildStackSteps.js.map +1 -0
- package/lib/commonjs/platforms/aws/setup/describeStackStatus.d.ts +4 -0
- package/lib/commonjs/platforms/aws/setup/describeStackStatus.js +32 -0
- package/lib/commonjs/platforms/aws/setup/describeStackStatus.js.map +1 -0
- package/lib/commonjs/platforms/aws/setup/index.d.ts +1 -0
- package/lib/commonjs/platforms/aws/setup/index.js +18 -0
- package/lib/commonjs/platforms/aws/setup/index.js.map +1 -0
- package/lib/commonjs/platforms/aws/stacks.d.ts +7 -0
- package/lib/commonjs/platforms/aws/stacks.js +94 -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 +3 -0
- package/lib/commonjs/platforms/aws/viewsSync.js +77 -0
- package/lib/commonjs/platforms/aws/viewsSync.js.map +1 -0
- package/lib/commonjs/platforms/docker/QpqDockerPlatformSettings.d.ts +10 -0
- package/lib/commonjs/platforms/docker/QpqDockerPlatformSettings.js +3 -0
- package/lib/commonjs/platforms/docker/QpqDockerPlatformSettings.js.map +1 -0
- package/lib/commonjs/platforms/docker/getContainerPorts.d.ts +4 -0
- package/lib/commonjs/platforms/docker/getContainerPorts.js +12 -0
- package/lib/commonjs/platforms/docker/getContainerPorts.js.map +1 -0
- package/lib/commonjs/platforms/docker/getDefaultPortMappings.d.ts +3 -0
- package/lib/commonjs/platforms/docker/getDefaultPortMappings.js +10 -0
- package/lib/commonjs/platforms/docker/getDefaultPortMappings.js.map +1 -0
- package/lib/commonjs/platforms/docker/getDockerPlatformSettings.d.ts +14 -0
- package/lib/commonjs/platforms/docker/getDockerPlatformSettings.js +39 -0
- package/lib/commonjs/platforms/docker/getDockerPlatformSettings.js.map +1 -0
- package/lib/commonjs/platforms/docker/getImageName.d.ts +6 -0
- package/lib/commonjs/platforms/docker/getImageName.js +10 -0
- package/lib/commonjs/platforms/docker/getImageName.js.map +1 -0
- package/lib/commonjs/platforms/docker/go.d.ts +2 -0
- package/lib/commonjs/platforms/docker/go.js +261 -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 +43 -0
- package/lib/commonjs/platforms/docker/index.js.map +1 -0
- package/lib/commonjs/platforms/docker/parseMounts.d.ts +7 -0
- package/lib/commonjs/platforms/docker/parseMounts.js +27 -0
- package/lib/commonjs/platforms/docker/parseMounts.js.map +1 -0
- package/lib/commonjs/platforms/docker/parsePortMappings.d.ts +8 -0
- package/lib/commonjs/platforms/docker/parsePortMappings.js +26 -0
- package/lib/commonjs/platforms/docker/parsePortMappings.js.map +1 -0
- package/lib/commonjs/platforms/docker/resolvePortMappings.d.ts +8 -0
- package/lib/commonjs/platforms/docker/resolvePortMappings.js +23 -0
- package/lib/commonjs/platforms/docker/resolvePortMappings.js.map +1 -0
- package/lib/commonjs/platforms/docker/writeComposeFile.d.ts +20 -0
- package/lib/commonjs/platforms/docker/writeComposeFile.js +44 -0
- package/lib/commonjs/platforms/docker/writeComposeFile.js.map +1 -0
- package/lib/commonjs/platforms/index.d.ts +3 -0
- package/lib/commonjs/platforms/index.js +35 -0
- package/lib/commonjs/platforms/index.js.map +1 -0
- package/lib/commonjs/platforms/types.d.ts +21 -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/commandMenu.d.ts +2 -0
- package/lib/esm/cli/commandMenu.js +67 -0
- package/lib/esm/cli/commandMenu.js.map +1 -0
- package/lib/esm/cli/commandRegistry.d.ts +10 -0
- package/lib/esm/cli/commandRegistry.js +161 -0
- package/lib/esm/cli/commandRegistry.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 +73 -0
- package/lib/esm/cli/runCli.js.map +1 -0
- package/lib/esm/commands/checkCircular.d.ts +1 -0
- package/lib/esm/commands/checkCircular.js +55 -0
- package/lib/esm/commands/checkCircular.js.map +1 -0
- package/lib/esm/commands/clearResources.d.ts +1 -0
- package/lib/esm/commands/clearResources.js +23 -0
- package/lib/esm/commands/clearResources.js.map +1 -0
- package/lib/esm/commands/go.d.ts +1 -0
- package/lib/esm/commands/go.js +16 -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 +33 -0
- package/lib/esm/commands/goDev.js.map +1 -0
- package/lib/esm/commands/goDevApi.d.ts +1 -0
- package/lib/esm/commands/goDevApi.js +142 -0
- package/lib/esm/commands/goDevApi.js.map +1 -0
- package/lib/esm/commands/goDevWeb.d.ts +4 -0
- package/lib/esm/commands/goDevWeb.js +129 -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 +29 -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 +26 -0
- package/lib/esm/commands/hooks.js.map +1 -0
- package/lib/esm/commands/migrate.d.ts +1 -0
- package/lib/esm/commands/migrate.js +57 -0
- package/lib/esm/commands/migrate.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/scriptBuild.d.ts +1 -0
- package/lib/esm/commands/scriptBuild.js +29 -0
- package/lib/esm/commands/scriptBuild.js.map +1 -0
- package/lib/esm/commands/scriptBuilderLayer.d.ts +1 -0
- package/lib/esm/commands/scriptBuilderLayer.js +34 -0
- package/lib/esm/commands/scriptBuilderLayer.js.map +1 -0
- package/lib/esm/commands/scriptNew.d.ts +1 -0
- package/lib/esm/commands/scriptNew.js +19 -0
- package/lib/esm/commands/scriptNew.js.map +1 -0
- package/lib/esm/commands/setup.d.ts +1 -0
- package/lib/esm/commands/setup.js +88 -0
- package/lib/esm/commands/setup.js.map +1 -0
- package/lib/esm/commands/synth.d.ts +1 -0
- package/lib/esm/commands/synth.js +73 -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 +3 -0
- package/lib/esm/lib/args.js +25 -0
- package/lib/esm/lib/args.js.map +1 -0
- package/lib/esm/lib/circularImports.d.ts +3 -0
- package/lib/esm/lib/circularImports.js +61 -0
- package/lib/esm/lib/circularImports.js.map +1 -0
- package/lib/esm/lib/clearResourcesPlan.d.ts +15 -0
- package/lib/esm/lib/clearResourcesPlan.js +65 -0
- package/lib/esm/lib/clearResourcesPlan.js.map +1 -0
- package/lib/esm/lib/deployPrompts.d.ts +26 -0
- package/lib/esm/lib/deployPrompts.js +103 -0
- package/lib/esm/lib/deployPrompts.js.map +1 -0
- package/lib/esm/lib/devServerEntry.d.ts +22 -0
- package/lib/esm/lib/devServerEntry.js +127 -0
- package/lib/esm/lib/devServerEntry.js.map +1 -0
- package/lib/esm/lib/devServerPorts.d.ts +13 -0
- package/lib/esm/lib/devServerPorts.js +27 -0
- package/lib/esm/lib/devServerPorts.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/getDefaultHookJobs.d.ts +2 -0
- package/lib/esm/lib/getDefaultHookJobs.js +4 -0
- package/lib/esm/lib/getDefaultHookJobs.js.map +1 -0
- package/lib/esm/lib/getDeployTargetLabel.d.ts +2 -0
- package/lib/esm/lib/getDeployTargetLabel.js +8 -0
- package/lib/esm/lib/getDeployTargetLabel.js.map +1 -0
- package/lib/esm/lib/goDockerMode.d.ts +6 -0
- package/lib/esm/lib/goDockerMode.js +19 -0
- package/lib/esm/lib/goDockerMode.js.map +1 -0
- package/lib/esm/lib/hooks.d.ts +9 -0
- package/lib/esm/lib/hooks.js +154 -0
- package/lib/esm/lib/hooks.js.map +1 -0
- package/lib/esm/lib/keepOtherDevServersFlag.d.ts +1 -0
- package/lib/esm/lib/keepOtherDevServersFlag.js +8 -0
- package/lib/esm/lib/keepOtherDevServersFlag.js.map +1 -0
- package/lib/esm/lib/killChildWithEscalation.d.ts +10 -0
- package/lib/esm/lib/killChildWithEscalation.js +29 -0
- package/lib/esm/lib/killChildWithEscalation.js.map +1 -0
- package/lib/esm/lib/killStaleListeners.d.ts +17 -0
- package/lib/esm/lib/killStaleListeners.js +210 -0
- package/lib/esm/lib/killStaleListeners.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 +15 -0
- package/lib/esm/lib/prompts.js +28 -0
- package/lib/esm/lib/prompts.js.map +1 -0
- package/lib/esm/lib/qpqConfigs.d.ts +4 -0
- package/lib/esm/lib/qpqConfigs.js +21 -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/resolveDeployment.d.ts +14 -0
- package/lib/esm/lib/resolveDeployment.js +45 -0
- package/lib/esm/lib/resolveDeployment.js.map +1 -0
- package/lib/esm/lib/runCommand.d.ts +14 -0
- package/lib/esm/lib/runCommand.js +92 -0
- package/lib/esm/lib/runCommand.js.map +1 -0
- package/lib/esm/lib/runTasks.d.ts +15 -0
- package/lib/esm/lib/runTasks.js +108 -0
- package/lib/esm/lib/runTasks.js.map +1 -0
- package/lib/esm/lib/setupStep.d.ts +16 -0
- package/lib/esm/lib/setupStep.js +2 -0
- package/lib/esm/lib/setupStep.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/typeWatcher.d.ts +2 -0
- package/lib/esm/lib/typeWatcher.js +51 -0
- package/lib/esm/lib/typeWatcher.js.map +1 -0
- package/lib/esm/lib/userScriptBuilderLayer.d.ts +23 -0
- package/lib/esm/lib/userScriptBuilderLayer.js +65 -0
- package/lib/esm/lib/userScriptBuilderLayer.js.map +1 -0
- package/lib/esm/lib/userScriptTemplate.d.ts +6 -0
- package/lib/esm/lib/userScriptTemplate.js +39 -0
- package/lib/esm/lib/userScriptTemplate.js.map +1 -0
- package/lib/esm/lib/views.d.ts +2 -0
- package/lib/esm/lib/views.js +14 -0
- package/lib/esm/lib/views.js.map +1 -0
- package/lib/esm/lib/webAddressingEnv.d.ts +7 -0
- package/lib/esm/lib/webAddressingEnv.js +11 -0
- package/lib/esm/lib/webAddressingEnv.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 +3 -0
- package/lib/esm/platforms/aws/cdkApp.js +22 -0
- package/lib/esm/platforms/aws/cdkApp.js.map +1 -0
- package/lib/esm/platforms/aws/clearResources.d.ts +2 -0
- package/lib/esm/platforms/aws/clearResources.js +151 -0
- package/lib/esm/platforms/aws/clearResources.js.map +1 -0
- package/lib/esm/platforms/aws/go.d.ts +2 -0
- package/lib/esm/platforms/aws/go.js +115 -0
- package/lib/esm/platforms/aws/go.js.map +1 -0
- package/lib/esm/platforms/aws/goDocker.d.ts +3 -0
- package/lib/esm/platforms/aws/goDocker.js +441 -0
- package/lib/esm/platforms/aws/goDocker.js.map +1 -0
- package/lib/esm/platforms/aws/goDockerManifest.d.ts +44 -0
- package/lib/esm/platforms/aws/goDockerManifest.js +26 -0
- package/lib/esm/platforms/aws/goDockerManifest.js.map +1 -0
- package/lib/esm/platforms/aws/index.d.ts +2 -0
- package/lib/esm/platforms/aws/index.js +20 -0
- package/lib/esm/platforms/aws/index.js.map +1 -0
- package/lib/esm/platforms/aws/prepareDeployment.d.ts +3 -0
- package/lib/esm/platforms/aws/prepareDeployment.js +6 -0
- package/lib/esm/platforms/aws/prepareDeployment.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 +89 -0
- package/lib/esm/platforms/aws/remote.js.map +1 -0
- package/lib/esm/platforms/aws/setup/awsSetupContext.d.ts +12 -0
- package/lib/esm/platforms/aws/setup/awsSetupContext.js +16 -0
- package/lib/esm/platforms/aws/setup/awsSetupContext.js.map +1 -0
- package/lib/esm/platforms/aws/setup/awsSetupSteps.d.ts +8 -0
- package/lib/esm/platforms/aws/setup/awsSetupSteps.js +31 -0
- package/lib/esm/platforms/aws/setup/awsSetupSteps.js.map +1 -0
- package/lib/esm/platforms/aws/setup/buildBucketNamesStep.d.ts +4 -0
- package/lib/esm/platforms/aws/setup/buildBucketNamesStep.js +62 -0
- package/lib/esm/platforms/aws/setup/buildBucketNamesStep.js.map +1 -0
- package/lib/esm/platforms/aws/setup/buildCdkBootstrapSteps.d.ts +5 -0
- package/lib/esm/platforms/aws/setup/buildCdkBootstrapSteps.js +24 -0
- package/lib/esm/platforms/aws/setup/buildCdkBootstrapSteps.js.map +1 -0
- package/lib/esm/platforms/aws/setup/buildGithubDeployRoleStep.d.ts +4 -0
- package/lib/esm/platforms/aws/setup/buildGithubDeployRoleStep.js +40 -0
- package/lib/esm/platforms/aws/setup/buildGithubDeployRoleStep.js.map +1 -0
- package/lib/esm/platforms/aws/setup/buildGithubOidcProviderStep.d.ts +4 -0
- package/lib/esm/platforms/aws/setup/buildGithubOidcProviderStep.js +40 -0
- package/lib/esm/platforms/aws/setup/buildGithubOidcProviderStep.js.map +1 -0
- package/lib/esm/platforms/aws/setup/buildHostedZonesStep.d.ts +4 -0
- package/lib/esm/platforms/aws/setup/buildHostedZonesStep.js +49 -0
- package/lib/esm/platforms/aws/setup/buildHostedZonesStep.js.map +1 -0
- package/lib/esm/platforms/aws/setup/buildIamCapabilityStep.d.ts +4 -0
- package/lib/esm/platforms/aws/setup/buildIamCapabilityStep.js +34 -0
- package/lib/esm/platforms/aws/setup/buildIamCapabilityStep.js.map +1 -0
- package/lib/esm/platforms/aws/setup/buildIdentityStep.d.ts +4 -0
- package/lib/esm/platforms/aws/setup/buildIdentityStep.js +26 -0
- package/lib/esm/platforms/aws/setup/buildIdentityStep.js.map +1 -0
- package/lib/esm/platforms/aws/setup/buildStackSteps.d.ts +5 -0
- package/lib/esm/platforms/aws/setup/buildStackSteps.js +17 -0
- package/lib/esm/platforms/aws/setup/buildStackSteps.js.map +1 -0
- package/lib/esm/platforms/aws/setup/describeStackStatus.d.ts +4 -0
- package/lib/esm/platforms/aws/setup/describeStackStatus.js +17 -0
- package/lib/esm/platforms/aws/setup/describeStackStatus.js.map +1 -0
- package/lib/esm/platforms/aws/setup/index.d.ts +1 -0
- package/lib/esm/platforms/aws/setup/index.js +2 -0
- package/lib/esm/platforms/aws/setup/index.js.map +1 -0
- package/lib/esm/platforms/aws/stacks.d.ts +7 -0
- package/lib/esm/platforms/aws/stacks.js +72 -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 +3 -0
- package/lib/esm/platforms/aws/viewsSync.js +60 -0
- package/lib/esm/platforms/aws/viewsSync.js.map +1 -0
- package/lib/esm/platforms/docker/QpqDockerPlatformSettings.d.ts +10 -0
- package/lib/esm/platforms/docker/QpqDockerPlatformSettings.js +2 -0
- package/lib/esm/platforms/docker/QpqDockerPlatformSettings.js.map +1 -0
- package/lib/esm/platforms/docker/getContainerPorts.d.ts +4 -0
- package/lib/esm/platforms/docker/getContainerPorts.js +8 -0
- package/lib/esm/platforms/docker/getContainerPorts.js.map +1 -0
- package/lib/esm/platforms/docker/getDefaultPortMappings.d.ts +3 -0
- package/lib/esm/platforms/docker/getDefaultPortMappings.js +6 -0
- package/lib/esm/platforms/docker/getDefaultPortMappings.js.map +1 -0
- package/lib/esm/platforms/docker/getDockerPlatformSettings.d.ts +14 -0
- package/lib/esm/platforms/docker/getDockerPlatformSettings.js +34 -0
- package/lib/esm/platforms/docker/getDockerPlatformSettings.js.map +1 -0
- package/lib/esm/platforms/docker/getImageName.d.ts +6 -0
- package/lib/esm/platforms/docker/getImageName.js +6 -0
- package/lib/esm/platforms/docker/getImageName.js.map +1 -0
- package/lib/esm/platforms/docker/go.d.ts +2 -0
- package/lib/esm/platforms/docker/go.js +242 -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 +31 -0
- package/lib/esm/platforms/docker/index.js.map +1 -0
- package/lib/esm/platforms/docker/parseMounts.d.ts +7 -0
- package/lib/esm/platforms/docker/parseMounts.js +23 -0
- package/lib/esm/platforms/docker/parseMounts.js.map +1 -0
- package/lib/esm/platforms/docker/parsePortMappings.d.ts +8 -0
- package/lib/esm/platforms/docker/parsePortMappings.js +21 -0
- package/lib/esm/platforms/docker/parsePortMappings.js.map +1 -0
- package/lib/esm/platforms/docker/resolvePortMappings.d.ts +8 -0
- package/lib/esm/platforms/docker/resolvePortMappings.js +18 -0
- package/lib/esm/platforms/docker/resolvePortMappings.js.map +1 -0
- package/lib/esm/platforms/docker/writeComposeFile.d.ts +20 -0
- package/lib/esm/platforms/docker/writeComposeFile.js +37 -0
- package/lib/esm/platforms/docker/writeComposeFile.js.map +1 -0
- package/lib/esm/platforms/index.d.ts +3 -0
- package/lib/esm/platforms/index.js +17 -0
- package/lib/esm/platforms/index.js.map +1 -0
- package/lib/esm/platforms/types.d.ts +21 -0
- package/lib/esm/platforms/types.js +6 -0
- package/lib/esm/platforms/types.js.map +1 -0
- package/package.json +71 -3
- package/templates/user-script/README.md +28 -0
- package/templates/user-script/gitignore +2 -0
- package/templates/user-script/package.json +16 -0
- package/templates/user-script/src/main.ts +15 -0
- package/templates/user-script/tsconfig.json +12 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveAppSelection.js","sourceRoot":"","sources":["../../../src/lib/resolveAppSelection.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+EAA+E;AAC/E,iEAAiE;AACjE,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,OAAO,CAAC,KAAK,CAAC,eAAe,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACzD,OAAO,CAAC,KAAK,CAAC,wDAAwD,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IAC5F,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC;AAEK,MAAM,mBAAmB,GAAG,CAAO,OAA0B,EAAmB,EAAE;IACvF,MAAM,aAAa,GAAG,IAAA,4BAAgB,GAAE,CAAC;IACzC,IAAI,aAAa,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC/B,OAAO,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAC;QAC5C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,MAAM,SAAS,GACb,IAAA,kBAAW,EAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IAEjI,IAAI,SAAS,EAAE,CAAC;QACd,IAAI,OAAO,CAAC,QAAQ,IAAI,SAAS,KAAK,KAAK;YAAE,OAAO,KAAK,CAAC;QAC1D,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,SAAS,CAAC;YAAE,eAAe,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC;QAClF,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,IAAI,aAAa,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC/B,OAAO,CAAC,GAAG,CAAC,cAAc,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QAC9C,OAAO,aAAa,CAAC,CAAC,CAAC,CAAC;IAC1B,CAAC;IAED,IAAI,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,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:api / 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,14 @@
|
|
|
1
|
+
import { QpqAppDeployment } from '@qpqjs/core';
|
|
2
|
+
export declare const DEPLOYMENT_FLAG = "--deployment";
|
|
3
|
+
export type ResolvedDeployment = {
|
|
4
|
+
deploymentName: string;
|
|
5
|
+
deployment: QpqAppDeployment;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Selects an entry of the app's deploy.config.json and writes it into process.env
|
|
9
|
+
* (identity, environment, feature, settings) before any service config is loaded.
|
|
10
|
+
* The file is the source of truth: nothing in the shell overrides a value in it.
|
|
11
|
+
* The platform driver validates its own settings, so an aws entry missing its
|
|
12
|
+
* account or region fails here, not inside cdk.
|
|
13
|
+
*/
|
|
14
|
+
export declare const resolveDeployment: (argv: string[], appName: string) => Promise<ResolvedDeployment>;
|
|
@@ -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.resolveDeployment = exports.DEPLOYMENT_FLAG = void 0;
|
|
13
|
+
const config_aws_1 = require("@qpqjs/config-aws");
|
|
14
|
+
const core_1 = require("@qpqjs/core");
|
|
15
|
+
const platforms_1 = require("../platforms");
|
|
16
|
+
const args_1 = require("./args");
|
|
17
|
+
const discovery_1 = require("./discovery");
|
|
18
|
+
const prompts_1 = require("./prompts");
|
|
19
|
+
exports.DEPLOYMENT_FLAG = '--deployment';
|
|
20
|
+
// Which entry to use: the flag, then DEPLOY_NAME (set by a parent qpq command or CI: a
|
|
21
|
+
// selector, never a value), then the sole entry, then a prompt. Headless with several
|
|
22
|
+
// entries and no selection is an error rather than a guess.
|
|
23
|
+
const selectDeploymentName = (argv, appName, configuredNames) => __awaiter(void 0, void 0, void 0, function* () {
|
|
24
|
+
const requested = (0, args_1.getArgValue)(argv, exports.DEPLOYMENT_FLAG) || process.env[core_1.QpqDeployEnvVar.deployName];
|
|
25
|
+
if (requested) {
|
|
26
|
+
if (!configuredNames.includes(requested)) {
|
|
27
|
+
console.error(`Unknown deployment '${requested}' in ${(0, config_aws_1.getQpqAppDeployConfigPath)((0, discovery_1.getRoot)(), appName)}. Configured: ${configuredNames.join(', ')}`);
|
|
28
|
+
process.exit(1);
|
|
29
|
+
}
|
|
30
|
+
return requested;
|
|
31
|
+
}
|
|
32
|
+
if (configuredNames.length === 1) {
|
|
33
|
+
console.log(`Using deployment: ${configuredNames[0]}`);
|
|
34
|
+
return configuredNames[0];
|
|
35
|
+
}
|
|
36
|
+
if (process.stdin.isTTY) {
|
|
37
|
+
return (0, prompts_1.promptSelect)('Select deployment', configuredNames);
|
|
38
|
+
}
|
|
39
|
+
console.error(`No deployment selected. Pass ${exports.DEPLOYMENT_FLAG} <name>. Configured: ${configuredNames.join(', ')}`);
|
|
40
|
+
return process.exit(1);
|
|
41
|
+
});
|
|
42
|
+
/**
|
|
43
|
+
* Selects an entry of the app's deploy.config.json and writes it into process.env
|
|
44
|
+
* (identity, environment, feature, settings) before any service config is loaded.
|
|
45
|
+
* The file is the source of truth: nothing in the shell overrides a value in it.
|
|
46
|
+
* The platform driver validates its own settings, so an aws entry missing its
|
|
47
|
+
* account or region fails here, not inside cdk.
|
|
48
|
+
*/
|
|
49
|
+
const resolveDeployment = (argv, appName) => __awaiter(void 0, void 0, void 0, function* () {
|
|
50
|
+
const { deployments } = (0, config_aws_1.getQpqAppDeployConfig)((0, discovery_1.getRoot)(), appName);
|
|
51
|
+
const deploymentName = yield selectDeploymentName(argv, appName, Object.keys(deployments));
|
|
52
|
+
const deployment = deployments[deploymentName];
|
|
53
|
+
(0, config_aws_1.primeDeploymentEnv)(appName, deploymentName, deployment);
|
|
54
|
+
(0, platforms_1.getPlatformDriver)(deployment.platform).prepareDeployment(deploymentName, deployment);
|
|
55
|
+
return { deploymentName, deployment };
|
|
56
|
+
});
|
|
57
|
+
exports.resolveDeployment = resolveDeployment;
|
|
58
|
+
//# sourceMappingURL=resolveDeployment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveDeployment.js","sourceRoot":"","sources":["../../../src/lib/resolveDeployment.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,kDAAyG;AACzG,sCAAgE;AAEhE,4CAAiD;AACjD,iCAAqC;AACrC,2CAAsC;AACtC,uCAAyC;AAE5B,QAAA,eAAe,GAAG,cAAc,CAAC;AAO9C,uFAAuF;AACvF,sFAAsF;AACtF,4DAA4D;AAC5D,MAAM,oBAAoB,GAAG,CAAO,IAAc,EAAE,OAAe,EAAE,eAAyB,EAAmB,EAAE;IACjH,MAAM,SAAS,GAAG,IAAA,kBAAW,EAAC,IAAI,EAAE,uBAAe,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,sBAAe,CAAC,UAAU,CAAC,CAAC;IAEhG,IAAI,SAAS,EAAE,CAAC;QACd,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;YACzC,OAAO,CAAC,KAAK,CAAC,uBAAuB,SAAS,QAAQ,IAAA,sCAAyB,EAAC,IAAA,mBAAO,GAAE,EAAE,OAAO,CAAC,iBAAiB,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YAClJ,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,IAAI,eAAe,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACjC,OAAO,CAAC,GAAG,CAAC,qBAAqB,eAAe,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QACvD,OAAO,eAAe,CAAC,CAAC,CAAC,CAAC;IAC5B,CAAC;IAED,IAAI,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;QACxB,OAAO,IAAA,sBAAY,EAAC,mBAAmB,EAAE,eAAe,CAAC,CAAC;IAC5D,CAAC;IAED,OAAO,CAAC,KAAK,CAAC,gCAAgC,uBAAe,wBAAwB,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACnH,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACzB,CAAC,CAAA,CAAC;AAEF;;;;;;GAMG;AACI,MAAM,iBAAiB,GAAG,CAAO,IAAc,EAAE,OAAe,EAA+B,EAAE;IACtG,MAAM,EAAE,WAAW,EAAE,GAAG,IAAA,kCAAqB,EAAC,IAAA,mBAAO,GAAE,EAAE,OAAO,CAAC,CAAC;IAClE,MAAM,cAAc,GAAG,MAAM,oBAAoB,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;IAC3F,MAAM,UAAU,GAAG,WAAW,CAAC,cAAc,CAAC,CAAC;IAE/C,IAAA,+BAAkB,EAAC,OAAO,EAAE,cAAc,EAAE,UAAU,CAAC,CAAC;IACxD,IAAA,6BAAiB,EAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,iBAAiB,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC;IAErF,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,CAAC;AACxC,CAAC,CAAA,CAAC;AATW,QAAA,iBAAiB,qBAS5B","sourcesContent":["import { getQpqAppDeployConfig, getQpqAppDeployConfigPath, primeDeploymentEnv } from '@qpqjs/config-aws';\nimport { QpqAppDeployment, QpqDeployEnvVar } from '@qpqjs/core';\n\nimport { getPlatformDriver } from '../platforms';\nimport { getArgValue } from './args';\nimport { getRoot } from './discovery';\nimport { promptSelect } from './prompts';\n\nexport const DEPLOYMENT_FLAG = '--deployment';\n\nexport type ResolvedDeployment = {\n deploymentName: string;\n deployment: QpqAppDeployment;\n};\n\n// Which entry to use: the flag, then DEPLOY_NAME (set by a parent qpq command or CI: a\n// selector, never a value), then the sole entry, then a prompt. Headless with several\n// entries and no selection is an error rather than a guess.\nconst selectDeploymentName = async (argv: string[], appName: string, configuredNames: string[]): Promise<string> => {\n const requested = getArgValue(argv, DEPLOYMENT_FLAG) || process.env[QpqDeployEnvVar.deployName];\n\n if (requested) {\n if (!configuredNames.includes(requested)) {\n console.error(`Unknown deployment '${requested}' in ${getQpqAppDeployConfigPath(getRoot(), appName)}. Configured: ${configuredNames.join(', ')}`);\n process.exit(1);\n }\n return requested;\n }\n\n if (configuredNames.length === 1) {\n console.log(`Using deployment: ${configuredNames[0]}`);\n return configuredNames[0];\n }\n\n if (process.stdin.isTTY) {\n return promptSelect('Select deployment', configuredNames);\n }\n\n console.error(`No deployment selected. Pass ${DEPLOYMENT_FLAG} <name>. Configured: ${configuredNames.join(', ')}`);\n return process.exit(1);\n};\n\n/**\n * Selects an entry of the app's deploy.config.json and writes it into process.env\n * (identity, environment, feature, settings) before any service config is loaded.\n * The file is the source of truth: nothing in the shell overrides a value in it.\n * The platform driver validates its own settings, so an aws entry missing its\n * account or region fails here, not inside cdk.\n */\nexport const resolveDeployment = async (argv: string[], appName: string): Promise<ResolvedDeployment> => {\n const { deployments } = getQpqAppDeployConfig(getRoot(), appName);\n const deploymentName = await selectDeploymentName(argv, appName, Object.keys(deployments));\n const deployment = deployments[deploymentName];\n\n primeDeploymentEnv(appName, deploymentName, deployment);\n getPlatformDriver(deployment.platform).prepareDeployment(deploymentName, deployment);\n\n return { deploymentName, deployment };\n};\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
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 declare const runCommandBestEffort: (command: string, args: string[], options?: RunCommandOptions) => Promise<void>;
|
|
8
|
+
export type RunCommandPrefixedOptions = {
|
|
9
|
+
env?: Record<string, string>;
|
|
10
|
+
cwd?: string;
|
|
11
|
+
color?: number;
|
|
12
|
+
};
|
|
13
|
+
export declare const nextPrefixColor: () => number;
|
|
14
|
+
export declare const runCommandPrefixed: (label: string, command: string, args: string[], options?: RunCommandPrefixedOptions) => Promise<void>;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.runCommandPrefixed = exports.nextPrefixColor = exports.runCommandBestEffort = 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 only on Windows (to resolve npm/aws/cdk .cmd shims). On posix, run
|
|
16
|
+
// without a shell so the already-array args are passed straight to the
|
|
17
|
+
// program and can't be re-interpreted by `sh -c` — no command injection via
|
|
18
|
+
// interpolated values (stack names, CI-supplied env, etc.).
|
|
19
|
+
shell: process.platform === 'win32',
|
|
20
|
+
cwd: (_a = options.cwd) !== null && _a !== void 0 ? _a : process.cwd(),
|
|
21
|
+
env: Object.assign(Object.assign({}, process.env), ((_b = options.env) !== null && _b !== void 0 ? _b : {})),
|
|
22
|
+
});
|
|
23
|
+
child.on('error', (error) => reject(error));
|
|
24
|
+
child.on('exit', (code, signal) => {
|
|
25
|
+
if (signal)
|
|
26
|
+
return reject(new Error(`${command} was killed with signal ${signal}`));
|
|
27
|
+
if (code)
|
|
28
|
+
return reject(new Error(`${command} ${validArgs.join(' ')} exited with code ${code}`));
|
|
29
|
+
return resolve();
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
exports.runCommand = runCommand;
|
|
33
|
+
// Run a command for its side effect only, swallowing both its output and its
|
|
34
|
+
// exit code — for best-effort cleanup steps (e.g. `docker rm -f` of a container
|
|
35
|
+
// that may not exist) that must never fail the run. Without a shell there's no
|
|
36
|
+
// `>/dev/null 2>&1 || true`, so quieting and non-failing happen here instead.
|
|
37
|
+
const runCommandBestEffort = (command, args, options = {}) => new Promise((resolve) => {
|
|
38
|
+
var _a, _b;
|
|
39
|
+
const validArgs = args.filter((a) => !!a);
|
|
40
|
+
const child = (0, child_process_1.spawn)(command, validArgs, {
|
|
41
|
+
stdio: 'ignore',
|
|
42
|
+
shell: process.platform === 'win32',
|
|
43
|
+
cwd: (_a = options.cwd) !== null && _a !== void 0 ? _a : process.cwd(),
|
|
44
|
+
env: Object.assign(Object.assign({}, process.env), ((_b = options.env) !== null && _b !== void 0 ? _b : {})),
|
|
45
|
+
});
|
|
46
|
+
child.on('error', () => resolve());
|
|
47
|
+
child.on('exit', () => resolve());
|
|
48
|
+
});
|
|
49
|
+
exports.runCommandBestEffort = runCommandBestEffort;
|
|
50
|
+
const PREFIX_COLORS = [36, 32, 33, 35, 34, 96, 92, 93, 95, 94];
|
|
51
|
+
let colorIndex = 0;
|
|
52
|
+
// Hand each concurrent task a distinct prefix color so interleaved output is
|
|
53
|
+
// scannable.
|
|
54
|
+
const nextPrefixColor = () => {
|
|
55
|
+
const color = PREFIX_COLORS[colorIndex % PREFIX_COLORS.length];
|
|
56
|
+
colorIndex += 1;
|
|
57
|
+
return color;
|
|
58
|
+
};
|
|
59
|
+
exports.nextPrefixColor = nextPrefixColor;
|
|
60
|
+
// Like runCommand, but pipes output and prefixes every line with a colored
|
|
61
|
+
// [label] — for running many commands concurrently without unreadable
|
|
62
|
+
// interleaving. Rejects on non-zero exit.
|
|
63
|
+
const runCommandPrefixed = (label, command, args, options = {}) => new Promise((resolve, reject) => {
|
|
64
|
+
var _a, _b, _c;
|
|
65
|
+
const validArgs = args.filter((a) => !!a);
|
|
66
|
+
const prefix = `\x1b[${(_a = options.color) !== null && _a !== void 0 ? _a : 36}m[${label}]\x1b[0m `;
|
|
67
|
+
const child = (0, child_process_1.spawn)(command, validArgs, {
|
|
68
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
69
|
+
// Shell only on Windows (to resolve npm/aws/cdk .cmd shims). On posix, run
|
|
70
|
+
// without a shell so the already-array args are passed straight to the
|
|
71
|
+
// program and can't be re-interpreted by `sh -c` — no command injection via
|
|
72
|
+
// interpolated values (stack names, CI-supplied env, etc.).
|
|
73
|
+
shell: process.platform === 'win32',
|
|
74
|
+
cwd: (_b = options.cwd) !== null && _b !== void 0 ? _b : process.cwd(),
|
|
75
|
+
env: Object.assign(Object.assign({}, process.env), ((_c = options.env) !== null && _c !== void 0 ? _c : {})),
|
|
76
|
+
});
|
|
77
|
+
const attach = (stream, out) => {
|
|
78
|
+
let buffered = '';
|
|
79
|
+
stream.on('data', (chunk) => {
|
|
80
|
+
var _a;
|
|
81
|
+
buffered += chunk.toString();
|
|
82
|
+
const lines = buffered.split('\n');
|
|
83
|
+
buffered = (_a = lines.pop()) !== null && _a !== void 0 ? _a : '';
|
|
84
|
+
lines.forEach((line) => out.write(`${prefix}${line}\n`));
|
|
85
|
+
});
|
|
86
|
+
stream.on('end', () => {
|
|
87
|
+
if (buffered)
|
|
88
|
+
out.write(`${prefix}${buffered}\n`);
|
|
89
|
+
});
|
|
90
|
+
};
|
|
91
|
+
attach(child.stdout, process.stdout);
|
|
92
|
+
attach(child.stderr, process.stderr);
|
|
93
|
+
child.on('error', (error) => reject(error));
|
|
94
|
+
child.on('exit', (code, signal) => {
|
|
95
|
+
if (signal)
|
|
96
|
+
return reject(new Error(`[${label}] ${command} was killed with signal ${signal}`));
|
|
97
|
+
if (code)
|
|
98
|
+
return reject(new Error(`[${label}] ${command} exited with code ${code}`));
|
|
99
|
+
return resolve();
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
exports.runCommandPrefixed = runCommandPrefixed;
|
|
103
|
+
//# 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,2EAA2E;QAC3E,uEAAuE;QACvE,4EAA4E;QAC5E,4DAA4D;QAC5D,KAAK,EAAE,OAAO,CAAC,QAAQ,KAAK,OAAO;QACnC,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,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,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AM,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;AAvCQ,QAAA,kBAAkB,sBAuC1B","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 only on Windows (to resolve npm/aws/cdk .cmd shims). On posix, run\n // without a shell so the already-array args are passed straight to the\n // program and can't be re-interpreted by `sh -c` — no command injection via\n // interpolated values (stack names, CI-supplied env, etc.).\n shell: process.platform === 'win32',\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\n// Run a command for its side effect only, swallowing both its output and its\n// exit code — for best-effort cleanup steps (e.g. `docker rm -f` of a container\n// that may not exist) that must never fail the run. Without a shell there's no\n// `>/dev/null 2>&1 || true`, so quieting and non-failing happen here instead.\nexport const runCommandBestEffort = (command: string, args: string[], options: RunCommandOptions = {}): Promise<void> =>\n new Promise((resolve) => {\n const validArgs = args.filter((a) => !!a);\n\n const child = spawn(command, validArgs, {\n stdio: 'ignore',\n shell: process.platform === 'win32',\n cwd: options.cwd ?? process.cwd(),\n env: { ...process.env, ...(options.env ?? {}) },\n });\n\n child.on('error', () => resolve());\n child.on('exit', () => resolve());\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 only on Windows (to resolve npm/aws/cdk .cmd shims). On posix, run\n // without a shell so the already-array args are passed straight to the\n // program and can't be re-interpreted by `sh -c` — no command injection via\n // interpolated values (stack names, CI-supplied env, etc.).\n shell: process.platform === 'win32',\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,15 @@
|
|
|
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 type DependencyTask = Task & {
|
|
11
|
+
id: string;
|
|
12
|
+
deps: string[];
|
|
13
|
+
};
|
|
14
|
+
export declare const runDependencyTasks: (tasks: DependencyTask[], limit: number) => Promise<TaskFailure[]>;
|
|
15
|
+
export declare const assertNoFailures: (phaseName: string, failures: TaskFailure[]) => void;
|
|
@@ -0,0 +1,123 @@
|
|
|
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.runDependencyTasks = 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
|
+
// Run tasks with at most `limit` in flight, but a task only starts once every
|
|
35
|
+
// task in its `deps` has succeeded. A failure doesn't stop unrelated tasks;
|
|
36
|
+
// dependents of the failed task are skipped (logged, not returned as failures,
|
|
37
|
+
// the root cause already is). Never rejects. Tasks left unstartable by a
|
|
38
|
+
// dependency cycle come back as failures.
|
|
39
|
+
const runDependencyTasks = (tasks, limit) => __awaiter(void 0, void 0, void 0, function* () {
|
|
40
|
+
const failures = [];
|
|
41
|
+
const succeeded = new Set();
|
|
42
|
+
const failed = new Set();
|
|
43
|
+
const started = new Set();
|
|
44
|
+
const pipelines = [];
|
|
45
|
+
let slots = Math.max(1, limit);
|
|
46
|
+
const waiting = [];
|
|
47
|
+
const acquire = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
48
|
+
if (slots > 0) {
|
|
49
|
+
slots -= 1;
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
yield new Promise((resolve) => waiting.push(resolve));
|
|
53
|
+
});
|
|
54
|
+
const release = () => {
|
|
55
|
+
const next = waiting.shift();
|
|
56
|
+
if (next) {
|
|
57
|
+
next();
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
slots += 1;
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
const runOne = (task) => __awaiter(void 0, void 0, void 0, function* () {
|
|
64
|
+
yield acquire();
|
|
65
|
+
try {
|
|
66
|
+
yield task.run();
|
|
67
|
+
succeeded.add(task.id);
|
|
68
|
+
}
|
|
69
|
+
catch (error) {
|
|
70
|
+
failed.add(task.id);
|
|
71
|
+
failures.push({ label: task.label, error: error });
|
|
72
|
+
}
|
|
73
|
+
finally {
|
|
74
|
+
release();
|
|
75
|
+
}
|
|
76
|
+
launchReady();
|
|
77
|
+
});
|
|
78
|
+
// Repeatedly sweep until stable: launching one task or cascading one skip can
|
|
79
|
+
// unblock (or block) tasks earlier in the list.
|
|
80
|
+
const launchReady = () => {
|
|
81
|
+
let changed = true;
|
|
82
|
+
while (changed) {
|
|
83
|
+
changed = false;
|
|
84
|
+
for (const task of tasks) {
|
|
85
|
+
if (started.has(task.id))
|
|
86
|
+
continue;
|
|
87
|
+
if (task.deps.some((dep) => failed.has(dep))) {
|
|
88
|
+
started.add(task.id);
|
|
89
|
+
failed.add(task.id); // cascade so transitive dependents skip too
|
|
90
|
+
console.log(`Skipping ${task.label} (a dependency failed)`);
|
|
91
|
+
changed = true;
|
|
92
|
+
}
|
|
93
|
+
else if (task.deps.every((dep) => succeeded.has(dep))) {
|
|
94
|
+
started.add(task.id);
|
|
95
|
+
pipelines.push(runOne(task));
|
|
96
|
+
changed = true;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
launchReady();
|
|
102
|
+
// runOne re-invokes launchReady as tasks finish, pushing newly unblocked
|
|
103
|
+
// pipelines while earlier ones are being awaited; drain until it stays empty.
|
|
104
|
+
while (pipelines.length > 0) {
|
|
105
|
+
yield Promise.all(pipelines.splice(0, pipelines.length));
|
|
106
|
+
}
|
|
107
|
+
for (const task of tasks) {
|
|
108
|
+
if (!started.has(task.id)) {
|
|
109
|
+
failures.push({ label: task.label, error: new Error('unstartable: dependency cycle') });
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return failures;
|
|
113
|
+
});
|
|
114
|
+
exports.runDependencyTasks = runDependencyTasks;
|
|
115
|
+
const assertNoFailures = (phaseName, failures) => {
|
|
116
|
+
if (failures.length === 0)
|
|
117
|
+
return;
|
|
118
|
+
console.error(`\n${phaseName} failed for:`);
|
|
119
|
+
failures.forEach((failure) => console.error(` ${failure.label}: ${failure.error.message}`));
|
|
120
|
+
throw new Error(`${phaseName}: ${failures.length} task(s) failed`);
|
|
121
|
+
};
|
|
122
|
+
exports.assertNoFailures = assertNoFailures;
|
|
123
|
+
//# sourceMappingURL=runTasks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runTasks.js","sourceRoot":"","sources":["../../../src/lib/runTasks.ts"],"names":[],"mappings":";;;;;;;;;;;;AAGA,+EAA+E;AAC/E,mEAAmE;AAC5D,MAAM,QAAQ,GAAG,CAAO,KAAa,EAAE,KAAa,EAA0B,EAAE;IACrF,MAAM,QAAQ,GAAkB,EAAE,CAAC;IACnC,IAAI,SAAS,GAAG,CAAC,CAAC;IAElB,MAAM,WAAW,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;IAC/D,MAAM,OAAO,CAAC,GAAG,CACf,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,EAAE,GAAS,EAAE;QAC7C,OAAO,SAAS,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC;YAChC,MAAM,IAAI,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC;YAC9B,SAAS,IAAI,CAAC,CAAC;YACf,IAAI,CAAC;gBACH,MAAM,IAAI,CAAC,GAAG,EAAE,CAAC;YACnB,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,QAAQ,CAAC,IAAI,CAAC,EAAE,K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GAAG,SAAS,KAAK,QAAQ,CAAC,MAAM,iBAAiB,CAAC,CAAC;AACrE,CAAC,CAAC;AALW,QAAA,gBAAgB,oBAK3B","sourcesContent":["export type Task = { label: string; run: () => Promise<void> };\nexport type TaskFailure = { label: string; error: Error };\n\n// Run tasks with at most `limit` in flight; never rejects — failures come back\n// labelled so a whole wave can finish before we report what broke.\nexport const runTasks = async (tasks: Task[], limit: number): Promise<TaskFailure[]> => {\n const failures: TaskFailure[] = [];\n let nextIndex = 0;\n\n const workerCount = Math.max(1, Math.min(limit, tasks.length));\n await Promise.all(\n Array.from({ length: workerCount }, async () => {\n while (nextIndex < tasks.length) {\n const task = tasks[nextIndex];\n nextIndex += 1;\n try {\n await task.run();\n } catch (error) {\n failures.push({ label: task.label, error: error as Error });\n }\n }\n }),\n );\n\n return failures;\n};\n\nexport type DependencyTask = Task & {\n // Unique id other tasks reference in `deps` (e.g. a package name).\n id: string;\n // Ids of tasks that must succeed before this one starts. Ids not present in\n // the task list should be filtered out by the caller.\n deps: string[];\n};\n\n// Run tasks with at most `limit` in flight, but a task only starts once every\n// task in its `deps` has succeeded. A failure doesn't stop unrelated tasks;\n// dependents of the failed task are skipped (logged, not returned as failures,\n// the root cause already is). Never rejects. Tasks left unstartable by a\n// dependency cycle come back as failures.\nexport const runDependencyTasks = async (tasks: DependencyTask[], limit: number): Promise<TaskFailure[]> => {\n const failures: TaskFailure[] = [];\n const succeeded = new Set<string>();\n const failed = new Set<string>();\n const started = new Set<string>();\n const pipelines: Array<Promise<void>> = [];\n\n let slots = Math.max(1, limit);\n const waiting: Array<() => void> = [];\n\n const acquire = async (): Promise<void> => {\n if (slots > 0) {\n slots -= 1;\n return;\n }\n await new Promise<void>((resolve) => waiting.push(resolve));\n };\n\n const release = (): void => {\n const next = waiting.shift();\n if (next) {\n next();\n } else {\n slots += 1;\n }\n };\n\n const runOne = async (task: DependencyTask): Promise<void> => {\n await acquire();\n try {\n await task.run();\n succeeded.add(task.id);\n } catch (error) {\n failed.add(task.id);\n failures.push({ label: task.label, error: error as Error });\n } finally {\n release();\n }\n launchReady();\n };\n\n // Repeatedly sweep until stable: launching one task or cascading one skip can\n // unblock (or block) tasks earlier in the list.\n const launchReady = (): void => {\n let changed = true;\n while (changed) {\n changed = false;\n for (const task of tasks) {\n if (started.has(task.id)) continue;\n if (task.deps.some((dep) => failed.has(dep))) {\n started.add(task.id);\n failed.add(task.id); // cascade so transitive dependents skip too\n console.log(`Skipping ${task.label} (a dependency failed)`);\n changed = true;\n } else if (task.deps.every((dep) => succeeded.has(dep))) {\n started.add(task.id);\n pipelines.push(runOne(task));\n changed = true;\n }\n }\n }\n };\n\n launchReady();\n // runOne re-invokes launchReady as tasks finish, pushing newly unblocked\n // pipelines while earlier ones are being awaited; drain until it stays empty.\n while (pipelines.length > 0) {\n await Promise.all(pipelines.splice(0, pipelines.length));\n }\n\n for (const task of tasks) {\n if (!started.has(task.id)) {\n failures.push({ label: task.label, error: new Error('unstartable: dependency cycle') });\n }\n }\n\n return failures;\n};\n\nexport const assertNoFailures = (phaseName: string, failures: TaskFailure[]): void => {\n if (failures.length === 0) return;\n console.error(`\\n${phaseName} failed for:`);\n failures.forEach((failure) => console.error(` ${failure.label}: ${failure.error.message}`));\n throw new Error(`${phaseName}: ${failures.length} task(s) failed`);\n};\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Nullable } from '@qpqjs/core';
|
|
2
|
+
export type SetupCheckResult = {
|
|
3
|
+
done: boolean;
|
|
4
|
+
detail?: string;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* One item of a platform's setup checklist. `check` says whether it is already in place
|
|
8
|
+
* (null when it cannot tell), `run` makes it so. A check-only step (credentials, zones) has a
|
|
9
|
+
* run that re-checks and throws with guidance, so a failed prerequisite stops the sequence.
|
|
10
|
+
*/
|
|
11
|
+
export type SetupStep = {
|
|
12
|
+
id: string;
|
|
13
|
+
name: string;
|
|
14
|
+
check: () => Promise<Nullable<SetupCheckResult>>;
|
|
15
|
+
run: () => Promise<void>;
|
|
16
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setupStep.js","sourceRoot":"","sources":["../../../src/lib/setupStep.ts"],"names":[],"mappings":"","sourcesContent":["import { Nullable } from '@qpqjs/core';\n\nexport type SetupCheckResult = {\n done: boolean;\n // One line for the menu: what exists, or what is missing and how to fix it.\n detail?: string;\n};\n\n/**\n * One item of a platform's setup checklist. `check` says whether it is already in place\n * (null when it cannot tell), `run` makes it so. A check-only step (credentials, zones) has a\n * run that re-checks and throws with guidance, so a failed prerequisite stops the sequence.\n */\nexport type SetupStep = {\n id: string;\n name: string;\n check: () => Promise<Nullable<SetupCheckResult>>;\n run: () => Promise<void>;\n};\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.logTimeEnd = exports.logTimeStart = void 0;
|
|
4
|
+
const logTimeStart = (name) => console.time(name);
|
|
5
|
+
exports.logTimeStart = logTimeStart;
|
|
6
|
+
const logTimeEnd = (name) => {
|
|
7
|
+
console.log('When:', new Date().toLocaleTimeString());
|
|
8
|
+
console.timeEnd(name);
|
|
9
|
+
};
|
|
10
|
+
exports.logTimeEnd = logTimeEnd;
|
|
11
|
+
//# sourceMappingURL=timing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timing.js","sourceRoot":"","sources":["../../../src/lib/timing.ts"],"names":[],"mappings":";;;AAAO,MAAM,YAAY,GAAG,CAAC,IAAY,EAAQ,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAA1D,QAAA,YAAY,gBAA8C;AAEhE,MAAM,UAAU,GAAG,CAAC,IAAY,EAAQ,EAAE;IAC/C,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,IAAI,EAAE,CAAC,kBAAkB,EAAE,CAAC,CAAC;IACtD,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AACxB,CAAC,CAAC;AAHW,QAAA,UAAU,cAGrB","sourcesContent":["export const logTimeStart = (name: string): void => console.time(name);\n\nexport const logTimeEnd = (name: string): void => {\n console.log('When:', new Date().toLocaleTimeString());\n console.timeEnd(name);\n};\n"]}
|
|
@@ -0,0 +1,59 @@
|
|
|
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.startTypeWatcher = void 0;
|
|
7
|
+
// Keeps workspace packages' declaration output (dist/*.d.ts) fresh while
|
|
8
|
+
// `qpq go:dev` runs. The rspack dev builds bundle workspace source directly,
|
|
9
|
+
// so this watcher only feeds the editor and validate-ts, which resolve
|
|
10
|
+
// cross-package types through each package's built declarations.
|
|
11
|
+
//
|
|
12
|
+
// One `tsc -b --watch` over every workspace package that ships types; routine
|
|
13
|
+
// watch chatter is dropped so only real compile errors reach the shared
|
|
14
|
+
// terminal. Opt out with `--no-types`.
|
|
15
|
+
const deploy_rspack_1 = require("@qpqjs/deploy-rspack");
|
|
16
|
+
const child_process_1 = require("child_process");
|
|
17
|
+
const fs_1 = __importDefault(require("fs"));
|
|
18
|
+
const path_1 = __importDefault(require("path"));
|
|
19
|
+
// Routine tsc watch status lines; everything else is worth showing.
|
|
20
|
+
const routineTscPatterns = [/Starting compilation in watch mode/, /File change detected/, /Found 0 errors/];
|
|
21
|
+
const isRoutineTscLine = (line) => routineTscPatterns.some((pattern) => pattern.test(line));
|
|
22
|
+
// Forwards non-routine tsc output line by line under a [types] prefix.
|
|
23
|
+
const forwardTscOutput = (chunk) => {
|
|
24
|
+
for (const line of chunk.toString().split('\n')) {
|
|
25
|
+
if (line.trim().length === 0 || isRoutineTscLine(line)) {
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
console.log(`[types] ${line}`);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
// A workspace package wants declaration watching when it has a tsconfig and
|
|
32
|
+
// publishes types from its build output. Packages bundled by rspack (views,
|
|
33
|
+
// service handlers) don't ship types and are skipped.
|
|
34
|
+
const isTypedWorkspacePackage = (dir) => {
|
|
35
|
+
if (!fs_1.default.existsSync(path_1.default.join(dir, 'tsconfig.json'))) {
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
const packageJson = JSON.parse(fs_1.default.readFileSync(path_1.default.join(dir, 'package.json'), 'utf-8'));
|
|
39
|
+
return !!(packageJson.types || packageJson.typings);
|
|
40
|
+
};
|
|
41
|
+
const startTypeWatcher = (root) => {
|
|
42
|
+
var _a, _b;
|
|
43
|
+
const projectDirs = (0, deploy_rspack_1.getWorkspacePackageDirs)(root).filter(isTypedWorkspacePackage);
|
|
44
|
+
if (projectDirs.length === 0) {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
const relativeDirs = projectDirs.map((dir) => path_1.default.relative(root, dir));
|
|
48
|
+
const child = (0, child_process_1.spawn)('npx', ['tsc', '-b', ...relativeDirs, '--watch', '--preserveWatchOutput', '--pretty'], {
|
|
49
|
+
cwd: root,
|
|
50
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
51
|
+
shell: process.platform === 'win32',
|
|
52
|
+
});
|
|
53
|
+
(_a = child.stdout) === null || _a === void 0 ? void 0 : _a.on('data', forwardTscOutput);
|
|
54
|
+
(_b = child.stderr) === null || _b === void 0 ? void 0 : _b.on('data', forwardTscOutput);
|
|
55
|
+
console.log(`Type watcher: tsc -b --watch over ${relativeDirs.length} workspace packages (disable with --no-types).`);
|
|
56
|
+
return child;
|
|
57
|
+
};
|
|
58
|
+
exports.startTypeWatcher = startTypeWatcher;
|
|
59
|
+
//# sourceMappingURL=typeWatcher.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typeWatcher.js","source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OAAO,CAAC,CAAC,CAAC;IACzF,OAAO,CAAC,CAAC,CAAC,WAAW,CAAC,KAAK,IAAI,WAAW,CAAC,OAAO,CAAC,CAAC;AACtD,CAAC,CAAC;AAEK,MAAM,gBAAgB,GAAG,CAAC,IAAY,EAAuB,EAAE;;IACpE,MAAM,WAAW,GAAG,IAAA,uCAAuB,EAAC,IAAI,CAAC,CAAC,MAAM,CAAC,uBAAuB,CAAC,CAAC;IAClF,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC7B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,YAAY,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,cAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC;IACxE,MAAM,KAAK,GAAG,IAAA,qBAAK,EAAC,KAAK,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,YAAY,EAAE,SAAS,EAAE,uBAAuB,EAAE,UAAU,CAAC,EAAE;QACzG,GAAG,EAAE,IAAI;QACT,KAAK,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC;QACjC,KAAK,EAAE,OAAO,CAAC,QAAQ,KAAK,OAAO;KACpC,CAAC,CAAC;IAEH,MAAA,KAAK,CAAC,MAAM,0CAAE,EAAE,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IAC3C,MAAA,KAAK,CAAC,MAAM,0CAAE,EAAE,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IAE3C,OAAO,CAAC,GAAG,CAAC,qCAAqC,YAAY,CAAC,MAAM,gDAAgD,CAAC,CAAC;IAEtH,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAnBW,QAAA,gBAAgB,oBAmB3B","sourcesContent":["// Keeps workspace packages' declaration output (dist/*.d.ts) fresh while\n// `qpq go:dev` runs. The rspack dev builds bundle workspace source directly,\n// so this watcher only feeds the editor and validate-ts, which resolve\n// cross-package types through each package's built declarations.\n//\n// One `tsc -b --watch` over every workspace package that ships types; routine\n// watch chatter is dropped so only real compile errors reach the shared\n// terminal. Opt out with `--no-types`.\nimport { getWorkspacePackageDirs } from '@qpqjs/deploy-rspack';\n\nimport { ChildProcess, spawn } from 'child_process';\nimport fs from 'fs';\nimport path from 'path';\n\n// Routine tsc watch status lines; everything else is worth showing.\nconst routineTscPatterns = [/Starting compilation in watch mode/, /File change detected/, /Found 0 errors/];\n\nconst isRoutineTscLine = (line: string): boolean => routineTscPatterns.some((pattern) => pattern.test(line));\n\n// Forwards non-routine tsc output line by line under a [types] prefix.\nconst forwardTscOutput = (chunk: Buffer): void => {\n for (const line of chunk.toString().split('\\n')) {\n if (line.trim().length === 0 || isRoutineTscLine(line)) {\n continue;\n }\n console.log(`[types] ${line}`);\n }\n};\n\n// A workspace package wants declaration watching when it has a tsconfig and\n// publishes types from its build output. Packages bundled by rspack (views,\n// service handlers) don't ship types and are skipped.\nconst isTypedWorkspacePackage = (dir: string): boolean => {\n if (!fs.existsSync(path.join(dir, 'tsconfig.json'))) {\n return false;\n }\n\n const packageJson = JSON.parse(fs.readFileSync(path.join(dir, 'package.json'), 'utf-8'));\n return !!(packageJson.types || packageJson.typings);\n};\n\nexport const startTypeWatcher = (root: string): ChildProcess | null => {\n const projectDirs = getWorkspacePackageDirs(root).filter(isTypedWorkspacePackage);\n if (projectDirs.length === 0) {\n return null;\n }\n\n const relativeDirs = projectDirs.map((dir) => path.relative(root, dir));\n const child = spawn('npx', ['tsc', '-b', ...relativeDirs, '--watch', '--preserveWatchOutput', '--pretty'], {\n cwd: root,\n stdio: ['ignore', 'pipe', 'pipe'],\n shell: process.platform === 'win32',\n });\n\n child.stdout?.on('data', forwardTscOutput);\n child.stderr?.on('data', forwardTscOutput);\n\n console.log(`Type watcher: tsc -b --watch over ${relativeDirs.length} workspace packages (disable with --no-types).`);\n\n return child;\n};\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { JavascriptRuntimeArchitecture } from '@qpqjs/core';
|
|
2
|
+
export type BuilderLayerInstallOptions = {
|
|
3
|
+
outDir: string;
|
|
4
|
+
architecture: JavascriptRuntimeArchitecture;
|
|
5
|
+
rspackVersion: string;
|
|
6
|
+
};
|
|
7
|
+
/** The npm cpu name for a lambda architecture. */
|
|
8
|
+
export declare const getBuilderLayerCpu: (architecture: JavascriptRuntimeArchitecture) => "arm64" | "x64";
|
|
9
|
+
/**
|
|
10
|
+
* The npm argv that installs rspack for linux and the lambda's cpu into the layer's
|
|
11
|
+
* nodejs directory. Pure, so the exact invocation is testable without running npm.
|
|
12
|
+
*/
|
|
13
|
+
export declare const getBuilderLayerInstallArgs: ({ outDir, architecture, rspackVersion }: BuilderLayerInstallOptions) => string[];
|
|
14
|
+
export type BuilderLayerRunners = {
|
|
15
|
+
getNpmVersion: () => string;
|
|
16
|
+
runNpm: (args: string[]) => void;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Produces the user-script builder layer directory: `<outDir>/nodejs/node_modules` holding
|
|
20
|
+
* rspack and its linux binding for the lambda's cpu. Empties `outDir` first and verifies
|
|
21
|
+
* the binding landed. Needs npm 9 or later for the `--os`/`--cpu` flags.
|
|
22
|
+
*/
|
|
23
|
+
export declare const buildUserScriptBuilderLayer: (options: BuilderLayerInstallOptions, runners?: BuilderLayerRunners) => string;
|
|
@@ -0,0 +1,74 @@
|
|
|
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.buildUserScriptBuilderLayer = exports.getBuilderLayerInstallArgs = exports.getBuilderLayerCpu = void 0;
|
|
7
|
+
const core_1 = require("@qpqjs/core");
|
|
8
|
+
const user_script_1 = require("@qpqjs/user-script");
|
|
9
|
+
const child_process_1 = require("child_process");
|
|
10
|
+
const fs_1 = __importDefault(require("fs"));
|
|
11
|
+
const path_1 = __importDefault(require("path"));
|
|
12
|
+
const MIN_NPM_MAJOR = 9;
|
|
13
|
+
// Lambda's layer layout: /opt/nodejs/node_modules is on the function's module path.
|
|
14
|
+
const LAYER_NODE_DIR = 'nodejs';
|
|
15
|
+
const npmCpuByArchitecture = {
|
|
16
|
+
[core_1.JavascriptRuntimeArchitecture.Arm64]: 'arm64',
|
|
17
|
+
[core_1.JavascriptRuntimeArchitecture.X86_64]: 'x64',
|
|
18
|
+
};
|
|
19
|
+
/** The npm cpu name for a lambda architecture. */
|
|
20
|
+
const getBuilderLayerCpu = (architecture) => npmCpuByArchitecture[architecture];
|
|
21
|
+
exports.getBuilderLayerCpu = getBuilderLayerCpu;
|
|
22
|
+
/**
|
|
23
|
+
* The npm argv that installs rspack for linux and the lambda's cpu into the layer's
|
|
24
|
+
* nodejs directory. Pure, so the exact invocation is testable without running npm.
|
|
25
|
+
*/
|
|
26
|
+
const getBuilderLayerInstallArgs = ({ outDir, architecture, rspackVersion }) => [
|
|
27
|
+
'install',
|
|
28
|
+
'--prefix',
|
|
29
|
+
path_1.default.join(outDir, LAYER_NODE_DIR),
|
|
30
|
+
'--os=linux',
|
|
31
|
+
`--cpu=${(0, exports.getBuilderLayerCpu)(architecture)}`,
|
|
32
|
+
'--libc=glibc',
|
|
33
|
+
'--omit=dev',
|
|
34
|
+
'--no-save',
|
|
35
|
+
'--no-package-lock',
|
|
36
|
+
'--no-audit',
|
|
37
|
+
'--no-fund',
|
|
38
|
+
`@rspack/core@${rspackVersion}`,
|
|
39
|
+
];
|
|
40
|
+
exports.getBuilderLayerInstallArgs = getBuilderLayerInstallArgs;
|
|
41
|
+
const parseMajor = (version) => parseInt(version.split('.')[0], 10);
|
|
42
|
+
const defaultRunners = {
|
|
43
|
+
getNpmVersion: () => (0, child_process_1.execFileSync)('npm', ['--version'], { encoding: 'utf8' }).trim(),
|
|
44
|
+
runNpm: (args) => {
|
|
45
|
+
(0, child_process_1.execFileSync)('npm', args, { stdio: 'inherit' });
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Produces the user-script builder layer directory: `<outDir>/nodejs/node_modules` holding
|
|
50
|
+
* rspack and its linux binding for the lambda's cpu. Empties `outDir` first and verifies
|
|
51
|
+
* the binding landed. Needs npm 9 or later for the `--os`/`--cpu` flags.
|
|
52
|
+
*/
|
|
53
|
+
const buildUserScriptBuilderLayer = (options, runners = defaultRunners) => {
|
|
54
|
+
const npmVersion = runners.getNpmVersion();
|
|
55
|
+
if (parseMajor(npmVersion) < MIN_NPM_MAJOR) {
|
|
56
|
+
throw new Error(`script:builder-layer needs npm ${MIN_NPM_MAJOR} or later for --os/--cpu installs; found ${npmVersion}`);
|
|
57
|
+
}
|
|
58
|
+
const nodeDir = path_1.default.join(options.outDir, LAYER_NODE_DIR);
|
|
59
|
+
fs_1.default.rmSync(options.outDir, { recursive: true, force: true });
|
|
60
|
+
fs_1.default.mkdirSync(nodeDir, { recursive: true });
|
|
61
|
+
fs_1.default.writeFileSync(path_1.default.join(nodeDir, 'package.json'), JSON.stringify({ name: 'user-script-builder-layer', private: true }, null, 2));
|
|
62
|
+
runners.runNpm((0, exports.getBuilderLayerInstallArgs)(options));
|
|
63
|
+
const bindingDir = path_1.default.join(nodeDir, 'node_modules', '@rspack', `binding-linux-${(0, exports.getBuilderLayerCpu)(options.architecture)}-gnu`);
|
|
64
|
+
if (!fs_1.default.existsSync(bindingDir)) {
|
|
65
|
+
throw new Error(`script:builder-layer: expected the rspack binding at [${bindingDir}] after install; the layer would not load on lambda`);
|
|
66
|
+
}
|
|
67
|
+
const installed = user_script_1.USER_SCRIPT_BUILDER_LAYER_MODULES.filter((name) => fs_1.default.existsSync(path_1.default.join(nodeDir, 'node_modules', name)));
|
|
68
|
+
if (installed.length !== user_script_1.USER_SCRIPT_BUILDER_LAYER_MODULES.length) {
|
|
69
|
+
throw new Error(`script:builder-layer: the layer is missing ${user_script_1.USER_SCRIPT_BUILDER_LAYER_MODULES.filter((name) => !installed.includes(name)).join(', ')}`);
|
|
70
|
+
}
|
|
71
|
+
return nodeDir;
|
|
72
|
+
};
|
|
73
|
+
exports.buildUserScriptBuilderLayer = buildUserScriptBuilderLayer;
|
|
74
|
+
//# sourceMappingURL=userScriptBuilderLayer.js.map
|