@qpqjs/cli 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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,92 @@
|
|
|
1
|
+
import { spawn } from 'child_process';
|
|
2
|
+
// Spawn a command, inheriting stdio, resolving on success. A non-zero exit
|
|
3
|
+
// REJECTS so a failed build/deploy stops the run.
|
|
4
|
+
export const runCommand = (command, args, options = {}) => new Promise((resolve, reject) => {
|
|
5
|
+
const validArgs = args.filter((a) => !!a);
|
|
6
|
+
if (options.logCommand) {
|
|
7
|
+
console.log(`Running command: ${command} ${validArgs.join(' ')}`);
|
|
8
|
+
}
|
|
9
|
+
const child = spawn(command, validArgs, {
|
|
10
|
+
stdio: 'inherit',
|
|
11
|
+
// Shell only on Windows (to resolve npm/aws/cdk .cmd shims). On posix, run
|
|
12
|
+
// without a shell so the already-array args are passed straight to the
|
|
13
|
+
// program and can't be re-interpreted by `sh -c` — no command injection via
|
|
14
|
+
// interpolated values (stack names, CI-supplied env, etc.).
|
|
15
|
+
shell: process.platform === 'win32',
|
|
16
|
+
cwd: options.cwd ?? process.cwd(),
|
|
17
|
+
env: { ...process.env, ...(options.env ?? {}) },
|
|
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
|
+
// Run a command for its side effect only, swallowing both its output and its
|
|
29
|
+
// exit code — for best-effort cleanup steps (e.g. `docker rm -f` of a container
|
|
30
|
+
// that may not exist) that must never fail the run. Without a shell there's no
|
|
31
|
+
// `>/dev/null 2>&1 || true`, so quieting and non-failing happen here instead.
|
|
32
|
+
export const runCommandBestEffort = (command, args, options = {}) => new Promise((resolve) => {
|
|
33
|
+
const validArgs = args.filter((a) => !!a);
|
|
34
|
+
const child = spawn(command, validArgs, {
|
|
35
|
+
stdio: 'ignore',
|
|
36
|
+
shell: process.platform === 'win32',
|
|
37
|
+
cwd: options.cwd ?? process.cwd(),
|
|
38
|
+
env: { ...process.env, ...(options.env ?? {}) },
|
|
39
|
+
});
|
|
40
|
+
child.on('error', () => resolve());
|
|
41
|
+
child.on('exit', () => resolve());
|
|
42
|
+
});
|
|
43
|
+
const PREFIX_COLORS = [36, 32, 33, 35, 34, 96, 92, 93, 95, 94];
|
|
44
|
+
let colorIndex = 0;
|
|
45
|
+
// Hand each concurrent task a distinct prefix color so interleaved output is
|
|
46
|
+
// scannable.
|
|
47
|
+
export const nextPrefixColor = () => {
|
|
48
|
+
const color = PREFIX_COLORS[colorIndex % PREFIX_COLORS.length];
|
|
49
|
+
colorIndex += 1;
|
|
50
|
+
return color;
|
|
51
|
+
};
|
|
52
|
+
// Like runCommand, but pipes output and prefixes every line with a colored
|
|
53
|
+
// [label] — for running many commands concurrently without unreadable
|
|
54
|
+
// interleaving. Rejects on non-zero exit.
|
|
55
|
+
export const runCommandPrefixed = (label, command, args, options = {}) => new Promise((resolve, reject) => {
|
|
56
|
+
const validArgs = args.filter((a) => !!a);
|
|
57
|
+
const prefix = `\x1b[${options.color ?? 36}m[${label}]\x1b[0m `;
|
|
58
|
+
const child = spawn(command, validArgs, {
|
|
59
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
60
|
+
// Shell only on Windows (to resolve npm/aws/cdk .cmd shims). On posix, run
|
|
61
|
+
// without a shell so the already-array args are passed straight to the
|
|
62
|
+
// program and can't be re-interpreted by `sh -c` — no command injection via
|
|
63
|
+
// interpolated values (stack names, CI-supplied env, etc.).
|
|
64
|
+
shell: process.platform === 'win32',
|
|
65
|
+
cwd: options.cwd ?? process.cwd(),
|
|
66
|
+
env: { ...process.env, ...(options.env ?? {}) },
|
|
67
|
+
});
|
|
68
|
+
const attach = (stream, out) => {
|
|
69
|
+
let buffered = '';
|
|
70
|
+
stream.on('data', (chunk) => {
|
|
71
|
+
buffered += chunk.toString();
|
|
72
|
+
const lines = buffered.split('\n');
|
|
73
|
+
buffered = lines.pop() ?? '';
|
|
74
|
+
lines.forEach((line) => out.write(`${prefix}${line}\n`));
|
|
75
|
+
});
|
|
76
|
+
stream.on('end', () => {
|
|
77
|
+
if (buffered)
|
|
78
|
+
out.write(`${prefix}${buffered}\n`);
|
|
79
|
+
});
|
|
80
|
+
};
|
|
81
|
+
attach(child.stdout, process.stdout);
|
|
82
|
+
attach(child.stderr, process.stderr);
|
|
83
|
+
child.on('error', (error) => reject(error));
|
|
84
|
+
child.on('exit', (code, signal) => {
|
|
85
|
+
if (signal)
|
|
86
|
+
return reject(new Error(`[${label}] ${command} was killed with signal ${signal}`));
|
|
87
|
+
if (code)
|
|
88
|
+
return reject(new Error(`[${label}] ${command} exited with code ${code}`));
|
|
89
|
+
return resolve();
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
//# sourceMappingURL=runCommand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runCommand.js","sourceRoot":"","sources":["../../../src/lib/runCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAYtC,2EAA2E;AAC3E,kDAAkD;AAClD,MAAM,CAAC,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,CAA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AAC,KAAK,EAAE,GAAG,EAAE;YACpB,IAAI,QAAQ;gBAAE,GAAG,CAAC,KAAK,CAAC,GAAG,MAAM,GAAG,QAAQ,IAAI,CAAC,CAAC;QACpD,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;IAEF,MAAM,CAAC,KAAK,CAAC,MAAkB,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IACjD,MAAM,CAAC,KAAK,CAAC,MAAkB,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IAEjD,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,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","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,108 @@
|
|
|
1
|
+
// Run tasks with at most `limit` in flight; never rejects — failures come back
|
|
2
|
+
// labelled so a whole wave can finish before we report what broke.
|
|
3
|
+
export const runTasks = async (tasks, limit) => {
|
|
4
|
+
const failures = [];
|
|
5
|
+
let nextIndex = 0;
|
|
6
|
+
const workerCount = Math.max(1, Math.min(limit, tasks.length));
|
|
7
|
+
await Promise.all(Array.from({ length: workerCount }, async () => {
|
|
8
|
+
while (nextIndex < tasks.length) {
|
|
9
|
+
const task = tasks[nextIndex];
|
|
10
|
+
nextIndex += 1;
|
|
11
|
+
try {
|
|
12
|
+
await task.run();
|
|
13
|
+
}
|
|
14
|
+
catch (error) {
|
|
15
|
+
failures.push({ label: task.label, error: error });
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}));
|
|
19
|
+
return failures;
|
|
20
|
+
};
|
|
21
|
+
// Run tasks with at most `limit` in flight, but a task only starts once every
|
|
22
|
+
// task in its `deps` has succeeded. A failure doesn't stop unrelated tasks;
|
|
23
|
+
// dependents of the failed task are skipped (logged, not returned as failures,
|
|
24
|
+
// the root cause already is). Never rejects. Tasks left unstartable by a
|
|
25
|
+
// dependency cycle come back as failures.
|
|
26
|
+
export const runDependencyTasks = async (tasks, limit) => {
|
|
27
|
+
const failures = [];
|
|
28
|
+
const succeeded = new Set();
|
|
29
|
+
const failed = new Set();
|
|
30
|
+
const started = new Set();
|
|
31
|
+
const pipelines = [];
|
|
32
|
+
let slots = Math.max(1, limit);
|
|
33
|
+
const waiting = [];
|
|
34
|
+
const acquire = async () => {
|
|
35
|
+
if (slots > 0) {
|
|
36
|
+
slots -= 1;
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
await new Promise((resolve) => waiting.push(resolve));
|
|
40
|
+
};
|
|
41
|
+
const release = () => {
|
|
42
|
+
const next = waiting.shift();
|
|
43
|
+
if (next) {
|
|
44
|
+
next();
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
slots += 1;
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
const runOne = async (task) => {
|
|
51
|
+
await acquire();
|
|
52
|
+
try {
|
|
53
|
+
await task.run();
|
|
54
|
+
succeeded.add(task.id);
|
|
55
|
+
}
|
|
56
|
+
catch (error) {
|
|
57
|
+
failed.add(task.id);
|
|
58
|
+
failures.push({ label: task.label, error: error });
|
|
59
|
+
}
|
|
60
|
+
finally {
|
|
61
|
+
release();
|
|
62
|
+
}
|
|
63
|
+
launchReady();
|
|
64
|
+
};
|
|
65
|
+
// Repeatedly sweep until stable: launching one task or cascading one skip can
|
|
66
|
+
// unblock (or block) tasks earlier in the list.
|
|
67
|
+
const launchReady = () => {
|
|
68
|
+
let changed = true;
|
|
69
|
+
while (changed) {
|
|
70
|
+
changed = false;
|
|
71
|
+
for (const task of tasks) {
|
|
72
|
+
if (started.has(task.id))
|
|
73
|
+
continue;
|
|
74
|
+
if (task.deps.some((dep) => failed.has(dep))) {
|
|
75
|
+
started.add(task.id);
|
|
76
|
+
failed.add(task.id); // cascade so transitive dependents skip too
|
|
77
|
+
console.log(`Skipping ${task.label} (a dependency failed)`);
|
|
78
|
+
changed = true;
|
|
79
|
+
}
|
|
80
|
+
else if (task.deps.every((dep) => succeeded.has(dep))) {
|
|
81
|
+
started.add(task.id);
|
|
82
|
+
pipelines.push(runOne(task));
|
|
83
|
+
changed = true;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
launchReady();
|
|
89
|
+
// runOne re-invokes launchReady as tasks finish, pushing newly unblocked
|
|
90
|
+
// pipelines while earlier ones are being awaited; drain until it stays empty.
|
|
91
|
+
while (pipelines.length > 0) {
|
|
92
|
+
await Promise.all(pipelines.splice(0, pipelines.length));
|
|
93
|
+
}
|
|
94
|
+
for (const task of tasks) {
|
|
95
|
+
if (!started.has(task.id)) {
|
|
96
|
+
failures.push({ label: task.label, error: new Error('unstartable: dependency cycle') });
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
return failures;
|
|
100
|
+
};
|
|
101
|
+
export const assertNoFailures = (phaseName, failures) => {
|
|
102
|
+
if (failures.length === 0)
|
|
103
|
+
return;
|
|
104
|
+
console.error(`\n${phaseName} failed for:`);
|
|
105
|
+
failures.forEach((failure) => console.error(` ${failure.label}: ${failure.error.message}`));
|
|
106
|
+
throw new Error(`${phaseName}: ${failures.length} task(s) failed`);
|
|
107
|
+
};
|
|
108
|
+
//# 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;AACnE,MAAM,CAAC,MAAM,QAAQ,GAAG,KAAK,EAAE,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,KAAK,IAAI,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,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,KAAK,EAAE,KAAc,EAAE,CAAC,CAAC;YAC9D,CAAC;QACH,CAAC;IACH,CAAC,CAAC,CACH,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,CAAC,IAAI,CAAC,CAAC,CAAC;oBAC7B,OAAO,GAAG,IAAI,CAAC;gBACjB,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC,CAAC;IAEF,WAAW,EAAE,CAAC;IACd,yEAAyE;IACzE,8EAA8E;IAC9E,OAAO,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC5B,MAAM,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC;IAC3D,CAAC;IAED,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC;YAC1B,QAAQ,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,KAAK,CAAC,+BAA+B,CAAC,EAAE,CAAC,CAAC;QAC1F,CAAC;IACH,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,SAAiB,EAAE,QAAuB,EAAQ,EAAE;IACnF,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO;IAClC,OAAO,CAAC,KAAK,CAAC,KAAK,SAAS,cAAc,CAAC,CAAC;IAC5C,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,OAAO,CAAC,KAAK,KAAK,OAAO,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;IAC7F,MAAM,IAAI,KAAK,CAAC,GAAG,SAAS,KAAK,QAAQ,CAAC,MAAM,iBAAiB,CAAC,CAAC;AACrE,CAAC,CAAC","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 @@
|
|
|
1
|
+
{"version":3,"file":"timing.js","sourceRoot":"","sources":["../../../src/lib/timing.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,IAAY,EAAQ,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAEvE,MAAM,CAAC,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","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,51 @@
|
|
|
1
|
+
// Keeps workspace packages' declaration output (dist/*.d.ts) fresh while
|
|
2
|
+
// `qpq go:dev` runs. The rspack dev builds bundle workspace source directly,
|
|
3
|
+
// so this watcher only feeds the editor and validate-ts, which resolve
|
|
4
|
+
// cross-package types through each package's built declarations.
|
|
5
|
+
//
|
|
6
|
+
// One `tsc -b --watch` over every workspace package that ships types; routine
|
|
7
|
+
// watch chatter is dropped so only real compile errors reach the shared
|
|
8
|
+
// terminal. Opt out with `--no-types`.
|
|
9
|
+
import { getWorkspacePackageDirs } from '@qpqjs/deploy-rspack';
|
|
10
|
+
import { spawn } from 'child_process';
|
|
11
|
+
import fs from 'fs';
|
|
12
|
+
import path from 'path';
|
|
13
|
+
// Routine tsc watch status lines; everything else is worth showing.
|
|
14
|
+
const routineTscPatterns = [/Starting compilation in watch mode/, /File change detected/, /Found 0 errors/];
|
|
15
|
+
const isRoutineTscLine = (line) => routineTscPatterns.some((pattern) => pattern.test(line));
|
|
16
|
+
// Forwards non-routine tsc output line by line under a [types] prefix.
|
|
17
|
+
const forwardTscOutput = (chunk) => {
|
|
18
|
+
for (const line of chunk.toString().split('\n')) {
|
|
19
|
+
if (line.trim().length === 0 || isRoutineTscLine(line)) {
|
|
20
|
+
continue;
|
|
21
|
+
}
|
|
22
|
+
console.log(`[types] ${line}`);
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
// A workspace package wants declaration watching when it has a tsconfig and
|
|
26
|
+
// publishes types from its build output. Packages bundled by rspack (views,
|
|
27
|
+
// service handlers) don't ship types and are skipped.
|
|
28
|
+
const isTypedWorkspacePackage = (dir) => {
|
|
29
|
+
if (!fs.existsSync(path.join(dir, 'tsconfig.json'))) {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
const packageJson = JSON.parse(fs.readFileSync(path.join(dir, 'package.json'), 'utf-8'));
|
|
33
|
+
return !!(packageJson.types || packageJson.typings);
|
|
34
|
+
};
|
|
35
|
+
export const startTypeWatcher = (root) => {
|
|
36
|
+
const projectDirs = getWorkspacePackageDirs(root).filter(isTypedWorkspacePackage);
|
|
37
|
+
if (projectDirs.length === 0) {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
const relativeDirs = projectDirs.map((dir) => path.relative(root, dir));
|
|
41
|
+
const child = spawn('npx', ['tsc', '-b', ...relativeDirs, '--watch', '--preserveWatchOutput', '--pretty'], {
|
|
42
|
+
cwd: root,
|
|
43
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
44
|
+
shell: process.platform === 'win32',
|
|
45
|
+
});
|
|
46
|
+
child.stdout?.on('data', forwardTscOutput);
|
|
47
|
+
child.stderr?.on('data', forwardTscOutput);
|
|
48
|
+
console.log(`Type watcher: tsc -b --watch over ${relativeDirs.length} workspace packages (disable with --no-types).`);
|
|
49
|
+
return child;
|
|
50
|
+
};
|
|
51
|
+
//# sourceMappingURL=typeWatcher.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typeWatcher.js","sourceRoot":"","sources":["../../../src/lib/typeWatcher.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,6EAA6E;AAC7E,uEAAuE;AACvE,iEAAiE;AACjE,EAAE;AACF,8EAA8E;AAC9E,wEAAwE;AACxE,uCAAuC;AACvC,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAE/D,OAAO,EAAgB,KAAK,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,oEAAoE;AACpE,MAAM,kBAAkB,GAAG,CAAC,oCAAoC,EAAE,sBAAsB,EAAE,gBAAgB,CAAC,CAAC;AAE5G,MAAM,gBAAgB,GAAG,CAAC,IAAY,EAAW,EAAE,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;AAE7G,uEAAuE;AACvE,MAAM,gBAAgB,GAAG,CAAC,KAAa,EAAQ,EAAE;IAC/C,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;QAChD,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,IAAI,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC;YACvD,SAAS;QACX,CAAC;QACD,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC;IACjC,CAAC;AACH,CAAC,CAAC;AA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AAC;IAC3C,KAAK,CAAC,MAAM,EAAE,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","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,65 @@
|
|
|
1
|
+
import { JavascriptRuntimeArchitecture } from '@qpqjs/core';
|
|
2
|
+
import { USER_SCRIPT_BUILDER_LAYER_MODULES } from '@qpqjs/user-script';
|
|
3
|
+
import { execFileSync } from 'child_process';
|
|
4
|
+
import fs from 'fs';
|
|
5
|
+
import path from 'path';
|
|
6
|
+
const MIN_NPM_MAJOR = 9;
|
|
7
|
+
// Lambda's layer layout: /opt/nodejs/node_modules is on the function's module path.
|
|
8
|
+
const LAYER_NODE_DIR = 'nodejs';
|
|
9
|
+
const npmCpuByArchitecture = {
|
|
10
|
+
[JavascriptRuntimeArchitecture.Arm64]: 'arm64',
|
|
11
|
+
[JavascriptRuntimeArchitecture.X86_64]: 'x64',
|
|
12
|
+
};
|
|
13
|
+
/** The npm cpu name for a lambda architecture. */
|
|
14
|
+
export const getBuilderLayerCpu = (architecture) => npmCpuByArchitecture[architecture];
|
|
15
|
+
/**
|
|
16
|
+
* The npm argv that installs rspack for linux and the lambda's cpu into the layer's
|
|
17
|
+
* nodejs directory. Pure, so the exact invocation is testable without running npm.
|
|
18
|
+
*/
|
|
19
|
+
export const getBuilderLayerInstallArgs = ({ outDir, architecture, rspackVersion }) => [
|
|
20
|
+
'install',
|
|
21
|
+
'--prefix',
|
|
22
|
+
path.join(outDir, LAYER_NODE_DIR),
|
|
23
|
+
'--os=linux',
|
|
24
|
+
`--cpu=${getBuilderLayerCpu(architecture)}`,
|
|
25
|
+
'--libc=glibc',
|
|
26
|
+
'--omit=dev',
|
|
27
|
+
'--no-save',
|
|
28
|
+
'--no-package-lock',
|
|
29
|
+
'--no-audit',
|
|
30
|
+
'--no-fund',
|
|
31
|
+
`@rspack/core@${rspackVersion}`,
|
|
32
|
+
];
|
|
33
|
+
const parseMajor = (version) => parseInt(version.split('.')[0], 10);
|
|
34
|
+
const defaultRunners = {
|
|
35
|
+
getNpmVersion: () => execFileSync('npm', ['--version'], { encoding: 'utf8' }).trim(),
|
|
36
|
+
runNpm: (args) => {
|
|
37
|
+
execFileSync('npm', args, { stdio: 'inherit' });
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Produces the user-script builder layer directory: `<outDir>/nodejs/node_modules` holding
|
|
42
|
+
* rspack and its linux binding for the lambda's cpu. Empties `outDir` first and verifies
|
|
43
|
+
* the binding landed. Needs npm 9 or later for the `--os`/`--cpu` flags.
|
|
44
|
+
*/
|
|
45
|
+
export const buildUserScriptBuilderLayer = (options, runners = defaultRunners) => {
|
|
46
|
+
const npmVersion = runners.getNpmVersion();
|
|
47
|
+
if (parseMajor(npmVersion) < MIN_NPM_MAJOR) {
|
|
48
|
+
throw new Error(`script:builder-layer needs npm ${MIN_NPM_MAJOR} or later for --os/--cpu installs; found ${npmVersion}`);
|
|
49
|
+
}
|
|
50
|
+
const nodeDir = path.join(options.outDir, LAYER_NODE_DIR);
|
|
51
|
+
fs.rmSync(options.outDir, { recursive: true, force: true });
|
|
52
|
+
fs.mkdirSync(nodeDir, { recursive: true });
|
|
53
|
+
fs.writeFileSync(path.join(nodeDir, 'package.json'), JSON.stringify({ name: 'user-script-builder-layer', private: true }, null, 2));
|
|
54
|
+
runners.runNpm(getBuilderLayerInstallArgs(options));
|
|
55
|
+
const bindingDir = path.join(nodeDir, 'node_modules', '@rspack', `binding-linux-${getBuilderLayerCpu(options.architecture)}-gnu`);
|
|
56
|
+
if (!fs.existsSync(bindingDir)) {
|
|
57
|
+
throw new Error(`script:builder-layer: expected the rspack binding at [${bindingDir}] after install; the layer would not load on lambda`);
|
|
58
|
+
}
|
|
59
|
+
const installed = USER_SCRIPT_BUILDER_LAYER_MODULES.filter((name) => fs.existsSync(path.join(nodeDir, 'node_modules', name)));
|
|
60
|
+
if (installed.length !== USER_SCRIPT_BUILDER_LAYER_MODULES.length) {
|
|
61
|
+
throw new Error(`script:builder-layer: the layer is missing ${USER_SCRIPT_BUILDER_LAYER_MODULES.filter((name) => !installed.includes(name)).join(', ')}`);
|
|
62
|
+
}
|
|
63
|
+
return nodeDir;
|
|
64
|
+
};
|
|
65
|
+
//# sourceMapping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IAAI,CAAC,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,iBAAiB,kBAAkB,CAAC,OAAO,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;IAClI,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;QAC/B,MAAM,IAAI,KAAK,CAAC,yDAAyD,UAAU,qDAAqD,CAAC,CAAC;IAC5I,CAAC;IAED,MAAM,SAAS,GAAG,iCAAiC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,cAAc,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;IAC9H,IAAI,SAAS,CAAC,MAAM,KAAK,iCAAiC,CAAC,MAAM,EAAE,CAAC;QAClE,MAAM,IAAI,KAAK,CAAC,8CAA8C,iCAAiC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC5J,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC","sourcesContent":["import { JavascriptRuntimeArchitecture } from '@qpqjs/core';\nimport { USER_SCRIPT_BUILDER_LAYER_MODULES } from '@qpqjs/user-script';\n\nimport { execFileSync } from 'child_process';\nimport fs from 'fs';\nimport path from 'path';\n\nconst MIN_NPM_MAJOR = 9;\n\n// Lambda's layer layout: /opt/nodejs/node_modules is on the function's module path.\nconst LAYER_NODE_DIR = 'nodejs';\n\nconst npmCpuByArchitecture: Record<JavascriptRuntimeArchitecture, 'arm64' | 'x64'> = {\n [JavascriptRuntimeArchitecture.Arm64]: 'arm64',\n [JavascriptRuntimeArchitecture.X86_64]: 'x64',\n};\n\nexport type BuilderLayerInstallOptions = {\n outDir: string;\n architecture: JavascriptRuntimeArchitecture;\n rspackVersion: string;\n};\n\n/** The npm cpu name for a lambda architecture. */\nexport const getBuilderLayerCpu = (architecture: JavascriptRuntimeArchitecture): 'arm64' | 'x64' => npmCpuByArchitecture[architecture];\n\n/**\n * The npm argv that installs rspack for linux and the lambda's cpu into the layer's\n * nodejs directory. Pure, so the exact invocation is testable without running npm.\n */\nexport const getBuilderLayerInstallArgs = ({ outDir, architecture, rspackVersion }: BuilderLayerInstallOptions): string[] => [\n 'install',\n '--prefix',\n path.join(outDir, LAYER_NODE_DIR),\n '--os=linux',\n `--cpu=${getBuilderLayerCpu(architecture)}`,\n '--libc=glibc',\n '--omit=dev',\n '--no-save',\n '--no-package-lock',\n '--no-audit',\n '--no-fund',\n `@rspack/core@${rspackVersion}`,\n];\n\nconst parseMajor = (version: string): number => parseInt(version.split('.')[0], 10);\n\nexport type BuilderLayerRunners = {\n getNpmVersion: () => string;\n runNpm: (args: string[]) => void;\n};\n\nconst defaultRunners: BuilderLayerRunners = {\n getNpmVersion: () => execFileSync('npm', ['--version'], { encoding: 'utf8' }).trim(),\n runNpm: (args) => {\n execFileSync('npm', args, { stdio: 'inherit' });\n },\n};\n\n/**\n * Produces the user-script builder layer directory: `<outDir>/nodejs/node_modules` holding\n * rspack and its linux binding for the lambda's cpu. Empties `outDir` first and verifies\n * the binding landed. Needs npm 9 or later for the `--os`/`--cpu` flags.\n */\nexport const buildUserScriptBuilderLayer = (options: BuilderLayerInstallOptions, runners: BuilderLayerRunners = defaultRunners): string => {\n const npmVersion = runners.getNpmVersion();\n if (parseMajor(npmVersion) < MIN_NPM_MAJOR) {\n throw new Error(`script:builder-layer needs npm ${MIN_NPM_MAJOR} or later for --os/--cpu installs; found ${npmVersion}`);\n }\n\n const nodeDir = path.join(options.outDir, LAYER_NODE_DIR);\n fs.rmSync(options.outDir, { recursive: true, force: true });\n fs.mkdirSync(nodeDir, { recursive: true });\n fs.writeFileSync(path.join(nodeDir, 'package.json'), JSON.stringify({ name: 'user-script-builder-layer', private: true }, null, 2));\n\n runners.runNpm(getBuilderLayerInstallArgs(options));\n\n const bindingDir = path.join(nodeDir, 'node_modules', '@rspack', `binding-linux-${getBuilderLayerCpu(options.architecture)}-gnu`);\n if (!fs.existsSync(bindingDir)) {\n throw new Error(`script:builder-layer: expected the rspack binding at [${bindingDir}] after install; the layer would not load on lambda`);\n }\n\n const installed = USER_SCRIPT_BUILDER_LAYER_MODULES.filter((name) => fs.existsSync(path.join(nodeDir, 'node_modules', name)));\n if (installed.length !== USER_SCRIPT_BUILDER_LAYER_MODULES.length) {\n throw new Error(`script:builder-layer: the layer is missing ${USER_SCRIPT_BUILDER_LAYER_MODULES.filter((name) => !installed.includes(name)).join(', ')}`);\n }\n\n return nodeDir;\n};\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Writes the user-script template project into `targetDir`, naming the package after
|
|
3
|
+
* the directory and pinning @qpqjs/core to this CLI's own version. Refuses a
|
|
4
|
+
* directory that already has files in it. Returns the relative paths written.
|
|
5
|
+
*/
|
|
6
|
+
export declare const createUserScriptProject: (targetDir: string) => string[];
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import { getOwnPackageRoot } from './packageRoot';
|
|
4
|
+
const TEMPLATE_DIR = 'templates/user-script';
|
|
5
|
+
// Shipped as `gitignore` because npm drops `.gitignore` files from a published package.
|
|
6
|
+
const RENAMED_ON_COPY = { gitignore: '.gitignore' };
|
|
7
|
+
const TEXT_SUBSTITUTIONS = ['package.json', 'README.md'];
|
|
8
|
+
const readOwnVersion = () => JSON.parse(fs.readFileSync(path.join(getOwnPackageRoot(), 'package.json'), 'utf8')).version;
|
|
9
|
+
const listFilesRecursive = (dir, base = dir) => fs.readdirSync(dir, { withFileTypes: true }).flatMap((entry) => {
|
|
10
|
+
const fullPath = path.join(dir, entry.name);
|
|
11
|
+
return entry.isDirectory() ? listFilesRecursive(fullPath, base) : [path.relative(base, fullPath)];
|
|
12
|
+
});
|
|
13
|
+
const substitute = (text, packageName, qpqVersion) => text.replace(/__PACKAGE_NAME__/g, packageName).replace(/__QPQ_VERSION__/g, qpqVersion);
|
|
14
|
+
/**
|
|
15
|
+
* Writes the user-script template project into `targetDir`, naming the package after
|
|
16
|
+
* the directory and pinning @qpqjs/core to this CLI's own version. Refuses a
|
|
17
|
+
* directory that already has files in it. Returns the relative paths written.
|
|
18
|
+
*/
|
|
19
|
+
export const createUserScriptProject = (targetDir) => {
|
|
20
|
+
const absoluteTarget = path.resolve(targetDir);
|
|
21
|
+
if (fs.existsSync(absoluteTarget) && fs.readdirSync(absoluteTarget).length > 0) {
|
|
22
|
+
throw new Error(`[${absoluteTarget}] is not empty; script:new only writes into a new or empty directory`);
|
|
23
|
+
}
|
|
24
|
+
const templateRoot = path.join(getOwnPackageRoot(), TEMPLATE_DIR);
|
|
25
|
+
const packageName = path.basename(absoluteTarget);
|
|
26
|
+
const qpqVersion = readOwnVersion();
|
|
27
|
+
const written = [];
|
|
28
|
+
for (const relativePath of listFilesRecursive(templateRoot)) {
|
|
29
|
+
const basename = path.basename(relativePath);
|
|
30
|
+
const outputRelative = path.join(path.dirname(relativePath), RENAMED_ON_COPY[basename] ?? basename);
|
|
31
|
+
const outputPath = path.join(absoluteTarget, outputRelative);
|
|
32
|
+
fs.mkdirSync(path.dirname(outputPath), { recursive: true });
|
|
33
|
+
const source = fs.readFileSync(path.join(templateRoot, relativePath), 'utf8');
|
|
34
|
+
fs.writeFileSync(outputPath, TEXT_SUBSTITUTIONS.includes(basename) ? substitute(source, packageName, qpqVersion) : source);
|
|
35
|
+
written.push(outputRelative);
|
|
36
|
+
}
|
|
37
|
+
return written.sort();
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=userScriptTemplate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"userScriptTemplate.js","sourceRoot":"","sources":["../../../src/lib/userScriptTemplate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IA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C,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;QAC3H,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IAC/B,CAAC;IAED,OAAO,OAAO,CAAC,IAAI,EAAE,CAAC;AACxB,CAAC,CAAC","sourcesContent":["import fs from 'fs';\nimport path from 'path';\n\nimport { getOwnPackageRoot } from './packageRoot';\n\nconst TEMPLATE_DIR = 'templates/user-script';\n\n// Shipped as `gitignore` because npm drops `.gitignore` files from a published package.\nconst RENAMED_ON_COPY: Record<string, string> = { gitignore: '.gitignore' };\n\nconst TEXT_SUBSTITUTIONS = ['package.json', 'README.md'];\n\nconst readOwnVersion = (): string => JSON.parse(fs.readFileSync(path.join(getOwnPackageRoot(), 'package.json'), 'utf8')).version as string;\n\nconst listFilesRecursive = (dir: string, base: string = dir): string[] =>\n fs.readdirSync(dir, { withFileTypes: true }).flatMap((entry) => {\n const fullPath = path.join(dir, entry.name);\n return entry.isDirectory() ? listFilesRecursive(fullPath, base) : [path.relative(base, fullPath)];\n });\n\nconst substitute = (text: string, packageName: string, qpqVersion: string): string =>\n text.replace(/__PACKAGE_NAME__/g, packageName).replace(/__QPQ_VERSION__/g, qpqVersion);\n\n/**\n * Writes the user-script template project into `targetDir`, naming the package after\n * the directory and pinning @qpqjs/core to this CLI's own version. Refuses a\n * directory that already has files in it. Returns the relative paths written.\n */\nexport const createUserScriptProject = (targetDir: string): string[] => {\n const absoluteTarget = path.resolve(targetDir);\n if (fs.existsSync(absoluteTarget) && fs.readdirSync(absoluteTarget).length > 0) {\n throw new Error(`[${absoluteTarget}] is not empty; script:new only writes into a new or empty directory`);\n }\n\n const templateRoot = path.join(getOwnPackageRoot(), TEMPLATE_DIR);\n const packageName = path.basename(absoluteTarget);\n const qpqVersion = readOwnVersion();\n\n const written: string[] = [];\n for (const relativePath of listFilesRecursive(templateRoot)) {\n const basename = path.basename(relativePath);\n const outputRelative = path.join(path.dirname(relativePath), RENAMED_ON_COPY[basename] ?? basename);\n const outputPath = path.join(absoluteTarget, outputRelative);\n fs.mkdirSync(path.dirname(outputPath), { recursive: true });\n\n const source = fs.readFileSync(path.join(templateRoot, relativePath), 'utf8');\n fs.writeFileSync(outputPath, TEXT_SUBSTITUTIONS.includes(basename) ? substitute(source, packageName, qpqVersion) : source);\n written.push(outputRelative);\n }\n\n return written.sort();\n};\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Views build — programmatic (getViewsRspackConfig), platform-neutral. Where
|
|
2
|
+
// the built views get hosted is a platform driver concern (see
|
|
3
|
+
// platforms/<platform>/viewsSync).
|
|
4
|
+
import { getViewsRspackConfig, runRspack } from '@qpqjs/deploy-rspack';
|
|
5
|
+
import path from 'path';
|
|
6
|
+
import { getRoot, getServiceDirectory } from './discovery';
|
|
7
|
+
export const bundleViews = async (appName, serviceName) => {
|
|
8
|
+
const viewsDir = path.join(getServiceDirectory(appName, serviceName), 'views');
|
|
9
|
+
process.env.NODE_ENV = 'production';
|
|
10
|
+
delete process.env.LOCAL_DEV_SERVER;
|
|
11
|
+
await runRspack(getViewsRspackConfig(viewsDir));
|
|
12
|
+
};
|
|
13
|
+
export const getViewsDistDir = (appName, serviceName) => path.join(getRoot(), 'dist', 'apps', appName, 'services', serviceName, 'views');
|
|
14
|
+
//# sourceMappingURL=views.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"views.js","sourceRoot":"","sources":["../../../src/lib/views.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,+DAA+D;AAC/D,mCAAmC;AACnC,OAAO,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEvE,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAE3D,MAAM,CAAC,MAAM,WAAW,GAAG,KAAK,EAAE,OAAe,EAAE,WAAmB,EAAiB,EAAE;IACvF,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,mBAAmB,CAAC,OAAO,EAAE,WAAW,CAAC,EAAE,OAAO,CAAC,CAAC;IAE/E,OAAO,CAAC,GAAG,CAAC,QAAQ,GAAG,YAAY,CAAC;IACpC,OAAO,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC;IAEpC,MAAM,SAAS,CAAC,oBAAoB,CAAC,QAAQ,CAAC,CAAC,CAAC;AAClD,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,OAAe,EAAE,WAAmB,EAAU,EAAE,CAC9E,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC","sourcesContent":["// Views build — programmatic (getViewsRspackConfig), platform-neutral. Where\n// the built views get hosted is a platform driver concern (see\n// platforms/<platform>/viewsSync).\nimport { getViewsRspackConfig, runRspack } from '@qpqjs/deploy-rspack';\n\nimport path from 'path';\n\nimport { getRoot, getServiceDirectory } from './discovery';\n\nexport const bundleViews = async (appName: string, serviceName: string): Promise<void> => {\n const viewsDir = path.join(getServiceDirectory(appName, serviceName), 'views');\n\n process.env.NODE_ENV = 'production';\n delete process.env.LOCAL_DEV_SERVER;\n\n await runRspack(getViewsRspackConfig(viewsDir));\n};\n\nexport const getViewsDistDir = (appName: string, serviceName: string): string =>\n path.join(getRoot(), 'dist', 'apps', appName, 'services', serviceName, 'views');\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { QPQConfig } from '@qpqjs/core';
|
|
2
|
+
import { WebAddressingPorts } from '@qpqjs/dev-server';
|
|
3
|
+
/** Env var the views build reads to bake `WebAddressing` into every bundle. */
|
|
4
|
+
export declare const QPQ_WEB_ADDRESSING_ENV = "QPQ_WEB_ADDRESSING";
|
|
5
|
+
/** Bakes port-mode addressing into the views builds that follow, until `clearWebAddressingEnv`. */
|
|
6
|
+
export declare const setWebAddressingEnv: (qpqConfigs: QPQConfig[], ports: WebAddressingPorts) => void;
|
|
7
|
+
export declare const clearWebAddressingEnv: () => void;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { getWebAddressing } from '@qpqjs/dev-server';
|
|
2
|
+
/** Env var the views build reads to bake `WebAddressing` into every bundle. */
|
|
3
|
+
export const QPQ_WEB_ADDRESSING_ENV = 'QPQ_WEB_ADDRESSING';
|
|
4
|
+
/** Bakes port-mode addressing into the views builds that follow, until `clearWebAddressingEnv`. */
|
|
5
|
+
export const setWebAddressingEnv = (qpqConfigs, ports) => {
|
|
6
|
+
process.env[QPQ_WEB_ADDRESSING_ENV] = JSON.stringify(getWebAddressing(qpqConfigs, ports));
|
|
7
|
+
};
|
|
8
|
+
export const clearWebAddressingEnv = () => {
|
|
9
|
+
delete process.env[QPQ_WEB_ADDRESSING_ENV];
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=webAddressingEnv.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webAddressingEnv.js","sourceRoot":"","sources":["../../../src/lib/webAddressingEnv.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAsB,MAAM,mBAAmB,CAAC;AAEzE,+EAA+E;AAC/E,MAAM,CAAC,MAAM,sBAAsB,GAAG,oBAAoB,CAAC;AAE3D,mGAAmG;AACnG,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,UAAuB,EAAE,KAAyB,EAAQ,EAAE;IAC9F,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,gBAAgB,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC,CAAC;AAC5F,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAS,EAAE;IAC9C,OAAO,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC;AAC7C,CAAC,CAAC","sourcesContent":["import { QPQConfig } from '@qpqjs/core';\nimport { getWebAddressing, WebAddressingPorts } from '@qpqjs/dev-server';\n\n/** Env var the views build reads to bake `WebAddressing` into every bundle. */\nexport const QPQ_WEB_ADDRESSING_ENV = 'QPQ_WEB_ADDRESSING';\n\n/** Bakes port-mode addressing into the views builds that follow, until `clearWebAddressingEnv`. */\nexport const setWebAddressingEnv = (qpqConfigs: QPQConfig[], ports: WebAddressingPorts): void => {\n process.env[QPQ_WEB_ADDRESSING_ENV] = JSON.stringify(getWebAddressing(qpqConfigs, ports));\n};\n\nexport const clearWebAddressingEnv = (): void => {\n delete process.env[QPQ_WEB_ADDRESSING_ENV];\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isAwsCredentialsValid: () => Promise<boolean>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { GetCallerIdentityCommand, STSClient } from '@aws-sdk/client-sts';
|
|
2
|
+
export const isAwsCredentialsValid = async () => {
|
|
3
|
+
try {
|
|
4
|
+
const client = new STSClient({
|
|
5
|
+
region: process.env.AWS_REGION || process.env.AWS_DEFAULT_REGION || 'us-east-1',
|
|
6
|
+
});
|
|
7
|
+
await client.send(new GetCallerIdentityCommand({}));
|
|
8
|
+
return true;
|
|
9
|
+
}
|
|
10
|
+
catch (error) {
|
|
11
|
+
console.log('Error validating AWS credentials:', error);
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=awsCredentials.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"awsCredentials.js","sourceRoot":"","sources":["../../../../src/platforms/aws/awsCredentials.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAE1E,MAAM,CAAC,MAAM,qBAAqB,GAAG,KAAK,IAAsB,EAAE;IAChE,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC;YAC3B,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,UAAU,IAAI,OAAO,CAAC,GAAG,CAAC,kBAAkB,IAAI,WAAW;SAChF,CAAC,CAAC;QACH,MAAM,MAAM,CAAC,IAAI,CAAC,IAAI,wBAAwB,CAAC,EAAE,CAAC,CAAC,CAAC;QACpD,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,GAAG,CAAC,mCAAmC,EAAE,KAAK,CAAC,CAAC;QACxD,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC,CAAC","sourcesContent":["import { GetCallerIdentityCommand, STSClient } from '@aws-sdk/client-sts';\n\nexport const isAwsCredentialsValid = async (): Promise<boolean> => {\n try {\n const client = new STSClient({\n region: process.env.AWS_REGION || process.env.AWS_DEFAULT_REGION || 'us-east-1',\n });\n await client.send(new GetCallerIdentityCommand({}));\n return true;\n } catch (error) {\n console.log('Error validating AWS credentials:', error);\n return false;\n }\n};\n"]}
|