create-payload-app 0.1.22-beta.4 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -50,19 +50,19 @@ var log_1 = require("../utils/log");
50
50
  var usage_1 = require("../utils/usage");
51
51
  function createProjectDir(projectDir) {
52
52
  return __awaiter(this, void 0, void 0, function () {
53
- var readDir;
53
+ var pathExists;
54
54
  return __generator(this, function (_a) {
55
55
  switch (_a.label) {
56
- case 0: return [4 /*yield*/, fs_extra_1.default.mkdir(projectDir)];
56
+ case 0: return [4 /*yield*/, fs_extra_1.default.pathExists(projectDir)];
57
57
  case 1:
58
- _a.sent();
59
- return [4 /*yield*/, fs_extra_1.default.readdir(projectDir)];
60
- case 2:
61
- readDir = _a.sent();
62
- if (readDir && readDir.length > 0) {
63
- log_1.error("The project directory '" + projectDir + "' is not empty");
58
+ pathExists = _a.sent();
59
+ if (pathExists) {
60
+ log_1.error("The project directory '" + projectDir + "' already exists");
64
61
  process.exit(1);
65
62
  }
63
+ return [4 /*yield*/, fs_extra_1.default.mkdir(projectDir)];
64
+ case 2:
65
+ _a.sent();
66
66
  return [2 /*return*/];
67
67
  }
68
68
  });
@@ -155,37 +155,38 @@ function createProject(args, projectDir, template, packageManager) {
155
155
  var templateDir, emitter, err_2, msg, spinner, result;
156
156
  return __generator(this, function (_a) {
157
157
  switch (_a.label) {
158
- case 0:
159
- createProjectDir(projectDir);
158
+ case 0: return [4 /*yield*/, createProjectDir(projectDir)];
159
+ case 1:
160
+ _a.sent();
160
161
  templateDir = path_1.default.resolve(__dirname, "../templates/" + template.name);
161
162
  console.log("\n Creating a new Payload app in " + chalk_1.default.green(path_1.default.resolve(projectDir)) + "\n");
162
- if (!(template.type === 'starter')) return [3 /*break*/, 2];
163
+ if (!(template.type === 'starter')) return [3 /*break*/, 3];
163
164
  emitter = degit_1.default(template.url);
164
165
  return [4 /*yield*/, emitter.clone(projectDir)];
165
- case 1:
166
- _a.sent();
167
- return [3 /*break*/, 5];
168
166
  case 2:
169
- _a.trys.push([2, 4, , 5]);
170
- return [4 /*yield*/, fs_extra_1.default.copy(templateDir, projectDir, { recursive: true })];
167
+ _a.sent();
168
+ return [3 /*break*/, 6];
171
169
  case 3:
170
+ _a.trys.push([3, 5, , 6]);
171
+ return [4 /*yield*/, fs_extra_1.default.copy(templateDir, projectDir, { recursive: true })];
172
+ case 4:
172
173
  _a.sent();
173
174
  log_1.success('Project directory created');
174
- return [3 /*break*/, 5];
175
- case 4:
175
+ return [3 /*break*/, 6];
176
+ case 5:
176
177
  err_2 = _a.sent();
177
178
  msg = 'Unable to copy template files. Please check template name or directory permissions.';
178
179
  log_1.error(msg);
179
180
  process.exit(1);
180
- return [3 /*break*/, 5];
181
- case 5:
181
+ return [3 /*break*/, 6];
182
+ case 6:
182
183
  spinner = ora_1.default('Checking latest Payload version...').start();
183
184
  return [4 /*yield*/, updatePayloadVersion(projectDir)];
184
- case 6:
185
+ case 7:
185
186
  _a.sent();
186
187
  spinner.text = 'Installing dependencies...';
187
188
  return [4 /*yield*/, installDeps(args, projectDir, packageManager)];
188
- case 7:
189
+ case 8:
189
190
  result = _a.sent();
190
191
  spinner.stop();
191
192
  spinner.clear();
@@ -10,7 +10,7 @@
10
10
  "serve": "NODE_ENV=production node server.js"
11
11
  },
12
12
  "dependencies": {
13
- "payload": "0.1.145",
13
+ "payload": "0.13.6",
14
14
  "dotenv": "^8.2.0",
15
15
  "express": "^4.17.1"
16
16
  },
@@ -10,7 +10,7 @@
10
10
  "serve": "NODE_ENV=production node server.js"
11
11
  },
12
12
  "dependencies": {
13
- "payload": "0.1.145",
13
+ "payload": "0.13.6",
14
14
  "dotenv": "^8.2.0",
15
15
  "express": "^4.17.1"
16
16
  },
@@ -10,7 +10,7 @@
10
10
  "serve": "NODE_ENV=production node server.js"
11
11
  },
12
12
  "dependencies": {
13
- "payload": "0.1.145",
13
+ "payload": "0.13.6",
14
14
  "dotenv": "^8.2.0",
15
15
  "express": "^4.17.1"
16
16
  },
@@ -9,10 +9,11 @@
9
9
  "build:payload": "cross-env PAYLOAD_CONFIG_PATH=src/payload.config.ts payload build",
10
10
  "build:server": "tsc",
11
11
  "build": "yarn build:payload && yarn build:server",
12
- "serve": "cross-env PAYLOAD_CONFIG_PATH=dist/payload.config.js NODE_ENV=production node dist/server.js"
12
+ "serve": "cross-env PAYLOAD_CONFIG_PATH=dist/payload.config.js NODE_ENV=production node dist/server.js",
13
+ "generate:types": "cross-env PAYLOAD_CONFIG_PATH=src/payload.config.ts payload generate:types"
13
14
  },
14
15
  "dependencies": {
15
- "payload": "0.1.145",
16
+ "payload": "0.13.6",
16
17
  "dotenv": "^8.2.0",
17
18
  "express": "^4.17.1"
18
19
  },
@@ -1,4 +1,5 @@
1
1
  import { buildConfig } from 'payload/config';
2
+ import path from 'path';
2
3
  // import Examples from './collections/Examples';
3
4
  import Users from './collections/Users';
4
5
 
@@ -12,4 +13,7 @@ export default buildConfig({
12
13
  // Add Collections here
13
14
  // Examples,
14
15
  ],
16
+ typescript: {
17
+ outputFile: path.resolve(__dirname, 'payload-types.ts')
18
+ },
15
19
  });
@@ -9,10 +9,11 @@
9
9
  "build:payload": "cross-env PAYLOAD_CONFIG_PATH=src/payload.config.ts payload build",
10
10
  "build:server": "tsc",
11
11
  "build": "yarn build:payload && yarn build:server",
12
- "serve": "cross-env PAYLOAD_CONFIG_PATH=dist/payload.config.js NODE_ENV=production node dist/server.js"
12
+ "serve": "cross-env PAYLOAD_CONFIG_PATH=dist/payload.config.js NODE_ENV=production node dist/server.js",
13
+ "generate:types": "cross-env PAYLOAD_CONFIG_PATH=src/payload.config.ts payload generate:types"
13
14
  },
14
15
  "dependencies": {
15
- "payload": "0.1.144",
16
+ "payload": "0.13.6",
16
17
  "dotenv": "^8.2.0",
17
18
  "express": "^4.17.1"
18
19
  },
@@ -1,4 +1,5 @@
1
1
  import { buildConfig } from 'payload/config';
2
+ import path from 'path';
2
3
  import Categories from './collections/Categories';
3
4
  import Posts from './collections/Posts';
4
5
  import Tags from './collections/Tags';
@@ -15,4 +16,7 @@ export default buildConfig({
15
16
  Tags,
16
17
  Users,
17
18
  ],
19
+ typescript: {
20
+ outputFile: path.resolve(__dirname, 'payload-types.ts')
21
+ },
18
22
  });
@@ -9,10 +9,11 @@
9
9
  "build:payload": "cross-env PAYLOAD_CONFIG_PATH=src/payload.config.ts payload build",
10
10
  "build:server": "tsc",
11
11
  "build": "yarn build:payload && yarn build:server",
12
- "serve": "cross-env PAYLOAD_CONFIG_PATH=dist/payload.config.js NODE_ENV=production node dist/server.js"
12
+ "serve": "cross-env PAYLOAD_CONFIG_PATH=dist/payload.config.js NODE_ENV=production node dist/server.js",
13
+ "generate:types": "cross-env PAYLOAD_CONFIG_PATH=src/payload.config.ts payload generate:types"
13
14
  },
14
15
  "dependencies": {
15
- "payload": "0.1.145",
16
+ "payload": "0.13.6",
16
17
  "dotenv": "^8.2.0",
17
18
  "express": "^4.17.1"
18
19
  },
@@ -1,4 +1,5 @@
1
1
  import { buildConfig } from 'payload/config';
2
+ import path from 'path';
2
3
  import TodoLists from './collections/TodoLists';
3
4
  import Users from './collections/Users';
4
5
 
@@ -11,4 +12,7 @@ export default buildConfig({
11
12
  TodoLists,
12
13
  Users,
13
14
  ],
15
+ typescript: {
16
+ outputFile: path.resolve(__dirname, 'payload-types.ts')
17
+ },
14
18
  });
package/package.json CHANGED
@@ -29,7 +29,7 @@
29
29
  "prompts": "^2.4.0",
30
30
  "terminal-link": "^2.1.1"
31
31
  },
32
- "version": "0.1.22-beta.4",
32
+ "version": "0.3.2",
33
33
  "devDependencies": {
34
34
  "@types/command-exists": "^1.2.0",
35
35
  "@types/degit": "^2.8.3",