create-payload-app 0.3.24 → 0.3.26

Sign up to get free protection for your applications and to get access to all the features.
@@ -83,7 +83,6 @@ describe('createProject', function () {
83
83
  expect(packageJson.name).toEqual(path_1.default.basename(projectDir));
84
84
  expect(packageJson.description).toContain(templateName);
85
85
  // Check all common files are create
86
- assertProjectFileExists('.npmrc');
87
86
  assertProjectFileExists('.gitignore');
88
87
  assertProjectFileExists('nodemon.json');
89
88
  assertProjectFileExists('README.md');
@@ -45,27 +45,20 @@ var fs_extra_1 = __importDefault(require("fs-extra"));
45
45
  var handlebars_1 = __importDefault(require("handlebars"));
46
46
  function writeCommonFiles(projectDir, template, packageManager) {
47
47
  return __awaiter(this, void 0, void 0, function () {
48
- var commonFilesDir, npmrc, npmrcDest, gi, giDest, packageJsonTemplate, packageJson, nodemon, nodemonDest, readmeTemplate, readme, tsconfig, tsconfigDest, dockerComposeTemplate, dockerCompose, dockerfileTemplate, dockerfile;
48
+ var commonFilesDir, gi, giDest, packageJsonTemplate, packageJson, nodemon, nodemonDest, readmeTemplate, readme, tsconfig, tsconfigDest, dockerComposeTemplate, dockerCompose, dockerfileTemplate, dockerfile;
49
49
  return __generator(this, function (_a) {
50
50
  switch (_a.label) {
51
51
  case 0:
52
52
  commonFilesDir = path_1.default.resolve(__dirname, 'common-files');
53
- npmrc = path_1.default.resolve(commonFilesDir, 'npmrc.template');
54
- npmrcDest = path_1.default.resolve(projectDir, '.npmrc');
55
- return [4 /*yield*/, fs_extra_1.default.copy(npmrc, npmrcDest)
56
- // .gitignore
57
- ];
58
- case 1:
59
- _a.sent();
60
53
  gi = path_1.default.resolve(commonFilesDir, 'gitignore.template');
61
54
  giDest = path_1.default.resolve(projectDir, '.gitignore');
62
55
  return [4 /*yield*/, fs_extra_1.default.copy(gi, giDest)
63
56
  // package.json
64
57
  ];
65
- case 2:
58
+ case 1:
66
59
  _a.sent();
67
60
  return [4 /*yield*/, fs_extra_1.default.readFile(path_1.default.resolve(commonFilesDir, 'package.template.json'), 'utf8')];
68
- case 3:
61
+ case 2:
69
62
  packageJsonTemplate = _a.sent();
70
63
  packageJson = handlebars_1.default.compile(packageJsonTemplate)({
71
64
  projectName: path_1.default.basename(projectDir),
@@ -75,17 +68,17 @@ function writeCommonFiles(projectDir, template, packageManager) {
75
68
  return [4 /*yield*/, fs_extra_1.default.writeFile(path_1.default.resolve(projectDir, 'package.json'), packageJson)
76
69
  // nodemon.json
77
70
  ];
78
- case 4:
71
+ case 3:
79
72
  _a.sent();
80
73
  nodemon = path_1.default.resolve(commonFilesDir, 'nodemon.json');
81
74
  nodemonDest = path_1.default.resolve(projectDir, 'nodemon.json');
82
75
  return [4 /*yield*/, fs_extra_1.default.copy(nodemon, nodemonDest)
83
76
  // README.md
84
77
  ];
85
- case 5:
78
+ case 4:
86
79
  _a.sent();
87
80
  return [4 /*yield*/, fs_extra_1.default.readFile(path_1.default.resolve(commonFilesDir, 'README.template.md'), 'utf8')];
88
- case 6:
81
+ case 5:
89
82
  readmeTemplate = _a.sent();
90
83
  readme = handlebars_1.default.compile(readmeTemplate)({
91
84
  projectName: path_1.default.basename(projectDir),
@@ -94,17 +87,17 @@ function writeCommonFiles(projectDir, template, packageManager) {
94
87
  return [4 /*yield*/, fs_extra_1.default.writeFile(path_1.default.resolve(projectDir, 'README.md'), readme)
95
88
  // tsconfig.json
96
89
  ];
97
- case 7:
90
+ case 6:
98
91
  _a.sent();
99
92
  tsconfig = path_1.default.resolve(commonFilesDir, 'tsconfig.json');
100
93
  tsconfigDest = path_1.default.resolve(projectDir, 'tsconfig.json');
101
94
  return [4 /*yield*/, fs_extra_1.default.copy(tsconfig, tsconfigDest)
102
95
  // docker-compose.yml
103
96
  ];
104
- case 8:
97
+ case 7:
105
98
  _a.sent();
106
99
  return [4 /*yield*/, fs_extra_1.default.readFile(path_1.default.resolve(commonFilesDir, 'docker-compose.template.yml'), 'utf8')];
107
- case 9:
100
+ case 8:
108
101
  dockerComposeTemplate = _a.sent();
109
102
  dockerCompose = handlebars_1.default.compile(dockerComposeTemplate)(packageManager === 'yarn'
110
103
  ? { installCmd: 'yarn install', devCmd: 'yarn dev' }
@@ -112,16 +105,16 @@ function writeCommonFiles(projectDir, template, packageManager) {
112
105
  return [4 /*yield*/, fs_extra_1.default.writeFile(path_1.default.resolve(projectDir, 'docker-compose.yml'), dockerCompose)
113
106
  // Dockerfile
114
107
  ];
115
- case 10:
108
+ case 9:
116
109
  _a.sent();
117
110
  return [4 /*yield*/, fs_extra_1.default.readFile(path_1.default.resolve(commonFilesDir, 'Dockerfile.template'), 'utf8')];
118
- case 11:
111
+ case 10:
119
112
  dockerfileTemplate = _a.sent();
120
113
  dockerfile = handlebars_1.default.compile(dockerfileTemplate)(packageManager === 'yarn'
121
114
  ? { installCmd: 'yarn install', buildCmd: 'yarn build' }
122
115
  : { installCmd: 'npm install', buildCmd: 'npm run build' });
123
116
  return [4 /*yield*/, fs_extra_1.default.writeFile(path_1.default.resolve(projectDir, 'Dockerfile'), dockerfile)];
124
- case 12:
117
+ case 11:
125
118
  _a.sent();
126
119
  return [2 /*return*/];
127
120
  }
@@ -0,0 +1,28 @@
1
+ import path from 'path';
2
+ import type { CollectionConfig } from 'payload/types';
3
+
4
+ const Media: CollectionConfig = {
5
+ slug: 'media',
6
+ upload: {
7
+ staticDir: path.resolve(__dirname, '../../media'),
8
+ // Specify the size name that you'd like to use as admin thumbnail
9
+ adminThumbnail: 'thumbnail',
10
+ imageSizes: [
11
+ {
12
+ height: 400,
13
+ width: 400,
14
+ crop: 'center',
15
+ name: 'thumbnail',
16
+ },
17
+ {
18
+ width: 900,
19
+ height: 450,
20
+ crop: 'center',
21
+ name: 'sixteenByNineMedium',
22
+ },
23
+ ],
24
+ },
25
+ fields: [],
26
+ };
27
+
28
+ export default Media;
@@ -4,6 +4,7 @@ import Categories from './collections/Categories';
4
4
  import Posts from './collections/Posts';
5
5
  import Tags from './collections/Tags';
6
6
  import Users from './collections/Users';
7
+ import Media from './collections/Media';
7
8
 
8
9
  export default buildConfig({
9
10
  serverURL: 'http://localhost:3000',
@@ -15,6 +16,7 @@ export default buildConfig({
15
16
  Posts,
16
17
  Tags,
17
18
  Users,
19
+ Media,
18
20
  ],
19
21
  typescript: {
20
22
  outputFile: path.resolve(__dirname, 'payload-types.ts')
package/package.json CHANGED
@@ -37,7 +37,7 @@
37
37
  "prompts": "^2.4.0",
38
38
  "terminal-link": "^2.1.1"
39
39
  },
40
- "version": "0.3.24",
40
+ "version": "0.3.26",
41
41
  "devDependencies": {
42
42
  "@types/command-exists": "^1.2.0",
43
43
  "@types/degit": "^2.8.3",
@@ -1 +0,0 @@
1
- legacy-peer-deps=true