@next-friday/create-app 0.0.0-stage → 1.0.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/LICENSE +21 -0
- package/README.md +94 -2
- package/dist/main.mjs +414 -0
- package/package.json +84 -3
- package/templates/base/.agents/hooks/agent-shell-gate.sh +355 -0
- package/templates/base/.agents/hooks/agent-suppression-gate.sh +45 -0
- package/templates/base/.agents/rules/automation-owned-checks.md +5 -0
- package/templates/base/.agents/rules/code-comments.md +3 -0
- package/templates/base/.agents/rules/current-state-authority.md +17 -0
- package/templates/base/.agents/rules/demand-driven-configuration.md +7 -0
- package/templates/base/.agents/rules/dependency-security.md +5 -0
- package/templates/base/.agents/rules/deterministic-testing.md +15 -0
- package/templates/base/.agents/rules/diagnostics-and-error-handling.md +7 -0
- package/templates/base/.agents/rules/git-workflow.md +10 -0
- package/templates/base/.agents/rules/no-suppression.md +7 -0
- package/templates/base/.agents/rules/script-driven-changes.md +7 -0
- package/templates/base/.agents/rules/single-author-style.md +7 -0
- package/templates/base/.claude/rules/agents-guide.md +1 -0
- package/templates/base/.claude/rules/automation-owned-checks.md +1 -0
- package/templates/base/.claude/rules/code-comments.md +1 -0
- package/templates/base/.claude/rules/current-state-authority.md +1 -0
- package/templates/base/.claude/rules/demand-driven-configuration.md +1 -0
- package/templates/base/.claude/rules/dependency-security.md +12 -0
- package/templates/base/.claude/rules/diagnostics-and-error-handling.md +1 -0
- package/templates/base/.claude/rules/git-workflow.md +1 -0
- package/templates/base/.claude/rules/no-suppression.md +1 -0
- package/templates/base/.claude/rules/script-driven-changes.md +1 -0
- package/templates/base/.claude/rules/single-author-style.md +1 -0
- package/templates/base/.claude/settings.json +61 -0
- package/templates/base/.commitlintrc.json +3 -0
- package/templates/base/.cursor/BUGBOT.md +17 -0
- package/templates/base/.cursor/hooks/agent-constitution-gate.sh +32 -0
- package/templates/base/.cursor/hooks.json +26 -0
- package/templates/base/.cursor/rules/automation-owned-checks.mdc +10 -0
- package/templates/base/.cursor/rules/code-comments.mdc +8 -0
- package/templates/base/.cursor/rules/current-state-authority.mdc +22 -0
- package/templates/base/.cursor/rules/demand-driven-configuration.mdc +12 -0
- package/templates/base/.cursor/rules/dependency-security.mdc +11 -0
- package/templates/base/.cursor/rules/diagnostics-and-error-handling.mdc +12 -0
- package/templates/base/.cursor/rules/git-workflow.mdc +15 -0
- package/templates/base/.cursor/rules/no-suppression.mdc +12 -0
- package/templates/base/.cursor/rules/script-driven-changes.mdc +12 -0
- package/templates/base/.cursor/rules/single-author-style.mdc +12 -0
- package/templates/base/.editorconfig +13 -0
- package/templates/base/.gitattributes +1 -0
- package/templates/base/.github/CODEOWNERS +2 -0
- package/templates/base/.github/ISSUE_TEMPLATE/config.yml +1 -0
- package/templates/base/.github/dependabot.yml +77 -0
- package/templates/base/.github/file-filters.yml +19 -0
- package/templates/base/.github/labeler.yml +25 -0
- package/templates/base/.github/requirements/diff-cover.txt +213 -0
- package/templates/base/.github/workflows/deploy.yml +124 -0
- package/templates/base/.github/workflows/osv-scanner.yml +34 -0
- package/templates/base/.github/workflows/pr-triage.yml +29 -0
- package/templates/base/.github/workflows/secret-scan.yml +50 -0
- package/templates/base/.github/workflows/validate-pr-title.yml +48 -0
- package/templates/base/.github/workflows/zizmor.yml +62 -0
- package/templates/base/.github/zizmor.yml +4 -0
- package/templates/base/.gitleaks.toml +14 -0
- package/templates/base/.husky/commit-msg +3 -0
- package/templates/base/.husky/pre-commit +17 -0
- package/templates/base/.husky/pre-merge-commit +7 -0
- package/templates/base/.husky/pre-push +15 -0
- package/templates/base/.nvmrc +1 -0
- package/templates/base/SECURITY.md +15 -0
- package/templates/base/knip.json +3 -0
- package/templates/base/pnpm-workspace.yaml +18 -0
- package/templates/base/railway.json +9 -0
- package/templates/base/scripts/check-agent-gates.ts +252 -0
- package/templates/base/scripts/sync-agent-rules.ts +121 -0
- package/templates/nestjs/.agents/rules/typescript-first.md +7 -0
- package/templates/nestjs/.agents/rules.json +41 -0
- package/templates/nestjs/.claude/rules/deterministic-testing.md +20 -0
- package/templates/nestjs/.claude/rules/typescript-first.md +13 -0
- package/templates/nestjs/.cursor/rules/deterministic-testing.mdc +21 -0
- package/templates/nestjs/.cursor/rules/typescript-first.mdc +13 -0
- package/templates/nestjs/.dependency-cruiser.json +28 -0
- package/templates/nestjs/.dockerignore +8 -0
- package/templates/nestjs/.env.example +1 -0
- package/templates/nestjs/.github/ISSUE_TEMPLATE/bug.yml +66 -0
- package/templates/nestjs/.github/ISSUE_TEMPLATE/feature.yml +50 -0
- package/templates/nestjs/.github/pull_request_template.md +25 -0
- package/templates/nestjs/.github/workflows/ci.yml +181 -0
- package/templates/nestjs/.github/workflows/sast.yml +45 -0
- package/templates/nestjs/.lintstagedrc.json +10 -0
- package/templates/nestjs/.prettierignore +2 -0
- package/templates/nestjs/.prettierrc.json +1 -0
- package/templates/nestjs/AGENTS.md +8 -0
- package/templates/nestjs/CONTRIBUTING.md +57 -0
- package/templates/nestjs/Dockerfile +27 -0
- package/templates/nestjs/README.md +78 -0
- package/templates/nestjs/_gitignore +47 -0
- package/templates/nestjs/eslint.config.ts +7 -0
- package/templates/nestjs/package.json +83 -0
- package/templates/nestjs/src/app.controller.test.ts +23 -0
- package/templates/nestjs/src/app.controller.ts +13 -0
- package/templates/nestjs/src/app.module.ts +12 -0
- package/templates/nestjs/src/app.service.ts +10 -0
- package/templates/nestjs/src/health/health.controller.test.ts +17 -0
- package/templates/nestjs/src/health/health.controller.ts +14 -0
- package/templates/nestjs/src/health/health.module.ts +10 -0
- package/templates/nestjs/src/main.ts +25 -0
- package/templates/nestjs/src/port.test.ts +29 -0
- package/templates/nestjs/src/port.ts +20 -0
- package/templates/nestjs/test/app.e2e.test.ts +40 -0
- package/templates/nestjs/tsconfig.build.json +9 -0
- package/templates/nestjs/tsconfig.json +20 -0
- package/templates/nestjs/vitest.config.ts +13 -0
- package/templates/nestjs/vitest.e2e.config.ts +8 -0
- package/templates/nextjs/.agents/rules/typescript-first.md +7 -0
- package/templates/nextjs/.agents/rules.json +41 -0
- package/templates/nextjs/.claude/rules/deterministic-testing.md +21 -0
- package/templates/nextjs/.claude/rules/typescript-first.md +15 -0
- package/templates/nextjs/.cursor/rules/deterministic-testing.mdc +21 -0
- package/templates/nextjs/.cursor/rules/typescript-first.mdc +13 -0
- package/templates/nextjs/.dependency-cruiser.json +34 -0
- package/templates/nextjs/.dockerignore +10 -0
- package/templates/nextjs/.env.example +1 -0
- package/templates/nextjs/.github/ISSUE_TEMPLATE/bug.yml +66 -0
- package/templates/nextjs/.github/ISSUE_TEMPLATE/feature.yml +50 -0
- package/templates/nextjs/.github/pull_request_template.md +25 -0
- package/templates/nextjs/.github/workflows/ci.yml +187 -0
- package/templates/nextjs/.github/workflows/sast.yml +46 -0
- package/templates/nextjs/.lintstagedrc.json +10 -0
- package/templates/nextjs/.prettierignore +2 -0
- package/templates/nextjs/AGENTS.md +18 -0
- package/templates/nextjs/CONTRIBUTING.md +57 -0
- package/templates/nextjs/Dockerfile +23 -0
- package/templates/nextjs/README.md +74 -0
- package/templates/nextjs/_gitignore +51 -0
- package/templates/nextjs/app/favicon.ico +0 -0
- package/templates/nextjs/app/globals.css +26 -0
- package/templates/nextjs/app/health/route.test.ts +20 -0
- package/templates/nextjs/app/health/route.ts +23 -0
- package/templates/nextjs/app/layout.tsx +29 -0
- package/templates/nextjs/app/page.test.ts +11 -0
- package/templates/nextjs/app/page.tsx +8 -0
- package/templates/nextjs/eslint.config.ts +32 -0
- package/templates/nextjs/knip.json +4 -0
- package/templates/nextjs/next.config.ts +35 -0
- package/templates/nextjs/package.json +78 -0
- package/templates/nextjs/playwright.config.ts +27 -0
- package/templates/nextjs/postcss.config.mjs +7 -0
- package/templates/nextjs/prettier.config.ts +11 -0
- package/templates/nextjs/test/home.e2e.test.ts +11 -0
- package/templates/nextjs/tsconfig.json +33 -0
- package/templates/nextjs/vitest.config.ts +12 -0
- package/templates/nodejs/.agents/rules/typescript-first.md +7 -0
- package/templates/nodejs/.agents/rules.json +41 -0
- package/templates/nodejs/.claude/rules/deterministic-testing.md +20 -0
- package/templates/nodejs/.claude/rules/typescript-first.md +13 -0
- package/templates/nodejs/.cursor/rules/deterministic-testing.mdc +21 -0
- package/templates/nodejs/.cursor/rules/typescript-first.mdc +13 -0
- package/templates/nodejs/.dependency-cruiser.json +28 -0
- package/templates/nodejs/.dockerignore +8 -0
- package/templates/nodejs/.env.example +1 -0
- package/templates/nodejs/.github/ISSUE_TEMPLATE/bug.yml +66 -0
- package/templates/nodejs/.github/ISSUE_TEMPLATE/feature.yml +50 -0
- package/templates/nodejs/.github/pull_request_template.md +25 -0
- package/templates/nodejs/.github/workflows/ci.yml +179 -0
- package/templates/nodejs/.github/workflows/sast.yml +45 -0
- package/templates/nodejs/.lintstagedrc.json +10 -0
- package/templates/nodejs/.prettierignore +2 -0
- package/templates/nodejs/.prettierrc.json +1 -0
- package/templates/nodejs/AGENTS.md +8 -0
- package/templates/nodejs/CONTRIBUTING.md +56 -0
- package/templates/nodejs/Dockerfile +27 -0
- package/templates/nodejs/README.md +74 -0
- package/templates/nodejs/_gitignore +47 -0
- package/templates/nodejs/eslint.config.ts +7 -0
- package/templates/nodejs/package.json +66 -0
- package/templates/nodejs/src/main.ts +22 -0
- package/templates/nodejs/src/port.test.ts +30 -0
- package/templates/nodejs/src/port.ts +20 -0
- package/templates/nodejs/src/server.test.ts +60 -0
- package/templates/nodejs/src/server.ts +37 -0
- package/templates/nodejs/tsconfig.build.json +9 -0
- package/templates/nodejs/tsconfig.json +19 -0
- package/templates/nodejs/vitest.config.ts +12 -0
- package/templates/payload/.agents/rules/typescript-first.md +7 -0
- package/templates/payload/.agents/rules.json +41 -0
- package/templates/payload/.claude/rules/deterministic-testing.md +21 -0
- package/templates/payload/.claude/rules/typescript-first.md +15 -0
- package/templates/payload/.cursor/rules/deterministic-testing.mdc +21 -0
- package/templates/payload/.cursor/rules/typescript-first.mdc +13 -0
- package/templates/payload/.dependency-cruiser.json +34 -0
- package/templates/payload/.dockerignore +9 -0
- package/templates/payload/.editorconfig-checker.json +3 -0
- package/templates/payload/.env.example +4 -0
- package/templates/payload/.github/ISSUE_TEMPLATE/bug.yml +66 -0
- package/templates/payload/.github/ISSUE_TEMPLATE/feature.yml +50 -0
- package/templates/payload/.github/pull_request_template.md +25 -0
- package/templates/payload/.github/workflows/ci.yml +204 -0
- package/templates/payload/.github/workflows/sast.yml +46 -0
- package/templates/payload/.lintstagedrc.json +10 -0
- package/templates/payload/.prettierignore +5 -0
- package/templates/payload/.prettierrc.json +1 -0
- package/templates/payload/AGENTS.md +19 -0
- package/templates/payload/CONTRIBUTING.md +58 -0
- package/templates/payload/Dockerfile +26 -0
- package/templates/payload/README.md +98 -0
- package/templates/payload/_gitignore +52 -0
- package/templates/payload/eslint.config.ts +35 -0
- package/templates/payload/next.config.ts +43 -0
- package/templates/payload/package.json +86 -0
- package/templates/payload/playwright.config.ts +27 -0
- package/templates/payload/src/app/(frontend)/layout.tsx +18 -0
- package/templates/payload/src/app/(frontend)/page.test.ts +14 -0
- package/templates/payload/src/app/(frontend)/page.tsx +14 -0
- package/templates/payload/src/app/(frontend)/styles.css +15 -0
- package/templates/payload/src/app/(payload)/admin/[[...segments]]/not-found.tsx +24 -0
- package/templates/payload/src/app/(payload)/admin/[[...segments]]/page.tsx +24 -0
- package/templates/payload/src/app/(payload)/admin/importMap.ts +6 -0
- package/templates/payload/src/app/(payload)/api/[...slug]/route.ts +19 -0
- package/templates/payload/src/app/(payload)/api/graphql/route.ts +8 -0
- package/templates/payload/src/app/(payload)/api/graphql-playground/route.ts +7 -0
- package/templates/payload/src/app/(payload)/custom.scss +0 -0
- package/templates/payload/src/app/(payload)/layout.tsx +31 -0
- package/templates/payload/src/app/health/route.test.ts +20 -0
- package/templates/payload/src/app/health/route.ts +23 -0
- package/templates/payload/src/collections/media.test.ts +27 -0
- package/templates/payload/src/collections/media.ts +18 -0
- package/templates/payload/src/collections/users.test.ts +10 -0
- package/templates/payload/src/collections/users.ts +10 -0
- package/templates/payload/src/environment.test.ts +32 -0
- package/templates/payload/src/environment.ts +14 -0
- package/templates/payload/src/migrations/20261030_005055_initial.json +969 -0
- package/templates/payload/src/migrations/20261030_005055_initial.ts +134 -0
- package/templates/payload/src/migrations/index.ts +9 -0
- package/templates/payload/src/payload-types.ts +339 -0
- package/templates/payload/src/payload.config.ts +47 -0
- package/templates/payload/test/home.e2e.test.ts +16 -0
- package/templates/payload/tsconfig.json +34 -0
- package/templates/payload/vitest.config.ts +19 -0
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { MigrateUpArgs, MigrateDownArgs, sql } from '@payloadcms/db-postgres'
|
|
2
|
+
|
|
3
|
+
export async function up({ db, payload, req }: MigrateUpArgs): Promise<void> {
|
|
4
|
+
await db.execute(sql`
|
|
5
|
+
CREATE TABLE "users_sessions" (
|
|
6
|
+
"_order" integer NOT NULL,
|
|
7
|
+
"_parent_id" integer NOT NULL,
|
|
8
|
+
"id" varchar PRIMARY KEY NOT NULL,
|
|
9
|
+
"created_at" timestamp(3) with time zone,
|
|
10
|
+
"expires_at" timestamp(3) with time zone NOT NULL
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
CREATE TABLE "users" (
|
|
14
|
+
"id" serial PRIMARY KEY NOT NULL,
|
|
15
|
+
"updated_at" timestamp(3) with time zone DEFAULT now() NOT NULL,
|
|
16
|
+
"created_at" timestamp(3) with time zone DEFAULT now() NOT NULL,
|
|
17
|
+
"email" varchar NOT NULL,
|
|
18
|
+
"reset_password_token" varchar,
|
|
19
|
+
"reset_password_expiration" timestamp(3) with time zone,
|
|
20
|
+
"salt" varchar,
|
|
21
|
+
"hash" varchar,
|
|
22
|
+
"reset_password_requested_at" timestamp(3) with time zone,
|
|
23
|
+
"login_attempts" numeric DEFAULT 0,
|
|
24
|
+
"lock_until" timestamp(3) with time zone
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
CREATE TABLE "media" (
|
|
28
|
+
"id" serial PRIMARY KEY NOT NULL,
|
|
29
|
+
"alt" varchar NOT NULL,
|
|
30
|
+
"updated_at" timestamp(3) with time zone DEFAULT now() NOT NULL,
|
|
31
|
+
"created_at" timestamp(3) with time zone DEFAULT now() NOT NULL,
|
|
32
|
+
"url" varchar,
|
|
33
|
+
"thumbnail_u_r_l" varchar,
|
|
34
|
+
"filename" varchar,
|
|
35
|
+
"mime_type" varchar,
|
|
36
|
+
"filesize" numeric,
|
|
37
|
+
"width" numeric,
|
|
38
|
+
"height" numeric,
|
|
39
|
+
"focal_x" numeric,
|
|
40
|
+
"focal_y" numeric
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
CREATE TABLE "payload_kv" (
|
|
44
|
+
"id" serial PRIMARY KEY NOT NULL,
|
|
45
|
+
"key" varchar NOT NULL,
|
|
46
|
+
"data" jsonb NOT NULL
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
CREATE TABLE "payload_locked_documents" (
|
|
50
|
+
"id" serial PRIMARY KEY NOT NULL,
|
|
51
|
+
"global_slug" varchar,
|
|
52
|
+
"updated_at" timestamp(3) with time zone DEFAULT now() NOT NULL,
|
|
53
|
+
"created_at" timestamp(3) with time zone DEFAULT now() NOT NULL
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
CREATE TABLE "payload_locked_documents_rels" (
|
|
57
|
+
"id" serial PRIMARY KEY NOT NULL,
|
|
58
|
+
"order" integer,
|
|
59
|
+
"parent_id" integer NOT NULL,
|
|
60
|
+
"path" varchar NOT NULL,
|
|
61
|
+
"users_id" integer,
|
|
62
|
+
"media_id" integer
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
CREATE TABLE "payload_preferences" (
|
|
66
|
+
"id" serial PRIMARY KEY NOT NULL,
|
|
67
|
+
"key" varchar,
|
|
68
|
+
"value" jsonb,
|
|
69
|
+
"updated_at" timestamp(3) with time zone DEFAULT now() NOT NULL,
|
|
70
|
+
"created_at" timestamp(3) with time zone DEFAULT now() NOT NULL
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
CREATE TABLE "payload_preferences_rels" (
|
|
74
|
+
"id" serial PRIMARY KEY NOT NULL,
|
|
75
|
+
"order" integer,
|
|
76
|
+
"parent_id" integer NOT NULL,
|
|
77
|
+
"path" varchar NOT NULL,
|
|
78
|
+
"users_id" integer
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
CREATE TABLE "payload_migrations" (
|
|
82
|
+
"id" serial PRIMARY KEY NOT NULL,
|
|
83
|
+
"name" varchar,
|
|
84
|
+
"batch" numeric,
|
|
85
|
+
"updated_at" timestamp(3) with time zone DEFAULT now() NOT NULL,
|
|
86
|
+
"created_at" timestamp(3) with time zone DEFAULT now() NOT NULL
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
ALTER TABLE "users_sessions" ADD CONSTRAINT "users_sessions_parent_id_fk" FOREIGN KEY ("_parent_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;
|
|
90
|
+
ALTER TABLE "payload_locked_documents_rels" ADD CONSTRAINT "payload_locked_documents_rels_parent_fk" FOREIGN KEY ("parent_id") REFERENCES "public"."payload_locked_documents"("id") ON DELETE cascade ON UPDATE no action;
|
|
91
|
+
ALTER TABLE "payload_locked_documents_rels" ADD CONSTRAINT "payload_locked_documents_rels_users_fk" FOREIGN KEY ("users_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;
|
|
92
|
+
ALTER TABLE "payload_locked_documents_rels" ADD CONSTRAINT "payload_locked_documents_rels_media_fk" FOREIGN KEY ("media_id") REFERENCES "public"."media"("id") ON DELETE cascade ON UPDATE no action;
|
|
93
|
+
ALTER TABLE "payload_preferences_rels" ADD CONSTRAINT "payload_preferences_rels_parent_fk" FOREIGN KEY ("parent_id") REFERENCES "public"."payload_preferences"("id") ON DELETE cascade ON UPDATE no action;
|
|
94
|
+
ALTER TABLE "payload_preferences_rels" ADD CONSTRAINT "payload_preferences_rels_users_fk" FOREIGN KEY ("users_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;
|
|
95
|
+
CREATE INDEX "users_sessions_order_idx" ON "users_sessions" USING btree ("_order");
|
|
96
|
+
CREATE INDEX "users_sessions_parent_id_idx" ON "users_sessions" USING btree ("_parent_id");
|
|
97
|
+
CREATE INDEX "users_updated_at_idx" ON "users" USING btree ("updated_at");
|
|
98
|
+
CREATE INDEX "users_created_at_idx" ON "users" USING btree ("created_at");
|
|
99
|
+
CREATE UNIQUE INDEX "users_email_idx" ON "users" USING btree ("email");
|
|
100
|
+
CREATE INDEX "media_updated_at_idx" ON "media" USING btree ("updated_at");
|
|
101
|
+
CREATE INDEX "media_created_at_idx" ON "media" USING btree ("created_at");
|
|
102
|
+
CREATE UNIQUE INDEX "media_filename_idx" ON "media" USING btree ("filename");
|
|
103
|
+
CREATE UNIQUE INDEX "payload_kv_key_idx" ON "payload_kv" USING btree ("key");
|
|
104
|
+
CREATE INDEX "payload_locked_documents_global_slug_idx" ON "payload_locked_documents" USING btree ("global_slug");
|
|
105
|
+
CREATE INDEX "payload_locked_documents_updated_at_idx" ON "payload_locked_documents" USING btree ("updated_at");
|
|
106
|
+
CREATE INDEX "payload_locked_documents_created_at_idx" ON "payload_locked_documents" USING btree ("created_at");
|
|
107
|
+
CREATE INDEX "payload_locked_documents_rels_order_idx" ON "payload_locked_documents_rels" USING btree ("order");
|
|
108
|
+
CREATE INDEX "payload_locked_documents_rels_parent_idx" ON "payload_locked_documents_rels" USING btree ("parent_id");
|
|
109
|
+
CREATE INDEX "payload_locked_documents_rels_path_idx" ON "payload_locked_documents_rels" USING btree ("path");
|
|
110
|
+
CREATE INDEX "payload_locked_documents_rels_users_id_idx" ON "payload_locked_documents_rels" USING btree ("users_id");
|
|
111
|
+
CREATE INDEX "payload_locked_documents_rels_media_id_idx" ON "payload_locked_documents_rels" USING btree ("media_id");
|
|
112
|
+
CREATE INDEX "payload_preferences_key_idx" ON "payload_preferences" USING btree ("key");
|
|
113
|
+
CREATE INDEX "payload_preferences_updated_at_idx" ON "payload_preferences" USING btree ("updated_at");
|
|
114
|
+
CREATE INDEX "payload_preferences_created_at_idx" ON "payload_preferences" USING btree ("created_at");
|
|
115
|
+
CREATE INDEX "payload_preferences_rels_order_idx" ON "payload_preferences_rels" USING btree ("order");
|
|
116
|
+
CREATE INDEX "payload_preferences_rels_parent_idx" ON "payload_preferences_rels" USING btree ("parent_id");
|
|
117
|
+
CREATE INDEX "payload_preferences_rels_path_idx" ON "payload_preferences_rels" USING btree ("path");
|
|
118
|
+
CREATE INDEX "payload_preferences_rels_users_id_idx" ON "payload_preferences_rels" USING btree ("users_id");
|
|
119
|
+
CREATE INDEX "payload_migrations_updated_at_idx" ON "payload_migrations" USING btree ("updated_at");
|
|
120
|
+
CREATE INDEX "payload_migrations_created_at_idx" ON "payload_migrations" USING btree ("created_at");`)
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export async function down({ db, payload, req }: MigrateDownArgs): Promise<void> {
|
|
124
|
+
await db.execute(sql`
|
|
125
|
+
DROP TABLE "users_sessions" CASCADE;
|
|
126
|
+
DROP TABLE "users" CASCADE;
|
|
127
|
+
DROP TABLE "media" CASCADE;
|
|
128
|
+
DROP TABLE "payload_kv" CASCADE;
|
|
129
|
+
DROP TABLE "payload_locked_documents" CASCADE;
|
|
130
|
+
DROP TABLE "payload_locked_documents_rels" CASCADE;
|
|
131
|
+
DROP TABLE "payload_preferences" CASCADE;
|
|
132
|
+
DROP TABLE "payload_preferences_rels" CASCADE;
|
|
133
|
+
DROP TABLE "payload_migrations" CASCADE;`)
|
|
134
|
+
}
|
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was automatically generated by Payload.
|
|
3
|
+
* DO NOT MODIFY IT BY HAND. Instead, modify your source Payload config,
|
|
4
|
+
* and re-run `payload generate:types` to regenerate this file.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Supported timezones in IANA format.
|
|
9
|
+
*
|
|
10
|
+
* This interface was referenced by `Config`'s JSON-Schema
|
|
11
|
+
* via the `definition` "supportedTimezones".
|
|
12
|
+
*/
|
|
13
|
+
export type SupportedTimezones =
|
|
14
|
+
| 'Pacific/Midway'
|
|
15
|
+
| 'Pacific/Niue'
|
|
16
|
+
| 'Pacific/Honolulu'
|
|
17
|
+
| 'Pacific/Rarotonga'
|
|
18
|
+
| 'America/Anchorage'
|
|
19
|
+
| 'Pacific/Gambier'
|
|
20
|
+
| 'America/Los_Angeles'
|
|
21
|
+
| 'America/Tijuana'
|
|
22
|
+
| 'America/Denver'
|
|
23
|
+
| 'America/Phoenix'
|
|
24
|
+
| 'America/Chicago'
|
|
25
|
+
| 'America/Guatemala'
|
|
26
|
+
| 'America/New_York'
|
|
27
|
+
| 'America/Bogota'
|
|
28
|
+
| 'America/Caracas'
|
|
29
|
+
| 'America/Santiago'
|
|
30
|
+
| 'America/Buenos_Aires'
|
|
31
|
+
| 'America/Sao_Paulo'
|
|
32
|
+
| 'Atlantic/South_Georgia'
|
|
33
|
+
| 'Atlantic/Azores'
|
|
34
|
+
| 'Atlantic/Cape_Verde'
|
|
35
|
+
| 'Europe/London'
|
|
36
|
+
| 'Europe/Berlin'
|
|
37
|
+
| 'Africa/Lagos'
|
|
38
|
+
| 'Europe/Athens'
|
|
39
|
+
| 'Africa/Cairo'
|
|
40
|
+
| 'Europe/Moscow'
|
|
41
|
+
| 'Asia/Riyadh'
|
|
42
|
+
| 'Asia/Dubai'
|
|
43
|
+
| 'Asia/Baku'
|
|
44
|
+
| 'Asia/Karachi'
|
|
45
|
+
| 'Asia/Tashkent'
|
|
46
|
+
| 'Asia/Calcutta'
|
|
47
|
+
| 'Asia/Dhaka'
|
|
48
|
+
| 'Asia/Almaty'
|
|
49
|
+
| 'Asia/Jakarta'
|
|
50
|
+
| 'Asia/Bangkok'
|
|
51
|
+
| 'Asia/Shanghai'
|
|
52
|
+
| 'Asia/Singapore'
|
|
53
|
+
| 'Asia/Tokyo'
|
|
54
|
+
| 'Asia/Seoul'
|
|
55
|
+
| 'Australia/Brisbane'
|
|
56
|
+
| 'Australia/Sydney'
|
|
57
|
+
| 'Pacific/Guam'
|
|
58
|
+
| 'Pacific/Noumea'
|
|
59
|
+
| 'Pacific/Auckland'
|
|
60
|
+
| 'Pacific/Fiji';
|
|
61
|
+
|
|
62
|
+
export interface Config {
|
|
63
|
+
auth: {
|
|
64
|
+
users: UserAuthOperations;
|
|
65
|
+
};
|
|
66
|
+
blocks: {};
|
|
67
|
+
collections: {
|
|
68
|
+
users: User;
|
|
69
|
+
media: Media;
|
|
70
|
+
'payload-kv': PayloadKv;
|
|
71
|
+
'payload-locked-documents': PayloadLockedDocument;
|
|
72
|
+
'payload-preferences': PayloadPreference;
|
|
73
|
+
'payload-migrations': PayloadMigration;
|
|
74
|
+
};
|
|
75
|
+
collectionsJoins: {};
|
|
76
|
+
collectionsSelect: {
|
|
77
|
+
users: UsersSelect<false> | UsersSelect<true>;
|
|
78
|
+
media: MediaSelect<false> | MediaSelect<true>;
|
|
79
|
+
'payload-kv': PayloadKvSelect<false> | PayloadKvSelect<true>;
|
|
80
|
+
'payload-locked-documents': PayloadLockedDocumentsSelect<false> | PayloadLockedDocumentsSelect<true>;
|
|
81
|
+
'payload-preferences': PayloadPreferencesSelect<false> | PayloadPreferencesSelect<true>;
|
|
82
|
+
'payload-migrations': PayloadMigrationsSelect<false> | PayloadMigrationsSelect<true>;
|
|
83
|
+
};
|
|
84
|
+
db: {
|
|
85
|
+
defaultIDType: number;
|
|
86
|
+
};
|
|
87
|
+
fallbackLocale: null;
|
|
88
|
+
globals: {};
|
|
89
|
+
globalsSelect: {};
|
|
90
|
+
locale: null;
|
|
91
|
+
widgets: {
|
|
92
|
+
collections: CollectionsWidget;
|
|
93
|
+
};
|
|
94
|
+
user: User;
|
|
95
|
+
jobs: {
|
|
96
|
+
tasks: unknown;
|
|
97
|
+
workflows: unknown;
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
export interface UserAuthOperations {
|
|
101
|
+
forgotPassword: {
|
|
102
|
+
email: string;
|
|
103
|
+
password: string;
|
|
104
|
+
};
|
|
105
|
+
login: {
|
|
106
|
+
email: string;
|
|
107
|
+
password: string;
|
|
108
|
+
};
|
|
109
|
+
registerFirstUser: {
|
|
110
|
+
email: string;
|
|
111
|
+
password: string;
|
|
112
|
+
};
|
|
113
|
+
unlock: {
|
|
114
|
+
email: string;
|
|
115
|
+
password: string;
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* This interface was referenced by `Config`'s JSON-Schema
|
|
120
|
+
* via the `definition` "users".
|
|
121
|
+
*/
|
|
122
|
+
export interface User {
|
|
123
|
+
id: number;
|
|
124
|
+
updatedAt: string;
|
|
125
|
+
createdAt: string;
|
|
126
|
+
email: string;
|
|
127
|
+
resetPasswordToken?: string | null;
|
|
128
|
+
resetPasswordExpiration?: string | null;
|
|
129
|
+
salt?: string | null;
|
|
130
|
+
hash?: string | null;
|
|
131
|
+
resetPasswordRequestedAt?: string | null;
|
|
132
|
+
loginAttempts?: number | null;
|
|
133
|
+
lockUntil?: string | null;
|
|
134
|
+
sessions?:
|
|
135
|
+
| {
|
|
136
|
+
id: string;
|
|
137
|
+
createdAt?: string | null;
|
|
138
|
+
expiresAt: string;
|
|
139
|
+
}[]
|
|
140
|
+
| null;
|
|
141
|
+
password?: string | null;
|
|
142
|
+
collection: 'users';
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* This interface was referenced by `Config`'s JSON-Schema
|
|
146
|
+
* via the `definition` "media".
|
|
147
|
+
*/
|
|
148
|
+
export interface Media {
|
|
149
|
+
id: number;
|
|
150
|
+
alt: string;
|
|
151
|
+
updatedAt: string;
|
|
152
|
+
createdAt: string;
|
|
153
|
+
url?: string | null;
|
|
154
|
+
thumbnailURL?: string | null;
|
|
155
|
+
filename?: string | null;
|
|
156
|
+
mimeType?: string | null;
|
|
157
|
+
filesize?: number | null;
|
|
158
|
+
width?: number | null;
|
|
159
|
+
height?: number | null;
|
|
160
|
+
focalX?: number | null;
|
|
161
|
+
focalY?: number | null;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* This interface was referenced by `Config`'s JSON-Schema
|
|
165
|
+
* via the `definition` "payload-kv".
|
|
166
|
+
*/
|
|
167
|
+
export interface PayloadKv {
|
|
168
|
+
id: number;
|
|
169
|
+
key: string;
|
|
170
|
+
data:
|
|
171
|
+
| {
|
|
172
|
+
[k: string]: unknown;
|
|
173
|
+
}
|
|
174
|
+
| unknown[]
|
|
175
|
+
| string
|
|
176
|
+
| number
|
|
177
|
+
| boolean
|
|
178
|
+
| null;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* This interface was referenced by `Config`'s JSON-Schema
|
|
182
|
+
* via the `definition` "payload-locked-documents".
|
|
183
|
+
*/
|
|
184
|
+
export interface PayloadLockedDocument {
|
|
185
|
+
id: number;
|
|
186
|
+
document?:
|
|
187
|
+
| ({
|
|
188
|
+
relationTo: 'users';
|
|
189
|
+
value: number | User;
|
|
190
|
+
} | null)
|
|
191
|
+
| ({
|
|
192
|
+
relationTo: 'media';
|
|
193
|
+
value: number | Media;
|
|
194
|
+
} | null);
|
|
195
|
+
globalSlug?: string | null;
|
|
196
|
+
user: {
|
|
197
|
+
relationTo: 'users';
|
|
198
|
+
value: number | User;
|
|
199
|
+
};
|
|
200
|
+
updatedAt: string;
|
|
201
|
+
createdAt: string;
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* This interface was referenced by `Config`'s JSON-Schema
|
|
205
|
+
* via the `definition` "payload-preferences".
|
|
206
|
+
*/
|
|
207
|
+
export interface PayloadPreference {
|
|
208
|
+
id: number;
|
|
209
|
+
user: {
|
|
210
|
+
relationTo: 'users';
|
|
211
|
+
value: number | User;
|
|
212
|
+
};
|
|
213
|
+
key?: string | null;
|
|
214
|
+
value?:
|
|
215
|
+
| {
|
|
216
|
+
[k: string]: unknown;
|
|
217
|
+
}
|
|
218
|
+
| unknown[]
|
|
219
|
+
| string
|
|
220
|
+
| number
|
|
221
|
+
| boolean
|
|
222
|
+
| null;
|
|
223
|
+
updatedAt: string;
|
|
224
|
+
createdAt: string;
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* This interface was referenced by `Config`'s JSON-Schema
|
|
228
|
+
* via the `definition` "payload-migrations".
|
|
229
|
+
*/
|
|
230
|
+
export interface PayloadMigration {
|
|
231
|
+
id: number;
|
|
232
|
+
name?: string | null;
|
|
233
|
+
batch?: number | null;
|
|
234
|
+
updatedAt: string;
|
|
235
|
+
createdAt: string;
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* This interface was referenced by `Config`'s JSON-Schema
|
|
239
|
+
* via the `definition` "users_select".
|
|
240
|
+
*/
|
|
241
|
+
export interface UsersSelect<T extends boolean = true> {
|
|
242
|
+
updatedAt?: T;
|
|
243
|
+
createdAt?: T;
|
|
244
|
+
email?: T;
|
|
245
|
+
resetPasswordToken?: T;
|
|
246
|
+
resetPasswordExpiration?: T;
|
|
247
|
+
salt?: T;
|
|
248
|
+
hash?: T;
|
|
249
|
+
resetPasswordRequestedAt?: T;
|
|
250
|
+
loginAttempts?: T;
|
|
251
|
+
lockUntil?: T;
|
|
252
|
+
sessions?:
|
|
253
|
+
| T
|
|
254
|
+
| {
|
|
255
|
+
id?: T;
|
|
256
|
+
createdAt?: T;
|
|
257
|
+
expiresAt?: T;
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* This interface was referenced by `Config`'s JSON-Schema
|
|
262
|
+
* via the `definition` "media_select".
|
|
263
|
+
*/
|
|
264
|
+
export interface MediaSelect<T extends boolean = true> {
|
|
265
|
+
alt?: T;
|
|
266
|
+
updatedAt?: T;
|
|
267
|
+
createdAt?: T;
|
|
268
|
+
url?: T;
|
|
269
|
+
thumbnailURL?: T;
|
|
270
|
+
filename?: T;
|
|
271
|
+
mimeType?: T;
|
|
272
|
+
filesize?: T;
|
|
273
|
+
width?: T;
|
|
274
|
+
height?: T;
|
|
275
|
+
focalX?: T;
|
|
276
|
+
focalY?: T;
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* This interface was referenced by `Config`'s JSON-Schema
|
|
280
|
+
* via the `definition` "payload-kv_select".
|
|
281
|
+
*/
|
|
282
|
+
export interface PayloadKvSelect<T extends boolean = true> {
|
|
283
|
+
key?: T;
|
|
284
|
+
data?: T;
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* This interface was referenced by `Config`'s JSON-Schema
|
|
288
|
+
* via the `definition` "payload-locked-documents_select".
|
|
289
|
+
*/
|
|
290
|
+
export interface PayloadLockedDocumentsSelect<T extends boolean = true> {
|
|
291
|
+
document?: T;
|
|
292
|
+
globalSlug?: T;
|
|
293
|
+
user?: T;
|
|
294
|
+
updatedAt?: T;
|
|
295
|
+
createdAt?: T;
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* This interface was referenced by `Config`'s JSON-Schema
|
|
299
|
+
* via the `definition` "payload-preferences_select".
|
|
300
|
+
*/
|
|
301
|
+
export interface PayloadPreferencesSelect<T extends boolean = true> {
|
|
302
|
+
user?: T;
|
|
303
|
+
key?: T;
|
|
304
|
+
value?: T;
|
|
305
|
+
updatedAt?: T;
|
|
306
|
+
createdAt?: T;
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* This interface was referenced by `Config`'s JSON-Schema
|
|
310
|
+
* via the `definition` "payload-migrations_select".
|
|
311
|
+
*/
|
|
312
|
+
export interface PayloadMigrationsSelect<T extends boolean = true> {
|
|
313
|
+
name?: T;
|
|
314
|
+
batch?: T;
|
|
315
|
+
updatedAt?: T;
|
|
316
|
+
createdAt?: T;
|
|
317
|
+
}
|
|
318
|
+
/**
|
|
319
|
+
* This interface was referenced by `Config`'s JSON-Schema
|
|
320
|
+
* via the `definition` "collections_widget".
|
|
321
|
+
*/
|
|
322
|
+
export interface CollectionsWidget {
|
|
323
|
+
data?: {
|
|
324
|
+
[k: string]: unknown;
|
|
325
|
+
};
|
|
326
|
+
width: 'full';
|
|
327
|
+
}
|
|
328
|
+
/**
|
|
329
|
+
* This interface was referenced by `Config`'s JSON-Schema
|
|
330
|
+
* via the `definition` "auth".
|
|
331
|
+
*/
|
|
332
|
+
export interface Auth {
|
|
333
|
+
[k: string]: unknown;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
|
|
337
|
+
declare module 'payload' {
|
|
338
|
+
export interface GeneratedTypes extends Config {}
|
|
339
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import {buildConfig} from "payload";
|
|
2
|
+
import {fileURLToPath} from "node:url";
|
|
3
|
+
import {lexicalEditor} from "@payloadcms/richtext-lexical";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import {postgresAdapter} from "@payloadcms/db-postgres";
|
|
6
|
+
import sharp from "sharp";
|
|
7
|
+
|
|
8
|
+
import {Media} from "./collections/media";
|
|
9
|
+
import {migrations} from "./migrations";
|
|
10
|
+
import {requireEnvironment} from "./environment";
|
|
11
|
+
import {Users} from "./collections/users";
|
|
12
|
+
|
|
13
|
+
const dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
14
|
+
const lintBanner = /^\/\* [a-z]+lint[:-]disable \*\/\n/gmu;
|
|
15
|
+
const serverURL = requireEnvironment("APP_URL");
|
|
16
|
+
const maxUploadBytes = 10_000_000;
|
|
17
|
+
|
|
18
|
+
export default buildConfig({
|
|
19
|
+
serverURL,
|
|
20
|
+
sharp,
|
|
21
|
+
cors: [serverURL],
|
|
22
|
+
collections: [Users, Media],
|
|
23
|
+
upload: {
|
|
24
|
+
limits: {
|
|
25
|
+
fileSize: maxUploadBytes,
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
admin: {
|
|
29
|
+
user: Users.slug,
|
|
30
|
+
importMap: {
|
|
31
|
+
baseDir: path.resolve(dirname),
|
|
32
|
+
importMapFile: path.resolve(dirname, "app/(payload)/admin/importMap.ts"),
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
editor: lexicalEditor(),
|
|
36
|
+
secret: requireEnvironment("PAYLOAD_SECRET"),
|
|
37
|
+
typescript: {
|
|
38
|
+
outputFile: path.resolve(dirname, "payload-types.ts"),
|
|
39
|
+
postProcess: [({compiledTypes}) => compiledTypes.replaceAll(lintBanner, "")],
|
|
40
|
+
},
|
|
41
|
+
db: postgresAdapter({
|
|
42
|
+
prodMigrations: migrations,
|
|
43
|
+
pool: {
|
|
44
|
+
connectionString: requireEnvironment("DATABASE_URL"),
|
|
45
|
+
},
|
|
46
|
+
}),
|
|
47
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import {expect, test} from "@playwright/test";
|
|
2
|
+
|
|
3
|
+
test("home page shows the template heading", async ({page}) => {
|
|
4
|
+
await page.goto("/");
|
|
5
|
+
|
|
6
|
+
await expect(
|
|
7
|
+
page.getByRole("heading", {
|
|
8
|
+
level: 1,
|
|
9
|
+
}),
|
|
10
|
+
).toHaveText("Next Friday Payload template");
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
test("admin panel asks for a user to sign in or create the first user", async ({page}) => {
|
|
14
|
+
await page.goto("/admin");
|
|
15
|
+
await expect(page).toHaveURL(/\/admin\/(login|create-first-user)/);
|
|
16
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2023",
|
|
4
|
+
"lib": ["dom", "dom.iterable", "esnext"],
|
|
5
|
+
"module": "esnext",
|
|
6
|
+
"moduleResolution": "bundler",
|
|
7
|
+
"jsx": "react-jsx",
|
|
8
|
+
"esModuleInterop": true,
|
|
9
|
+
"incremental": true,
|
|
10
|
+
"isolatedModules": true,
|
|
11
|
+
"noEmit": true,
|
|
12
|
+
"resolveJsonModule": true,
|
|
13
|
+
"skipLibCheck": true,
|
|
14
|
+
"strict": true,
|
|
15
|
+
"plugins": [
|
|
16
|
+
{
|
|
17
|
+
"name": "next"
|
|
18
|
+
}
|
|
19
|
+
],
|
|
20
|
+
"paths": {
|
|
21
|
+
"@/*": ["./src/*"],
|
|
22
|
+
"@payload-config": ["./src/payload.config.ts"]
|
|
23
|
+
},
|
|
24
|
+
"allowJs": true
|
|
25
|
+
},
|
|
26
|
+
"include": [
|
|
27
|
+
"next-env.d.ts",
|
|
28
|
+
"**/*.ts",
|
|
29
|
+
"**/*.tsx",
|
|
30
|
+
".next/types/**/*.ts",
|
|
31
|
+
".next/dev/types/**/*.ts"
|
|
32
|
+
],
|
|
33
|
+
"exclude": ["node_modules", ".next"]
|
|
34
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {defineConfig} from "vitest/config";
|
|
2
|
+
|
|
3
|
+
export default defineConfig({
|
|
4
|
+
test: {
|
|
5
|
+
coverage: {
|
|
6
|
+
reporter: ["text", "html", "cobertura"],
|
|
7
|
+
include: ["src/**/*.{ts,tsx}"],
|
|
8
|
+
exclude: [
|
|
9
|
+
"src/**/*.test.{ts,tsx}",
|
|
10
|
+
"src/**/layout.tsx",
|
|
11
|
+
String.raw`src/app/\(payload\)/**`,
|
|
12
|
+
"src/migrations/**",
|
|
13
|
+
"src/payload-types.ts",
|
|
14
|
+
"src/payload.config.ts",
|
|
15
|
+
],
|
|
16
|
+
},
|
|
17
|
+
include: ["src/**/*.test.{ts,tsx}"],
|
|
18
|
+
},
|
|
19
|
+
});
|