create-raredays-app 0.1.6 → 0.1.7
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/bin/index.js +10 -51
- package/package.json +1 -1
package/bin/index.js
CHANGED
|
@@ -110,8 +110,7 @@ Options:
|
|
|
110
110
|
config file pointing at the local install.
|
|
111
111
|
--deploy <target> Scaffold deploy config for a target host.
|
|
112
112
|
One of: vercel, none (default).
|
|
113
|
-
Writes vercel.json, .env.example, docs/DEPLOY.md
|
|
114
|
-
(full-stack only) .github/workflows/deploy-migrations.yml.
|
|
113
|
+
Writes vercel.json, .env.example, and docs/DEPLOY.md.
|
|
115
114
|
-h, --help Show this help
|
|
116
115
|
|
|
117
116
|
Presets:
|
|
@@ -724,14 +723,12 @@ async function applyDeploy(targetDir, opts) {
|
|
|
724
723
|
if (!existsSync(docsDir)) await mkdir(docsDir, { recursive: true });
|
|
725
724
|
await writeFile(resolve(docsDir, "DEPLOY.md"), buildDeployMd(opts));
|
|
726
725
|
|
|
727
|
-
//
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
await writeFile(resolve(workflowsDir, "deploy-migrations.yml"), buildMigrationsWorkflow());
|
|
732
|
-
}
|
|
726
|
+
// The full-stack template already ships .github/workflows/db-migrate.yml
|
|
727
|
+
// (production migrate on push to main, path-filtered, with a concurrency
|
|
728
|
+
// lock). We must NOT generate a second deploy-migrations.yml — that would run
|
|
729
|
+
// prod migrations twice and drift on Node/pnpm versions. See docs/DEPLOY.md.
|
|
733
730
|
|
|
734
|
-
//
|
|
731
|
+
// 4. scripts/setup-vercel.sh — interactive linker.
|
|
735
732
|
const scriptsDir = resolve(targetDir, "scripts");
|
|
736
733
|
if (!existsSync(scriptsDir)) await mkdir(scriptsDir, { recursive: true });
|
|
737
734
|
const scriptPath = resolve(scriptsDir, "setup-vercel.sh");
|
|
@@ -739,7 +736,7 @@ async function applyDeploy(targetDir, opts) {
|
|
|
739
736
|
const { chmod } = await import("node:fs/promises");
|
|
740
737
|
await chmod(scriptPath, 0o755);
|
|
741
738
|
|
|
742
|
-
//
|
|
739
|
+
// 5. Return the extra env-vars deploy implies.
|
|
743
740
|
const extra = [];
|
|
744
741
|
if (isFullStack) extra.push("DATABASE_URL");
|
|
745
742
|
for (const m of opts.selectedModules ?? []) {
|
|
@@ -772,8 +769,9 @@ pairs well with Vercel.
|
|
|
772
769
|
? `
|
|
773
770
|
## 6. Run migrations
|
|
774
771
|
|
|
775
|
-
The
|
|
776
|
-
runs \`pnpm db:migrate\` on push to \`main
|
|
772
|
+
The full-stack template ships a workflow at \`.github/workflows/db-migrate.yml\`
|
|
773
|
+
that runs \`pnpm db:migrate\` on push to \`main\` when files under
|
|
774
|
+
\`db/migrations/**\` change, gated behind the \`production\` environment.
|
|
777
775
|
|
|
778
776
|
To enable it:
|
|
779
777
|
|
|
@@ -864,45 +862,6 @@ This app is plain Next.js — it'll also run on:
|
|
|
864
862
|
`;
|
|
865
863
|
}
|
|
866
864
|
|
|
867
|
-
function buildMigrationsWorkflow() {
|
|
868
|
-
return `# Runs database migrations against the production database after a manual
|
|
869
|
-
# approval. Requires a GitHub Environment named "production" with DATABASE_URL
|
|
870
|
-
# as a secret and a required reviewer.
|
|
871
|
-
#
|
|
872
|
-
# See docs/DEPLOY.md for setup instructions.
|
|
873
|
-
name: Deploy migrations
|
|
874
|
-
|
|
875
|
-
on:
|
|
876
|
-
push:
|
|
877
|
-
branches: [main]
|
|
878
|
-
workflow_dispatch:
|
|
879
|
-
|
|
880
|
-
jobs:
|
|
881
|
-
migrate:
|
|
882
|
-
name: Apply pending migrations
|
|
883
|
-
runs-on: ubuntu-latest
|
|
884
|
-
environment: production
|
|
885
|
-
steps:
|
|
886
|
-
- uses: actions/checkout@v4
|
|
887
|
-
|
|
888
|
-
- uses: pnpm/action-setup@v4
|
|
889
|
-
with:
|
|
890
|
-
version: 9
|
|
891
|
-
|
|
892
|
-
- uses: actions/setup-node@v4
|
|
893
|
-
with:
|
|
894
|
-
node-version: 20
|
|
895
|
-
cache: pnpm
|
|
896
|
-
|
|
897
|
-
- run: pnpm install --frozen-lockfile
|
|
898
|
-
|
|
899
|
-
- name: Run migrations
|
|
900
|
-
env:
|
|
901
|
-
DATABASE_URL: \${{ secrets.DATABASE_URL }}
|
|
902
|
-
run: pnpm db:migrate
|
|
903
|
-
`;
|
|
904
|
-
}
|
|
905
|
-
|
|
906
865
|
function buildSetupVercelScript() {
|
|
907
866
|
return `#!/usr/bin/env bash
|
|
908
867
|
# Interactive helper: links this repo to a new Vercel project.
|