@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 @@
|
|
|
1
|
+
{"version":3,"file":"userScriptBuilderLayer.js","sourceRoot":"","sources":["../../../src/lib/userScriptBuilderLayer.ts"],"names":[],"mappings":";;;;;;AAAA,sCAA4D;AAC5D,oDAAuE;AAEvE,iDAA6C;AAC7C,4CAAoB;AACpB,gDAAwB;AAExB,MAAM,aAAa,GAAG,CAAC,CAAC;AAExB,oFAAoF;AACpF,MAAM,cAAc,GAAG,QAAQ,CAAC;AAEhC,MAAM,oBAAoB,GAA2D;IACnF,CAAC,oCAA6B,CAAC,KAAK,CAAC,EAAE,OAAO;IAC9C,CAAC,oCAA6B,CAAC,MAAM,CAAC,EAAE,KAAK;CAC9C,CAAC;AAQF,kDAAkD;AAC3C,MAAM,kBAAkB,GAAG,CAAC,YAA2C,EAAmB,EAAE,CAAC,oBAAoB,CAAC,YAAY,CAAC,CAAC;AAA1H,QAAA,kBAAkB,sBAAwG;AAEvI;;;GAGG;AACI,MAAM,0BAA0B,GAAG,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,aAAa,EAA8B,EAAY,EAAE,CAAC;IAC3H,SAAS;IACT,UAAU;IACV,cAAI,CAAC,IAAI,CAAC,MAAM,EAAE,cAAc,CAAC;IACjC,YAAY;IACZ,SAAS,IAAA,0BAAkB,EAAC,YAAY,CAAC,EAAE;IAC3C,cAAc;IACd,YAAY;IACZ,WAAW;IACX,mBAAmB;IACnB,YAAY;IACZ,WAAW;IACX,gBAAgB,aAAa,EAAE;CAChC,CAAC;AAbW,QAAA,0BAA0B,8BAarC;AAEF,MAAM,UAAU,GAAG,CAAC,OAAe,EAAU,EAAE,CAAC,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AAC,MAAM,CAAC,IAAA,kCAA0B,EAAC,OAAO,CAAC,CAAC,CAAC;IAEpD,MAAM,UAAU,GAAG,cAAI,CAAC,IAAI,CAAC,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,iBAAiB,IAAA,0BAAkB,EAAC,OAAO,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;IAClI,IAAI,CAAC,YAAE,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;QAC/B,MAAM,IAAI,KAAK,CAAC,yDAAyD,UAAU,qDAAqD,CAAC,CAAC;IAC5I,CAAC;IAED,MAAM,SAAS,GAAG,+CAAiC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,YAAE,CAAC,UAAU,CAAC,cAAI,CAAC,IAAI,CAAC,OAAO,EAAE,cAAc,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;IAC9H,IAAI,SAAS,CAAC,MAAM,KAAK,+CAAiC,CAAC,MAAM,EAAE,CAAC;QAClE,MAAM,IAAI,KAAK,CAAC,8CAA8C,+CAAiC,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;AAxBW,QAAA,2BAA2B,+BAwBtC","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,47 @@
|
|
|
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.createUserScriptProject = void 0;
|
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const packageRoot_1 = require("./packageRoot");
|
|
10
|
+
const TEMPLATE_DIR = 'templates/user-script';
|
|
11
|
+
// Shipped as `gitignore` because npm drops `.gitignore` files from a published package.
|
|
12
|
+
const RENAMED_ON_COPY = { gitignore: '.gitignore' };
|
|
13
|
+
const TEXT_SUBSTITUTIONS = ['package.json', 'README.md'];
|
|
14
|
+
const readOwnVersion = () => JSON.parse(fs_1.default.readFileSync(path_1.default.join((0, packageRoot_1.getOwnPackageRoot)(), 'package.json'), 'utf8')).version;
|
|
15
|
+
const listFilesRecursive = (dir, base = dir) => fs_1.default.readdirSync(dir, { withFileTypes: true }).flatMap((entry) => {
|
|
16
|
+
const fullPath = path_1.default.join(dir, entry.name);
|
|
17
|
+
return entry.isDirectory() ? listFilesRecursive(fullPath, base) : [path_1.default.relative(base, fullPath)];
|
|
18
|
+
});
|
|
19
|
+
const substitute = (text, packageName, qpqVersion) => text.replace(/__PACKAGE_NAME__/g, packageName).replace(/__QPQ_VERSION__/g, qpqVersion);
|
|
20
|
+
/**
|
|
21
|
+
* Writes the user-script template project into `targetDir`, naming the package after
|
|
22
|
+
* the directory and pinning @qpqjs/core to this CLI's own version. Refuses a
|
|
23
|
+
* directory that already has files in it. Returns the relative paths written.
|
|
24
|
+
*/
|
|
25
|
+
const createUserScriptProject = (targetDir) => {
|
|
26
|
+
var _a;
|
|
27
|
+
const absoluteTarget = path_1.default.resolve(targetDir);
|
|
28
|
+
if (fs_1.default.existsSync(absoluteTarget) && fs_1.default.readdirSync(absoluteTarget).length > 0) {
|
|
29
|
+
throw new Error(`[${absoluteTarget}] is not empty; script:new only writes into a new or empty directory`);
|
|
30
|
+
}
|
|
31
|
+
const templateRoot = path_1.default.join((0, packageRoot_1.getOwnPackageRoot)(), TEMPLATE_DIR);
|
|
32
|
+
const packageName = path_1.default.basename(absoluteTarget);
|
|
33
|
+
const qpqVersion = readOwnVersion();
|
|
34
|
+
const written = [];
|
|
35
|
+
for (const relativePath of listFilesRecursive(templateRoot)) {
|
|
36
|
+
const basename = path_1.default.basename(relativePath);
|
|
37
|
+
const outputRelative = path_1.default.join(path_1.default.dirname(relativePath), (_a = RENAMED_ON_COPY[basename]) !== null && _a !== void 0 ? _a : basename);
|
|
38
|
+
const outputPath = path_1.default.join(absoluteTarget, outputRelative);
|
|
39
|
+
fs_1.default.mkdirSync(path_1.default.dirname(outputPath), { recursive: true });
|
|
40
|
+
const source = fs_1.default.readFileSync(path_1.default.join(templateRoot, relativePath), 'utf8');
|
|
41
|
+
fs_1.default.writeFileSync(outputPath, TEXT_SUBSTITUTIONS.includes(basename) ? substitute(source, packageName, qpqVersion) : source);
|
|
42
|
+
written.push(outputRelative);
|
|
43
|
+
}
|
|
44
|
+
return written.sort();
|
|
45
|
+
};
|
|
46
|
+
exports.createUserScriptProject = createUserScriptProject;
|
|
47
|
+
//# sourceMappingURL=userScriptTemplate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"userScriptTemplate.js","sourceRoot":"","sources":["../../../src/lib/userScriptTemplate.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAoB;AACpB,gDAAwB;AAExB,+CAAkD;AAElD,MAAM,YAAY,GAAG,uBAAuB,CAAC;AAE7C,wFAAwF;AACxF,MAAM,eAAe,GAA2B,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC;AAE5E,MAAM,kBAAkB,GAAG,CAAC,cAAc,EAAE,WAAW,CAAC,CAAC;AAEzD,MAAM,cAAc,GAAG,GAAW,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,YAAE,CAAC,YAAY,CAAC,cAAI,CAAC,IAAI,CAAC,IAAA,+BAAiB,GAAE,EAAE,cAAc,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,OAAiB,CAAC;AAE3I,MAAM,kBAAkB,GAAG,CAAC,GAAW,EAAE,OAAe,GAAG,EAAY,EAAE,CACvE,YAAE,CAAC,WAAW,CAAC,GAAG,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;IAC7D,MAAM,QAAQ,GAAG,cAAI,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;IA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QAAQ,CAAC,CAAC;QACpG,MAAM,UAAU,GAAG,cAAI,CAAC,IAAI,CAAC,cAAc,EAAE,cAAc,CAAC,CAAC;QAC7D,YAAE,CAAC,SAAS,CAAC,cAAI,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAE5D,MAAM,MAAM,GAAG,YAAE,CAAC,YAAY,CAAC,cAAI,CAAC,IAAI,CAAC,YAAY,EAAE,YAAY,CAAC,EAAE,MAAM,CAAC,CAAC;QAC9E,YAAE,CAAC,aAAa,CAAC,UAAU,EAAE,kBAAkB,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,MAAM,EAAE,WAAW,EAAE,UAAU,CAAC,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;AAvBW,QAAA,uBAAuB,2BAuBlC","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,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.getViewsDistDir = exports.bundleViews = void 0;
|
|
16
|
+
// Views build — programmatic (getViewsRspackConfig), platform-neutral. Where
|
|
17
|
+
// the built views get hosted is a platform driver concern (see
|
|
18
|
+
// platforms/<platform>/viewsSync).
|
|
19
|
+
const deploy_rspack_1 = require("@qpqjs/deploy-rspack");
|
|
20
|
+
const path_1 = __importDefault(require("path"));
|
|
21
|
+
const discovery_1 = require("./discovery");
|
|
22
|
+
const bundleViews = (appName, serviceName) => __awaiter(void 0, void 0, void 0, function* () {
|
|
23
|
+
const viewsDir = path_1.default.join((0, discovery_1.getServiceDirectory)(appName, serviceName), 'views');
|
|
24
|
+
process.env.NODE_ENV = 'production';
|
|
25
|
+
delete process.env.LOCAL_DEV_SERVER;
|
|
26
|
+
yield (0, deploy_rspack_1.runRspack)((0, deploy_rspack_1.getViewsRspackConfig)(viewsDir));
|
|
27
|
+
});
|
|
28
|
+
exports.bundleViews = bundleViews;
|
|
29
|
+
const getViewsDistDir = (appName, serviceName) => path_1.default.join((0, discovery_1.getRoot)(), 'dist', 'apps', appName, 'services', serviceName, 'views');
|
|
30
|
+
exports.getViewsDistDir = getViewsDistDir;
|
|
31
|
+
//# 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,wDAAuE;AAEvE,gDAAwB;AAExB,2CAA2D;AAEpD,MAAM,WAAW,GAAG,CAAO,OAAe,EAAE,WAAmB,EAAiB,EAAE;IACvF,MAAM,QAAQ,GAAG,cAAI,CAAC,IAAI,CAAC,IAAA,+BAAmB,EAAC,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,IAAA,yBAAS,EAAC,IAAA,oCAAoB,EAAC,QAAQ,CAAC,CAAC,CAAC;AAClD,CAAC,CAAA,CAAC;AAPW,QAAA,WAAW,eAOtB;AAEK,MAAM,eAAe,GAAG,CAAC,OAAe,EAAE,WAAmB,EAAU,EAAE,CAC9E,cAAI,CAAC,IAAI,CAAC,IAAA,mBAAO,GAAE,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC;AADrE,QAAA,eAAe,mBACsD","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,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.clearWebAddressingEnv = exports.setWebAddressingEnv = exports.QPQ_WEB_ADDRESSING_ENV = void 0;
|
|
4
|
+
const dev_server_1 = require("@qpqjs/dev-server");
|
|
5
|
+
/** Env var the views build reads to bake `WebAddressing` into every bundle. */
|
|
6
|
+
exports.QPQ_WEB_ADDRESSING_ENV = 'QPQ_WEB_ADDRESSING';
|
|
7
|
+
/** Bakes port-mode addressing into the views builds that follow, until `clearWebAddressingEnv`. */
|
|
8
|
+
const setWebAddressingEnv = (qpqConfigs, ports) => {
|
|
9
|
+
process.env[exports.QPQ_WEB_ADDRESSING_ENV] = JSON.stringify((0, dev_server_1.getWebAddressing)(qpqConfigs, ports));
|
|
10
|
+
};
|
|
11
|
+
exports.setWebAddressingEnv = setWebAddressingEnv;
|
|
12
|
+
const clearWebAddressingEnv = () => {
|
|
13
|
+
delete process.env[exports.QPQ_WEB_ADDRESSING_ENV];
|
|
14
|
+
};
|
|
15
|
+
exports.clearWebAddressingEnv = clearWebAddressingEnv;
|
|
16
|
+
//# sourceMappingURL=webAddressingEnv.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webAddressingEnv.js","sourceRoot":"","sources":["../../../src/lib/webAddressingEnv.ts"],"names":[],"mappings":";;;AACA,kDAAyE;AAEzE,+EAA+E;AAClE,QAAA,sBAAsB,GAAG,oBAAoB,CAAC;AAE3D,mGAAmG;AAC5F,MAAM,mBAAmB,GAAG,CAAC,UAAuB,EAAE,KAAyB,EAAQ,EAAE;IAC9F,OAAO,CAAC,GAAG,CAAC,8BAAsB,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,IAAA,6BAAgB,EAAC,UAAU,EAAE,KAAK,CAAC,CAAC,CAAC;AAC5F,CAAC,CAAC;AAFW,QAAA,mBAAmB,uBAE9B;AAEK,MAAM,qBAAqB,GAAG,GAAS,EAAE;IAC9C,OAAO,OAAO,CAAC,GAAG,CAAC,8BAAsB,CAAC,CAAC;AAC7C,CAAC,CAAC;AAFW,QAAA,qBAAqB,yBAEhC","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,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.isAwsCredentialsValid = void 0;
|
|
13
|
+
const client_sts_1 = require("@aws-sdk/client-sts");
|
|
14
|
+
const isAwsCredentialsValid = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
15
|
+
try {
|
|
16
|
+
const client = new client_sts_1.STSClient({
|
|
17
|
+
region: process.env.AWS_REGION || process.env.AWS_DEFAULT_REGION || 'us-east-1',
|
|
18
|
+
});
|
|
19
|
+
yield client.send(new client_sts_1.GetCallerIdentityCommand({}));
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
catch (error) {
|
|
23
|
+
console.log('Error validating AWS credentials:', error);
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
exports.isAwsCredentialsValid = isAwsCredentialsValid;
|
|
28
|
+
//# sourceMappingURL=awsCredentials.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"awsCredentials.js","sourceRoot":"","sources":["../../../../src/platforms/aws/awsCredentials.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA0E;AAEnE,MAAM,qBAAqB,GAAG,GAA2B,EAAE;IAChE,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAI,sBAAS,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,qCAAwB,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,CAAA,CAAC;AAXW,QAAA,qBAAqB,yBAWhC","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"]}
|
|
@@ -0,0 +1,31 @@
|
|
|
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.getDockerDir = exports.getCdkCliVersion = exports.getCdkAppCommand = void 0;
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const packageRoot_1 = require("../../lib/packageRoot");
|
|
9
|
+
// The CDK app command (`cdk ... --app "<this>"`): @qpqjs/deploy-aws's
|
|
10
|
+
// generic workspace app under ts-node hooks, with DEPLOY_* in the env.
|
|
11
|
+
const getCdkAppCommand = () => {
|
|
12
|
+
// Resolve ts-node from this package, not the workspace cwd — under npm link
|
|
13
|
+
// the CLI's dependencies are never hoisted into the workspace's node_modules,
|
|
14
|
+
// so a bare `-r ts-node/...` preload fails there.
|
|
15
|
+
const tsNodeRegister = require.resolve('ts-node/register/transpile-only');
|
|
16
|
+
const cdkAppScript = path_1.default.join((0, packageRoot_1.getOwnPackageRoot)(), 'lib', 'commonjs', 'bin', 'qpqCdkApp.js');
|
|
17
|
+
return `node -r "${tsNodeRegister}" "${cdkAppScript}"`;
|
|
18
|
+
};
|
|
19
|
+
exports.getCdkAppCommand = getCdkAppCommand;
|
|
20
|
+
// The CLI's own aws-cdk. The go:docker deployer image pins to it and a saved
|
|
21
|
+
// build records it, so the CDK that deploys an assembly is always the one that
|
|
22
|
+
// synthesized it and can read its schema.
|
|
23
|
+
const getCdkCliVersion = () => {
|
|
24
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
25
|
+
return require('aws-cdk/package.json').version;
|
|
26
|
+
};
|
|
27
|
+
exports.getCdkCliVersion = getCdkCliVersion;
|
|
28
|
+
// The docker build context for the go:docker deployer image.
|
|
29
|
+
const getDockerDir = () => path_1.default.join((0, packageRoot_1.getOwnPackageRoot)(), 'docker', 'cdk-deployer');
|
|
30
|
+
exports.getDockerDir = getDockerDir;
|
|
31
|
+
//# sourceMappingURL=cdkApp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cdkApp.js","sourceRoot":"","sources":["../../../../src/platforms/aws/cdkApp.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAExB,uDAA0D;AAE1D,sEAAsE;AACtE,uEAAuE;AAChE,MAAM,gBAAgB,GAAG,GAAW,EAAE;IAC3C,4EAA4E;IAC5E,8EAA8E;IAC9E,kDAAkD;IAClD,MAAM,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC,iCAAiC,CAAC,CAAC;IAC1E,MAAM,YAAY,GAAG,cAAI,CAAC,IAAI,CAAC,IAAA,+BAAiB,GAAE,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,cAAc,CAAC,CAAC;IAC9F,OAAO,YAAY,cAAc,MAAM,YAAY,GAAG,CAAC;AACzD,CAAC,CAAC;AAPW,QAAA,gBAAgB,oBAO3B;AAEF,6EAA6E;AAC7E,+EAA+E;AAC/E,0CAA0C;AACnC,MAAM,gBAAgB,GAAG,GAAW,EAAE;IAC3C,iEAAiE;IACjE,OAAO,OAAO,CAAC,sBAAsB,CAAC,CAAC,OAAiB,CAAC;AAC3D,CAAC,CAAC;AAHW,QAAA,gBAAgB,oBAG3B;AAEF,6DAA6D;AACtD,MAAM,YAAY,GAAG,GAAW,EAAE,CAAC,cAAI,CAAC,IAAI,CAAC,IAAA,+BAAiB,GAAE,EAAE,QAAQ,EAAE,cAAc,CAAC,CAAC;AAAtF,QAAA,YAAY,gBAA0E","sourcesContent":["import path from 'path';\n\nimport { getOwnPackageRoot } from '../../lib/packageRoot';\n\n// The CDK app command (`cdk ... --app \"<this>\"`): @qpqjs/deploy-aws's\n// generic workspace app under ts-node hooks, with DEPLOY_* in the env.\nexport const getCdkAppCommand = (): string => {\n // Resolve ts-node from this package, not the workspace cwd — under npm link\n // the CLI's dependencies are never hoisted into the workspace's node_modules,\n // so a bare `-r ts-node/...` preload fails there.\n const tsNodeRegister = require.resolve('ts-node/register/transpile-only');\n const cdkAppScript = path.join(getOwnPackageRoot(), 'lib', 'commonjs', 'bin', 'qpqCdkApp.js');\n return `node -r \"${tsNodeRegister}\" \"${cdkAppScript}\"`;\n};\n\n// The CLI's own aws-cdk. The go:docker deployer image pins to it and a saved\n// build records it, so the CDK that deploys an assembly is always the one that\n// synthesized it and can read its schema.\nexport const getCdkCliVersion = (): string => {\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n return require('aws-cdk/package.json').version as string;\n};\n\n// The docker build context for the go:docker deployer image.\nexport const getDockerDir = (): string => path.join(getOwnPackageRoot(), 'docker', 'cdk-deployer');\n"]}
|
|
@@ -0,0 +1,167 @@
|
|
|
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.awsClearResources = void 0;
|
|
13
|
+
// AWS implementation of `qpq clear-resources`: empty (never delete) the
|
|
14
|
+
// selected data resources. Storage drives are S3 buckets - emptied including
|
|
15
|
+
// every object version and delete marker, so versioned buckets come out clean
|
|
16
|
+
// too. Key value stores are DynamoDB tables - truncated by scanning keys only
|
|
17
|
+
// and batch-deleting. The stacks and the resources themselves are untouched,
|
|
18
|
+
// so this is the "reset my data" counterpart to `qpq teardown`.
|
|
19
|
+
//
|
|
20
|
+
// Runtime names are resolved from each service's live qpq config with the
|
|
21
|
+
// same naming utils the deployed runtime uses, so what gets emptied is
|
|
22
|
+
// exactly what the app reads and writes.
|
|
23
|
+
const actionprocessor_aws_1 = require("@qpqjs/actionprocessor-aws");
|
|
24
|
+
const config_aws_1 = require("@qpqjs/config-aws");
|
|
25
|
+
const core_1 = require("@qpqjs/core");
|
|
26
|
+
const client_dynamodb_1 = require("@aws-sdk/client-dynamodb");
|
|
27
|
+
const client_s3_1 = require("@aws-sdk/client-s3");
|
|
28
|
+
const qpqConfigs_1 = require("../../lib/qpqConfigs");
|
|
29
|
+
const awsCredentials_1 = require("./awsCredentials");
|
|
30
|
+
// Same resolution as the runtime's resolveStorageDriveBucketName (not exported
|
|
31
|
+
// from the actionprocessor package root): honour the cross-module owner and
|
|
32
|
+
// its resourceNameOverride.
|
|
33
|
+
const resolveBucketName = (drive, qpqConfig) => {
|
|
34
|
+
var _a, _b;
|
|
35
|
+
const storageDriveConfig = core_1.qpqCoreUtils.getStorageDriveByName(drive, qpqConfig);
|
|
36
|
+
if (!storageDriveConfig) {
|
|
37
|
+
throw new Error(`Could not find storage drive config for [${drive}]`);
|
|
38
|
+
}
|
|
39
|
+
return actionprocessor_aws_1.awsNamingUtils.getConfigRuntimeResourceNameFromConfigWithServiceOverride(((_a = storageDriveConfig.owner) === null || _a === void 0 ? void 0 : _a.resourceNameOverride) || drive, qpqConfig, (_b = storageDriveConfig.owner) === null || _b === void 0 ? void 0 : _b.module);
|
|
40
|
+
};
|
|
41
|
+
// Log a progress heartbeat roughly every this-many removals, so a large
|
|
42
|
+
// resource visibly ticks along instead of looking hung.
|
|
43
|
+
const PROGRESS_EVERY = 2000;
|
|
44
|
+
// Empty a bucket including all versions + delete markers. Returns the number
|
|
45
|
+
// of objects/versions removed.
|
|
46
|
+
const emptyBucket = (bucketName, region) => __awaiter(void 0, void 0, void 0, function* () {
|
|
47
|
+
var _a, _b;
|
|
48
|
+
const s3 = new client_s3_1.S3Client({ region });
|
|
49
|
+
let removed = 0;
|
|
50
|
+
let lastReported = 0;
|
|
51
|
+
let keyMarker;
|
|
52
|
+
let versionIdMarker;
|
|
53
|
+
do {
|
|
54
|
+
const page = yield s3.send(new client_s3_1.ListObjectVersionsCommand({ Bucket: bucketName, KeyMarker: keyMarker, VersionIdMarker: versionIdMarker }));
|
|
55
|
+
const objects = [...((_a = page.Versions) !== null && _a !== void 0 ? _a : []), ...((_b = page.DeleteMarkers) !== null && _b !== void 0 ? _b : [])].map((v) => ({
|
|
56
|
+
Key: v.Key,
|
|
57
|
+
VersionId: v.VersionId,
|
|
58
|
+
}));
|
|
59
|
+
if (objects.length > 0) {
|
|
60
|
+
yield s3.send(new client_s3_1.DeleteObjectsCommand({ Bucket: bucketName, Delete: { Objects: objects, Quiet: true } }));
|
|
61
|
+
removed += objects.length;
|
|
62
|
+
}
|
|
63
|
+
if (removed - lastReported >= PROGRESS_EVERY) {
|
|
64
|
+
console.log(` ... ${removed} objects/versions so far`);
|
|
65
|
+
lastReported = removed;
|
|
66
|
+
}
|
|
67
|
+
keyMarker = page.IsTruncated ? page.NextKeyMarker : undefined;
|
|
68
|
+
versionIdMarker = page.IsTruncated ? page.NextVersionIdMarker : undefined;
|
|
69
|
+
} while (keyMarker || versionIdMarker);
|
|
70
|
+
return removed;
|
|
71
|
+
});
|
|
72
|
+
// Truncate a table: scan key attributes only, batch-delete 25 at a time,
|
|
73
|
+
// retrying unprocessed items. Returns the number of items removed.
|
|
74
|
+
const truncateTable = (tableName, region) => __awaiter(void 0, void 0, void 0, function* () {
|
|
75
|
+
var _a, _b, _c, _d, _e;
|
|
76
|
+
const dynamo = new client_dynamodb_1.DynamoDBClient({ region });
|
|
77
|
+
const described = yield dynamo.send(new client_dynamodb_1.DescribeTableCommand({ TableName: tableName }));
|
|
78
|
+
const keyAttributes = ((_b = (_a = described.Table) === null || _a === void 0 ? void 0 : _a.KeySchema) !== null && _b !== void 0 ? _b : []).map((k) => k.AttributeName);
|
|
79
|
+
// Alias every key attribute - a raw name could collide with a reserved word.
|
|
80
|
+
const projection = keyAttributes.map((_, i) => `#k${i}`).join(', ');
|
|
81
|
+
const attributeNames = Object.fromEntries(keyAttributes.map((attribute, i) => [`#k${i}`, attribute]));
|
|
82
|
+
let removed = 0;
|
|
83
|
+
let lastReported = 0;
|
|
84
|
+
let exclusiveStartKey;
|
|
85
|
+
do {
|
|
86
|
+
const page = yield dynamo.send(new client_dynamodb_1.ScanCommand({
|
|
87
|
+
TableName: tableName,
|
|
88
|
+
ProjectionExpression: projection,
|
|
89
|
+
ExpressionAttributeNames: attributeNames,
|
|
90
|
+
ExclusiveStartKey: exclusiveStartKey,
|
|
91
|
+
}));
|
|
92
|
+
const items = (_c = page.Items) !== null && _c !== void 0 ? _c : [];
|
|
93
|
+
for (let i = 0; i < items.length; i += 25) {
|
|
94
|
+
let requests = items.slice(i, i + 25).map((item) => ({ DeleteRequest: { Key: item } }));
|
|
95
|
+
while (requests.length > 0) {
|
|
96
|
+
const result = yield dynamo.send(new client_dynamodb_1.BatchWriteItemCommand({ RequestItems: { [tableName]: requests } }));
|
|
97
|
+
removed += requests.length;
|
|
98
|
+
const unprocessed = (_e = (_d = result.UnprocessedItems) === null || _d === void 0 ? void 0 : _d[tableName]) !== null && _e !== void 0 ? _e : [];
|
|
99
|
+
removed -= unprocessed.length;
|
|
100
|
+
requests = unprocessed;
|
|
101
|
+
if (requests.length > 0) {
|
|
102
|
+
// Throttled - back off briefly before retrying the leftovers.
|
|
103
|
+
yield new Promise((resolve) => setTimeout(resolve, 250));
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
if (removed - lastReported >= PROGRESS_EVERY) {
|
|
108
|
+
console.log(` ... ${removed} items so far`);
|
|
109
|
+
lastReported = removed;
|
|
110
|
+
}
|
|
111
|
+
exclusiveStartKey = page.LastEvaluatedKey;
|
|
112
|
+
} while (exclusiveStartKey);
|
|
113
|
+
return removed;
|
|
114
|
+
});
|
|
115
|
+
const clearResource = (appName, resource) => __awaiter(void 0, void 0, void 0, function* () {
|
|
116
|
+
const qpqConfig = (0, qpqConfigs_1.loadServiceQpqConfig)(appName, resource.service);
|
|
117
|
+
const region = config_aws_1.qpqConfigAwsUtils.getApplicationModuleDeployRegion(qpqConfig);
|
|
118
|
+
if (resource.kind === 'storageDrive') {
|
|
119
|
+
const bucketName = resolveBucketName(resource.resourceName, qpqConfig);
|
|
120
|
+
console.log(` emptying s3://${bucketName} ...`);
|
|
121
|
+
try {
|
|
122
|
+
const removed = yield emptyBucket(bucketName, region);
|
|
123
|
+
console.log(` emptied s3://${bucketName} (${removed} objects/versions)`);
|
|
124
|
+
}
|
|
125
|
+
catch (error) {
|
|
126
|
+
if (error instanceof client_s3_1.NoSuchBucket) {
|
|
127
|
+
console.log(` skipped s3://${bucketName} (bucket does not exist - not deployed?)`);
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
throw error;
|
|
131
|
+
}
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
// 'kvs' matches the resourceType every runtime KVS action processor passes,
|
|
135
|
+
// giving the deployed '-qpqkvs' table name suffix.
|
|
136
|
+
const tableName = actionprocessor_aws_1.awsNamingUtils.getKvsDynamoTableNameFromConfig(resource.resourceName, qpqConfig, 'kvs');
|
|
137
|
+
console.log(` truncating ${tableName} ...`);
|
|
138
|
+
try {
|
|
139
|
+
const removed = yield truncateTable(tableName, region);
|
|
140
|
+
console.log(` truncated ${tableName} (${removed} items)`);
|
|
141
|
+
}
|
|
142
|
+
catch (error) {
|
|
143
|
+
if (error instanceof client_dynamodb_1.ResourceNotFoundException) {
|
|
144
|
+
console.log(` skipped ${tableName} (table does not exist - not deployed?)`);
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
throw error;
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
const awsClearResources = (appName, plan) => __awaiter(void 0, void 0, void 0, function* () {
|
|
151
|
+
if (plan.kind === 'cancelled') {
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
if ((yield (0, awsCredentials_1.isAwsCredentialsValid)()) === false) {
|
|
155
|
+
console.log('Credentials are expired or invalid.');
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
console.log('\nEmptying resources:');
|
|
159
|
+
// Sequential on purpose: predictable output, and no burst of parallel scans
|
|
160
|
+
// against provisioned-throughput tables.
|
|
161
|
+
for (const resource of plan.resources) {
|
|
162
|
+
yield clearResource(appName, resource);
|
|
163
|
+
}
|
|
164
|
+
console.log('Done.');
|
|
165
|
+
});
|
|
166
|
+
exports.awsClearResources = awsClearResources;
|
|
167
|
+
//# sourceMappingURL=clearResources.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clearResources.js","sourceRoot":"","sources":["../../../../src/platforms/aws/clearResources.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,wEAAwE;AACxE,6EAA6E;AAC7E,8EAA8E;AAC9E,8EAA8E;AAC9E,6EAA6E;AAC7E,gEAAgE;AAChE,EAAE;AACF,0EAA0E;AAC1E,uEAAuE;AACvE,yCAAyC;AACzC,oEAA4D;AAC5D,kDAAsD;AACtD,sCAAsD;AAEtD,8DAOkC;AAClC,kDAA+H;AAG/H,qDAA4D;AAC5D,qDAAyD;AAEzD,+EAA+E;AAC/E,4EAA4E;AAC5E,4BAA4B;AAC5B,MAAM,iBAAiB,GAAG,CAAC,KAAa,EAAE,SAAoB,EAAU,EAAE;;IACxE,MAAM,kBAAkB,GAAG,mBAAY,CAAC,qBAAqB,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;IAEhF,IAAI,CAAC,kBAAkB,EAAE,CAAC;QACxB,MAAM,IAAI,KAAK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a,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IACzC,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;AACvB,CAAC,CAAA,CAAC;AAnBW,QAAA,iBAAiB,qBAmB5B","sourcesContent":["// AWS implementation of `qpq clear-resources`: empty (never delete) the\n// selected data resources. Storage drives are S3 buckets - emptied including\n// every object version and delete marker, so versioned buckets come out clean\n// too. Key value stores are DynamoDB tables - truncated by scanning keys only\n// and batch-deleting. The stacks and the resources themselves are untouched,\n// so this is the \"reset my data\" counterpart to `qpq teardown`.\n//\n// Runtime names are resolved from each service's live qpq config with the\n// same naming utils the deployed runtime uses, so what gets emptied is\n// exactly what the app reads and writes.\nimport { awsNamingUtils } from '@qpqjs/actionprocessor-aws';\nimport { qpqConfigAwsUtils } from '@qpqjs/config-aws';\nimport { QPQConfig, qpqCoreUtils } from '@qpqjs/core';\n\nimport {\n BatchWriteItemCommand,\n DescribeTableCommand,\n DynamoDBClient,\n ResourceNotFoundException,\n ScanCommand,\n WriteRequest,\n} from '@aws-sdk/client-dynamodb';\nimport { DeleteObjectsCommand, ListObjectVersionsCommand, NoSuchBucket, ObjectIdentifier, S3Client } from '@aws-sdk/client-s3';\n\nimport { ClearableResource, ClearResourcesPlan } from '../../lib/clearResourcesPlan';\nimport { loadServiceQpqConfig } from '../../lib/qpqConfigs';\nimport { isAwsCredentialsValid } from './awsCredentials';\n\n// Same resolution as the runtime's resolveStorageDriveBucketName (not exported\n// from the actionprocessor package root): honour the cross-module owner and\n// its resourceNameOverride.\nconst resolveBucketName = (drive: string, qpqConfig: QPQConfig): string => {\n const storageDriveConfig = qpqCoreUtils.getStorageDriveByName(drive, qpqConfig);\n\n if (!storageDriveConfig) {\n throw new Error(`Could not find storage drive config for [${drive}]`);\n }\n\n return awsNamingUtils.getConfigRuntimeResourceNameFromConfigWithServiceOverride(\n storageDriveConfig.owner?.resourceNameOverride || drive,\n qpqConfig,\n storageDriveConfig.owner?.module,\n );\n};\n\n// Log a progress heartbeat roughly every this-many removals, so a large\n// resource visibly ticks along instead of looking hung.\nconst PROGRESS_EVERY = 2000;\n\n// Empty a bucket including all versions + delete markers. Returns the number\n// of objects/versions removed.\nconst emptyBucket = async (bucketName: string, region: string): Promise<number> => {\n const s3 = new S3Client({ region });\n let removed = 0;\n let lastReported = 0;\n let keyMarker: string | undefined;\n let versionIdMarker: string | undefined;\n\n do {\n const page = await s3.send(new ListObjectVersionsCommand({ Bucket: bucketName, KeyMarker: keyMarker, VersionIdMarker: versionIdMarker }));\n\n const objects: ObjectIdentifier[] = [...(page.Versions ?? []), ...(page.DeleteMarkers ?? [])].map((v) => ({\n Key: v.Key!,\n VersionId: v.VersionId,\n }));\n\n if (objects.length > 0) {\n await s3.send(new DeleteObjectsCommand({ Bucket: bucketName, Delete: { Objects: objects, Quiet: true } }));\n removed += objects.length;\n }\n\n if (removed - lastReported >= PROGRESS_EVERY) {\n console.log(` ... ${removed} objects/versions so far`);\n lastReported = removed;\n }\n\n keyMarker = page.IsTruncated ? page.NextKeyMarker : undefined;\n versionIdMarker = page.IsTruncated ? page.NextVersionIdMarker : undefined;\n } while (keyMarker || versionIdMarker);\n\n return removed;\n};\n\n// Truncate a table: scan key attributes only, batch-delete 25 at a time,\n// retrying unprocessed items. Returns the number of items removed.\nconst truncateTable = async (tableName: string, region: string): Promise<number> => {\n const dynamo = new DynamoDBClient({ region });\n\n const described = await dynamo.send(new DescribeTableCommand({ TableName: tableName }));\n const keyAttributes = (described.Table?.KeySchema ?? []).map((k) => k.AttributeName!);\n\n // Alias every key attribute - a raw name could collide with a reserved word.\n const projection = keyAttributes.map((_, i) => `#k${i}`).join(', ');\n const attributeNames = Object.fromEntries(keyAttributes.map((attribute, i) => [`#k${i}`, attribute]));\n\n let removed = 0;\n let lastReported = 0;\n let exclusiveStartKey: Record<string, any> | undefined;\n\n do {\n const page = await dynamo.send(\n new ScanCommand({\n TableName: tableName,\n ProjectionExpression: projection,\n ExpressionAttributeNames: attributeNames,\n ExclusiveStartKey: exclusiveStartKey,\n }),\n );\n\n const items = page.Items ?? [];\n\n for (let i = 0; i < items.length; i += 25) {\n let requests: WriteRequest[] = items.slice(i, i + 25).map((item) => ({ DeleteRequest: { Key: item } }));\n\n while (requests.length > 0) {\n const result = await dynamo.send(new BatchWriteItemCommand({ RequestItems: { [tableName]: requests } }));\n removed += requests.length;\n\n const unprocessed = result.UnprocessedItems?.[tableName] ?? [];\n removed -= unprocessed.length;\n requests = unprocessed;\n\n if (requests.length > 0) {\n // Throttled - back off briefly before retrying the leftovers.\n await new Promise((resolve) => setTimeout(resolve, 250));\n }\n }\n }\n\n if (removed - lastReported >= PROGRESS_EVERY) {\n console.log(` ... ${removed} items so far`);\n lastReported = removed;\n }\n\n exclusiveStartKey = page.LastEvaluatedKey;\n } while (exclusiveStartKey);\n\n return removed;\n};\n\nconst clearResource = async (appName: string, resource: ClearableResource): Promise<void> => {\n const qpqConfig = loadServiceQpqConfig(appName, resource.service);\n const region = qpqConfigAwsUtils.getApplicationModuleDeployRegion(qpqConfig);\n\n if (resource.kind === 'storageDrive') {\n const bucketName = resolveBucketName(resource.resourceName, qpqConfig);\n console.log(` emptying s3://${bucketName} ...`);\n try {\n const removed = await emptyBucket(bucketName, region);\n console.log(` emptied s3://${bucketName} (${removed} objects/versions)`);\n } catch (error) {\n if (error instanceof NoSuchBucket) {\n console.log(` skipped s3://${bucketName} (bucket does not exist - not deployed?)`);\n return;\n }\n throw error;\n }\n return;\n }\n\n // 'kvs' matches the resourceType every runtime KVS action processor passes,\n // giving the deployed '-qpqkvs' table name suffix.\n const tableName = awsNamingUtils.getKvsDynamoTableNameFromConfig(resource.resourceName, qpqConfig, 'kvs');\n console.log(` truncating ${tableName} ...`);\n try {\n const removed = await truncateTable(tableName, region);\n console.log(` truncated ${tableName} (${removed} items)`);\n } catch (error) {\n if (error instanceof ResourceNotFoundException) {\n console.log(` skipped ${tableName} (table does not exist - not deployed?)`);\n return;\n }\n throw error;\n }\n};\n\nexport const awsClearResources = async (appName: string, plan: ClearResourcesPlan): Promise<void> => {\n if (plan.kind === 'cancelled') {\n return;\n }\n\n if ((await isAwsCredentialsValid()) === false) {\n console.log('Credentials are expired or invalid.');\n return;\n }\n\n console.log('\\nEmptying resources:');\n\n // Sequential on purpose: predictable output, and no burst of parallel scans\n // against provisioned-throughput tables.\n for (const resource of plan.resources) {\n await clearResource(appName, resource);\n }\n\n console.log('Done.');\n};\n"]}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.awsGo = void 0;
|
|
16
|
+
// AWS sequential deploy (`qpq go`). Per service it: synths the QPQ config,
|
|
17
|
+
// rspack-bundles the backend (programmatic — no per-service rspack.config.ts),
|
|
18
|
+
// deploys the inf/api/web CDK stacks (cdk runs the generic workspace app via
|
|
19
|
+
// --app), bundles views (rspack, production) and syncs them to S3. Finally, any
|
|
20
|
+
// service that opts into module federation has its federated remote published
|
|
21
|
+
// (built + uploaded + manifest flipped), so a deploy that ships new backend
|
|
22
|
+
// code also republishes the code the lambdas federate.
|
|
23
|
+
const core_1 = require("@qpqjs/core");
|
|
24
|
+
const deploy_aws_1 = require("@qpqjs/deploy-aws");
|
|
25
|
+
const deploy_rspack_1 = require("@qpqjs/deploy-rspack");
|
|
26
|
+
const path_1 = __importDefault(require("path"));
|
|
27
|
+
const synth_1 = require("../../commands/synth");
|
|
28
|
+
const discovery_1 = require("../../lib/discovery");
|
|
29
|
+
const getDefaultHookJobs_1 = require("../../lib/getDefaultHookJobs");
|
|
30
|
+
const hooks_1 = require("../../lib/hooks");
|
|
31
|
+
const qpqConfigs_1 = require("../../lib/qpqConfigs");
|
|
32
|
+
const runTasks_1 = require("../../lib/runTasks");
|
|
33
|
+
const timing_1 = require("../../lib/timing");
|
|
34
|
+
const views_1 = require("../../lib/views");
|
|
35
|
+
const awsCredentials_1 = require("./awsCredentials");
|
|
36
|
+
const publish_1 = require("./publish");
|
|
37
|
+
const stacks_1 = require("./stacks");
|
|
38
|
+
const viewsSync_1 = require("./viewsSync");
|
|
39
|
+
const buildAndDeploy = (serviceName, needsSynth, needsBuildApi, needsInfStack, needsApiStack, needsWebStack, needsViewStack, appName) => __awaiter(void 0, void 0, void 0, function* () {
|
|
40
|
+
if (needsSynth) {
|
|
41
|
+
console.log('Synth QPQ Configs');
|
|
42
|
+
yield (0, synth_1.synthCommand)([serviceName, '--app', appName]);
|
|
43
|
+
}
|
|
44
|
+
const qpqConfigForService = (0, qpqConfigs_1.loadServiceQpqConfig)(appName, serviceName);
|
|
45
|
+
if (needsBuildApi) {
|
|
46
|
+
console.log('Building Api: ', serviceName);
|
|
47
|
+
yield (0, deploy_rspack_1.runRspack)((0, deploy_rspack_1.getServiceRspackConfig)(qpqConfigForService, path_1.default.join((0, discovery_1.getServiceDirectory)(appName, serviceName), 'service')));
|
|
48
|
+
}
|
|
49
|
+
if (needsInfStack) {
|
|
50
|
+
console.log('Deploy Inf: ', serviceName);
|
|
51
|
+
yield (0, stacks_1.deployServiceStack)(serviceName, deploy_aws_1.qpqDeployAwsUtils.getInfStackName(qpqConfigForService), appName);
|
|
52
|
+
}
|
|
53
|
+
if (needsApiStack) {
|
|
54
|
+
console.log('Deploy Api: ', serviceName);
|
|
55
|
+
yield (0, stacks_1.deployServiceStack)(serviceName, deploy_aws_1.qpqDeployAwsUtils.getApiStackName(qpqConfigForService), appName);
|
|
56
|
+
}
|
|
57
|
+
if (needsWebStack) {
|
|
58
|
+
console.log('Deploy Web: ', serviceName);
|
|
59
|
+
yield (0, stacks_1.deployServiceStack)(serviceName, deploy_aws_1.qpqDeployAwsUtils.getWebStackName(qpqConfigForService), appName);
|
|
60
|
+
}
|
|
61
|
+
if (needsViewStack && (0, discovery_1.getServiceNamesWithViews)(appName).includes(serviceName)) {
|
|
62
|
+
console.log('Building Views: ', serviceName);
|
|
63
|
+
yield (0, views_1.bundleViews)(appName, serviceName);
|
|
64
|
+
yield (0, viewsSync_1.syncViewsToS3)(appName, serviceName);
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
const awsGo = (appName, plan) => __awaiter(void 0, void 0, void 0, function* () {
|
|
68
|
+
if (plan.kind === 'cancelled') {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
(0, timing_1.logTimeStart)('totalTime');
|
|
72
|
+
if (plan.kind === 'account') {
|
|
73
|
+
yield (0, stacks_1.deployAccountStack)(plan.appName);
|
|
74
|
+
(0, timing_1.logTimeEnd)('totalTime');
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
if (plan.kind === 'bootstrap') {
|
|
78
|
+
// Feature bootstraps deploy into a shared account — leave the account-level
|
|
79
|
+
// guardrails stack alone (deploy it explicitly via the 'account' option).
|
|
80
|
+
if (process.env[core_1.QpqDeployEnvVar.featureName]) {
|
|
81
|
+
console.log('Skipping account stack for feature deploy');
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
yield (0, stacks_1.deployAccountStack)(plan.appName);
|
|
85
|
+
}
|
|
86
|
+
if (plan.includeDomain) {
|
|
87
|
+
yield (0, stacks_1.deployDomainStack)(plan.appName);
|
|
88
|
+
}
|
|
89
|
+
yield (0, stacks_1.deployBootstrapStack)(plan.appName);
|
|
90
|
+
(0, timing_1.logTimeEnd)('totalTime');
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
const { services, stacks } = plan;
|
|
94
|
+
const shouldBuildApi = stacks !== 'views';
|
|
95
|
+
console.log('\n\nRunning automated deploy\n\n');
|
|
96
|
+
console.log('Executing for services');
|
|
97
|
+
console.log(services.join(', '));
|
|
98
|
+
if ((yield (0, awsCredentials_1.isAwsCredentialsValid)()) === false) {
|
|
99
|
+
console.log('Credentials are expired or invalid.');
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
const allStacks = stacks === 'all';
|
|
103
|
+
yield (0, hooks_1.runAppHook)(appName, 'predeploy');
|
|
104
|
+
// Workspace packages resolve through their built dist/ (package.json main),
|
|
105
|
+
// so bundles would ship stale code unless every lib is tsc'd first.
|
|
106
|
+
console.log('Building workspace packages');
|
|
107
|
+
(0, runTasks_1.assertNoFailures)('Workspace build', yield (0, hooks_1.runHookForAppPackages)('build', appName, (0, getDefaultHookJobs_1.getDefaultHookJobs)()));
|
|
108
|
+
// Views uploads resolve bucket names from the shell service's config.
|
|
109
|
+
if (allStacks || stacks === 'views') {
|
|
110
|
+
yield (0, synth_1.synthCommand)(['shell', '--app', appName]);
|
|
111
|
+
}
|
|
112
|
+
for (let phase = 0; phase <= 5; phase += 1) {
|
|
113
|
+
yield services.reduce((cur, service) => __awaiter(void 0, void 0, void 0, function* () {
|
|
114
|
+
yield cur;
|
|
115
|
+
return buildAndDeploy(service, phase === 0, phase === 1 && shouldBuildApi, phase === 2 && (allStacks || stacks === 'inf'), phase === 3 && (allStacks || stacks === 'api'), phase === 4 && (allStacks || stacks === 'web'), phase === 5 && (allStacks || stacks === 'views'), appName);
|
|
116
|
+
}), Promise.resolve());
|
|
117
|
+
}
|
|
118
|
+
// Publishing federated remotes only matters once the new backend code is
|
|
119
|
+
// live, so it's gated on the api stack having been (re)deployed. Services
|
|
120
|
+
// without defineFederatedModuleStore(...) are skipped.
|
|
121
|
+
if (allStacks || stacks === 'api') {
|
|
122
|
+
const federatedServices = (0, qpqConfigs_1.getServiceNamesWithFederation)(appName, services);
|
|
123
|
+
if (federatedServices.length > 0) {
|
|
124
|
+
console.log('\n\nPublishing federated backends\n');
|
|
125
|
+
yield (0, publish_1.awsPublish)(appName, federatedServices);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
(0, timing_1.logTimeEnd)('totalTime');
|
|
129
|
+
});
|
|
130
|
+
exports.awsGo = awsGo;
|
|
131
|
+
//# sourceMappingURL=go.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"go.js","sourceRoot":"","sources":["../../../../src/platforms/aws/go.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2EAA2E;AAC3E,+EAA+E;AAC/E,6EAA6E;AAC7E,gFAAgF;AAChF,8EAA8E;AAC9E,4EAA4E;AAC5E,uDAAuD;AACvD,sCAA8C;AAC9C,kDAAsD;AACtD,wDAAyE;AAEzE,gDAAwB;AAExB,gDAAoD;AAEpD,mDAAoF;AACpF,qEAAkE;AAClE,2CAAoE;AACpE,qDAA2F;AAC3F,iDAAsD;AACtD,6CAA4D;AAC5D,2CAA8C;AAC9C,qDAAyD;AACzD,uCAAuC;AACvC,qCAA2G;AAC3G,2CAA4C;AAE5C,MAAM,cAAc,GAAG,CACrB,WAAmB,EACnB,UAAmB,EACnB,aAAsB,EACtB,aAAsB,EACtB,aAAsB,EACtB,aAAsB,EACtB,cAAuB,EACvB,OAAe,EACA,EAAE;IACjB,IAAI,UAAU,EAAE,CAAC;QACf,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;QACjC,MAAM,IAAA,oBAAY,EAAC,CAAC,WAAW,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;IACtD,CAAC;IAED,MAAM,mBAAmB,GAAG,IAAA,iCAAoB,EAAC,OAAO,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ACR,CAAC;QACJ,CAAC,CAAA,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;IACxB,CAAC;IAED,yEAAyE;IACzE,0EAA0E;IAC1E,uDAAuD;IACvD,IAAI,SAAS,IAAI,MAAM,KAAK,KAAK,EAAE,CAAC;QAClC,MAAM,iBAAiB,GAAG,IAAA,0CAA6B,EAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;QAC3E,IAAI,iBAAiB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACjC,OAAO,CAAC,GAAG,CAAC,qCAAqC,CAAC,CAAC;YACnD,MAAM,IAAA,oBAAU,EAAC,OAAO,EAAE,iBAAiB,CAAC,CAAC;QAC/C,CAAC;IACH,CAAC;IAED,IAAA,mBAAU,EAAC,WAAW,CAAC,CAAC;AAC1B,CAAC,CAAA,CAAC;AAnFW,QAAA,KAAK,SAmFhB","sourcesContent":["// AWS sequential deploy (`qpq go`). Per service it: synths the QPQ config,\n// rspack-bundles the backend (programmatic — no per-service rspack.config.ts),\n// deploys the inf/api/web CDK stacks (cdk runs the generic workspace app via\n// --app), bundles views (rspack, production) and syncs them to S3. Finally, any\n// service that opts into module federation has its federated remote published\n// (built + uploaded + manifest flipped), so a deploy that ships new backend\n// code also republishes the code the lambdas federate.\nimport { QpqDeployEnvVar } from '@qpqjs/core';\nimport { qpqDeployAwsUtils } from '@qpqjs/deploy-aws';\nimport { getServiceRspackConfig, runRspack } from '@qpqjs/deploy-rspack';\n\nimport path from 'path';\n\nimport { synthCommand } from '../../commands/synth';\nimport { DeployPlan } from '../../lib/deployPrompts';\nimport { getServiceDirectory, getServiceNamesWithViews } from '../../lib/discovery';\nimport { getDefaultHookJobs } from '../../lib/getDefaultHookJobs';\nimport { runAppHook, runHookForAppPackages } from '../../lib/hooks';\nimport { getServiceNamesWithFederation, loadServiceQpqConfig } from '../../lib/qpqConfigs';\nimport { assertNoFailures } from '../../lib/runTasks';\nimport { logTimeEnd, logTimeStart } from '../../lib/timing';\nimport { bundleViews } from '../../lib/views';\nimport { isAwsCredentialsValid } from './awsCredentials';\nimport { awsPublish } from './publish';\nimport { deployAccountStack, deployBootstrapStack, deployDomainStack, deployServiceStack } from './stacks';\nimport { syncViewsToS3 } from './viewsSync';\n\nconst buildAndDeploy = async (\n serviceName: string,\n needsSynth: boolean,\n needsBuildApi: boolean,\n needsInfStack: boolean,\n needsApiStack: boolean,\n needsWebStack: boolean,\n needsViewStack: boolean,\n appName: string,\n): Promise<void> => {\n if (needsSynth) {\n console.log('Synth QPQ Configs');\n await synthCommand([serviceName, '--app', appName]);\n }\n\n const qpqConfigForService = loadServiceQpqConfig(appName, serviceName);\n\n if (needsBuildApi) {\n console.log('Building Api: ', serviceName);\n await runRspack(getServiceRspackConfig(qpqConfigForService, path.join(getServiceDirectory(appName, serviceName), 'service')));\n }\n\n if (needsInfStack) {\n console.log('Deploy Inf: ', serviceName);\n await deployServiceStack(serviceName, qpqDeployAwsUtils.getInfStackName(qpqConfigForService), appName);\n }\n\n if (needsApiStack) {\n console.log('Deploy Api: ', serviceName);\n await deployServiceStack(serviceName, qpqDeployAwsUtils.getApiStackName(qpqConfigForService), appName);\n }\n\n if (needsWebStack) {\n console.log('Deploy Web: ', serviceName);\n await deployServiceStack(serviceName, qpqDeployAwsUtils.getWebStackName(qpqConfigForService), appName);\n }\n\n if (needsViewStack && getServiceNamesWithViews(appName).includes(serviceName)) {\n console.log('Building Views: ', serviceName);\n await bundleViews(appName, serviceName);\n await syncViewsToS3(appName, serviceName);\n }\n};\n\nexport const awsGo = async (appName: string, plan: DeployPlan): Promise<void> => {\n if (plan.kind === 'cancelled') {\n return;\n }\n\n logTimeStart('totalTime');\n\n if (plan.kind === 'account') {\n await deployAccountStack(plan.appName);\n logTimeEnd('totalTime');\n return;\n }\n\n if (plan.kind === 'bootstrap') {\n // Feature bootstraps deploy into a shared account — leave the account-level\n // guardrails stack alone (deploy it explicitly via the 'account' option).\n if (process.env[QpqDeployEnvVar.featureName]) {\n console.log('Skipping account stack for feature deploy');\n } else {\n await deployAccountStack(plan.appName);\n }\n if (plan.includeDomain) {\n await deployDomainStack(plan.appName);\n }\n await deployBootstrapStack(plan.appName);\n logTimeEnd('totalTime');\n return;\n }\n\n const { services, stacks } = plan;\n const shouldBuildApi = stacks !== 'views';\n\n console.log('\\n\\nRunning automated deploy\\n\\n');\n console.log('Executing for services');\n console.log(services.join(', '));\n\n if ((await isAwsCredentialsValid()) === false) {\n console.log('Credentials are expired or invalid.');\n return;\n }\n\n const allStacks = stacks === 'all';\n\n await runAppHook(appName, 'predeploy');\n\n // Workspace packages resolve through their built dist/ (package.json main),\n // so bundles would ship stale code unless every lib is tsc'd first.\n console.log('Building workspace packages');\n assertNoFailures('Workspace build', await runHookForAppPackages('build', appName, getDefaultHookJobs()));\n\n // Views uploads resolve bucket names from the shell service's config.\n if (allStacks || stacks === 'views') {\n await synthCommand(['shell', '--app', appName]);\n }\n\n for (let phase = 0; phase <= 5; phase += 1) {\n await services.reduce(async (cur, service) => {\n await cur;\n return buildAndDeploy(\n service,\n phase === 0,\n phase === 1 && shouldBuildApi,\n phase === 2 && (allStacks || stacks === 'inf'),\n phase === 3 && (allStacks || stacks === 'api'),\n phase === 4 && (allStacks || stacks === 'web'),\n phase === 5 && (allStacks || stacks === 'views'),\n appName,\n );\n }, Promise.resolve());\n }\n\n // Publishing federated remotes only matters once the new backend code is\n // live, so it's gated on the api stack having been (re)deployed. Services\n // without defineFederatedModuleStore(...) are skipped.\n if (allStacks || stacks === 'api') {\n const federatedServices = getServiceNamesWithFederation(appName, services);\n if (federatedServices.length > 0) {\n console.log('\\n\\nPublishing federated backends\\n');\n await awsPublish(appName, federatedServices);\n }\n }\n\n logTimeEnd('totalTime');\n};\n"]}
|