create-payload-app 0.3.22 → 0.3.24

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.
Files changed (36) hide show
  1. package/dist/lib/common-files/package.template.json +1 -1
  2. package/package.json +4 -2
  3. package/dist/lib/common-files/javascript/nodemon.json +0 -3
  4. package/dist/lib/common-files/javascript/package.template.json +0 -20
  5. package/dist/lib/common-files/typescript/nodemon.json +0 -4
  6. package/dist/lib/common-files/typescript/package.template.json +0 -30
  7. package/dist/lib/common-files/typescript/tsconfig.json +0 -28
  8. package/dist/lib/parse-language.js +0 -79
  9. package/dist/templates/js-blank/collections/Examples.js +0 -15
  10. package/dist/templates/js-blank/collections/Users.js +0 -16
  11. package/dist/templates/js-blank/payload.config.js +0 -15
  12. package/dist/templates/js-blank/server.js +0 -24
  13. package/dist/templates/js-blog/collections/Categories.js +0 -18
  14. package/dist/templates/js-blog/collections/Posts.js +0 -60
  15. package/dist/templates/js-blog/collections/Tags.js +0 -18
  16. package/dist/templates/js-blog/collections/Users.js +0 -19
  17. package/dist/templates/js-blog/payload.config.js +0 -18
  18. package/dist/templates/js-blog/server.js +0 -24
  19. package/dist/templates/js-todo/collections/TodoLists.js +0 -36
  20. package/dist/templates/js-todo/collections/Users.js +0 -16
  21. package/dist/templates/js-todo/payload.config.js +0 -14
  22. package/dist/templates/js-todo/server.js +0 -24
  23. package/dist/templates/ts-blank/src/collections/Examples.ts +0 -17
  24. package/dist/templates/ts-blank/src/collections/Users.ts +0 -18
  25. package/dist/templates/ts-blank/src/payload.config.ts +0 -22
  26. package/dist/templates/ts-blank/src/server.ts +0 -24
  27. package/dist/templates/ts-blog/src/collections/Categories.ts +0 -20
  28. package/dist/templates/ts-blog/src/collections/Posts.ts +0 -62
  29. package/dist/templates/ts-blog/src/collections/Tags.ts +0 -20
  30. package/dist/templates/ts-blog/src/collections/Users.ts +0 -21
  31. package/dist/templates/ts-blog/src/payload.config.ts +0 -25
  32. package/dist/templates/ts-blog/src/server.ts +0 -24
  33. package/dist/templates/ts-todo/src/collections/TodoLists.ts +0 -38
  34. package/dist/templates/ts-todo/src/collections/Users.ts +0 -18
  35. package/dist/templates/ts-todo/src/payload.config.ts +0 -21
  36. package/dist/templates/ts-todo/src/server.ts +0 -24
@@ -12,7 +12,7 @@
12
12
  "serve": "cross-env PAYLOAD_CONFIG_PATH=dist/payload.config.js NODE_ENV=production node dist/server.js",
13
13
  "copyfiles": "copyfiles -u 1 \"src/**/*.{html,css,scss,ttf,woff,woff2,eot,svg,jpg,png}\" dist/",
14
14
  "generate:types": "cross-env PAYLOAD_CONFIG_PATH=src/payload.config.ts payload generate:types",
15
- "generate:graphQLSchema": "PAYLOAD_CONFIG_PATH=src/payload.config.ts payload generate:graphQLSchema"
15
+ "generate:graphQLSchema": "cross-env PAYLOAD_CONFIG_PATH=src/payload.config.ts payload generate:graphQLSchema"
16
16
  },
