@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":"goDockerManifest.js","sourceRoot":"","sources":["../../../../src/platforms/aws/goDockerManifest.ts"],"names":[],"mappings":";;;;;;AAMA,4CAAoB;AACpB,gDAAwB;AAGxB,mDAA8C;AA8B9C,MAAM,aAAa,GAAG,aAAa,CAAC;AAEpC,0FAA0F;AACnF,MAAM,mBAAmB,GAAG,CAAC,OAAe,EAAE,WAAmB,EAAU,EAAE,CAClF,cAAI,CAAC,IAAI,CAAC,IAAA,mBAAO,GAAE,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC;AAD5D,QAAA,mBAAmB,uBACyC;AAEzE,qFAAqF;AAC9E,MAAM,sBAAsB,GAAG,CAAC,OAAe,EAAE,WAAmB,EAAU,EAAE,CACrF,cAAI,CAAC,IAAI,CAAC,IAAA,2BAAmB,EAAC,OAAO,EAAE,WAAW,CAAC,EAAE,UAAU,CAAC,CAAC;AADtD,QAAA,sBAAsB,0BACgC;AAEnE,iEAAiE;AAC1D,MAAM,cAAc,GAAG,CAAC,YAAoB,EAAU,EAAE,CAAC,cAAI,CAAC,QAAQ,CAAC,IAAA,mBAAO,GAAE,EAAE,YAAY,CAAC,CAAC,KAAK,CAAC,cAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAApH,QAAA,cAAc,kBAAsG;AAEjI,oEAAoE;AAC7D,MAAM,gBAAgB,GAAG,CAAC,YAAoB,EAAU,EAAE,CAAC,cAAI,CAAC,OAAO,CAAC,IAAA,mBAAO,GAAE,EAAE,YAAY,CAAC,CAAC;AAA3F,QAAA,gBAAgB,oBAA2E;AAEjG,MAAM,0BAA0B,GAAG,CAAC,OAAe,EAAE,WAAmB,EAAE,QAA+B,EAAQ,EAAE;IACxH,MAAM,QAAQ,GAAG,IAAA,2BAAmB,EAAC,OAAO,EAAE,WAAW,CAAC,CAAC;IAC3D,YAAE,CAAC,SAAS,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC5C,YAAE,CAAC,aAAa,CAAC,cAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,aAAa,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;AAC1F,CAAC,CAAC;AAJW,QAAA,0BAA0B,8BAIrC;AAEF,uGAAuG;AAChG,MAAM,yBAAyB,GAAG,CAAC,OAAe,EAAE,WAAmB,EAAyB,EAAE;IACvG,MAAM,YAAY,GAAG,cAAI,CAAC,IAAI,CAAC,IAAA,2BAAmB,EAAC,OAAO,EAAE,WAAW,CAAC,EAAE,aAAa,CAAC,CAAC;IAEzF,IAAI,CAAC,YAAE,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE,CAAC;QACjC,MAAM,IAAI,KAAK,CACb,uBAAuB,WAAW,cAAc,YAAY,2BAA2B,WAAW,+BAA+B,OAAO,UAAU,CACnJ,CAAC;IACJ,CAAC;IAED,OAAO,IAAI,CAAC,KAAK,CAAC,YAAE,CAAC,YAAY,CAAC,YAAY,EAAE,OAAO,CAAC,CAA0B,CAAC;AACrF,CAAC,CAAC;AAVW,QAAA,yBAAyB,6BAUpC","sourcesContent":["// The saved build `qpq go:docker --build-only` leaves behind and `--from-build`\n// deploys from. Per service it is the CDK cloud assembly plus a manifest under\n// dist/qpq/go-docker/<app>/<service>, with the views bundle and the federated\n// remote left where their bundlers write them and pointed at from the manifest.\nimport { Nullable } from '@qpqjs/core';\n\nimport fs from 'fs';\nimport path from 'path';\n\nimport { StackType } from '../../lib/deployPrompts';\nimport { getRoot } from '../../lib/discovery';\n\n/** The CloudFormation stack names of one service's assembly. */\nexport type GoDockerStackNames = { inf: string; api: string; web: string };\n\n/** A built views bundle and the S3 locations it syncs to. */\nexport type GoDockerViewsEntry = { dir: string; destinations: string[] };\n\n/** A built federated remote (its publish dir and the store it goes into). */\nexport type GoDockerRemoteEntry = { dir: string; manifestHash: string; bucketName: string; servicePrefix: string };\n\n/**\n * Everything the deploy half needs for one service that only the live config can\n * answer, resolved by the build half. Paths are relative to the consumer root with\n * forward slashes, so a build saved on one machine deploys from another checkout.\n */\nexport type GoDockerBuildManifest = {\n // The aws-cdk that synthesized the assembly; the deploy half refuses any other.\n cdkVersion: string;\n deploymentName: string;\n // The stack selection the build ran with: `all` can deploy any phase, anything else only its own.\n builtFor: StackType;\n // Null for a views-only build, which synthesizes nothing.\n stacks: Nullable<GoDockerStackNames>;\n // Null when the service has no views or they were not built.\n views: Nullable<GoDockerViewsEntry>;\n // Null when the service has no defineFederatedModuleStore(...) or the api was not built.\n remote: Nullable<GoDockerRemoteEntry>;\n};\n\nconst MANIFEST_FILE = 'deploy.json';\n\n/** The per-service directory the build half owns: the cloud assembly and the manifest. */\nexport const getGoDockerBuildDir = (appName: string, serviceName: string): string =>\n path.join(getRoot(), 'dist', 'qpq', 'go-docker', appName, serviceName);\n\n/** Where `cdk synth --output` writes the service's self-contained cloud assembly. */\nexport const getGoDockerAssemblyDir = (appName: string, serviceName: string): string =>\n path.join(getGoDockerBuildDir(appName, serviceName), 'assembly');\n\n/** A path under the consumer root, as the manifest stores it. */\nexport const toManifestPath = (absolutePath: string): string => path.relative(getRoot(), absolutePath).split(path.sep).join('/');\n\n/** The absolute path a manifest entry points at on this machine. */\nexport const fromManifestPath = (manifestPath: string): string => path.resolve(getRoot(), manifestPath);\n\nexport const writeGoDockerBuildManifest = (appName: string, serviceName: string, manifest: GoDockerBuildManifest): void => {\n const buildDir = getGoDockerBuildDir(appName, serviceName);\n fs.mkdirSync(buildDir, { recursive: true });\n fs.writeFileSync(path.join(buildDir, MANIFEST_FILE), JSON.stringify(manifest, null, 2));\n};\n\n/** Throws, naming the directory and the command that fills it, when the service has no saved build. */\nexport const readGoDockerBuildManifest = (appName: string, serviceName: string): GoDockerBuildManifest => {\n const manifestPath = path.join(getGoDockerBuildDir(appName, serviceName), MANIFEST_FILE);\n\n if (!fs.existsSync(manifestPath)) {\n throw new Error(\n `no saved build for [${serviceName}] (missing ${manifestPath}) - run \\`qpq go:docker ${serviceName} <stack> --build-only --app ${appName}\\` first`,\n );\n }\n\n return JSON.parse(fs.readFileSync(manifestPath, 'utf-8')) as GoDockerBuildManifest;\n};\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.awsPlatformDriver = void 0;
|
|
4
|
+
const clearResources_1 = require("./clearResources");
|
|
5
|
+
const go_1 = require("./go");
|
|
6
|
+
const goDocker_1 = require("./goDocker");
|
|
7
|
+
const prepareDeployment_1 = require("./prepareDeployment");
|
|
8
|
+
const publish_1 = require("./publish");
|
|
9
|
+
const setup_1 = require("./setup");
|
|
10
|
+
const teardown_1 = require("./teardown");
|
|
11
|
+
exports.awsPlatformDriver = {
|
|
12
|
+
prepareDeployment: prepareDeployment_1.awsPrepareDeployment,
|
|
13
|
+
go: go_1.awsGo,
|
|
14
|
+
goDocker: goDocker_1.awsGoDocker,
|
|
15
|
+
teardown: teardown_1.awsTeardown,
|
|
16
|
+
clearResources: clearResources_1.awsClearResources,
|
|
17
|
+
setupSteps: setup_1.awsSetupSteps,
|
|
18
|
+
publish: publish_1.awsPublish,
|
|
19
|
+
publishBuild: publish_1.awsPublishBuild,
|
|
20
|
+
publishUpload: publish_1.awsPublishUpload,
|
|
21
|
+
publishDeploy: publish_1.awsPublishDeploy,
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/platforms/aws/index.ts"],"names":[],"mappings":";;;AACA,qDAAqD;AACrD,6BAA6B;AAC7B,yCAAyC;AACzC,2DAA2D;AAC3D,uCAA4F;AAC5F,mCAAwC;AACxC,yCAAyC;AAE5B,QAAA,iBAAiB,GAAsB;IAClD,iBAAiB,EAAE,wCAAoB;IAEvC,EAAE,EAAE,UAAK;IACT,QAAQ,EAAE,sBAAW;IACrB,QAAQ,EAAE,sBAAW;IACrB,cAAc,EAAE,kCAAiB;IACjC,UAAU,EAAE,qBAAa;IAEzB,OAAO,EAAE,oBAAU;IACnB,YAAY,EAAE,yBAAe;IAC7B,aAAa,EAAE,0BAAgB;IAC/B,aAAa,EAAE,0BAAgB;CAChC,CAAC","sourcesContent":["import { QpqPlatformDriver } from '../types';\nimport { awsClearResources } from './clearResources';\nimport { awsGo } from './go';\nimport { awsGoDocker } from './goDocker';\nimport { awsPrepareDeployment } from './prepareDeployment';\nimport { awsPublish, awsPublishBuild, awsPublishDeploy, awsPublishUpload } from './publish';\nimport { awsSetupSteps } from './setup';\nimport { awsTeardown } from './teardown';\n\nexport const awsPlatformDriver: QpqPlatformDriver = {\n prepareDeployment: awsPrepareDeployment,\n\n go: awsGo,\n goDocker: awsGoDocker,\n teardown: awsTeardown,\n clearResources: awsClearResources,\n setupSteps: awsSetupSteps,\n\n publish: awsPublish,\n publishBuild: awsPublishBuild,\n publishUpload: awsPublishUpload,\n publishDeploy: awsPublishDeploy,\n};\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.awsPrepareDeployment = void 0;
|
|
4
|
+
const config_aws_1 = require("@qpqjs/config-aws");
|
|
5
|
+
/** Checks the entry has an account and region, then primes AWS_DEFAULT_ACCOUNT / AWS_DEFAULT_REGION from it. */
|
|
6
|
+
const awsPrepareDeployment = (deploymentName, deployment) => {
|
|
7
|
+
(0, config_aws_1.primeAwsDeploymentEnv)((0, config_aws_1.validateAwsDeployment)(deploymentName, deployment));
|
|
8
|
+
};
|
|
9
|
+
exports.awsPrepareDeployment = awsPrepareDeployment;
|
|
10
|
+
//# sourceMappingURL=prepareDeployment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prepareDeployment.js","sourceRoot":"","sources":["../../../../src/platforms/aws/prepareDeployment.ts"],"names":[],"mappings":";;;AAAA,kDAAiF;AAGjF,gHAAgH;AACzG,MAAM,oBAAoB,GAAG,CAAC,cAAsB,EAAE,UAA4B,EAAQ,EAAE;IACjG,IAAA,kCAAqB,EAAC,IAAA,kCAAqB,EAAC,cAAc,EAAE,UAAU,CAAC,CAAC,CAAC;AAC3E,CAAC,CAAC;AAFW,QAAA,oBAAoB,wBAE/B","sourcesContent":["import { primeAwsDeploymentEnv, validateAwsDeployment } from '@qpqjs/config-aws';\nimport { QpqAppDeployment } from '@qpqjs/core';\n\n/** Checks the entry has an account and region, then primes AWS_DEFAULT_ACCOUNT / AWS_DEFAULT_REGION from it. */\nexport const awsPrepareDeployment = (deploymentName: string, deployment: QpqAppDeployment): void => {\n primeAwsDeploymentEnv(validateAwsDeployment(deploymentName, deployment));\n};\n"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const awsPublishBuild: (appName: string, serviceNames: string[]) => Promise<void>;
|
|
2
|
+
export declare const awsPublishUpload: (appName: string, serviceNames: string[]) => Promise<void>;
|
|
3
|
+
export declare const awsPublishDeploy: (appName: string, serviceNames: string[]) => Promise<void>;
|
|
4
|
+
export declare const awsPublish: (appName: string, serviceNames: string[]) => Promise<void>;
|
|
@@ -0,0 +1,66 @@
|
|
|
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.awsPublish = exports.awsPublishDeploy = exports.awsPublishUpload = exports.awsPublishBuild = void 0;
|
|
13
|
+
// AWS federated remote publishing — build each backend service as a
|
|
14
|
+
// module-federation remote and publish it into that service's federated code
|
|
15
|
+
// bucket (see ./remote for the three-phase mechanics).
|
|
16
|
+
const awsCredentials_1 = require("./awsCredentials");
|
|
17
|
+
const remote_1 = require("./remote");
|
|
18
|
+
const requireAwsCredentials = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
19
|
+
if (!(yield (0, awsCredentials_1.isAwsCredentialsValid)())) {
|
|
20
|
+
console.error('AWS credentials are not valid. Configure them and retry.');
|
|
21
|
+
process.exit(1);
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
const awsPublishBuild = (appName, serviceNames) => __awaiter(void 0, void 0, void 0, function* () {
|
|
25
|
+
console.log(`Building federated remotes for [${appName}]: ${serviceNames.join(', ')}`);
|
|
26
|
+
for (const serviceName of serviceNames) {
|
|
27
|
+
yield (0, remote_1.buildRemote)(appName, serviceName);
|
|
28
|
+
}
|
|
29
|
+
console.log('Done. Next: qpq publish:upload, then qpq publish:deploy.');
|
|
30
|
+
});
|
|
31
|
+
exports.awsPublishBuild = awsPublishBuild;
|
|
32
|
+
const awsPublishUpload = (appName, serviceNames) => __awaiter(void 0, void 0, void 0, function* () {
|
|
33
|
+
yield requireAwsCredentials();
|
|
34
|
+
// Resolve every target up front - a missing build fails the whole step
|
|
35
|
+
// before a single byte is uploaded.
|
|
36
|
+
const targets = serviceNames.map((serviceName) => (0, remote_1.resolvePublishTarget)(appName, serviceName));
|
|
37
|
+
console.log(`Uploading federated remotes for [${appName}]: ${serviceNames.join(', ')}`);
|
|
38
|
+
yield Promise.all(targets.map((target) => (0, remote_1.uploadRemoteVersion)(target)));
|
|
39
|
+
console.log('Done. Run qpq publish:deploy to flip lambdas to the new versions.');
|
|
40
|
+
});
|
|
41
|
+
exports.awsPublishUpload = awsPublishUpload;
|
|
42
|
+
const awsPublishDeploy = (appName, serviceNames) => __awaiter(void 0, void 0, void 0, function* () {
|
|
43
|
+
yield requireAwsCredentials();
|
|
44
|
+
const targets = serviceNames.map((serviceName) => (0, remote_1.resolvePublishTarget)(appName, serviceName));
|
|
45
|
+
console.log(`Deploying federated remote manifests for [${appName}]: ${serviceNames.join(', ')}`);
|
|
46
|
+
yield Promise.all(targets.map((target) => (0, remote_1.deployRemoteManifest)(target)));
|
|
47
|
+
console.log('Done. New lambda cold starts will federate these services from S3.');
|
|
48
|
+
});
|
|
49
|
+
exports.awsPublishDeploy = awsPublishDeploy;
|
|
50
|
+
const awsPublish = (appName, serviceNames) => __awaiter(void 0, void 0, void 0, function* () {
|
|
51
|
+
yield requireAwsCredentials();
|
|
52
|
+
console.log(`Publishing federated remotes for [${appName}]: ${serviceNames.join(', ')}`);
|
|
53
|
+
// 1. Build everything first - any build failure bails before any upload,
|
|
54
|
+
// so the buckets never end up with a half-published set of services.
|
|
55
|
+
for (const serviceName of serviceNames) {
|
|
56
|
+
yield (0, remote_1.buildRemote)(appName, serviceName);
|
|
57
|
+
}
|
|
58
|
+
const targets = serviceNames.map((serviceName) => (0, remote_1.resolvePublishTarget)(appName, serviceName));
|
|
59
|
+
// 2. Upload all version dirs in parallel - manifests untouched, nothing live yet.
|
|
60
|
+
yield Promise.all(targets.map((target) => (0, remote_1.uploadRemoteVersion)(target)));
|
|
61
|
+
// 3. Every version dir is fully uploaded - flip the manifests, in parallel.
|
|
62
|
+
yield Promise.all(targets.map((target) => (0, remote_1.deployRemoteManifest)(target)));
|
|
63
|
+
console.log('Done. New lambda cold starts will federate these services from S3.');
|
|
64
|
+
});
|
|
65
|
+
exports.awsPublish = awsPublish;
|
|
66
|
+
//# sourceMappingURL=publish.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"publish.js","sourceRoot":"","sources":["../../../../src/platforms/aws/publish.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oEAAoE;AACpE,6EAA6E;AAC7E,uDAAuD;AACvD,qDAAyD;AACzD,qCAAwG;AAExG,MAAM,qBAAqB,GAAG,GAAwB,EAAE;IACtD,IAAI,CAAC,CAAC,MAAM,IAAA,sCAAqB,GAAE,CAAC,EAAE,CAAC;QACrC,OAAO,CAAC,KAAK,CAAC,0DAA0D,CAAC,CAAC;QAC1E,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAA,CAAC;AAEK,MAAM,eAAe,GAAG,CAAO,OAAe,EAAE,YAAsB,EAAiB,EAAE;IAC9F,OAAO,CAAC,GAAG,CAAC,mCAAmC,OAAO,MAAM,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAEvF,KAAK,MAAM,WAAW,IAAI,YAAY,EAAE,CAAC;QACvC,MAAM,IAAA,oBAAW,EAAC,OAAO,EAAE,WAAW,CAAC,CAAC;IAC1C,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,0DAA0D,CAAC,CAAC;AAC1E,CAAC,CAAA,CAAC;AARW,QAAA,eAAe,mBAQ1B;AAEK,MAAM,gBAAgB,GAAG,CAAO,OAAe,EAAE,YAAsB,EAAiB,EAAE;IAC/F,MAAM,qBAAqB,EAAE,CAAC;IAE9B,uEAAuE;IACvE,oCAAoC;IACpC,MAAM,OAAO,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,IAAA,6BAAoB,EAAC,OAAO,EAAE,WAAW,CAA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C,MAAM,IAAA,oBAAW,EAAC,OAAO,EAAE,WAAW,CAAC,CAAC;IAC1C,CAAC;IACD,MAAM,OAAO,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,IAAA,6BAAoB,EAAC,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC;IAE9F,kFAAkF;IAClF,MAAM,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,IAAA,4BAAmB,EAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IAExE,4EAA4E;IAC5E,MAAM,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,IAAA,6BAAoB,EAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IAEzE,OAAO,CAAC,GAAG,CAAC,oEAAoE,CAAC,CAAC;AACpF,CAAC,CAAA,CAAC;AAnBW,QAAA,UAAU,cAmBrB","sourcesContent":["// AWS federated remote publishing — build each backend service as a\n// module-federation remote and publish it into that service's federated code\n// bucket (see ./remote for the three-phase mechanics).\nimport { isAwsCredentialsValid } from './awsCredentials';\nimport { buildRemote, deployRemoteManifest, resolvePublishTarget, uploadRemoteVersion } from './remote';\n\nconst requireAwsCredentials = async (): Promise<void> => {\n if (!(await isAwsCredentialsValid())) {\n console.error('AWS credentials are not valid. Configure them and retry.');\n process.exit(1);\n }\n};\n\nexport const awsPublishBuild = async (appName: string, serviceNames: string[]): Promise<void> => {\n console.log(`Building federated remotes for [${appName}]: ${serviceNames.join(', ')}`);\n\n for (const serviceName of serviceNames) {\n await buildRemote(appName, serviceName);\n }\n\n console.log('Done. Next: qpq publish:upload, then qpq publish:deploy.');\n};\n\nexport const awsPublishUpload = async (appName: string, serviceNames: string[]): Promise<void> => {\n await requireAwsCredentials();\n\n // Resolve every target up front - a missing build fails the whole step\n // before a single byte is uploaded.\n const targets = serviceNames.map((serviceName) => resolvePublishTarget(appName, serviceName));\n\n console.log(`Uploading federated remotes for [${appName}]: ${serviceNames.join(', ')}`);\n await Promise.all(targets.map((target) => uploadRemoteVersion(target)));\n\n console.log('Done. Run qpq publish:deploy to flip lambdas to the new versions.');\n};\n\nexport const awsPublishDeploy = async (appName: string, serviceNames: string[]): Promise<void> => {\n await requireAwsCredentials();\n\n const targets = serviceNames.map((serviceName) => resolvePublishTarget(appName, serviceName));\n\n console.log(`Deploying federated remote manifests for [${appName}]: ${serviceNames.join(', ')}`);\n await Promise.all(targets.map((target) => deployRemoteManifest(target)));\n\n console.log('Done. New lambda cold starts will federate these services from S3.');\n};\n\nexport const awsPublish = async (appName: string, serviceNames: string[]): Promise<void> => {\n await requireAwsCredentials();\n\n console.log(`Publishing federated remotes for [${appName}]: ${serviceNames.join(', ')}`);\n\n // 1. Build everything first - any build failure bails before any upload,\n // so the buckets never end up with a half-published set of services.\n for (const serviceName of serviceNames) {\n await buildRemote(appName, serviceName);\n }\n const targets = serviceNames.map((serviceName) => resolvePublishTarget(appName, serviceName));\n\n // 2. Upload all version dirs in parallel - manifests untouched, nothing live yet.\n await Promise.all(targets.map((target) => uploadRemoteVersion(target)));\n\n // 3. Every version dir is fully uploaded - flip the manifests, in parallel.\n await Promise.all(targets.map((target) => deployRemoteManifest(target)));\n\n console.log('Done. New lambda cold starts will federate these services from S3.');\n};\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type RemotePublishTarget = {
|
|
2
|
+
serviceName: string;
|
|
3
|
+
publishPath: string;
|
|
4
|
+
manifestHash: string;
|
|
5
|
+
bucketName: string;
|
|
6
|
+
servicePrefix: string;
|
|
7
|
+
};
|
|
8
|
+
export declare const buildRemote: (appName: string, serviceName: string) => Promise<void>;
|
|
9
|
+
export declare const resolvePublishTarget: (appName: string, serviceName: string) => RemotePublishTarget;
|
|
10
|
+
export declare const uploadRemoteVersion: (target: RemotePublishTarget) => Promise<void>;
|
|
11
|
+
export declare const deployRemoteManifest: (target: RemotePublishTarget) => Promise<void>;
|
|
@@ -0,0 +1,105 @@
|
|
|
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.deployRemoteManifest = exports.uploadRemoteVersion = exports.resolvePublishTarget = exports.buildRemote = void 0;
|
|
16
|
+
// Build a backend service as a module-federation remote and publish it into the
|
|
17
|
+
// shared federated-code storage drive, under the service's own prefix. After this
|
|
18
|
+
// runs, the already-deployed lambdas load their stories from the bucket (quidproquo's
|
|
19
|
+
// dynamicModuleLoader tries the federated store first, falls back to the bundled
|
|
20
|
+
// code when nothing's published).
|
|
21
|
+
//
|
|
22
|
+
// The store is one storage drive shared across services (via `owner`). Each service
|
|
23
|
+
// opts in with defineFederatedModuleStore(<driveName>) and its lambdas read from
|
|
24
|
+
// s3://<bucket>/<service>. Read access comes from the storage drive's own grants, so
|
|
25
|
+
// the drive + a deploy of each service must exist before publishing. The bucket name
|
|
26
|
+
// resolves from the same service config the deploy used, so it always matches.
|
|
27
|
+
//
|
|
28
|
+
// Publishing is split into three phases so they can run as separate commands
|
|
29
|
+
// (publish:build / publish:upload / publish:deploy) or chained by `qpq publish`:
|
|
30
|
+
// buildRemote - rspack the remote + lay out service-remote-published/
|
|
31
|
+
// uploadRemoteVersion - sync the hashed version dir (everything BUT manifest.json)
|
|
32
|
+
// deployRemoteManifest - upload manifest.json, atomically flipping lambdas over
|
|
33
|
+
// Version files always land before the manifest that references them, so a reading
|
|
34
|
+
// lambda never sees a manifest whose files aren't all present yet.
|
|
35
|
+
const actionprocessor_aws_1 = require("@qpqjs/actionprocessor-aws");
|
|
36
|
+
const core_1 = require("@qpqjs/core");
|
|
37
|
+
const deploy_rspack_1 = require("@qpqjs/deploy-rspack");
|
|
38
|
+
const fs_1 = __importDefault(require("fs"));
|
|
39
|
+
const path_1 = __importDefault(require("path"));
|
|
40
|
+
const discovery_1 = require("../../lib/discovery");
|
|
41
|
+
const qpqConfigs_1 = require("../../lib/qpqConfigs");
|
|
42
|
+
const runCommand_1 = require("../../lib/runCommand");
|
|
43
|
+
const getPublishPath = (appName, serviceName) => path_1.default.join((0, discovery_1.getRoot)(), 'dist', 'apps', appName, 'services', serviceName, 'service-remote-published');
|
|
44
|
+
// Resolve the shared store bucket from the service's defineFederatedModuleStore
|
|
45
|
+
// setting (same derivation the lambda env var uses) and the per-service prefix
|
|
46
|
+
// so many services share one bucket.
|
|
47
|
+
const resolveRemoteStore = (appName, serviceName) => {
|
|
48
|
+
var _a;
|
|
49
|
+
const qpqConfig = (0, qpqConfigs_1.loadServiceQpqConfig)(appName, serviceName);
|
|
50
|
+
const federatedStore = core_1.qpqCoreUtils.getFederatedModuleStore(qpqConfig);
|
|
51
|
+
if (!federatedStore) {
|
|
52
|
+
throw new Error(`service [${serviceName}] has no defineFederatedModuleStore(...) - add it (and the matching storage drive) to opt into federation`);
|
|
53
|
+
}
|
|
54
|
+
const storageDrive = core_1.qpqCoreUtils.getStorageDriveByName(federatedStore.storageDrive, qpqConfig);
|
|
55
|
+
if (!storageDrive) {
|
|
56
|
+
throw new Error(`defineFederatedModuleStore references storage drive [${federatedStore.storageDrive}] which service [${serviceName}] does not declare`);
|
|
57
|
+
}
|
|
58
|
+
const bucketName = actionprocessor_aws_1.awsNamingUtils.resolveConfigRuntimeResourceNameFromConfig(((_a = storageDrive.owner) === null || _a === void 0 ? void 0 : _a.resourceNameOverride) || storageDrive.storageDrive, qpqConfig, storageDrive.owner);
|
|
59
|
+
const servicePrefix = core_1.qpqCoreUtils.getApplicationModuleName(qpqConfig);
|
|
60
|
+
return { bucketName, servicePrefix };
|
|
61
|
+
};
|
|
62
|
+
// Phase 1: rspack the federated remote container and lay out the publishable
|
|
63
|
+
// version dir + manifest.json under service-remote-published/. Validates the
|
|
64
|
+
// federation config up front so a misconfigured service fails before the build.
|
|
65
|
+
const buildRemote = (appName, serviceName) => __awaiter(void 0, void 0, void 0, function* () {
|
|
66
|
+
resolveRemoteStore(appName, serviceName);
|
|
67
|
+
const serviceDir = path_1.default.join((0, discovery_1.getServiceDirectory)(appName, serviceName), 'service');
|
|
68
|
+
const qpqConfig = (0, qpqConfigs_1.loadServiceQpqConfig)(appName, serviceName);
|
|
69
|
+
console.log(`Building federated remote: [${serviceName}]`);
|
|
70
|
+
const config = (0, deploy_rspack_1.getServiceRemoteRspackConfig)(qpqConfig, serviceDir);
|
|
71
|
+
yield (0, deploy_rspack_1.runRspack)(config);
|
|
72
|
+
const remoteBuildPath = config.output.path;
|
|
73
|
+
(0, deploy_rspack_1.publishFederatedRemote)(qpqConfig, remoteBuildPath, getPublishPath(appName, serviceName));
|
|
74
|
+
});
|
|
75
|
+
exports.buildRemote = buildRemote;
|
|
76
|
+
// Resolve a publish target from a prior buildRemote's on-disk output.
|
|
77
|
+
const resolvePublishTarget = (appName, serviceName) => {
|
|
78
|
+
const publishPath = getPublishPath(appName, serviceName);
|
|
79
|
+
const manifestPath = path_1.default.join(publishPath, 'manifest.json');
|
|
80
|
+
if (!fs_1.default.existsSync(manifestPath)) {
|
|
81
|
+
throw new Error(`no built remote found for [${serviceName}] (missing ${manifestPath}) - run \`qpq publish:build --app ${appName}\` first`);
|
|
82
|
+
}
|
|
83
|
+
const manifest = JSON.parse(fs_1.default.readFileSync(manifestPath, 'utf-8'));
|
|
84
|
+
return Object.assign({ serviceName,
|
|
85
|
+
publishPath, manifestHash: manifest.hash }, resolveRemoteStore(appName, serviceName));
|
|
86
|
+
};
|
|
87
|
+
exports.resolvePublishTarget = resolvePublishTarget;
|
|
88
|
+
// Phase 2: upload the hashed version dir - everything EXCEPT manifest.json, so
|
|
89
|
+
// nothing referenced by a live manifest changes. Safe to run concurrently across
|
|
90
|
+
// services - each writes only under its own prefix.
|
|
91
|
+
const uploadRemoteVersion = (target) => __awaiter(void 0, void 0, void 0, function* () {
|
|
92
|
+
const { serviceName, publishPath, manifestHash, bucketName, servicePrefix } = target;
|
|
93
|
+
console.log(`Uploading [${serviceName}] version [${manifestHash}] to [s3://${bucketName}/${servicePrefix}/${manifestHash}]`);
|
|
94
|
+
yield (0, runCommand_1.runCommand)('aws', ['s3', 'sync', path_1.default.join(publishPath, manifestHash), `s3://${bucketName}/${servicePrefix}/${manifestHash}`]);
|
|
95
|
+
});
|
|
96
|
+
exports.uploadRemoteVersion = uploadRemoteVersion;
|
|
97
|
+
// Phase 3: upload manifest.json, the pointer lambdas read - this is the moment
|
|
98
|
+
// the new version goes live. Only run once the version dir is fully uploaded.
|
|
99
|
+
const deployRemoteManifest = (target) => __awaiter(void 0, void 0, void 0, function* () {
|
|
100
|
+
const { serviceName, publishPath, manifestHash, bucketName, servicePrefix } = target;
|
|
101
|
+
console.log(`Deploying [${serviceName}] manifest for version [${manifestHash}] to [s3://${bucketName}/${servicePrefix}/manifest.json]`);
|
|
102
|
+
yield (0, runCommand_1.runCommand)('aws', ['s3', 'cp', path_1.default.join(publishPath, 'manifest.json'), `s3://${bucketName}/${servicePrefix}/manifest.json`]);
|
|
103
|
+
});
|
|
104
|
+
exports.deployRemoteManifest = deployRemoteManifest;
|
|
105
|
+
//# sourceMappingURL=remote.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remote.js","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CAAC;IAErF,OAAO,CAAC,GAAG,CAAC,cAAc,WAAW,2BAA2B,YAAY,cAAc,UAAU,IAAI,aAAa,iBAAiB,CAAC,CAAC;IACxI,MAAM,IAAA,uBAAU,EAAC,KAAK,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,cAAI,CAAC,IAAI,CAAC,WAAW,EAAE,eAAe,CAAC,EAAE,QAAQ,UAAU,IAAI,aAAa,gBAAgB,CAAC,CAAC,CAAC;AACtI,CAAC,CAAA,CAAC;AALW,QAAA,oBAAoB,wBAK/B","sourcesContent":["// Build a backend service as a module-federation remote and publish it into the\n// shared federated-code storage drive, under the service's own prefix. After this\n// runs, the already-deployed lambdas load their stories from the bucket (quidproquo's\n// dynamicModuleLoader tries the federated store first, falls back to the bundled\n// code when nothing's published).\n//\n// The store is one storage drive shared across services (via `owner`). Each service\n// opts in with defineFederatedModuleStore(<driveName>) and its lambdas read from\n// s3://<bucket>/<service>. Read access comes from the storage drive's own grants, so\n// the drive + a deploy of each service must exist before publishing. The bucket name\n// resolves from the same service config the deploy used, so it always matches.\n//\n// Publishing is split into three phases so they can run as separate commands\n// (publish:build / publish:upload / publish:deploy) or chained by `qpq publish`:\n// buildRemote - rspack the remote + lay out service-remote-published/\n// uploadRemoteVersion - sync the hashed version dir (everything BUT manifest.json)\n// deployRemoteManifest - upload manifest.json, atomically flipping lambdas over\n// Version files always land before the manifest that references them, so a reading\n// lambda never sees a manifest whose files aren't all present yet.\nimport { awsNamingUtils } from '@qpqjs/actionprocessor-aws';\nimport { qpqCoreUtils } from '@qpqjs/core';\nimport { getServiceRemoteRspackConfig, publishFederatedRemote, runRspack } from '@qpqjs/deploy-rspack';\n\nimport fs from 'fs';\nimport path from 'path';\n\nimport { getRoot, getServiceDirectory } from '../../lib/discovery';\nimport { loadServiceQpqConfig } from '../../lib/qpqConfigs';\nimport { runCommand } from '../../lib/runCommand';\n\n// Everything the upload/deploy phases need to publish a built remote. Resolved\n// from the on-disk build output + service config, so each phase can run in its\n// own process without handing state between commands.\nexport type RemotePublishTarget = {\n serviceName: string;\n publishPath: string;\n manifestHash: string;\n bucketName: string;\n servicePrefix: string;\n};\n\nconst getPublishPath = (appName: string, serviceName: string): string =>\n path.join(getRoot(), 'dist', 'apps', appName, 'services', serviceName, 'service-remote-published');\n\n// Resolve the shared store bucket from the service's defineFederatedModuleStore\n// setting (same derivation the lambda env var uses) and the per-service prefix\n// so many services share one bucket.\nconst resolveRemoteStore = (appName: string, serviceName: string): { bucketName: string; servicePrefix: string } => {\n const qpqConfig = loadServiceQpqConfig(appName, serviceName);\n\n const federatedStore = qpqCoreUtils.getFederatedModuleStore(qpqConfig);\n if (!federatedStore) {\n throw new Error(\n `service [${serviceName}] has no defineFederatedModuleStore(...) - add it (and the matching storage drive) to opt into federation`,\n );\n }\n const storageDrive = qpqCoreUtils.getStorageDriveByName(federatedStore.storageDrive, qpqConfig);\n if (!storageDrive) {\n throw new Error(\n `defineFederatedModuleStore references storage drive [${federatedStore.storageDrive}] which service [${serviceName}] does not declare`,\n );\n }\n const bucketName = awsNamingUtils.resolveConfigRuntimeResourceNameFromConfig(\n storageDrive.owner?.resourceNameOverride || storageDrive.storageDrive,\n qpqConfig,\n storageDrive.owner,\n );\n const servicePrefix = qpqCoreUtils.getApplicationModuleName(qpqConfig);\n\n return { bucketName, servicePrefix };\n};\n\n// Phase 1: rspack the federated remote container and lay out the publishable\n// version dir + manifest.json under service-remote-published/. Validates the\n// federation config up front so a misconfigured service fails before the build.\nexport const buildRemote = async (appName: string, serviceName: string): Promise<void> => {\n resolveRemoteStore(appName, serviceName);\n\n const serviceDir = path.join(getServiceDirectory(appName, serviceName), 'service');\n const qpqConfig = loadServiceQpqConfig(appName, serviceName);\n\n console.log(`Building federated remote: [${serviceName}]`);\n const config = getServiceRemoteRspackConfig(qpqConfig, serviceDir);\n await runRspack(config);\n\n const remoteBuildPath = config.output!.path as string;\n publishFederatedRemote(qpqConfig, remoteBuildPath, getPublishPath(appName, serviceName));\n};\n\n// Resolve a publish target from a prior buildRemote's on-disk output.\nexport const resolvePublishTarget = (appName: string, serviceName: string): RemotePublishTarget => {\n const publishPath = getPublishPath(appName, serviceName);\n const manifestPath = path.join(publishPath, 'manifest.json');\n\n if (!fs.existsSync(manifestPath)) {\n throw new Error(`no built remote found for [${serviceName}] (missing ${manifestPath}) - run \\`qpq publish:build --app ${appName}\\` first`);\n }\n const manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf-8')) as {\n hash: string;\n };\n\n return {\n serviceName,\n publishPath,\n manifestHash: manifest.hash,\n ...resolveRemoteStore(appName, serviceName),\n };\n};\n\n// Phase 2: upload the hashed version dir - everything EXCEPT manifest.json, so\n// nothing referenced by a live manifest changes. Safe to run concurrently across\n// services - each writes only under its own prefix.\nexport const uploadRemoteVersion = async (target: RemotePublishTarget): Promise<void> => {\n const { serviceName, publishPath, manifestHash, bucketName, servicePrefix } = target;\n\n console.log(`Uploading [${serviceName}] version [${manifestHash}] to [s3://${bucketName}/${servicePrefix}/${manifestHash}]`);\n await runCommand('aws', ['s3', 'sync', path.join(publishPath, manifestHash), `s3://${bucketName}/${servicePrefix}/${manifestHash}`]);\n};\n\n// Phase 3: upload manifest.json, the pointer lambdas read - this is the moment\n// the new version goes live. Only run once the version dir is fully uploaded.\nexport const deployRemoteManifest = async (target: RemotePublishTarget): Promise<void> => {\n const { serviceName, publishPath, manifestHash, bucketName, servicePrefix } = target;\n\n console.log(`Deploying [${serviceName}] manifest for version [${manifestHash}] to [s3://${bucketName}/${servicePrefix}/manifest.json]`);\n await runCommand('aws', ['s3', 'cp', path.join(publishPath, 'manifest.json'), `s3://${bucketName}/${servicePrefix}/manifest.json`]);\n};\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { QPQConfig } from '@qpqjs/core';
|
|
2
|
+
/** Everything the AWS setup steps share: the target account/region and the app's configs. */
|
|
3
|
+
export type AwsSetupContext = {
|
|
4
|
+
appName: string;
|
|
5
|
+
environment: string;
|
|
6
|
+
accountId: string;
|
|
7
|
+
region: string;
|
|
8
|
+
accountQpqConfig: QPQConfig;
|
|
9
|
+
bootstrapQpqConfig: QPQConfig;
|
|
10
|
+
serviceQpqConfigs: QPQConfig[];
|
|
11
|
+
};
|
|
12
|
+
export declare const buildAwsSetupContext: (appName: string, deploymentName: string) => AwsSetupContext;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildAwsSetupContext = void 0;
|
|
4
|
+
const deploy_aws_1 = require("@qpqjs/deploy-aws");
|
|
5
|
+
const discovery_1 = require("../../../lib/discovery");
|
|
6
|
+
const qpqConfigs_1 = require("../../../lib/qpqConfigs");
|
|
7
|
+
const buildAwsSetupContext = (appName, deploymentName) => {
|
|
8
|
+
const ctx = (0, deploy_aws_1.getQpqAppDeployContext)((0, discovery_1.getRoot)(), appName, deploymentName);
|
|
9
|
+
return {
|
|
10
|
+
appName,
|
|
11
|
+
environment: ctx.environment,
|
|
12
|
+
accountId: ctx.accountId,
|
|
13
|
+
region: ctx.region,
|
|
14
|
+
accountQpqConfig: (0, deploy_aws_1.getWorkspaceAccountQpqConfig)(ctx),
|
|
15
|
+
bootstrapQpqConfig: (0, deploy_aws_1.getWorkspaceBootstrapQpqConfig)(ctx),
|
|
16
|
+
serviceQpqConfigs: (0, discovery_1.getServiceNames)(appName).map((service) => (0, qpqConfigs_1.loadServiceQpqConfig)(appName, service)),
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
exports.buildAwsSetupContext = buildAwsSetupContext;
|
|
20
|
+
//# sourceMappingURL=awsSetupContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"awsSetupContext.js","sourceRoot":"","sources":["../../../../../src/platforms/aws/setup/awsSetupContext.ts"],"names":[],"mappings":";;;AACA,kDAAyH;AAEzH,sDAAkE;AAClE,wDAA+D;AAaxD,MAAM,oBAAoB,GAAG,CAAC,OAAe,EAAE,cAAsB,EAAmB,EAAE;IAC/F,MAAM,GAAG,GAAG,IAAA,mCAAsB,EAAC,IAAA,mBAAO,GAAE,EAAE,OAAO,EAAE,cAAc,CAAC,CAAC;IAEvE,OAAO;QACL,OAAO;QACP,WAAW,EAAE,GAAG,CAAC,WAAW;QAC5B,SAAS,EAAE,GAAG,CAAC,SAAS;QACxB,MAAM,EAAE,GAAG,CAAC,MAAM;QAClB,gBAAgB,EAAE,IAAA,yCAA4B,EAAC,GAAG,CAAC;QACnD,kBAAkB,EAAE,IAAA,2CAA8B,EAAC,GAAG,CAAC;QACvD,iBAAiB,EAAE,IAAA,2BAAe,EAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,IAAA,iCAAoB,EAAC,OAAO,EAAE,OAAO,CAAC,CAAC;KACrG,CAAC;AACJ,CAAC,CAAC;AAZW,QAAA,oBAAoB,wBAY/B","sourcesContent":["import { QPQConfig } from '@qpqjs/core';\nimport { getQpqAppDeployContext, getWorkspaceAccountQpqConfig, getWorkspaceBootstrapQpqConfig } from '@qpqjs/deploy-aws';\n\nimport { getRoot, getServiceNames } from '../../../lib/discovery';\nimport { loadServiceQpqConfig } from '../../../lib/qpqConfigs';\n\n/** Everything the AWS setup steps share: the target account/region and the app's configs. */\nexport type AwsSetupContext = {\n appName: string;\n environment: string;\n accountId: string;\n region: string;\n accountQpqConfig: QPQConfig;\n bootstrapQpqConfig: QPQConfig;\n serviceQpqConfigs: QPQConfig[];\n};\n\nexport const buildAwsSetupContext = (appName: string, deploymentName: string): AwsSetupContext => {\n const ctx = getQpqAppDeployContext(getRoot(), appName, deploymentName);\n\n return {\n appName,\n environment: ctx.environment,\n accountId: ctx.accountId,\n region: ctx.region,\n accountQpqConfig: getWorkspaceAccountQpqConfig(ctx),\n bootstrapQpqConfig: getWorkspaceBootstrapQpqConfig(ctx),\n serviceQpqConfigs: getServiceNames(appName).map((service) => loadServiceQpqConfig(appName, service)),\n };\n};\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { SetupStep } from '../../../lib/setupStep';
|
|
2
|
+
/**
|
|
3
|
+
* The AWS checklist, in the order it must run: prerequisites that only check, the CDK
|
|
4
|
+
* toolkit per region, then the app-wide stacks (the account stack creates the GitHub OIDC
|
|
5
|
+
* provider, the bootstrap stack the GitHub deploy role). Services are deployed separately
|
|
6
|
+
* with `qpq go` / `qpq go:docker`, which is where the time goes and where parallelism lives.
|
|
7
|
+
*/
|
|
8
|
+
export declare const awsSetupSteps: (appName: string, deploymentName: string) => Promise<SetupStep[]>;
|
|
@@ -0,0 +1,44 @@
|
|
|
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.awsSetupSteps = void 0;
|
|
13
|
+
const awsSetupContext_1 = require("./awsSetupContext");
|
|
14
|
+
const buildBucketNamesStep_1 = require("./buildBucketNamesStep");
|
|
15
|
+
const buildCdkBootstrapSteps_1 = require("./buildCdkBootstrapSteps");
|
|
16
|
+
const buildGithubDeployRoleStep_1 = require("./buildGithubDeployRoleStep");
|
|
17
|
+
const buildGithubOidcProviderStep_1 = require("./buildGithubOidcProviderStep");
|
|
18
|
+
const buildHostedZonesStep_1 = require("./buildHostedZonesStep");
|
|
19
|
+
const buildIamCapabilityStep_1 = require("./buildIamCapabilityStep");
|
|
20
|
+
const buildIdentityStep_1 = require("./buildIdentityStep");
|
|
21
|
+
const buildStackSteps_1 = require("./buildStackSteps");
|
|
22
|
+
/**
|
|
23
|
+
* The AWS checklist, in the order it must run: prerequisites that only check, the CDK
|
|
24
|
+
* toolkit per region, then the app-wide stacks (the account stack creates the GitHub OIDC
|
|
25
|
+
* provider, the bootstrap stack the GitHub deploy role). Services are deployed separately
|
|
26
|
+
* with `qpq go` / `qpq go:docker`, which is where the time goes and where parallelism lives.
|
|
27
|
+
*/
|
|
28
|
+
const awsSetupSteps = (appName, deploymentName) => __awaiter(void 0, void 0, void 0, function* () {
|
|
29
|
+
const ctx = (0, awsSetupContext_1.buildAwsSetupContext)(appName, deploymentName);
|
|
30
|
+
return [
|
|
31
|
+
(0, buildIdentityStep_1.buildIdentityStep)(ctx),
|
|
32
|
+
(0, buildIamCapabilityStep_1.buildIamCapabilityStep)(ctx),
|
|
33
|
+
(0, buildHostedZonesStep_1.buildHostedZonesStep)(ctx),
|
|
34
|
+
(0, buildBucketNamesStep_1.buildBucketNamesStep)(ctx),
|
|
35
|
+
...(0, buildCdkBootstrapSteps_1.buildCdkBootstrapSteps)(ctx),
|
|
36
|
+
(0, buildStackSteps_1.buildAccountStackStep)(ctx),
|
|
37
|
+
(0, buildGithubOidcProviderStep_1.buildGithubOidcProviderStep)(ctx),
|
|
38
|
+
(0, buildStackSteps_1.buildDomainStackStep)(ctx),
|
|
39
|
+
(0, buildStackSteps_1.buildBootstrapStackStep)(ctx),
|
|
40
|
+
(0, buildGithubDeployRoleStep_1.buildGithubDeployRoleStep)(ctx),
|
|
41
|
+
];
|
|
42
|
+
});
|
|
43
|
+
exports.awsSetupSteps = awsSetupSteps;
|
|
44
|
+
//# sourceMappingURL=awsSetupSteps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"awsSetupSteps.js","sourceRoot":"","sources":["../../../../../src/platforms/aws/setup/awsSetupSteps.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,uDAAyD;AACzD,iEAA8D;AAC9D,qEAAkE;AAClE,2EAAwE;AACxE,+EAA4E;AAC5E,iEAA8D;AAC9D,qEAAkE;AAClE,2DAAwD;AACxD,uDAAyG;AAEzG;;;;;GAKG;AACI,MAAM,aAAa,GAAG,CAAO,OAAe,EAAE,cAAsB,EAAwB,EAAE;IACnG,MAAM,GAAG,GAAG,IAAA,sCAAoB,EAAC,OAAO,EAAE,cAAc,CAAC,CAAC;IAE1D,OAAO;QACL,IAAA,qCAAiB,EAAC,GAAG,CAAC;QACtB,IAAA,+CAAsB,EAAC,GAAG,CAAC;QAC3B,IAAA,2CAAoB,EAAC,GAAG,CAAC;QACzB,IAAA,2CAAoB,EAAC,GAAG,CAAC;QACzB,GAAG,IAAA,+CAAsB,EAAC,GAAG,CAAC;QAC9B,IAAA,uCAAqB,EAAC,GAAG,CAAC;QAC1B,IAAA,yDAA2B,EAAC,GAAG,CAAC;QAChC,IAAA,sCAAoB,EAAC,GAAG,CAAC;QACzB,IAAA,yCAAuB,EAAC,GAAG,CAAC;QAC5B,IAAA,qDAAyB,EAAC,GAAG,CAAC;KAC/B,CAAC;AACJ,CAAC,CAAA,CAAC;AAfW,QAAA,aAAa,iBAexB","sourcesContent":["import { SetupStep } from '../../../lib/setupStep';\nimport { buildAwsSetupContext } from './awsSetupContext';\nimport { buildBucketNamesStep } from './buildBucketNamesStep';\nimport { buildCdkBootstrapSteps } from './buildCdkBootstrapSteps';\nimport { buildGithubDeployRoleStep } from './buildGithubDeployRoleStep';\nimport { buildGithubOidcProviderStep } from './buildGithubOidcProviderStep';\nimport { buildHostedZonesStep } from './buildHostedZonesStep';\nimport { buildIamCapabilityStep } from './buildIamCapabilityStep';\nimport { buildIdentityStep } from './buildIdentityStep';\nimport { buildAccountStackStep, buildBootstrapStackStep, buildDomainStackStep } from './buildStackSteps';\n\n/**\n * The AWS checklist, in the order it must run: prerequisites that only check, the CDK\n * toolkit per region, then the app-wide stacks (the account stack creates the GitHub OIDC\n * provider, the bootstrap stack the GitHub deploy role). Services are deployed separately\n * with `qpq go` / `qpq go:docker`, which is where the time goes and where parallelism lives.\n */\nexport const awsSetupSteps = async (appName: string, deploymentName: string): Promise<SetupStep[]> => {\n const ctx = buildAwsSetupContext(appName, deploymentName);\n\n return [\n buildIdentityStep(ctx),\n buildIamCapabilityStep(ctx),\n buildHostedZonesStep(ctx),\n buildBucketNamesStep(ctx),\n ...buildCdkBootstrapSteps(ctx),\n buildAccountStackStep(ctx),\n buildGithubOidcProviderStep(ctx),\n buildDomainStackStep(ctx),\n buildBootstrapStackStep(ctx),\n buildGithubDeployRoleStep(ctx),\n ];\n};\n"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { SetupStep } from '../../../lib/setupStep';
|
|
2
|
+
import { AwsSetupContext } from './awsSetupContext';
|
|
3
|
+
/** Check-only: no bucket the deploy will create is already taken by another AWS account. */
|
|
4
|
+
export declare const buildBucketNamesStep: (ctx: AwsSetupContext) => SetupStep;
|
|
@@ -0,0 +1,77 @@
|
|
|
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.buildBucketNamesStep = void 0;
|
|
13
|
+
const actionprocessor_aws_1 = require("@qpqjs/actionprocessor-aws");
|
|
14
|
+
const core_1 = require("@qpqjs/core");
|
|
15
|
+
const webserver_1 = require("@qpqjs/webserver");
|
|
16
|
+
const client_s3_1 = require("@aws-sdk/client-s3");
|
|
17
|
+
// Every bucket a service deploy creates, named the way the constructs name them.
|
|
18
|
+
const getServiceBucketNames = (qpqConfig) => [
|
|
19
|
+
...core_1.qpqCoreUtils
|
|
20
|
+
.getOwnedItems(core_1.qpqCoreUtils.getStorageDrives(qpqConfig), qpqConfig)
|
|
21
|
+
.map((drive) => actionprocessor_aws_1.awsNamingUtils.getConfigRuntimeResourceNameFromConfig(drive.storageDrive, qpqConfig)),
|
|
22
|
+
...webserver_1.qpqWebServerUtils
|
|
23
|
+
.getWebEntryConfigs(qpqConfig)
|
|
24
|
+
.filter((webEntry) => !webEntry.storageDrive.sourceStorageDrive)
|
|
25
|
+
.map((webEntry) => actionprocessor_aws_1.awsNamingUtils.getQpqRuntimeResourceNameFromConfig(webEntry.name, qpqConfig, 'we')),
|
|
26
|
+
];
|
|
27
|
+
// HeadBucket: 404 means free, 200 ours, 403 exists in another account.
|
|
28
|
+
const getBucketOwner = (client, bucketName) => __awaiter(void 0, void 0, void 0, function* () {
|
|
29
|
+
var _a;
|
|
30
|
+
try {
|
|
31
|
+
yield client.send(new client_s3_1.HeadBucketCommand({ Bucket: bucketName }));
|
|
32
|
+
return 'ours';
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
const status = (_a = error.$metadata) === null || _a === void 0 ? void 0 : _a.httpStatusCode;
|
|
36
|
+
if (status === 404) {
|
|
37
|
+
return 'free';
|
|
38
|
+
}
|
|
39
|
+
if (status === 403 || status === 301) {
|
|
40
|
+
return 'other';
|
|
41
|
+
}
|
|
42
|
+
throw error;
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
// S3 bucket names are global and the framework names them from app, service and
|
|
46
|
+
// environment alone, so a second account cannot reuse a name the first still holds.
|
|
47
|
+
const checkBucketNames = (ctx) => __awaiter(void 0, void 0, void 0, function* () {
|
|
48
|
+
const names = [...new Set(ctx.serviceQpqConfigs.flatMap(getServiceBucketNames))];
|
|
49
|
+
const client = new client_s3_1.S3Client({ region: ctx.region });
|
|
50
|
+
const taken = [];
|
|
51
|
+
let ours = 0;
|
|
52
|
+
for (const name of names) {
|
|
53
|
+
const owner = yield getBucketOwner(client, name);
|
|
54
|
+
if (owner === 'other')
|
|
55
|
+
taken.push(name);
|
|
56
|
+
if (owner === 'ours')
|
|
57
|
+
ours += 1;
|
|
58
|
+
}
|
|
59
|
+
return taken.length === 0
|
|
60
|
+
? { done: true, detail: `${names.length} bucket name(s) available or already ours (${ours} existing)` }
|
|
61
|
+
: { done: false, detail: `held by another account: ${taken.join(', ')}; delete them there or change the app prefix` };
|
|
62
|
+
});
|
|
63
|
+
/** Check-only: no bucket the deploy will create is already taken by another AWS account. */
|
|
64
|
+
const buildBucketNamesStep = (ctx) => ({
|
|
65
|
+
id: 'bucket-names',
|
|
66
|
+
name: 'S3 bucket names available',
|
|
67
|
+
check: () => checkBucketNames(ctx),
|
|
68
|
+
run: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
69
|
+
var _a;
|
|
70
|
+
const result = yield checkBucketNames(ctx);
|
|
71
|
+
if (!result.done) {
|
|
72
|
+
throw new Error((_a = result.detail) !== null && _a !== void 0 ? _a : 'bucket names taken');
|
|
73
|
+
}
|
|
74
|
+
}),
|
|
75
|
+
});
|
|
76
|
+
exports.buildBucketNamesStep = buildBucketNamesStep;
|
|
77
|
+
//# sourceMappingURL=buildBucketNamesStep.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buildBucketNamesStep.js","sourceRoot":"","sources":["../../../../../src/platforms/aws/setup/buildBucketNamesStep.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oEAA4D;AAC5D,sCAAsD;AACtD,gDAAqD;AAErD,kDAAiE;AAKjE,iFAAiF;AACjF,MAAM,qBAAqB,GAAG,CAAC,SAAoB,EAAY,EAAE,CAAC;IAChE,GA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A;CACF,CAAC,CAAC;AAVU,QAAA,oBAAoB,wBAU9B","sourcesContent":["import { awsNamingUtils } from '@qpqjs/actionprocessor-aws';\nimport { QPQConfig, qpqCoreUtils } from '@qpqjs/core';\nimport { qpqWebServerUtils } from '@qpqjs/webserver';\n\nimport { HeadBucketCommand, S3Client } from '@aws-sdk/client-s3';\n\nimport { SetupCheckResult, SetupStep } from '../../../lib/setupStep';\nimport { AwsSetupContext } from './awsSetupContext';\n\n// Every bucket a service deploy creates, named the way the constructs name them.\nconst getServiceBucketNames = (qpqConfig: QPQConfig): string[] => [\n ...qpqCoreUtils\n .getOwnedItems(qpqCoreUtils.getStorageDrives(qpqConfig), qpqConfig)\n .map((drive) => awsNamingUtils.getConfigRuntimeResourceNameFromConfig(drive.storageDrive, qpqConfig)),\n ...qpqWebServerUtils\n .getWebEntryConfigs(qpqConfig)\n .filter((webEntry) => !webEntry.storageDrive.sourceStorageDrive)\n .map((webEntry) => awsNamingUtils.getQpqRuntimeResourceNameFromConfig(webEntry.name, qpqConfig, 'we')),\n];\n\ntype BucketOwner = 'free' | 'ours' | 'other';\n\n// HeadBucket: 404 means free, 200 ours, 403 exists in another account.\nconst getBucketOwner = async (client: S3Client, bucketName: string): Promise<BucketOwner> => {\n try {\n await client.send(new HeadBucketCommand({ Bucket: bucketName }));\n return 'ours';\n } catch (error) {\n const status = (error as { $metadata?: { httpStatusCode?: number } }).$metadata?.httpStatusCode;\n if (status === 404) {\n return 'free';\n }\n if (status === 403 || status === 301) {\n return 'other';\n }\n throw error;\n }\n};\n\n// S3 bucket names are global and the framework names them from app, service and\n// environment alone, so a second account cannot reuse a name the first still holds.\nconst checkBucketNames = async (ctx: AwsSetupContext): Promise<SetupCheckResult> => {\n const names = [...new Set(ctx.serviceQpqConfigs.flatMap(getServiceBucketNames))];\n const client = new S3Client({ region: ctx.region });\n\n const taken: string[] = [];\n let ours = 0;\n for (const name of names) {\n const owner = await getBucketOwner(client, name);\n if (owner === 'other') taken.push(name);\n if (owner === 'ours') ours += 1;\n }\n\n return taken.length === 0\n ? { done: true, detail: `${names.length} bucket name(s) available or already ours (${ours} existing)` }\n : { done: false, detail: `held by another account: ${taken.join(', ')}; delete them there or change the app prefix` };\n};\n\n/** Check-only: no bucket the deploy will create is already taken by another AWS account. */\nexport const buildBucketNamesStep = (ctx: AwsSetupContext): SetupStep => ({\n id: 'bucket-names',\n name: 'S3 bucket names available',\n check: () => checkBucketNames(ctx),\n run: async () => {\n const result = await checkBucketNames(ctx);\n if (!result.done) {\n throw new Error(result.detail ?? 'bucket names taken');\n }\n },\n});\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { SetupStep } from '../../../lib/setupStep';
|
|
2
|
+
import { AwsSetupContext } from './awsSetupContext';
|
|
3
|
+
/** Every region the app deploys into: the deploy region plus each certificate region (us-east-1 for CloudFront). */
|
|
4
|
+
export declare const getSetupRegions: (ctx: AwsSetupContext) => string[];
|
|
5
|
+
export declare const buildCdkBootstrapSteps: (ctx: AwsSetupContext) => SetupStep[];
|
|
@@ -0,0 +1,38 @@
|
|
|
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.buildCdkBootstrapSteps = exports.getSetupRegions = void 0;
|
|
13
|
+
const config_aws_1 = require("@qpqjs/config-aws");
|
|
14
|
+
const discovery_1 = require("../../../lib/discovery");
|
|
15
|
+
const runCommand_1 = require("../../../lib/runCommand");
|
|
16
|
+
const describeStackStatus_1 = require("./describeStackStatus");
|
|
17
|
+
/** Every region the app deploys into: the deploy region plus each certificate region (us-east-1 for CloudFront). */
|
|
18
|
+
const getSetupRegions = (ctx) => [
|
|
19
|
+
...new Set([ctx.region, ...config_aws_1.qpqConfigAwsUtils.getDomainCertificateConfigs(ctx.bootstrapQpqConfig).map((cert) => cert.region)]),
|
|
20
|
+
];
|
|
21
|
+
exports.getSetupRegions = getSetupRegions;
|
|
22
|
+
const buildCdkBootstrapStep = (ctx, region) => ({
|
|
23
|
+
id: `cdk-bootstrap-${region}`,
|
|
24
|
+
name: `CDK bootstrap ${region}`,
|
|
25
|
+
check: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
26
|
+
const status = yield (0, describeStackStatus_1.describeStackStatus)('CDKToolkit', region);
|
|
27
|
+
if (status === null) {
|
|
28
|
+
return { done: false, detail: 'no CDKToolkit stack' };
|
|
29
|
+
}
|
|
30
|
+
return (0, describeStackStatus_1.isStackHealthy)(status)
|
|
31
|
+
? { done: true, detail: `CDKToolkit ${status}` }
|
|
32
|
+
: { done: false, detail: `CDKToolkit is ${status}; delete the stack in ${region} before retrying` };
|
|
33
|
+
}),
|
|
34
|
+
run: () => (0, runCommand_1.runCommand)('npx', ['cdk', 'bootstrap', `aws://${ctx.accountId}/${region}`], { cwd: (0, discovery_1.getRoot)() }),
|
|
35
|
+
});
|
|
36
|
+
const buildCdkBootstrapSteps = (ctx) => (0, exports.getSetupRegions)(ctx).map((region) => buildCdkBootstrapStep(ctx, region));
|
|
37
|
+
exports.buildCdkBootstrapSteps = buildCdkBootstrapSteps;
|
|
38
|
+
//# sourceMappingURL=buildCdkBootstrapSteps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buildCdkBootstrapSteps.js","sourceRoot":"","sources":["../../../../../src/platforms/aws/setup/buildCdkBootstr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E,IAAA,mBAAO,GAAE,EAAE,CAAC;CAC3G,CAAC,CAAC;AAEI,MAAM,sBAAsB,GAAG,CAAC,GAAoB,EAAe,EAAE,CAAC,IAAA,uBAAe,EAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,qBAAqB,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC;AAAzI,QAAA,sBAAsB,0BAAmH","sourcesContent":["import { qpqConfigAwsUtils } from '@qpqjs/config-aws';\n\nimport { getRoot } from '../../../lib/discovery';\nimport { runCommand } from '../../../lib/runCommand';\nimport { SetupStep } from '../../../lib/setupStep';\nimport { AwsSetupContext } from './awsSetupContext';\nimport { describeStackStatus, isStackHealthy } from './describeStackStatus';\n\n/** Every region the app deploys into: the deploy region plus each certificate region (us-east-1 for CloudFront). */\nexport const getSetupRegions = (ctx: AwsSetupContext): string[] => [\n ...new Set([ctx.region, ...qpqConfigAwsUtils.getDomainCertificateConfigs(ctx.bootstrapQpqConfig).map((cert) => cert.region)]),\n];\n\nconst buildCdkBootstrapStep = (ctx: AwsSetupContext, region: string): SetupStep => ({\n id: `cdk-bootstrap-${region}`,\n name: `CDK bootstrap ${region}`,\n check: async () => {\n const status = await describeStackStatus('CDKToolkit', region);\n if (status === null) {\n return { done: false, detail: 'no CDKToolkit stack' };\n }\n return isStackHealthy(status)\n ? { done: true, detail: `CDKToolkit ${status}` }\n : { done: false, detail: `CDKToolkit is ${status}; delete the stack in ${region} before retrying` };\n },\n run: () => runCommand('npx', ['cdk', 'bootstrap', `aws://${ctx.accountId}/${region}`], { cwd: getRoot() }),\n});\n\nexport const buildCdkBootstrapSteps = (ctx: AwsSetupContext): SetupStep[] => getSetupRegions(ctx).map((region) => buildCdkBootstrapStep(ctx, region));\n"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { SetupStep } from '../../../lib/setupStep';
|
|
2
|
+
import { AwsSetupContext } from './awsSetupContext';
|
|
3
|
+
/** Check-only: the GitHub Actions deploy role is declared and deployed, with the values the GitHub Environment needs. */
|
|
4
|
+
export declare const buildGithubDeployRoleStep: (ctx: AwsSetupContext) => SetupStep;
|