@factiii/stack 0.1.2
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 +420 -0
- package/bin/factiii +229 -0
- package/dist/cli/check-config.d.ts +9 -0
- package/dist/cli/check-config.d.ts.map +1 -0
- package/dist/cli/check-config.js +19 -0
- package/dist/cli/check-config.js.map +1 -0
- package/dist/cli/deploy-secrets.d.ts +16 -0
- package/dist/cli/deploy-secrets.d.ts.map +1 -0
- package/dist/cli/deploy-secrets.js +227 -0
- package/dist/cli/deploy-secrets.js.map +1 -0
- package/dist/cli/deploy.d.ts +30 -0
- package/dist/cli/deploy.d.ts.map +1 -0
- package/dist/cli/deploy.js +306 -0
- package/dist/cli/deploy.js.map +1 -0
- package/dist/cli/deployer.d.ts +13 -0
- package/dist/cli/deployer.d.ts.map +1 -0
- package/dist/cli/deployer.js +21 -0
- package/dist/cli/deployer.js.map +1 -0
- package/dist/cli/dev-sync.d.ts +30 -0
- package/dist/cli/dev-sync.d.ts.map +1 -0
- package/dist/cli/dev-sync.js +500 -0
- package/dist/cli/dev-sync.js.map +1 -0
- package/dist/cli/execute-plugin-command.d.ts +25 -0
- package/dist/cli/execute-plugin-command.d.ts.map +1 -0
- package/dist/cli/execute-plugin-command.js +237 -0
- package/dist/cli/execute-plugin-command.js.map +1 -0
- package/dist/cli/fix.d.ts +22 -0
- package/dist/cli/fix.d.ts.map +1 -0
- package/dist/cli/fix.js +267 -0
- package/dist/cli/fix.js.map +1 -0
- package/dist/cli/index.d.ts +17 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +31 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/init.d.ts +9 -0
- package/dist/cli/init.d.ts.map +1 -0
- package/dist/cli/init.js +190 -0
- package/dist/cli/init.js.map +1 -0
- package/dist/cli/plugin-commands.d.ts +22 -0
- package/dist/cli/plugin-commands.d.ts.map +1 -0
- package/dist/cli/plugin-commands.js +121 -0
- package/dist/cli/plugin-commands.js.map +1 -0
- package/dist/cli/scan.d.ts +66 -0
- package/dist/cli/scan.d.ts.map +1 -0
- package/dist/cli/scan.js +511 -0
- package/dist/cli/scan.js.map +1 -0
- package/dist/cli/secrets.d.ts +19 -0
- package/dist/cli/secrets.d.ts.map +1 -0
- package/dist/cli/secrets.js +318 -0
- package/dist/cli/secrets.js.map +1 -0
- package/dist/cli/undeploy.d.ts +9 -0
- package/dist/cli/undeploy.d.ts.map +1 -0
- package/dist/cli/undeploy.js +95 -0
- package/dist/cli/undeploy.js.map +1 -0
- package/dist/cli/upgrade.d.ts +9 -0
- package/dist/cli/upgrade.d.ts.map +1 -0
- package/dist/cli/upgrade.js +24 -0
- package/dist/cli/upgrade.js.map +1 -0
- package/dist/cli/validate.d.ts +9 -0
- package/dist/cli/validate.d.ts.map +1 -0
- package/dist/cli/validate.js +20 -0
- package/dist/cli/validate.js.map +1 -0
- package/dist/generators/generate-factiii-auto.d.ts +31 -0
- package/dist/generators/generate-factiii-auto.d.ts.map +1 -0
- package/dist/generators/generate-factiii-auto.js +251 -0
- package/dist/generators/generate-factiii-auto.js.map +1 -0
- package/dist/generators/generate-factiii-yml.d.ts +23 -0
- package/dist/generators/generate-factiii-yml.d.ts.map +1 -0
- package/dist/generators/generate-factiii-yml.js +228 -0
- package/dist/generators/generate-factiii-yml.js.map +1 -0
- package/dist/generators/index.d.ts +8 -0
- package/dist/generators/index.d.ts.map +1 -0
- package/dist/generators/index.js +14 -0
- package/dist/generators/index.js.map +1 -0
- package/dist/index.d.ts +39 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +90 -0
- package/dist/index.js.map +1 -0
- package/dist/plugins/addons/server-mode/index.d.ts +57 -0
- package/dist/plugins/addons/server-mode/index.d.ts.map +1 -0
- package/dist/plugins/addons/server-mode/index.js +136 -0
- package/dist/plugins/addons/server-mode/index.js.map +1 -0
- package/dist/plugins/addons/server-mode/scanfix/mac.d.ts +17 -0
- package/dist/plugins/addons/server-mode/scanfix/mac.d.ts.map +1 -0
- package/dist/plugins/addons/server-mode/scanfix/mac.js +461 -0
- package/dist/plugins/addons/server-mode/scanfix/mac.js.map +1 -0
- package/dist/plugins/addons/server-mode/scanfix/ubuntu.d.ts +12 -0
- package/dist/plugins/addons/server-mode/scanfix/ubuntu.d.ts.map +1 -0
- package/dist/plugins/addons/server-mode/scanfix/ubuntu.js +246 -0
- package/dist/plugins/addons/server-mode/scanfix/ubuntu.js.map +1 -0
- package/dist/plugins/addons/server-mode/scanfix/windows.d.ts +14 -0
- package/dist/plugins/addons/server-mode/scanfix/windows.d.ts.map +1 -0
- package/dist/plugins/addons/server-mode/scanfix/windows.js +113 -0
- package/dist/plugins/addons/server-mode/scanfix/windows.js.map +1 -0
- package/dist/plugins/approved.json +13 -0
- package/dist/plugins/frameworks/prisma-trpc/index.d.ts +65 -0
- package/dist/plugins/frameworks/prisma-trpc/index.d.ts.map +1 -0
- package/dist/plugins/frameworks/prisma-trpc/index.js +668 -0
- package/dist/plugins/frameworks/prisma-trpc/index.js.map +1 -0
- package/dist/plugins/index.d.ts +101 -0
- package/dist/plugins/index.d.ts.map +1 -0
- package/dist/plugins/index.js +411 -0
- package/dist/plugins/index.js.map +1 -0
- package/dist/plugins/interfaces/addon.d.ts +43 -0
- package/dist/plugins/interfaces/addon.d.ts.map +1 -0
- package/dist/plugins/interfaces/addon.js +53 -0
- package/dist/plugins/interfaces/addon.js.map +1 -0
- package/dist/plugins/interfaces/framework.d.ts +43 -0
- package/dist/plugins/interfaces/framework.d.ts.map +1 -0
- package/dist/plugins/interfaces/framework.js +53 -0
- package/dist/plugins/interfaces/framework.js.map +1 -0
- package/dist/plugins/interfaces/index.d.ts +10 -0
- package/dist/plugins/interfaces/index.d.ts.map +1 -0
- package/dist/plugins/interfaces/index.js +17 -0
- package/dist/plugins/interfaces/index.js.map +1 -0
- package/dist/plugins/interfaces/pipeline.d.ts +78 -0
- package/dist/plugins/interfaces/pipeline.d.ts.map +1 -0
- package/dist/plugins/interfaces/pipeline.js +82 -0
- package/dist/plugins/interfaces/pipeline.js.map +1 -0
- package/dist/plugins/interfaces/server.d.ts +65 -0
- package/dist/plugins/interfaces/server.d.ts.map +1 -0
- package/dist/plugins/interfaces/server.js +72 -0
- package/dist/plugins/interfaces/server.js.map +1 -0
- package/dist/plugins/pipelines/aws/configs/ec2.d.ts +9 -0
- package/dist/plugins/pipelines/aws/configs/ec2.d.ts.map +1 -0
- package/dist/plugins/pipelines/aws/configs/ec2.js +34 -0
- package/dist/plugins/pipelines/aws/configs/ec2.js.map +1 -0
- package/dist/plugins/pipelines/aws/configs/free-tier.d.ts +13 -0
- package/dist/plugins/pipelines/aws/configs/free-tier.d.ts.map +1 -0
- package/dist/plugins/pipelines/aws/configs/free-tier.js +86 -0
- package/dist/plugins/pipelines/aws/configs/free-tier.js.map +1 -0
- package/dist/plugins/pipelines/aws/configs/index.d.ts +14 -0
- package/dist/plugins/pipelines/aws/configs/index.d.ts.map +1 -0
- package/dist/plugins/pipelines/aws/configs/index.js +21 -0
- package/dist/plugins/pipelines/aws/configs/index.js.map +1 -0
- package/dist/plugins/pipelines/aws/configs/types.d.ts +36 -0
- package/dist/plugins/pipelines/aws/configs/types.d.ts.map +1 -0
- package/dist/plugins/pipelines/aws/configs/types.js +9 -0
- package/dist/plugins/pipelines/aws/configs/types.js.map +1 -0
- package/dist/plugins/pipelines/aws/dev.d.ts +10 -0
- package/dist/plugins/pipelines/aws/dev.d.ts.map +1 -0
- package/dist/plugins/pipelines/aws/dev.js +70 -0
- package/dist/plugins/pipelines/aws/dev.js.map +1 -0
- package/dist/plugins/pipelines/aws/index.d.ts +118 -0
- package/dist/plugins/pipelines/aws/index.d.ts.map +1 -0
- package/dist/plugins/pipelines/aws/index.js +346 -0
- package/dist/plugins/pipelines/aws/index.js.map +1 -0
- package/dist/plugins/pipelines/aws/prod.d.ts +19 -0
- package/dist/plugins/pipelines/aws/prod.d.ts.map +1 -0
- package/dist/plugins/pipelines/aws/prod.js +362 -0
- package/dist/plugins/pipelines/aws/prod.js.map +1 -0
- package/dist/plugins/pipelines/aws/scanfix/aws-cli.d.ts +7 -0
- package/dist/plugins/pipelines/aws/scanfix/aws-cli.d.ts.map +1 -0
- package/dist/plugins/pipelines/aws/scanfix/aws-cli.js +31 -0
- package/dist/plugins/pipelines/aws/scanfix/aws-cli.js.map +1 -0
- package/dist/plugins/pipelines/aws/scanfix/config.d.ts +7 -0
- package/dist/plugins/pipelines/aws/scanfix/config.d.ts.map +1 -0
- package/dist/plugins/pipelines/aws/scanfix/config.js +134 -0
- package/dist/plugins/pipelines/aws/scanfix/config.js.map +1 -0
- package/dist/plugins/pipelines/factiii/github-secrets-store.d.ts +65 -0
- package/dist/plugins/pipelines/factiii/github-secrets-store.d.ts.map +1 -0
- package/dist/plugins/pipelines/factiii/github-secrets-store.js +221 -0
- package/dist/plugins/pipelines/factiii/github-secrets-store.js.map +1 -0
- package/dist/plugins/pipelines/factiii/index.d.ts +195 -0
- package/dist/plugins/pipelines/factiii/index.d.ts.map +1 -0
- package/dist/plugins/pipelines/factiii/index.js +862 -0
- package/dist/plugins/pipelines/factiii/index.js.map +1 -0
- package/dist/plugins/pipelines/factiii/prod.d.ts +17 -0
- package/dist/plugins/pipelines/factiii/prod.d.ts.map +1 -0
- package/dist/plugins/pipelines/factiii/prod.js +282 -0
- package/dist/plugins/pipelines/factiii/prod.js.map +1 -0
- package/dist/plugins/pipelines/factiii/scanfix/config.d.ts +7 -0
- package/dist/plugins/pipelines/factiii/scanfix/config.d.ts.map +1 -0
- package/dist/plugins/pipelines/factiii/scanfix/config.js +80 -0
- package/dist/plugins/pipelines/factiii/scanfix/config.js.map +1 -0
- package/dist/plugins/pipelines/factiii/scanfix/github-cli.d.ts +7 -0
- package/dist/plugins/pipelines/factiii/scanfix/github-cli.d.ts.map +1 -0
- package/dist/plugins/pipelines/factiii/scanfix/github-cli.js +43 -0
- package/dist/plugins/pipelines/factiii/scanfix/github-cli.js.map +1 -0
- package/dist/plugins/pipelines/factiii/scanfix/secrets.d.ts +7 -0
- package/dist/plugins/pipelines/factiii/scanfix/secrets.d.ts.map +1 -0
- package/dist/plugins/pipelines/factiii/scanfix/secrets.js +237 -0
- package/dist/plugins/pipelines/factiii/scanfix/secrets.js.map +1 -0
- package/dist/plugins/pipelines/factiii/scanfix/workflows.d.ts +7 -0
- package/dist/plugins/pipelines/factiii/scanfix/workflows.d.ts.map +1 -0
- package/dist/plugins/pipelines/factiii/scanfix/workflows.js +169 -0
- package/dist/plugins/pipelines/factiii/scanfix/workflows.js.map +1 -0
- package/dist/plugins/pipelines/factiii/staging.d.ts +25 -0
- package/dist/plugins/pipelines/factiii/staging.d.ts.map +1 -0
- package/dist/plugins/pipelines/factiii/staging.js +223 -0
- package/dist/plugins/pipelines/factiii/staging.js.map +1 -0
- package/dist/plugins/pipelines/factiii/utils/detection.d.ts +36 -0
- package/dist/plugins/pipelines/factiii/utils/detection.d.ts.map +1 -0
- package/dist/plugins/pipelines/factiii/utils/detection.js +140 -0
- package/dist/plugins/pipelines/factiii/utils/detection.js.map +1 -0
- package/dist/plugins/pipelines/factiii/utils/workflows.d.ts +16 -0
- package/dist/plugins/pipelines/factiii/utils/workflows.d.ts.map +1 -0
- package/dist/plugins/pipelines/factiii/utils/workflows.js +129 -0
- package/dist/plugins/pipelines/factiii/utils/workflows.js.map +1 -0
- package/dist/plugins/pipelines/factiii/workflows/factiii-cicd-prod.yml +112 -0
- package/dist/plugins/pipelines/factiii/workflows/factiii-cicd-staging.yml +112 -0
- package/dist/plugins/pipelines/factiii/workflows/factiii-command.yml +130 -0
- package/dist/plugins/pipelines/factiii/workflows/factiii-deploy.yml +198 -0
- package/dist/plugins/pipelines/factiii/workflows/factiii-dev-sync.yml +179 -0
- package/dist/plugins/pipelines/factiii/workflows/factiii-fix.yml +176 -0
- package/dist/plugins/pipelines/factiii/workflows/factiii-scan.yml +176 -0
- package/dist/plugins/pipelines/factiii/workflows/factiii-undeploy.yml +95 -0
- package/dist/plugins/servers/amazon-linux/index.d.ts +93 -0
- package/dist/plugins/servers/amazon-linux/index.d.ts.map +1 -0
- package/dist/plugins/servers/amazon-linux/index.js +217 -0
- package/dist/plugins/servers/amazon-linux/index.js.map +1 -0
- package/dist/plugins/servers/mac/dev.d.ts +10 -0
- package/dist/plugins/servers/mac/dev.d.ts.map +1 -0
- package/dist/plugins/servers/mac/dev.js +71 -0
- package/dist/plugins/servers/mac/dev.js.map +1 -0
- package/dist/plugins/servers/mac/index.d.ts +101 -0
- package/dist/plugins/servers/mac/index.d.ts.map +1 -0
- package/dist/plugins/servers/mac/index.js +257 -0
- package/dist/plugins/servers/mac/index.js.map +1 -0
- package/dist/plugins/servers/mac/scanfix/config.d.ts +7 -0
- package/dist/plugins/servers/mac/scanfix/config.d.ts.map +1 -0
- package/dist/plugins/servers/mac/scanfix/config.js +168 -0
- package/dist/plugins/servers/mac/scanfix/config.js.map +1 -0
- package/dist/plugins/servers/mac/scanfix/containers.d.ts +7 -0
- package/dist/plugins/servers/mac/scanfix/containers.d.ts.map +1 -0
- package/dist/plugins/servers/mac/scanfix/containers.js +167 -0
- package/dist/plugins/servers/mac/scanfix/containers.js.map +1 -0
- package/dist/plugins/servers/mac/scanfix/system.d.ts +7 -0
- package/dist/plugins/servers/mac/scanfix/system.d.ts.map +1 -0
- package/dist/plugins/servers/mac/scanfix/system.js +144 -0
- package/dist/plugins/servers/mac/scanfix/system.js.map +1 -0
- package/dist/plugins/servers/mac/staging.d.ts +21 -0
- package/dist/plugins/servers/mac/staging.d.ts.map +1 -0
- package/dist/plugins/servers/mac/staging.js +708 -0
- package/dist/plugins/servers/mac/staging.js.map +1 -0
- package/dist/plugins/servers/ubuntu/index.d.ts +93 -0
- package/dist/plugins/servers/ubuntu/index.d.ts.map +1 -0
- package/dist/plugins/servers/ubuntu/index.js +224 -0
- package/dist/plugins/servers/ubuntu/index.js.map +1 -0
- package/dist/plugins/servers/windows/index.d.ts +90 -0
- package/dist/plugins/servers/windows/index.d.ts.map +1 -0
- package/dist/plugins/servers/windows/index.js +205 -0
- package/dist/plugins/servers/windows/index.js.map +1 -0
- package/dist/scanfix/commands/index.d.ts +27 -0
- package/dist/scanfix/commands/index.d.ts.map +1 -0
- package/dist/scanfix/commands/index.js +97 -0
- package/dist/scanfix/commands/index.js.map +1 -0
- package/dist/scanfix/commands/mac.d.ts +11 -0
- package/dist/scanfix/commands/mac.d.ts.map +1 -0
- package/dist/scanfix/commands/mac.js +31 -0
- package/dist/scanfix/commands/mac.js.map +1 -0
- package/dist/scanfix/commands/ubuntu.d.ts +11 -0
- package/dist/scanfix/commands/ubuntu.d.ts.map +1 -0
- package/dist/scanfix/commands/ubuntu.js +30 -0
- package/dist/scanfix/commands/ubuntu.js.map +1 -0
- package/dist/scanfix/fixes/certbot.d.ts +25 -0
- package/dist/scanfix/fixes/certbot.d.ts.map +1 -0
- package/dist/scanfix/fixes/certbot.js +136 -0
- package/dist/scanfix/fixes/certbot.js.map +1 -0
- package/dist/scanfix/fixes/docker.d.ts +29 -0
- package/dist/scanfix/fixes/docker.d.ts.map +1 -0
- package/dist/scanfix/fixes/docker.js +149 -0
- package/dist/scanfix/fixes/docker.js.map +1 -0
- package/dist/scanfix/fixes/git.d.ts +20 -0
- package/dist/scanfix/fixes/git.d.ts.map +1 -0
- package/dist/scanfix/fixes/git.js +71 -0
- package/dist/scanfix/fixes/git.js.map +1 -0
- package/dist/scanfix/fixes/index.d.ts +11 -0
- package/dist/scanfix/fixes/index.d.ts.map +1 -0
- package/dist/scanfix/fixes/index.js +27 -0
- package/dist/scanfix/fixes/index.js.map +1 -0
- package/dist/scanfix/fixes/node.d.ts +20 -0
- package/dist/scanfix/fixes/node.d.ts.map +1 -0
- package/dist/scanfix/fixes/node.js +71 -0
- package/dist/scanfix/fixes/node.js.map +1 -0
- package/dist/scanfix/fixes/pnpm.d.ts +20 -0
- package/dist/scanfix/fixes/pnpm.d.ts.map +1 -0
- package/dist/scanfix/fixes/pnpm.js +122 -0
- package/dist/scanfix/fixes/pnpm.js.map +1 -0
- package/dist/scanfix/index.d.ts +23 -0
- package/dist/scanfix/index.d.ts.map +1 -0
- package/dist/scanfix/index.js +44 -0
- package/dist/scanfix/index.js.map +1 -0
- package/dist/scanfix/platform.d.ts +20 -0
- package/dist/scanfix/platform.d.ts.map +1 -0
- package/dist/scanfix/platform.js +48 -0
- package/dist/scanfix/platform.js.map +1 -0
- package/dist/scanfix/ssl-cert-helper.d.ts +27 -0
- package/dist/scanfix/ssl-cert-helper.d.ts.map +1 -0
- package/dist/scanfix/ssl-cert-helper.js +117 -0
- package/dist/scanfix/ssl-cert-helper.js.map +1 -0
- package/dist/scanfix/types.d.ts +27 -0
- package/dist/scanfix/types.d.ts.map +1 -0
- package/dist/scanfix/types.js +8 -0
- package/dist/scanfix/types.js.map +1 -0
- package/dist/scripts/check-existing-secrets.d.ts +6 -0
- package/dist/scripts/check-existing-secrets.d.ts.map +1 -0
- package/dist/scripts/check-existing-secrets.js +86 -0
- package/dist/scripts/check-existing-secrets.js.map +1 -0
- package/dist/scripts/generate-all.d.ts +40 -0
- package/dist/scripts/generate-all.d.ts.map +1 -0
- package/dist/scripts/generate-all.js +373 -0
- package/dist/scripts/generate-all.js.map +1 -0
- package/dist/scripts/get-repo-name.d.ts +6 -0
- package/dist/scripts/get-repo-name.d.ts.map +1 -0
- package/dist/scripts/get-repo-name.js +54 -0
- package/dist/scripts/get-repo-name.js.map +1 -0
- package/dist/scripts/index.d.ts +7 -0
- package/dist/scripts/index.d.ts.map +1 -0
- package/dist/scripts/index.js +14 -0
- package/dist/scripts/index.js.map +1 -0
- package/dist/scripts/validate-env-files.d.ts +6 -0
- package/dist/scripts/validate-env-files.d.ts.map +1 -0
- package/dist/scripts/validate-env-files.js +126 -0
- package/dist/scripts/validate-env-files.js.map +1 -0
- package/dist/scripts/validate-example-values.d.ts +8 -0
- package/dist/scripts/validate-example-values.d.ts.map +1 -0
- package/dist/scripts/validate-example-values.js +88 -0
- package/dist/scripts/validate-example-values.js.map +1 -0
- package/dist/scripts/validate-factiii-yml.d.ts +6 -0
- package/dist/scripts/validate-factiii-yml.d.ts.map +1 -0
- package/dist/scripts/validate-factiii-yml.js +71 -0
- package/dist/scripts/validate-factiii-yml.js.map +1 -0
- package/dist/types/cli.d.ts +138 -0
- package/dist/types/cli.d.ts.map +1 -0
- package/dist/types/cli.js +8 -0
- package/dist/types/cli.js.map +1 -0
- package/dist/types/config.d.ts +113 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/config.js +8 -0
- package/dist/types/config.js.map +1 -0
- package/dist/types/index.d.ts +9 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +25 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/plugin.d.ts +352 -0
- package/dist/types/plugin.d.ts.map +1 -0
- package/dist/types/plugin.js +8 -0
- package/dist/types/plugin.js.map +1 -0
- package/dist/utils/ansible-vault-secrets.d.ts +95 -0
- package/dist/utils/ansible-vault-secrets.d.ts.map +1 -0
- package/dist/utils/ansible-vault-secrets.js +406 -0
- package/dist/utils/ansible-vault-secrets.js.map +1 -0
- package/dist/utils/config-helpers.d.ts +72 -0
- package/dist/utils/config-helpers.d.ts.map +1 -0
- package/dist/utils/config-helpers.js +171 -0
- package/dist/utils/config-helpers.js.map +1 -0
- package/dist/utils/config-schema.d.ts +17 -0
- package/dist/utils/config-schema.d.ts.map +1 -0
- package/dist/utils/config-schema.js +100 -0
- package/dist/utils/config-schema.js.map +1 -0
- package/dist/utils/config-validator.d.ts +29 -0
- package/dist/utils/config-validator.d.ts.map +1 -0
- package/dist/utils/config-validator.js +146 -0
- package/dist/utils/config-validator.js.map +1 -0
- package/dist/utils/deployment-report.d.ts +100 -0
- package/dist/utils/deployment-report.d.ts.map +1 -0
- package/dist/utils/deployment-report.js +225 -0
- package/dist/utils/deployment-report.js.map +1 -0
- package/dist/utils/dns-validator.d.ts +19 -0
- package/dist/utils/dns-validator.d.ts.map +1 -0
- package/dist/utils/dns-validator.js +94 -0
- package/dist/utils/dns-validator.js.map +1 -0
- package/dist/utils/env-validator.d.ts +108 -0
- package/dist/utils/env-validator.d.ts.map +1 -0
- package/dist/utils/env-validator.js +342 -0
- package/dist/utils/env-validator.js.map +1 -0
- package/dist/utils/github-workflow-monitor.d.ts +49 -0
- package/dist/utils/github-workflow-monitor.d.ts.map +1 -0
- package/dist/utils/github-workflow-monitor.js +145 -0
- package/dist/utils/github-workflow-monitor.js.map +1 -0
- package/dist/utils/index.d.ts +18 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +48 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/secret-prompts.d.ts +67 -0
- package/dist/utils/secret-prompts.d.ts.map +1 -0
- package/dist/utils/secret-prompts.js +369 -0
- package/dist/utils/secret-prompts.js.map +1 -0
- package/dist/utils/server-check.d.ts +43 -0
- package/dist/utils/server-check.d.ts.map +1 -0
- package/dist/utils/server-check.js +397 -0
- package/dist/utils/server-check.js.map +1 -0
- package/dist/utils/ssh-deploy.d.ts +70 -0
- package/dist/utils/ssh-deploy.d.ts.map +1 -0
- package/dist/utils/ssh-deploy.js +268 -0
- package/dist/utils/ssh-deploy.js.map +1 -0
- package/dist/utils/ssh-helper.d.ts +40 -0
- package/dist/utils/ssh-helper.d.ts.map +1 -0
- package/dist/utils/ssh-helper.js +221 -0
- package/dist/utils/ssh-helper.js.map +1 -0
- package/dist/utils/template-generator.d.ts +42 -0
- package/dist/utils/template-generator.d.ts.map +1 -0
- package/dist/utils/template-generator.js +223 -0
- package/dist/utils/template-generator.js.map +1 -0
- package/dist/utils/version-check.d.ts +69 -0
- package/dist/utils/version-check.d.ts.map +1 -0
- package/dist/utils/version-check.js +211 -0
- package/dist/utils/version-check.js.map +1 -0
- package/package.json +82 -0
|
@@ -0,0 +1,668 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Prisma + tRPC Framework Plugin
|
|
4
|
+
*
|
|
5
|
+
* Handles Prisma database and tRPC API server detection, validation,
|
|
6
|
+
* and deployment (migrations, etc.).
|
|
7
|
+
*/
|
|
8
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
|
+
if (k2 === undefined) k2 = k;
|
|
10
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
11
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
12
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
13
|
+
}
|
|
14
|
+
Object.defineProperty(o, k2, desc);
|
|
15
|
+
}) : (function(o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
o[k2] = m[k];
|
|
18
|
+
}));
|
|
19
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
20
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
21
|
+
}) : function(o, v) {
|
|
22
|
+
o["default"] = v;
|
|
23
|
+
});
|
|
24
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
+
var ownKeys = function(o) {
|
|
26
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
+
var ar = [];
|
|
28
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
+
return ar;
|
|
30
|
+
};
|
|
31
|
+
return ownKeys(o);
|
|
32
|
+
};
|
|
33
|
+
return function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
})();
|
|
41
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
42
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
43
|
+
};
|
|
44
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
+
const fs = __importStar(require("fs"));
|
|
46
|
+
const path = __importStar(require("path"));
|
|
47
|
+
const child_process_1 = require("child_process");
|
|
48
|
+
const js_yaml_1 = __importDefault(require("js-yaml"));
|
|
49
|
+
class PrismaTrpcPlugin {
|
|
50
|
+
// ============================================================
|
|
51
|
+
// STATIC METADATA
|
|
52
|
+
// ============================================================
|
|
53
|
+
static id = 'prisma-trpc';
|
|
54
|
+
static name = 'Prisma + tRPC';
|
|
55
|
+
static category = 'framework';
|
|
56
|
+
static version = '1.0.0';
|
|
57
|
+
// Env vars this plugin requires (will be validated against .env.example)
|
|
58
|
+
static requiredEnvVars = ['DATABASE_URL'];
|
|
59
|
+
// Schema for factiii.yml (user-editable)
|
|
60
|
+
static configSchema = {
|
|
61
|
+
prisma: {
|
|
62
|
+
schema_path: null, // Optional override
|
|
63
|
+
version: null, // Optional override
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
// Schema for factiiiAuto.yml (auto-detected)
|
|
67
|
+
static autoConfigSchema = {
|
|
68
|
+
has_prisma: 'boolean',
|
|
69
|
+
has_trpc: 'boolean',
|
|
70
|
+
prisma_schema: 'string',
|
|
71
|
+
prisma_version: 'string',
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* Determine if this plugin should be loaded for this project
|
|
75
|
+
* Loads if Prisma or tRPC is detected in package.json
|
|
76
|
+
*/
|
|
77
|
+
static async shouldLoad(rootDir, _config) {
|
|
78
|
+
const pkgPath = path.join(rootDir, 'package.json');
|
|
79
|
+
if (!fs.existsSync(pkgPath))
|
|
80
|
+
return false;
|
|
81
|
+
try {
|
|
82
|
+
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
|
|
83
|
+
const deps = { ...pkg.dependencies, ...pkg.devDependencies };
|
|
84
|
+
return !!(deps.prisma ||
|
|
85
|
+
deps['@prisma/client'] ||
|
|
86
|
+
deps['@trpc/server'] ||
|
|
87
|
+
deps['@trpc/client']);
|
|
88
|
+
}
|
|
89
|
+
catch {
|
|
90
|
+
return false;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
// ============================================================
|
|
94
|
+
// FIXES - All issues this plugin can detect and resolve
|
|
95
|
+
// ============================================================
|
|
96
|
+
static fixes = [
|
|
97
|
+
// DEV STAGE FIXES
|
|
98
|
+
{
|
|
99
|
+
id: 'missing-prisma',
|
|
100
|
+
stage: 'dev',
|
|
101
|
+
severity: 'info',
|
|
102
|
+
description: 'Prisma not detected in project',
|
|
103
|
+
scan: async (_config, rootDir) => {
|
|
104
|
+
// Check if prisma is in package.json
|
|
105
|
+
const pkgPath = path.join(rootDir, 'package.json');
|
|
106
|
+
if (!fs.existsSync(pkgPath))
|
|
107
|
+
return true;
|
|
108
|
+
try {
|
|
109
|
+
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
|
|
110
|
+
const deps = { ...pkg.dependencies, ...pkg.devDependencies };
|
|
111
|
+
return !deps.prisma && !deps['@prisma/client'];
|
|
112
|
+
}
|
|
113
|
+
catch {
|
|
114
|
+
return true;
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
fix: null,
|
|
118
|
+
manualFix: 'Install Prisma: npm install -D prisma @prisma/client && npx prisma init',
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
id: 'missing-prisma-schema',
|
|
122
|
+
stage: 'dev',
|
|
123
|
+
severity: 'critical',
|
|
124
|
+
description: 'Prisma schema not found',
|
|
125
|
+
scan: async (_config, rootDir) => {
|
|
126
|
+
// Only check if Prisma is installed
|
|
127
|
+
const hasPrisma = await PrismaTrpcPlugin.hasPrisma(rootDir);
|
|
128
|
+
if (!hasPrisma)
|
|
129
|
+
return false;
|
|
130
|
+
return !PrismaTrpcPlugin.findPrismaSchema(rootDir);
|
|
131
|
+
},
|
|
132
|
+
fix: null,
|
|
133
|
+
manualFix: 'Run: npx prisma init',
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
id: 'missing-env-file',
|
|
137
|
+
stage: 'dev',
|
|
138
|
+
severity: 'warning',
|
|
139
|
+
description: '.env file missing (copy of .env.example)',
|
|
140
|
+
scan: async (_config, rootDir) => {
|
|
141
|
+
if (!fs.existsSync(path.join(rootDir, '.env.example')))
|
|
142
|
+
return false;
|
|
143
|
+
return !fs.existsSync(path.join(rootDir, '.env'));
|
|
144
|
+
},
|
|
145
|
+
fix: async (_config, rootDir) => {
|
|
146
|
+
fs.copyFileSync(path.join(rootDir, '.env.example'), path.join(rootDir, '.env'));
|
|
147
|
+
console.log(' Created .env from .env.example');
|
|
148
|
+
return true;
|
|
149
|
+
},
|
|
150
|
+
manualFix: 'Run: cp .env.example .env',
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
id: 'prisma-client-not-generated',
|
|
154
|
+
stage: 'dev',
|
|
155
|
+
severity: 'warning',
|
|
156
|
+
description: 'Prisma client not generated',
|
|
157
|
+
scan: async (_config, rootDir) => {
|
|
158
|
+
const hasPrisma = await PrismaTrpcPlugin.hasPrisma(rootDir);
|
|
159
|
+
if (!hasPrisma)
|
|
160
|
+
return false;
|
|
161
|
+
// Check if prisma client exists in node_modules
|
|
162
|
+
const clientPath = path.join(rootDir, 'node_modules', '.prisma', 'client');
|
|
163
|
+
return !fs.existsSync(clientPath);
|
|
164
|
+
},
|
|
165
|
+
fix: async (_config, rootDir) => {
|
|
166
|
+
try {
|
|
167
|
+
(0, child_process_1.execSync)('npx prisma generate', { cwd: rootDir, stdio: 'pipe' });
|
|
168
|
+
console.log(' Generated Prisma client');
|
|
169
|
+
return true;
|
|
170
|
+
}
|
|
171
|
+
catch (e) {
|
|
172
|
+
const errorMessage = e instanceof Error ? e.message : String(e);
|
|
173
|
+
console.log(` Failed: ${errorMessage}`);
|
|
174
|
+
return false;
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
manualFix: 'Run: npx prisma generate',
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
id: 'pending-migrations-dev',
|
|
181
|
+
stage: 'dev',
|
|
182
|
+
severity: 'warning',
|
|
183
|
+
description: 'Prisma migrations pending locally',
|
|
184
|
+
scan: async (_config, rootDir) => {
|
|
185
|
+
const hasPrisma = await PrismaTrpcPlugin.hasPrisma(rootDir);
|
|
186
|
+
if (!hasPrisma)
|
|
187
|
+
return false;
|
|
188
|
+
try {
|
|
189
|
+
const result = (0, child_process_1.execSync)('npx prisma migrate status', {
|
|
190
|
+
cwd: rootDir,
|
|
191
|
+
encoding: 'utf8',
|
|
192
|
+
stdio: 'pipe',
|
|
193
|
+
});
|
|
194
|
+
return (result.includes('Following migration') || result.includes('not yet applied'));
|
|
195
|
+
}
|
|
196
|
+
catch {
|
|
197
|
+
return false; // Error likely means no database connection
|
|
198
|
+
}
|
|
199
|
+
},
|
|
200
|
+
fix: async (_config, rootDir) => {
|
|
201
|
+
try {
|
|
202
|
+
(0, child_process_1.execSync)('npx prisma migrate dev', { cwd: rootDir, stdio: 'inherit' });
|
|
203
|
+
return true;
|
|
204
|
+
}
|
|
205
|
+
catch {
|
|
206
|
+
return false;
|
|
207
|
+
}
|
|
208
|
+
},
|
|
209
|
+
manualFix: 'Run: npx prisma migrate dev',
|
|
210
|
+
},
|
|
211
|
+
// STAGING STAGE FIXES
|
|
212
|
+
{
|
|
213
|
+
id: 'missing-env-staging',
|
|
214
|
+
stage: 'staging',
|
|
215
|
+
severity: 'critical',
|
|
216
|
+
description: '.env.staging file missing',
|
|
217
|
+
scan: async (_config, rootDir) => {
|
|
218
|
+
return !fs.existsSync(path.join(rootDir, '.env.staging'));
|
|
219
|
+
},
|
|
220
|
+
fix: async (_config, rootDir) => {
|
|
221
|
+
if (fs.existsSync(path.join(rootDir, '.env.example'))) {
|
|
222
|
+
fs.copyFileSync(path.join(rootDir, '.env.example'), path.join(rootDir, '.env.staging'));
|
|
223
|
+
console.log(' Created .env.staging from .env.example');
|
|
224
|
+
console.log(' ⚠️ Please update values for staging environment');
|
|
225
|
+
return true;
|
|
226
|
+
}
|
|
227
|
+
return false;
|
|
228
|
+
},
|
|
229
|
+
manualFix: 'Create .env.staging with staging database URL',
|
|
230
|
+
},
|
|
231
|
+
// PROD STAGE FIXES
|
|
232
|
+
{
|
|
233
|
+
id: 'missing-env-prod',
|
|
234
|
+
stage: 'prod',
|
|
235
|
+
severity: 'critical',
|
|
236
|
+
description: '.env.prod file missing',
|
|
237
|
+
scan: async (_config, rootDir) => {
|
|
238
|
+
return !fs.existsSync(path.join(rootDir, '.env.prod'));
|
|
239
|
+
},
|
|
240
|
+
fix: async (_config, rootDir) => {
|
|
241
|
+
if (fs.existsSync(path.join(rootDir, '.env.example'))) {
|
|
242
|
+
fs.copyFileSync(path.join(rootDir, '.env.example'), path.join(rootDir, '.env.prod'));
|
|
243
|
+
console.log(' Created .env.prod from .env.example');
|
|
244
|
+
console.log(' ⚠️ Please update values for production environment');
|
|
245
|
+
return true;
|
|
246
|
+
}
|
|
247
|
+
return false;
|
|
248
|
+
},
|
|
249
|
+
manualFix: 'Create .env.prod with production database URL',
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
id: 'env-example-staging-format',
|
|
253
|
+
stage: 'dev',
|
|
254
|
+
severity: 'warning',
|
|
255
|
+
description: '.env.example and .env.staging should use postgres:5432 format (container format) and match each other',
|
|
256
|
+
scan: async (config, rootDir) => {
|
|
257
|
+
const hasPrisma = await PrismaTrpcPlugin.hasPrisma(rootDir);
|
|
258
|
+
if (!hasPrisma)
|
|
259
|
+
return false;
|
|
260
|
+
const examplePath = path.join(rootDir, '.env.example');
|
|
261
|
+
const stagingPath = path.join(rootDir, '.env.staging');
|
|
262
|
+
// Check if .env.example exists
|
|
263
|
+
if (!fs.existsSync(examplePath)) {
|
|
264
|
+
return false; // Missing .env.example is handled by another fix
|
|
265
|
+
}
|
|
266
|
+
// Parse .env.example
|
|
267
|
+
const exampleContent = fs.readFileSync(examplePath, 'utf8');
|
|
268
|
+
const exampleDbUrlMatch = exampleContent.match(/^DATABASE_URL=(.+)$/m);
|
|
269
|
+
const exampleTestDbUrlMatch = exampleContent.match(/^TEST_DATABASE_URL=(.+)$/m);
|
|
270
|
+
// Check if .env.example uses postgres:5432 format
|
|
271
|
+
const exampleUsesContainerFormat = exampleDbUrlMatch?.[1]?.includes('@postgres:5432/') ?? false;
|
|
272
|
+
const exampleTestUsesContainerFormat = exampleTestDbUrlMatch?.[1]?.includes('@postgres:5432/') ?? false;
|
|
273
|
+
if (!exampleUsesContainerFormat) {
|
|
274
|
+
return true; // .env.example doesn't use container format
|
|
275
|
+
}
|
|
276
|
+
// Check if .env.staging exists
|
|
277
|
+
if (!fs.existsSync(stagingPath)) {
|
|
278
|
+
return false; // Missing .env.staging is handled by another fix
|
|
279
|
+
}
|
|
280
|
+
// Parse .env.staging
|
|
281
|
+
const stagingContent = fs.readFileSync(stagingPath, 'utf8');
|
|
282
|
+
const stagingDbUrlMatch = stagingContent.match(/^DATABASE_URL=(.+)$/m);
|
|
283
|
+
const stagingTestDbUrlMatch = stagingContent.match(/^TEST_DATABASE_URL=(.+)$/m);
|
|
284
|
+
// Check if .env.staging uses postgres:5432 format
|
|
285
|
+
const stagingUsesContainerFormat = stagingDbUrlMatch?.[1]?.includes('@postgres:5432/') ?? false;
|
|
286
|
+
const stagingTestUsesContainerFormat = stagingTestDbUrlMatch?.[1]?.includes('@postgres:5432/') ?? false;
|
|
287
|
+
if (!stagingUsesContainerFormat) {
|
|
288
|
+
return true; // .env.staging doesn't use container format
|
|
289
|
+
}
|
|
290
|
+
// Check if they match (compare the URLs, ignoring host/port differences if one is container format)
|
|
291
|
+
// Extract the database name and credentials for comparison
|
|
292
|
+
const extractDbInfo = (url) => {
|
|
293
|
+
try {
|
|
294
|
+
const urlObj = new URL(url);
|
|
295
|
+
return `${urlObj.username}:${urlObj.password}@${urlObj.pathname}`;
|
|
296
|
+
}
|
|
297
|
+
catch {
|
|
298
|
+
return null;
|
|
299
|
+
}
|
|
300
|
+
};
|
|
301
|
+
const exampleDbInfo = exampleDbUrlMatch?.[1]
|
|
302
|
+
? extractDbInfo(exampleDbUrlMatch[1])
|
|
303
|
+
: null;
|
|
304
|
+
const stagingDbInfo = stagingDbUrlMatch?.[1]
|
|
305
|
+
? extractDbInfo(stagingDbUrlMatch[1])
|
|
306
|
+
: null;
|
|
307
|
+
if (exampleDbInfo && stagingDbInfo && exampleDbInfo !== stagingDbInfo) {
|
|
308
|
+
return true; // They don't match
|
|
309
|
+
}
|
|
310
|
+
// Check TEST_DATABASE_URL if both exist
|
|
311
|
+
if (exampleTestDbUrlMatch?.[1] && stagingTestDbUrlMatch?.[1]) {
|
|
312
|
+
const exampleTestDbInfo = extractDbInfo(exampleTestDbUrlMatch[1]);
|
|
313
|
+
const stagingTestDbInfo = extractDbInfo(stagingTestDbUrlMatch[1]);
|
|
314
|
+
if (exampleTestDbInfo && stagingTestDbInfo && exampleTestDbInfo !== stagingTestDbInfo) {
|
|
315
|
+
return true; // They don't match
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
// Check for port conflicts when on staging server
|
|
319
|
+
const isOnStagingServer = process.env.GITHUB_ACTIONS === 'true';
|
|
320
|
+
if (isOnStagingServer) {
|
|
321
|
+
const hasConflict = await PrismaTrpcPlugin.checkPortConflicts(rootDir, config);
|
|
322
|
+
if (hasConflict) {
|
|
323
|
+
return true; // Port conflict detected
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
return false; // All checks passed
|
|
327
|
+
},
|
|
328
|
+
fix: async (config, rootDir) => {
|
|
329
|
+
const examplePath = path.join(rootDir, '.env.example');
|
|
330
|
+
const stagingPath = path.join(rootDir, '.env.staging');
|
|
331
|
+
if (!fs.existsSync(examplePath)) {
|
|
332
|
+
return false;
|
|
333
|
+
}
|
|
334
|
+
// Read .env.example
|
|
335
|
+
let exampleContent = fs.readFileSync(examplePath, 'utf8');
|
|
336
|
+
// Update DATABASE_URL to use postgres:5432 format if it doesn't
|
|
337
|
+
exampleContent = exampleContent.replace(/^DATABASE_URL=(.+)$/m, (match, url) => {
|
|
338
|
+
try {
|
|
339
|
+
const urlObj = new URL(url);
|
|
340
|
+
// Replace localhost:PORT or any host:PORT with postgres:5432
|
|
341
|
+
const newUrl = url.replace(/@[^:]+:\d+\//, '@postgres:5432/');
|
|
342
|
+
return `DATABASE_URL=${newUrl}`;
|
|
343
|
+
}
|
|
344
|
+
catch {
|
|
345
|
+
return match; // Keep original if parsing fails
|
|
346
|
+
}
|
|
347
|
+
});
|
|
348
|
+
// Update TEST_DATABASE_URL similarly
|
|
349
|
+
exampleContent = exampleContent.replace(/^TEST_DATABASE_URL=(.+)$/m, (match, url) => {
|
|
350
|
+
try {
|
|
351
|
+
const urlObj = new URL(url);
|
|
352
|
+
const newUrl = url.replace(/@[^:]+:\d+\//, '@postgres:5432/');
|
|
353
|
+
return `TEST_DATABASE_URL=${newUrl}`;
|
|
354
|
+
}
|
|
355
|
+
catch {
|
|
356
|
+
return match;
|
|
357
|
+
}
|
|
358
|
+
});
|
|
359
|
+
fs.writeFileSync(examplePath, exampleContent);
|
|
360
|
+
// Update .env.staging to match if it exists
|
|
361
|
+
if (fs.existsSync(stagingPath)) {
|
|
362
|
+
let stagingContent = fs.readFileSync(stagingPath, 'utf8');
|
|
363
|
+
// Extract database info from example
|
|
364
|
+
const exampleDbUrlMatch = exampleContent.match(/^DATABASE_URL=(.+)$/m);
|
|
365
|
+
if (exampleDbUrlMatch?.[1]) {
|
|
366
|
+
const exampleUrl = exampleDbUrlMatch[1];
|
|
367
|
+
try {
|
|
368
|
+
const urlObj = new URL(exampleUrl);
|
|
369
|
+
const newStagingUrl = `postgresql://${urlObj.username}:${urlObj.password}@postgres:5432${urlObj.pathname}${urlObj.search}`;
|
|
370
|
+
stagingContent = stagingContent.replace(/^DATABASE_URL=(.+)$/m, `DATABASE_URL=${newStagingUrl}`);
|
|
371
|
+
}
|
|
372
|
+
catch {
|
|
373
|
+
// Keep original if parsing fails
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
// Update TEST_DATABASE_URL similarly
|
|
377
|
+
const exampleTestDbUrlMatch = exampleContent.match(/^TEST_DATABASE_URL=(.+)$/m);
|
|
378
|
+
if (exampleTestDbUrlMatch?.[1]) {
|
|
379
|
+
const exampleTestUrl = exampleTestDbUrlMatch[1];
|
|
380
|
+
try {
|
|
381
|
+
const urlObj = new URL(exampleTestUrl);
|
|
382
|
+
const newStagingTestUrl = `postgresql://${urlObj.username}:${urlObj.password}@postgres:5432${urlObj.pathname}${urlObj.search}`;
|
|
383
|
+
stagingContent = stagingContent.replace(/^TEST_DATABASE_URL=(.+)$/m, `TEST_DATABASE_URL=${newStagingTestUrl}`);
|
|
384
|
+
}
|
|
385
|
+
catch {
|
|
386
|
+
// Keep original if parsing fails
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
fs.writeFileSync(stagingPath, stagingContent);
|
|
390
|
+
console.log(' Updated .env.example and .env.staging to use postgres:5432 format');
|
|
391
|
+
}
|
|
392
|
+
else {
|
|
393
|
+
console.log(' Updated .env.example to use postgres:5432 format');
|
|
394
|
+
}
|
|
395
|
+
return true;
|
|
396
|
+
},
|
|
397
|
+
manualFix: 'Update .env.example and .env.staging to use postgres:5432 format (container format). They should match each other.',
|
|
398
|
+
},
|
|
399
|
+
];
|
|
400
|
+
// ============================================================
|
|
401
|
+
// STATIC HELPER METHODS
|
|
402
|
+
// ============================================================
|
|
403
|
+
/**
|
|
404
|
+
* Auto-detect Prisma and tRPC configuration
|
|
405
|
+
*/
|
|
406
|
+
static async detectConfig(rootDir) {
|
|
407
|
+
const hasPrisma = await this.hasPrisma(rootDir);
|
|
408
|
+
const hasTrpc = await this.detectTrpc(rootDir);
|
|
409
|
+
if (!hasPrisma && !hasTrpc)
|
|
410
|
+
return null;
|
|
411
|
+
const config = {
|
|
412
|
+
has_prisma: hasPrisma,
|
|
413
|
+
has_trpc: hasTrpc,
|
|
414
|
+
};
|
|
415
|
+
if (hasPrisma) {
|
|
416
|
+
config.prisma_schema = this.findPrismaSchema(rootDir);
|
|
417
|
+
config.prisma_version = this.getPrismaVersion(rootDir);
|
|
418
|
+
}
|
|
419
|
+
return config;
|
|
420
|
+
}
|
|
421
|
+
/**
|
|
422
|
+
* Detect tRPC in the project
|
|
423
|
+
*/
|
|
424
|
+
static async detectTrpc(rootDir) {
|
|
425
|
+
const pkgPath = path.join(rootDir, 'package.json');
|
|
426
|
+
if (!fs.existsSync(pkgPath))
|
|
427
|
+
return false;
|
|
428
|
+
try {
|
|
429
|
+
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
|
|
430
|
+
const deps = { ...pkg.dependencies, ...pkg.devDependencies };
|
|
431
|
+
return !!(deps['@trpc/server'] || deps['@trpc/client']);
|
|
432
|
+
}
|
|
433
|
+
catch {
|
|
434
|
+
return false;
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
/**
|
|
438
|
+
* Check if Prisma is installed in the project
|
|
439
|
+
*/
|
|
440
|
+
static async hasPrisma(rootDir) {
|
|
441
|
+
const pkgPath = path.join(rootDir, 'package.json');
|
|
442
|
+
if (!fs.existsSync(pkgPath))
|
|
443
|
+
return false;
|
|
444
|
+
try {
|
|
445
|
+
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
|
|
446
|
+
const deps = { ...pkg.dependencies, ...pkg.devDependencies };
|
|
447
|
+
return !!(deps.prisma || deps['@prisma/client']);
|
|
448
|
+
}
|
|
449
|
+
catch {
|
|
450
|
+
return false;
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
/**
|
|
454
|
+
* Find Prisma schema file
|
|
455
|
+
*/
|
|
456
|
+
static findPrismaSchema(rootDir) {
|
|
457
|
+
const commonPaths = [
|
|
458
|
+
'prisma/schema.prisma',
|
|
459
|
+
'apps/server/prisma/schema.prisma',
|
|
460
|
+
'packages/server/prisma/schema.prisma',
|
|
461
|
+
'backend/prisma/schema.prisma',
|
|
462
|
+
'server/prisma/schema.prisma',
|
|
463
|
+
];
|
|
464
|
+
for (const relativePath of commonPaths) {
|
|
465
|
+
const fullPath = path.join(rootDir, relativePath);
|
|
466
|
+
if (fs.existsSync(fullPath)) {
|
|
467
|
+
return relativePath;
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
return null;
|
|
471
|
+
}
|
|
472
|
+
/**
|
|
473
|
+
* Get Prisma version from package.json
|
|
474
|
+
*/
|
|
475
|
+
static getPrismaVersion(rootDir) {
|
|
476
|
+
const pkgPath = path.join(rootDir, 'package.json');
|
|
477
|
+
if (!fs.existsSync(pkgPath))
|
|
478
|
+
return null;
|
|
479
|
+
try {
|
|
480
|
+
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
|
|
481
|
+
const deps = { ...pkg.dependencies, ...pkg.devDependencies };
|
|
482
|
+
const version = deps.prisma ?? deps['@prisma/client'];
|
|
483
|
+
return version ? version.replace(/^[\^~]/, '') : null;
|
|
484
|
+
}
|
|
485
|
+
catch {
|
|
486
|
+
return null;
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
/**
|
|
490
|
+
* Check for port conflicts across repos in staging
|
|
491
|
+
* Returns true if a conflict is detected (will throw error in scan)
|
|
492
|
+
*/
|
|
493
|
+
static async checkPortConflicts(rootDir, config) {
|
|
494
|
+
// Only check when on staging server
|
|
495
|
+
const isOnStagingServer = process.env.GITHUB_ACTIONS === 'true';
|
|
496
|
+
if (!isOnStagingServer) {
|
|
497
|
+
return false;
|
|
498
|
+
}
|
|
499
|
+
// Import scanRepos from generate-all
|
|
500
|
+
// Use dynamic import to avoid circular dependencies
|
|
501
|
+
const generateAllModule = await Promise.resolve().then(() => __importStar(require('../../../scripts/generate-all.js')));
|
|
502
|
+
const scanRepos = generateAllModule.scanRepos;
|
|
503
|
+
if (!scanRepos) {
|
|
504
|
+
return false; // Can't check if scanRepos not available
|
|
505
|
+
}
|
|
506
|
+
const repos = scanRepos();
|
|
507
|
+
const factiiiDir = process.env.FACTIII_DIR ?? path.join(process.env.HOME ?? '/Users/jon', '.factiii');
|
|
508
|
+
const composePath = path.join(factiiiDir, 'docker-compose.yml');
|
|
509
|
+
// Collect all exposed ports from existing postgres services
|
|
510
|
+
const usedPorts = new Map(); // port -> repo name
|
|
511
|
+
if (fs.existsSync(composePath)) {
|
|
512
|
+
try {
|
|
513
|
+
const composeContent = fs.readFileSync(composePath, 'utf8');
|
|
514
|
+
const compose = js_yaml_1.default.load(composeContent);
|
|
515
|
+
if (compose.services) {
|
|
516
|
+
for (const [serviceName, service] of Object.entries(compose.services)) {
|
|
517
|
+
// Check if this is a postgres service
|
|
518
|
+
if (serviceName === 'postgres' || serviceName.includes('postgres')) {
|
|
519
|
+
if (service.ports && Array.isArray(service.ports)) {
|
|
520
|
+
for (const portMapping of service.ports) {
|
|
521
|
+
// Parse port mapping like "5438:5432"
|
|
522
|
+
const match = portMapping.match(/^(\d+):\d+$/);
|
|
523
|
+
if (match) {
|
|
524
|
+
const exposedPort = parseInt(match[1], 10);
|
|
525
|
+
// Try to find which repo this belongs to by checking service names
|
|
526
|
+
for (const repo of repos) {
|
|
527
|
+
if (serviceName.includes(repo.name)) {
|
|
528
|
+
usedPorts.set(exposedPort, repo.name);
|
|
529
|
+
break;
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
// If we can't determine repo, still track the port
|
|
533
|
+
if (!usedPorts.has(exposedPort)) {
|
|
534
|
+
usedPorts.set(exposedPort, 'unknown');
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
catch (error) {
|
|
544
|
+
// If we can't parse docker-compose.yml, skip conflict check
|
|
545
|
+
console.log(` ⚠️ Could not parse docker-compose.yml for port conflict check: ${error instanceof Error ? error.message : String(error)}`);
|
|
546
|
+
return false;
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
// Check current repo's planned port from .env.staging
|
|
550
|
+
const stagingPath = path.join(rootDir, '.env.staging');
|
|
551
|
+
if (!fs.existsSync(stagingPath)) {
|
|
552
|
+
return false; // No .env.staging, can't check
|
|
553
|
+
}
|
|
554
|
+
const stagingContent = fs.readFileSync(stagingPath, 'utf8');
|
|
555
|
+
const dbUrlMatch = stagingContent.match(/^DATABASE_URL=(.+)$/m);
|
|
556
|
+
if (!dbUrlMatch) {
|
|
557
|
+
return false; // No DATABASE_URL, can't check
|
|
558
|
+
}
|
|
559
|
+
const dbUrl = dbUrlMatch[1];
|
|
560
|
+
let plannedPort = null;
|
|
561
|
+
// If DATABASE_URL uses postgres:5432 format, we need to check docker-compose.yml
|
|
562
|
+
// to see what port would be exposed. But if docker-compose.yml doesn't exist yet,
|
|
563
|
+
// we can't determine the port. In that case, we'll skip the check.
|
|
564
|
+
if (dbUrl.includes('@postgres:5432/')) {
|
|
565
|
+
// Container format - check if we can determine exposed port from docker-compose
|
|
566
|
+
// For now, we'll check the current repo's service in docker-compose if it exists
|
|
567
|
+
const currentRepoName = config.name ?? 'app';
|
|
568
|
+
if (fs.existsSync(composePath)) {
|
|
569
|
+
try {
|
|
570
|
+
const composeContent = fs.readFileSync(composePath, 'utf8');
|
|
571
|
+
const compose = js_yaml_1.default.load(composeContent);
|
|
572
|
+
// Look for postgres service
|
|
573
|
+
// Note: There should only be one postgres service in the unified docker-compose.yml
|
|
574
|
+
// but it might be shared or per-repo. For now, check for any postgres service.
|
|
575
|
+
if (compose.services) {
|
|
576
|
+
for (const [serviceName, service] of Object.entries(compose.services)) {
|
|
577
|
+
if (serviceName === 'postgres') {
|
|
578
|
+
if (service.ports && Array.isArray(service.ports)) {
|
|
579
|
+
for (const portMapping of service.ports) {
|
|
580
|
+
const match = portMapping.match(/^(\d+):\d+$/);
|
|
581
|
+
if (match) {
|
|
582
|
+
plannedPort = parseInt(match[1], 10);
|
|
583
|
+
break;
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
if (plannedPort)
|
|
588
|
+
break;
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
catch {
|
|
594
|
+
// Skip if can't parse
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
// If we still don't have a planned port, we can't check for conflicts
|
|
598
|
+
// This will be checked after first deploy when docker-compose.yml is generated
|
|
599
|
+
if (!plannedPort) {
|
|
600
|
+
return false;
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
else {
|
|
604
|
+
// Host format (localhost:PORT) - extract port from URL
|
|
605
|
+
try {
|
|
606
|
+
const urlObj = new URL(dbUrl);
|
|
607
|
+
plannedPort = parseInt(urlObj.port || '5432', 10);
|
|
608
|
+
}
|
|
609
|
+
catch {
|
|
610
|
+
return false; // Can't parse URL
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
if (!plannedPort) {
|
|
614
|
+
return false;
|
|
615
|
+
}
|
|
616
|
+
// Check if planned port conflicts with any used port
|
|
617
|
+
if (usedPorts.has(plannedPort)) {
|
|
618
|
+
const conflictingRepo = usedPorts.get(plannedPort);
|
|
619
|
+
const currentRepoName = config.name ?? 'app';
|
|
620
|
+
throw new Error(`Port conflict detected: Port ${plannedPort} is already used by ${conflictingRepo === 'unknown' ? 'another repo' : `repo "${conflictingRepo}"`}. ` +
|
|
621
|
+
`Each repo needs a unique port in their .env.staging DATABASE_URL. ` +
|
|
622
|
+
`Update your .env.staging to use a different port (e.g., 5438, 5439, 5440, etc.). ` +
|
|
623
|
+
`This ensures each database container can communicate with its server container properly.`);
|
|
624
|
+
}
|
|
625
|
+
return false; // No conflict
|
|
626
|
+
}
|
|
627
|
+
// ============================================================
|
|
628
|
+
// INSTANCE METHODS
|
|
629
|
+
// ============================================================
|
|
630
|
+
_config;
|
|
631
|
+
constructor(config) {
|
|
632
|
+
this._config = config;
|
|
633
|
+
}
|
|
634
|
+
/**
|
|
635
|
+
* Deploy - run migrations for the environment
|
|
636
|
+
*/
|
|
637
|
+
async deploy(_config, environment) {
|
|
638
|
+
const rootDir = process.cwd();
|
|
639
|
+
if (!(await PrismaTrpcPlugin.hasPrisma(rootDir))) {
|
|
640
|
+
return { success: true, message: 'Prisma not detected, skipping' };
|
|
641
|
+
}
|
|
642
|
+
console.log(` 📦 Running Prisma migrations for ${environment}...`);
|
|
643
|
+
try {
|
|
644
|
+
if (environment === 'dev') {
|
|
645
|
+
(0, child_process_1.execSync)('npx prisma migrate dev', { stdio: 'inherit' });
|
|
646
|
+
}
|
|
647
|
+
else {
|
|
648
|
+
// For staging/prod, use migrate deploy (non-interactive)
|
|
649
|
+
(0, child_process_1.execSync)('npx prisma migrate deploy', { stdio: 'inherit' });
|
|
650
|
+
}
|
|
651
|
+
return { success: true, message: 'Migrations complete' };
|
|
652
|
+
}
|
|
653
|
+
catch (error) {
|
|
654
|
+
return {
|
|
655
|
+
success: false,
|
|
656
|
+
error: error instanceof Error ? error.message : String(error),
|
|
657
|
+
};
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
/**
|
|
661
|
+
* Undeploy - nothing to do for Prisma
|
|
662
|
+
*/
|
|
663
|
+
async undeploy(_config, _environment) {
|
|
664
|
+
return { success: true, message: 'Nothing to undeploy for Prisma' };
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
exports.default = PrismaTrpcPlugin;
|
|
668
|
+
//# sourceMappingURL=index.js.map
|