17
17
  "dependencies": {
18
18
  "payload": "1.1.17",
package/package.json CHANGED
@@ -7,12 +7,13 @@
7
7
  "scripts": {
8
8
  "build": "tsc && yarn copyfiles",
9
9
  "copyfiles": "copyfiles -u 1 \"src/templates/**\" \"src/lib/common-files/**\" dist",
10
+ "clean": "rimraf dist",
10
11
  "typecheck": "tsc --noEmit",
11
12
  "lint": "eslint \"src/**/*.ts\"",
12
13
  "lint:fix": "eslint \"src/**/*.ts\" --fix",
13
14
  "lint-staged": "lint-staged --quiet",
14
15
  "test": "jest",
15
- "prepublishOnly": "yarn test && yarn build",
16
+ "prepublishOnly": "yarn test && yarn clean && yarn build",
16
17
  "prepare": "husky install",
17
18
  "release:beta": "yarn publish --tag beta",
18
19
  "release": "yarn publish"
@@ -36,7 +37,7 @@
36
37
  "prompts": "^2.4.0",
37
38
  "terminal-link": "^2.1.1"
38
39
  },
39
- "version": "0.3.22",
40
+ "version": "0.3.24",
40
41
  "devDependencies": {
41
42
  "@types/command-exists": "^1.2.0",
42
43
  "@types/degit": "^2.8.3",
@@ -55,6 +56,7 @@
55
56
  "jest": "^27.4.5",
56
57
  "lint-staged": "^13.0.3",
57
58
  "prettier": "^2.3.2",
59
+ "rimraf": "^4.1.2",
58
60
  "ts-jest": "^27.1.1",
59
61
  "typescript": "^4.8.4"
60
62
  },
@@ -1,3 +0,0 @@
1
- {
2
- "exec": "node server.js"
3
- }
@@ -1,20 +0,0 @@
1
- {
2
- "name": "payload-template-{{templateName}}",
3
- "description": "Payload project created from {{templateName}} template",
4
- "version": "1.0.0",
5
- "main": "server.js",
6
- "license": "MIT",
7
- "scripts": {
8
- "dev": "nodemon",
9
- "build": "payload build",
10
- "serve": "NODE_ENV=production node server.js"
11
- },
12
- "dependencies": {
13
- "payload": "1.1.17",
14
- "dotenv": "^8.2.0",
15
- "express": "^4.17.1"
16
- },
17
- "devDependencies": {
18
- "nodemon": "^2.0.6"
19
- }
20
- }
@@ -1,4 +0,0 @@
1
- {
2
- "ext": "ts",
3
- "exec": "ts-node src/server.ts"
4
- }
@@ -1,30 +0,0 @@
1
- {
2
- "name": "{{projectName}}",
3
- "description": "Payload project created from {{templateName}} template",
4
- "version": "1.0.0",
5
- "main": "dist/server.js",
6
- "license": "MIT",
7
- "scripts": {
8
- "dev": "cross-env PAYLOAD_CONFIG_PATH=src/payload.config.ts nodemon",
9
- "build:payload": "cross-env PAYLOAD_CONFIG_PATH=src/payload.config.ts payload build",
10
- "build:server": "tsc",
11
- "build": "{{runCommand}} copyfiles && {{runCommand}} build:payload && {{runCommand}} build:server",
12
- "serve": "cross-env PAYLOAD_CONFIG_PATH=dist/payload.config.js NODE_ENV=production node dist/server.js",
13
- "copyfiles": "copyfiles -u 1 \"src/**/*.{html,css,scss,ttf,woff,woff2,eot,svg,jpg,png}\" dist/",
14
- "generate:types": "cross-env PAYLOAD_CONFIG_PATH=src/payload.config.ts payload generate:types",
15
- "generate:graphQLSchema": "PAYLOAD_CONFIG_PATH=src/payload.config.ts payload generate:graphQLSchema"
16
- },
17
- "dependencies": {
18
- "payload": "1.1.17",
19
- "dotenv": "^8.2.0",
20
- "express": "^4.17.1"
21
- },
22
- "devDependencies": {
23
- "@types/express": "^4.17.9",
24
- "cross-env": "^7.0.3",
25
- "nodemon": "^2.0.6",
26
- "ts-node": "^9.1.1",
27
- "copyfiles": "^2.4.1",
28
- "typescript": "^4.8.4"
29
- }
30
- }
@@ -1,28 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "es5",
4
- "lib": [
5
- "dom",
6
- "dom.iterable",
7
- "esnext"
8
- ],
9
- "allowJs": true,
10
- "strict": false,
11
- "esModuleInterop": true,
12
- "skipLibCheck": true,
13
- "outDir": "./dist",
14
- "rootDir": "./src",
15
- "jsx": "react"
16
- },
17
- "include": [
18
- "src"
19
- ],
20
- "exclude": [
21
- "node_modules",
22
- "dist",
23
- "build",
24
- ],
25
- "ts-node": {
26
- "transpileOnly": true
27
- }
28
- }
@@ -1,79 +0,0 @@
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 __generator = (this && this.__generator) || function (thisArg, body) {
12
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
- function verb(n) { return function (v) { return step([n, v]); }; }
15
- function step(op) {
16
- if (f) throw new TypeError("Generator is already executing.");
17
- while (_) try {
18
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
- if (y = 0, t) op = [op[0] & 2, t.value];
20
- switch (op[0]) {
21
- case 0: case 1: t = op; break;
22
- case 4: _.label++; return { value: op[1], done: false };
23
- case 5: _.label++; y = op[1]; op = [0]; continue;
24
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
- default:
26
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
- if (t[2]) _.ops.pop();
31
- _.trys.pop(); continue;
32
- }
33
- op = body.call(thisArg, _);
34
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
- }
37
- };
38
- var __importDefault = (this && this.__importDefault) || function (mod) {
39
- return (mod && mod.__esModule) ? mod : { "default": mod };
40
- };
41
- Object.defineProperty(exports, "__esModule", { value: true });
42
- exports.parseLanguage = void 0;
43
- var prompts_1 = __importDefault(require("prompts"));
44
- function parseLanguage(args) {
45
- return __awaiter(this, void 0, void 0, function () {
46
- var response;
47
- return __generator(this, function (_a) {
48
- switch (_a.label) {
49
- case 0:
50
- if (args['--template'])
51
- return [2 /*return*/, args['--template']];
52
- return [4 /*yield*/, (0, prompts_1.default)({
53
- type: 'select',
54
- name: 'value',
55
- message: 'Choose language',
56
- choices: [
57
- {
58
- title: 'javascript',
59
- value: 'js',
60
- },
61
- {
62
- title: 'typescript',
63
- value: 'ts',
64
- },
65
- ],
66
- validate: function (value) { return !!value.length; },
67
- }, {
68
- onCancel: function () {
69
- process.exit(0);
70
- },
71
- })];
72
- case 1:
73
- response = _a.sent();
74
- return [2 /*return*/, response.value];
75
- }
76
- });
77
- });
78
- }
79
- exports.parseLanguage = parseLanguage;
@@ -1,15 +0,0 @@
1
- // Example Collection - For reference only, this must be added to payload.config.js to be used.
2
- const Examples = {
3
- slug: 'examples',
4
- admin: {
5
- useAsTitle: 'someField',
6
- },
7
- fields: [
8
- {
9
- name: 'someField',
10
- type: 'text',
11
- },
12
- ],
13
- }
14
-
15
- export default Examples;
@@ -1,16 +0,0 @@
1
- const Users = {
2
- slug: 'users',
3
- auth: true,
4
- admin: {
5
- useAsTitle: 'email',
6
- },
7
- access: {
8
- read: () => true,
9
- },
10
- fields: [
11
- // Email added by default
12
- // Add more fields as needed
13
- ],
14
- };
15
-
16
- export default Users;
@@ -1,15 +0,0 @@
1
- import { buildConfig } from 'payload/config';
2
- import Examples from './collections/Examples';
3
- import Users from './collections/Users';
4
-
5
- export default buildConfig({
6
- serverURL: 'http://localhost:3000',
7
- admin: {
8
- user: Users.slug,
9
- },
10
- collections: [
11
- Users,
12
- // Add Collections here
13
- // Examples
14
- ],
15
- });
@@ -1,24 +0,0 @@
1
- const express = require('express');
2
- const payload = require('payload');
3
-
4
- require('dotenv').config();
5
- const app = express();
6
-
7
- // Redirect root to Admin panel
8
- app.get('/', (_, res) => {
9
- res.redirect('/admin');
10
- });
11
-
12
- // Initialize Payload
13
- payload.init({
14
- secret: process.env.PAYLOAD_SECRET,
15
- mongoURL: process.env.MONGODB_URI,
16
- express: app,
17
- onInit: () => {
18
- payload.logger.info(`Payload Admin URL: ${payload.getAdminURL()}`);
19
- },
20
- });
21
-
22
- // Add your own express routes here
23
-
24
- app.listen(3000);
@@ -1,18 +0,0 @@
1
- const Categories = {
2
- slug: 'categories',
3
- admin: {
4
- useAsTitle: 'name',
5
- },
6
- access: {
7
- read: () => true,
8
- },
9
- fields: [
10
- {
11
- name: 'name',
12
- type: 'text',
13
- },
14
- ],
15
- timestamps: false,
16
- }
17
-
18
- export default Categories;
@@ -1,60 +0,0 @@
1
- const Posts = {
2
- slug: 'posts',
3
- admin: {
4
- defaultColumns: ['title', 'author', 'category', 'tags', 'status'],
5
- useAsTitle: 'title',
6
- },
7
- access: {
8
- read: () => true,
9
- },
10
- fields: [
11
- {
12
- name: 'title',
13
- type: 'text',
14
- },
15
- {
16
- name: 'author',
17
- type: 'relationship',
18
- relationTo: 'users',
19
- },
20
- {
21
- name: 'publishedDate',
22
- type: 'date',
23
- },
24
- {
25
- name: 'category',
26
- type: 'relationship',
27
- relationTo: 'categories'
28
- },
29
- {
30
- name: 'tags',
31
- type: 'relationship',
32
- relationTo: 'tags',
33
- hasMany: true,
34
- },
35
- {
36
- name: 'content',
37
- type: 'richText'
38
- },
39
- {
40
- name: 'status',
41
- type: 'select',
42
- options: [
43
- {
44
- value: 'draft',
45
- label: 'Draft',
46
- },
47
- {
48
- value: 'published',
49
- label: 'Published',
50
- },
51
- ],
52
- defaultValue: 'draft',
53
- admin: {
54
- position: 'sidebar',
55
- }
56
- }
57
- ],
58
- }
59
-
60
- export default Posts;
@@ -1,18 +0,0 @@
1
- const Tags = {
2
- slug: 'tags',
3
- admin: {
4
- useAsTitle: 'name',
5
- },
6
- access: {
7
- read: () => true,
8
- },
9
- fields: [
10
- {
11
- name: 'name',
12
- type: 'text',
13
- },
14
- ],
15
- timestamps: false,
16
- }
17
-
18
- export default Tags;
@@ -1,19 +0,0 @@
1
- const Users = {
2
- slug: 'users',
3
- auth: true,
4
- admin: {
5
- useAsTitle: 'email',
6
- },
7
- access: {
8
- read: () => true,
9
- },
10
- fields: [
11
- // Email added by default
12
- {
13
- name: 'name',
14
- type: 'text',
15
- }
16
- ],
17
- };
18
-
19
- export default Users;
@@ -1,18 +0,0 @@
1
- import { buildConfig } from 'payload/config';
2
- import Categories from './collections/Categories';
3
- import Posts from './collections/Posts';
4
- import Tags from './collections/Tags';
5
- import Users from './collections/Users';
6
-
7
- export default buildConfig({
8
- serverURL: 'http://localhost:3000',
9
- admin: {
10
- user: Users.slug,
11
- },
12
- collections: [
13
- Categories,
14
- Posts,
15
- Tags,
16
- Users,
17
- ],
18
- });
@@ -1,24 +0,0 @@
1
- const express = require('express');
2
- const payload = require('payload');
3
-
4
- require('dotenv').config();
5
- const app = express();
6
-
7
- // Redirect root to Admin panel
8
- app.get('/', (_, res) => {
9
- res.redirect('/admin');
10
- });
11
-
12
- // Initialize Payload
13
- payload.init({
14
- secret: process.env.PAYLOAD_SECRET,
15
- mongoURL: process.env.MONGODB_URI,
16
- express: app,
17
- onInit: () => {
18
- payload.logger.info(`Payload Admin URL: ${payload.getAdminURL()}`);
19
- },
20
- });
21
-
22
- // Add your own express routes here
23
-
24
- app.listen(3000);
@@ -1,36 +0,0 @@
1
- const Todo = {
2
- slug: 'todos',
3
- admin: {
4
- defaultColumns: ['listName', 'tasks', 'updatedAt'],
5
- useAsTitle: 'listName',
6
- },
7
- access: {
8
- create: () => true,
9
- read: () => true,
10
- update: () => true,
11
- delete: () => true,
12
- },
13
- fields: [
14
- {
15
- name: 'listName',
16
- type: 'text',
17
- },
18
- {
19
- name: 'tasks',
20
- type: 'array',
21
- fields: [
22
- {
23
- name: 'name',
24
- type: 'text',
25
- },
26
- {
27
- name: 'complete',
28
- type: 'checkbox',
29
- defaultValue: false,
30
- }
31
- ]
32
- },
33
- ],
34
- }
35
-
36
- export default Todo;
@@ -1,16 +0,0 @@
1
- const Users = {
2
- slug: 'users',
3
- auth: true,
4
- admin: {
5
- useAsTitle: 'email',
6
- },
7
- access: {
8
- read: () => true,
9
- },
10
- fields: [
11
- // Email added by default
12
- // Add more fields as needed
13
- ],
14
- };
15
-
16
- export default Users;
@@ -1,14 +0,0 @@
1
- import { buildConfig } from 'payload/config';
2
- import TodoLists from './collections/TodoLists';
3
- import Users from './collections/Users';
4
-
5
- export default buildConfig({
6
- serverURL: 'http://localhost:3000',
7
- admin: {
8
- user: Users.slug,
9
- },
10
- collections: [
11
- TodoLists,
12
- Users,
13
- ],
14
- });
@@ -1,24 +0,0 @@
1
- const express = require('express');
2
- const payload = require('payload');
3
-
4
- require('dotenv').config();
5
- const app = express();
6
-
7
- // Redirect root to Admin panel
8
- app.get('/', (_, res) => {
9
- res.redirect('/admin');
10
- });
11
-
12
- // Initialize Payload
13
- payload.init({
14
- secret: process.env.PAYLOAD_SECRET,
15
- mongoURL: process.env.MONGODB_URI,
16
- express: app,
17
- onInit: () => {
18
- payload.logger.info(`Payload Admin URL: ${payload.getAdminURL()}`);
19
- },
20
- });
21
-
22
- // Add your own express routes here
23
-
24
- app.listen(3000);
@@ -1,17 +0,0 @@
1
- import { CollectionConfig } from 'payload/types';
2
-
3
- // Example Collection - For reference only, this must be added to payload.config.ts to be used.
4
- const Examples: CollectionConfig = {
5
- slug: 'examples',
6
- admin: {
7
- useAsTitle: 'someField',
8
- },
9
- fields: [
10
- {
11
- name: 'someField',
12
- type: 'text',
13
- },
14
- ],
15
- }
16
-
17
- export default Examples;
@@ -1,18 +0,0 @@
1
- import { CollectionConfig } from 'payload/types';
2
-
3
- const Users: CollectionConfig = {
4
- slug: 'users',
5
- auth: true,
6
- admin: {
7
- useAsTitle: 'email',
8
- },
9
- access: {
10
- read: () => true,
11
- },
12
- fields: [
13
- // Email added by default
14
- // Add more fields as needed
15
- ],
16
- };
17
-
18
- export default Users;
@@ -1,22 +0,0 @@
1
- import { buildConfig } from 'payload/config';
2
- import path from 'path';
3
- // import Examples from './collections/Examples';
4
- import Users from './collections/Users';
5
-
6
- export default buildConfig({
7
- serverURL: 'http://localhost:3000',
8
- admin: {
9
- user: Users.slug,
10
- },
11
- collections: [
12
- Users,
13
- // Add Collections here
14
- // Examples,
15
- ],
16
- typescript: {
17
- outputFile: path.resolve(__dirname, 'payload-types.ts'),
18
- },
19
- graphQL: {
20
- schemaOutputFile: path.resolve(__dirname, 'generated-schema.graphql'),
21
- },
22
- });
@@ -1,24 +0,0 @@
1
- import express from 'express';
2
- import payload from 'payload';
3
-
4
- require('dotenv').config();
5
- const app = express();
6
-
7
- // Redirect root to Admin panel
8
- app.get('/', (_, res) => {
9
- res.redirect('/admin');
10
- });
11
-
12
- // Initialize Payload
13
- payload.init({
14
- secret: process.env.PAYLOAD_SECRET,
15
- mongoURL: process.env.MONGODB_URI,
16
- express: app,
17
- onInit: () => {
18
- payload.logger.info(`Payload Admin URL: ${payload.getAdminURL()}`)
19
- },
20
- })
21
-
22
- // Add your own express routes here
23
-
24
- app.listen(3000);
@@ -1,20 +0,0 @@
1
- import { CollectionConfig } from 'payload/types';
2
-
3
- const Categories: CollectionConfig = {
4
- slug: 'categories',
5
- admin: {
6
- useAsTitle: 'name',
7
- },
8
- access: {
9
- read: () => true,
10
- },
11
- fields: [
12
- {
13
- name: 'name',
14
- type: 'text',
15
- },
16
- ],
17
- timestamps: false,
18
- }
19
-
20
- export default Categories;
@@ -1,62 +0,0 @@
1
- import { CollectionConfig } from 'payload/types';
2
-
3
- const Posts: CollectionConfig = {
4
- slug: 'posts',
5
- admin: {
6
- defaultColumns: ['title', 'author', 'category', 'tags', 'status'],
7
- useAsTitle: 'title',
8
- },
9
- access: {
10
- read: () => true,
11
- },
12
- fields: [
13
- {
14
- name: 'title',
15
- type: 'text',
16
- },
17
- {
18
- name: 'author',
19
- type: 'relationship',
20
- relationTo: 'users',
21
- },
22
- {
23
- name: 'publishedDate',
24
- type: 'date',
25
- },
26
- {
27
- name: 'category',
28
- type: 'relationship',
29
- relationTo: 'categories'
30
- },
31
- {
32
- name: 'tags',
33
- type: 'relationship',
34
- relationTo: 'tags',
35
- hasMany: true,
36
- },
37
- {
38
- name: 'content',
39
- type: 'richText'
40
- },
41
- {
42
- name: 'status',
43
- type: 'select',
44
- options: [
45
- {
46
- value: 'draft',
47
- label: 'Draft',
48
- },
49
- {
50
- value: 'published',
51
- label: 'Published',
52
- },
53
- ],
54
- defaultValue: 'draft',
55
- admin: {
56
- position: 'sidebar',
57
- }
58
- }
59
- ],
60
- }
61
-
62
- export default Posts;
@@ -1,20 +0,0 @@
1
- import { CollectionConfig } from 'payload/types';
2
-
3
- const Tags: CollectionConfig = {
4
- slug: 'tags',
5
- admin: {
6
- useAsTitle: 'name',
7
- },
8
- access: {
9
- read: () => true,
10
- },
11
- fields: [
12
- {
13
- name: 'name',
14
- type: 'text',
15
- },
16
- ],
17
- timestamps: false,
18
- }
19
-
20
- export default Tags;
@@ -1,21 +0,0 @@
1
- import { CollectionConfig } from 'payload/types';
2
-
3
- const Users: CollectionConfig = {
4
- slug: 'users',
5
- auth: true,
6
- admin: {
7
- useAsTitle: 'email',
8
- },
9
- access: {
10
- read: () => true,
11
- },
12
- fields: [
13
- // Email added by default
14
- {
15
- name: 'name',
16
- type: 'text',
17
- }
18
- ],
19
- };
20
-
21
- export default Users;
@@ -1,25 +0,0 @@
1
- import { buildConfig } from 'payload/config';
2
- import path from 'path';
3
- import Categories from './collections/Categories';
4
- import Posts from './collections/Posts';
5
- import Tags from './collections/Tags';
6
- import Users from './collections/Users';
7
-
8
- export default buildConfig({
9
- serverURL: 'http://localhost:3000',
10
- admin: {
11
- user: Users.slug,
12
- },
13
- collections: [
14
- Categories,
15
- Posts,
16
- Tags,
17
- Users,
18
- ],
19
- typescript: {
20
- outputFile: path.resolve(__dirname, 'payload-types.ts')
21
- },
22
- graphQL: {
23
- schemaOutputFile: path.resolve(__dirname, 'generated-schema.graphql'),
24
- },
25
- });
@@ -1,24 +0,0 @@
1
- import express from 'express';
2
- import payload from 'payload';
3
-
4
- require('dotenv').config();
5
- const app = express();
6
-
7
- // Redirect root to Admin panel
8
- app.get('/', (_, res) => {
9
- res.redirect('/admin');
10
- });
11
-
12
- // Initialize Payload
13
- payload.init({
14
- secret: process.env.PAYLOAD_SECRET,
15
- mongoURL: process.env.MONGODB_URI,
16
- express: app,
17
- onInit: () => {
18
- payload.logger.info(`Payload Admin URL: ${payload.getAdminURL()}`)
19
- },
20
- })
21
-
22
- // Add your own express routes here
23
-
24
- app.listen(3000);
@@ -1,38 +0,0 @@
1
- import { CollectionConfig } from 'payload/types';
2
-
3
- const Todo: CollectionConfig = {
4
- slug: 'todos',
5
- admin: {
6
- defaultColumns: ['listName', 'tasks', 'updatedAt'],
7
- useAsTitle: 'listName',
8
- },
9
- access: {
10
- create: () => true,
11
- read: () => true,
12
- update: () => true,
13
- delete: () => true,
14
- },
15
- fields: [
16
- {
17
- name: 'listName',
18
- type: 'text',
19
- },
20
- {
21
- name: 'tasks',
22
- type: 'array',
23
- fields: [
24
- {
25
- name: 'name',
26
- type: 'text',
27
- },
28
- {
29
- name: 'complete',
30
- type: 'checkbox',
31
- defaultValue: false,
32
- }
33
- ]
34
- },
35
- ],
36
- }
37
-
38
- export default Todo;
@@ -1,18 +0,0 @@
1
- import { CollectionConfig } from 'payload/types';
2
-
3
- const Users: CollectionConfig = {
4
- slug: 'users',
5
- auth: true,
6
- admin: {
7
- useAsTitle: 'email',
8
- },
9
- access: {
10
- read: () => true,
11
- },
12
- fields: [
13
- // Email added by default
14
- // Add more fields as needed
15
- ],
16
- };
17
-
18
- export default Users;
@@ -1,21 +0,0 @@
1
- import { buildConfig } from 'payload/config';
2
- import path from 'path';
3
- import TodoLists from './collections/TodoLists';
4
- import Users from './collections/Users';
5
-
6
- export default buildConfig({
7
- serverURL: 'http://localhost:3000',
8
- admin: {
9
- user: Users.slug,
10
- },
11
- collections: [
12
- TodoLists,
13
- Users,
14
- ],
15
- typescript: {
16
- outputFile: path.resolve(__dirname, 'payload-types.ts')
17
- },
18
- graphQL: {
19
- schemaOutputFile: path.resolve(__dirname, 'generated-schema.graphql'),
20
- },
21
- });
@@ -1,24 +0,0 @@
1
- import express from 'express';
2
- import payload from 'payload';
3
-
4
- require('dotenv').config();
5
- const app = express();
6
-
7
- // Redirect root to Admin panel
8
- app.get('/', (_, res) => {
9
- res.redirect('/admin');
10
- });
11
-
12
- // Initialize Payload
13
- payload.init({
14
- secret: process.env.PAYLOAD_SECRET,
15
- mongoURL: process.env.MONGODB_URI,
16
- express: app,
17
- onInit: () => {
18
- payload.logger.info(`Payload Admin URL: ${payload.getAdminURL()}`)
19
- },
20
- })
21
-
22
- // Add your own express routes here
23
-
24
- app.listen(3000);