create-payload-app 0.3.14 → 0.3.15-beta.0
Sign up to get free protection for your applications and to get access to all the features.
- package/bin/cli.js +0 -0
- package/dist/index.js +14 -26
- package/dist/lib/common-files/README.template.md +9 -0
- package/dist/lib/common-files/docker-compose.template.yml +35 -0
- package/dist/{templates → lib/common-files}/gitignore.template +0 -0
- package/dist/{templates/js-blank → lib/common-files/javascript}/nodemon.json +0 -0
- package/dist/{templates/js-blank/package.json → lib/common-files/javascript/package.template.json} +3 -3
- package/dist/{templates → lib/common-files}/npmrc.template +0 -0
- package/dist/{templates/ts-blank → lib/common-files/typescript}/nodemon.json +0 -0
- package/dist/{templates/ts-blank/package.json → lib/common-files/typescript/package.template.json} +4 -4
- package/dist/{templates/ts-blank → lib/common-files/typescript}/tsconfig.json +0 -0
- package/dist/lib/{createProject.js → create-project.js} +25 -26
- package/dist/lib/{createProject.test.js → create-project.test.js} +36 -6
- package/dist/lib/{generateSecret.js → generate-secret.js} +0 -0
- package/dist/lib/{getDatabaseConnection.js → get-db-connection.js} +0 -0
- package/dist/lib/{parseLanguage.js → parse-language.js} +0 -0
- package/dist/lib/{parseProjectName.js → parse-project-name.js} +0 -0
- package/dist/lib/{parseTemplate.js → parse-template.js} +1 -4
- package/dist/lib/templates.js +6 -2
- package/dist/lib/write-common-files.js +118 -0
- package/dist/lib/{writeEnvFile.js → write-env-file.js} +0 -0
- package/dist/main.js +40 -45
- package/dist/utils/log.js +3 -3
- package/dist/utils/messages.js +1 -1
- package/package.json +22 -7
- package/dist/lib/constants.js +0 -4
- package/dist/lib/getPackageManager.js +0 -69
- package/dist/lib/getPayloadSecret.js +0 -69
- package/dist/lib/getPayloadVersion.js +0 -75
- package/dist/templates/js-blog/nodemon.json +0 -3
- package/dist/templates/js-blog/package.json +0 -20
- package/dist/templates/js-todo/nodemon.json +0 -3
- package/dist/templates/js-todo/package.json +0 -20
- package/dist/templates/ts-blog/nodemon.json +0 -4
- package/dist/templates/ts-blog/package.json +0 -30
- package/dist/templates/ts-blog/tsconfig.json +0 -28
- package/dist/templates/ts-todo/nodemon.json +0 -4
- package/dist/templates/ts-todo/package.json +0 -30
- package/dist/templates/ts-todo/tsconfig.json +0 -28
- package/dist/utils/telemetry.js +0 -44
- package/dist/utils/usage.js +0 -67
package/dist/main.js
CHANGED
@@ -43,19 +43,19 @@ exports.Main = void 0;
|
|
43
43
|
var slugify_1 = __importDefault(require("@sindresorhus/slugify"));
|
44
44
|
var arg_1 = __importDefault(require("arg"));
|
45
45
|
var command_exists_1 = __importDefault(require("command-exists"));
|
46
|
-
var
|
47
|
-
var
|
48
|
-
var
|
49
|
-
var
|
50
|
-
var
|
51
|
-
var
|
46
|
+
var create_project_1 = require("./lib/create-project");
|
47
|
+
var get_db_connection_1 = require("./lib/get-db-connection");
|
48
|
+
var generate_secret_1 = require("./lib/generate-secret");
|
49
|
+
var parse_language_1 = require("./lib/parse-language");
|
50
|
+
var parse_project_name_1 = require("./lib/parse-project-name");
|
51
|
+
var parse_template_1 = require("./lib/parse-template");
|
52
52
|
var templates_1 = require("./lib/templates");
|
53
|
-
var
|
53
|
+
var write_env_file_1 = require("./lib/write-env-file");
|
54
54
|
var log_1 = require("./utils/log");
|
55
55
|
var messages_1 = require("./utils/messages");
|
56
|
-
var usage_1 = require("./utils/usage");
|
57
56
|
var Main = /** @class */ (function () {
|
58
57
|
function Main() {
|
58
|
+
// @ts-expect-error bad typings
|
59
59
|
this.args = (0, arg_1.default)({
|
60
60
|
'--help': Boolean,
|
61
61
|
'--name': String,
|
@@ -73,75 +73,72 @@ var Main = /** @class */ (function () {
|
|
73
73
|
}
|
74
74
|
Main.prototype.init = function () {
|
75
75
|
return __awaiter(this, void 0, void 0, function () {
|
76
|
-
var _a, _b, templateArg, valid, _c, _d, projectName, language, validTemplates, template, databaseUri, payloadSecret, projectDir, packageManager,
|
77
|
-
return __generator(this, function (
|
78
|
-
switch (
|
76
|
+
var _a, _b, templateArg, valid, _c, _d, projectName, language, validTemplates, template, databaseUri, payloadSecret, projectDir, packageManager, error_1;
|
77
|
+
return __generator(this, function (_e) {
|
78
|
+
switch (_e.label) {
|
79
79
|
case 0:
|
80
|
-
|
80
|
+
_e.trys.push([0, 16, , 17]);
|
81
81
|
if (!this.args['--help']) return [3 /*break*/, 2];
|
82
82
|
_b = (_a = console).log;
|
83
83
|
return [4 /*yield*/, (0, messages_1.helpMessage)()];
|
84
84
|
case 1:
|
85
|
-
_b.apply(_a, [
|
85
|
+
_b.apply(_a, [_e.sent()]);
|
86
86
|
process.exit(0);
|
87
|
-
|
87
|
+
_e.label = 2;
|
88
88
|
case 2:
|
89
89
|
templateArg = this.args['--template'];
|
90
90
|
if (!templateArg) return [3 /*break*/, 5];
|
91
91
|
return [4 /*yield*/, (0, templates_1.validateTemplate)(templateArg)];
|
92
92
|
case 3:
|
93
|
-
valid =
|
93
|
+
valid = _e.sent();
|
94
94
|
if (!!valid) return [3 /*break*/, 5];
|
95
95
|
_d = (_c = console).log;
|
96
96
|
return [4 /*yield*/, (0, messages_1.helpMessage)()];
|
97
97
|
case 4:
|
98
|
-
_d.apply(_c, [
|
98
|
+
_d.apply(_c, [_e.sent()]);
|
99
99
|
process.exit(1);
|
100
|
-
|
100
|
+
_e.label = 5;
|
101
101
|
case 5:
|
102
102
|
console.log(messages_1.welcomeMessage);
|
103
|
-
return [4 /*yield*/, (0,
|
103
|
+
return [4 /*yield*/, (0, parse_project_name_1.parseProjectName)(this.args)];
|
104
104
|
case 6:
|
105
|
-
projectName =
|
106
|
-
return [4 /*yield*/, (0,
|
105
|
+
projectName = _e.sent();
|
106
|
+
return [4 /*yield*/, (0, parse_language_1.parseLanguage)(this.args)];
|
107
107
|
case 7:
|
108
|
-
language =
|
108
|
+
language = _e.sent();
|
109
109
|
return [4 /*yield*/, (0, templates_1.getValidTemplates)()];
|
110
110
|
case 8:
|
111
|
-
validTemplates =
|
112
|
-
return [4 /*yield*/, (0,
|
111
|
+
validTemplates = _e.sent();
|
112
|
+
return [4 /*yield*/, (0, parse_template_1.parseTemplate)(this.args, validTemplates, language)];
|
113
113
|
case 9:
|
114
|
-
template =
|
115
|
-
return [4 /*yield*/, (0,
|
114
|
+
template = _e.sent();
|
115
|
+
return [4 /*yield*/, (0, get_db_connection_1.getDatabaseConnection)(this.args, projectName)];
|
116
116
|
case 10:
|
117
|
-
databaseUri =
|
118
|
-
return [4 /*yield*/, (0,
|
117
|
+
databaseUri = _e.sent();
|
118
|
+
return [4 /*yield*/, (0, generate_secret_1.generateSecret)()];
|
119
119
|
case 11:
|
120
|
-
payloadSecret =
|
120
|
+
payloadSecret = _e.sent();
|
121
121
|
projectDir = "./".concat((0, slugify_1.default)(projectName));
|
122
122
|
return [4 /*yield*/, getPackageManager(this.args)];
|
123
123
|
case 12:
|
124
|
-
packageManager =
|
124
|
+
packageManager = _e.sent();
|
125
125
|
if (!!this.args['--dry-run']) return [3 /*break*/, 15];
|
126
|
-
return [4 /*yield*/, (0,
|
126
|
+
return [4 /*yield*/, (0, create_project_1.createProject)(this.args, projectDir, template, packageManager)];
|
127
127
|
case 13:
|
128
|
-
|
129
|
-
return [4 /*yield*/, (0,
|
128
|
+
_e.sent();
|
129
|
+
return [4 /*yield*/, (0, write_env_file_1.writeEnvFile)(projectName, databaseUri, payloadSecret)];
|
130
130
|
case 14:
|
131
|
-
|
132
|
-
|
131
|
+
_e.sent();
|
132
|
+
_e.label = 15;
|
133
133
|
case 15:
|
134
134
|
(0, log_1.success)('Payload project successfully created');
|
135
|
-
|
136
|
-
return [
|
135
|
+
console.log((0, messages_1.successMessage)(projectDir, packageManager));
|
136
|
+
return [3 /*break*/, 17];
|
137
137
|
case 16:
|
138
|
-
|
139
|
-
return [3 /*break*/, 18];
|
140
|
-
case 17:
|
141
|
-
error_1 = _g.sent();
|
138
|
+
error_1 = _e.sent();
|
142
139
|
console.log(error_1);
|
143
|
-
return [3 /*break*/,
|
144
|
-
case
|
140
|
+
return [3 /*break*/, 17];
|
141
|
+
case 17: return [2 /*return*/];
|
145
142
|
}
|
146
143
|
});
|
147
144
|
});
|
@@ -169,9 +166,7 @@ function getPackageManager(args) {
|
|
169
166
|
error_2 = _a.sent();
|
170
167
|
packageManager = 'npm';
|
171
168
|
return [3 /*break*/, 4];
|
172
|
-
case 4:
|
173
|
-
(0, usage_1.setTags)({ package_manager: packageManager });
|
174
|
-
return [2 /*return*/, packageManager];
|
169
|
+
case 4: return [2 /*return*/, packageManager];
|
175
170
|
}
|
176
171
|
});
|
177
172
|
});
|
package/dist/utils/log.js
CHANGED
@@ -7,7 +7,7 @@ exports.error = exports.info = exports.warning = exports.success = void 0;
|
|
7
7
|
var chalk_1 = __importDefault(require("chalk"));
|
8
8
|
var figures_1 = __importDefault(require("figures"));
|
9
9
|
var success = function (message) {
|
10
|
-
console.log(chalk_1.default.green(figures_1.default.tick)
|
10
|
+
console.log("".concat(chalk_1.default.green(figures_1.default.tick), " ").concat(chalk_1.default.bold(message)));
|
11
11
|
};
|
12
12
|
exports.success = success;
|
13
13
|
var warning = function (message) {
|
@@ -15,10 +15,10 @@ var warning = function (message) {
|
|
15
15
|
};
|
16
16
|
exports.warning = warning;
|
17
17
|
var info = function (message) {
|
18
|
-
console.log(chalk_1.default.yellow(figures_1.default.info)
|
18
|
+
console.log("".concat(chalk_1.default.yellow(figures_1.default.info), " ").concat(chalk_1.default.bold(message)));
|
19
19
|
};
|
20
20
|
exports.info = info;
|
21
21
|
var error = function (message) {
|
22
|
-
console.log(chalk_1.default.red(figures_1.default.cross)
|
22
|
+
console.log("".concat(chalk_1.default.red(figures_1.default.cross), " ").concat(chalk_1.default.bold(message)));
|
23
23
|
};
|
24
24
|
exports.error = error;
|
package/dist/utils/messages.js
CHANGED
@@ -49,7 +49,7 @@ var figures_1 = __importDefault(require("figures"));
|
|
49
49
|
var terminal_link_1 = __importDefault(require("terminal-link"));
|
50
50
|
var templates_1 = require("../lib/templates");
|
51
51
|
var header = function (message) {
|
52
|
-
return chalk_1.default.yellow(figures_1.default.star)
|
52
|
+
return "".concat(chalk_1.default.yellow(figures_1.default.star), " ").concat(chalk_1.default.bold(message));
|
53
53
|
};
|
54
54
|
exports.welcomeMessage = (0, chalk_1.default)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n {green Welcome to Payload. Let's create a project! }\n"], ["\n {green Welcome to Payload. Let's create a project! }\n"])));
|
55
55
|
function helpMessage() {
|
package/package.json
CHANGED
@@ -6,11 +6,14 @@
|
|
6
6
|
},
|
7
7
|
"scripts": {
|
8
8
|
"build": "tsc && yarn copyfiles",
|
9
|
-
"copyfiles": "copyfiles -u 1 \"src/templates/**\" dist",
|
9
|
+
"copyfiles": "copyfiles -u 1 \"src/templates/**\" \"src/lib/common-files/**\" dist",
|
10
10
|
"typecheck": "tsc --noEmit",
|
11
11
|
"lint": "eslint \"src/**/*.ts\"",
|
12
|
+
"lint:fix": "eslint \"src/**/*.ts\" --fix",
|
13
|
+
"lint-staged": "lint-staged --quiet",
|
12
14
|
"test": "jest",
|
13
|
-
"prepublishOnly": "yarn test && yarn build"
|
15
|
+
"prepublishOnly": "yarn test && yarn build",
|
16
|
+
"prepare": "husky install"
|
14
17
|
},
|
15
18
|
"files": [
|
16
19
|
"package.json",
|
@@ -18,7 +21,6 @@
|
|
18
21
|
"bin"
|
19
22
|
],
|
20
23
|
"dependencies": {
|
21
|
-
"@sentry/node": "^6.18.2",
|
22
24
|
"@sindresorhus/slugify": "^1.1.0",
|
23
25
|
"arg": "^5.0.0",
|
24
26
|
"chalk": "^4.1.0",
|
@@ -27,11 +29,12 @@
|
|
27
29
|
"execa": "^5.0.0",
|
28
30
|
"figures": "^3.2.0",
|
29
31
|
"fs-extra": "^9.0.1",
|
32
|
+
"handlebars": "^4.7.7",
|
30
33
|
"ora": "^5.1.0",
|
31
34
|
"prompts": "^2.4.0",
|
32
35
|
"terminal-link": "^2.1.1"
|
33
36
|
},
|
34
|
-
"version": "0.3.
|
37
|
+
"version": "0.3.15-beta.0",
|
35
38
|
"devDependencies": {
|
36
39
|
"@types/command-exists": "^1.2.0",
|
37
40
|
"@types/degit": "^2.8.3",
|
@@ -39,16 +42,28 @@
|
|
39
42
|
"@types/jest": "^27.0.3",
|
40
43
|
"@types/node": "^16.6.2",
|
41
44
|
"@types/prompts": "^2.4.0",
|
42
|
-
"@typescript-eslint/eslint-plugin": "^
|
43
|
-
"@typescript-eslint/parser": "^
|
45
|
+
"@typescript-eslint/eslint-plugin": "^5.41.0",
|
46
|
+
"@typescript-eslint/parser": "^5.41.0",
|
44
47
|
"copyfiles": "^2.4.1",
|
45
48
|
"eslint": "^7.32.0",
|
46
49
|
"eslint-config-airbnb-base": "^14.2.1",
|
47
50
|
"eslint-config-prettier": "^8.3.0",
|
48
51
|
"eslint-plugin-prettier": "^3.4.0",
|
52
|
+
"husky": "^8.0.1",
|
49
53
|
"jest": "^27.4.5",
|
54
|
+
"lint-staged": "^13.0.3",
|
50
55
|
"prettier": "^2.3.2",
|
51
56
|
"ts-jest": "^27.1.1",
|
52
|
-
"typescript": "^4.
|
57
|
+
"typescript": "^4.8.4"
|
58
|
+
},
|
59
|
+
"husky": {
|
60
|
+
"hooks": {
|
61
|
+
"pre-commit": "lint-staged"
|
62
|
+
}
|
63
|
+
},
|
64
|
+
"lint-staged": {
|
65
|
+
"*.{ts,tsx}": [
|
66
|
+
"eslint \"src/**/*.ts\" --cache --fix"
|
67
|
+
]
|
53
68
|
}
|
54
69
|
}
|
package/dist/lib/constants.js
DELETED
@@ -1,69 +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.getPackageManager = void 0;
|
43
|
-
var command_exists_1 = __importDefault(require("command-exists"));
|
44
|
-
function getPackageManager(args) {
|
45
|
-
return __awaiter(this, void 0, void 0, function () {
|
46
|
-
var packageManager, error_1;
|
47
|
-
return __generator(this, function (_a) {
|
48
|
-
switch (_a.label) {
|
49
|
-
case 0:
|
50
|
-
if (!args['--use-npm']) return [3 /*break*/, 1];
|
51
|
-
packageManager = 'npm';
|
52
|
-
return [3 /*break*/, 4];
|
53
|
-
case 1:
|
54
|
-
_a.trys.push([1, 3, , 4]);
|
55
|
-
return [4 /*yield*/, (0, command_exists_1.default)('yarn')];
|
56
|
-
case 2:
|
57
|
-
_a.sent();
|
58
|
-
packageManager = 'yarn';
|
59
|
-
return [3 /*break*/, 4];
|
60
|
-
case 3:
|
61
|
-
error_1 = _a.sent();
|
62
|
-
packageManager = 'npm';
|
63
|
-
return [3 /*break*/, 4];
|
64
|
-
case 4: return [2 /*return*/, packageManager];
|
65
|
-
}
|
66
|
-
});
|
67
|
-
});
|
68
|
-
}
|
69
|
-
exports.getPackageManager = getPackageManager;
|
@@ -1,69 +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.getPayloadSecret = void 0;
|
43
|
-
var prompts_1 = __importDefault(require("prompts"));
|
44
|
-
function getPayloadSecret(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['--secret'])
|
51
|
-
return [2 /*return*/, args['--secret']];
|
52
|
-
return [4 /*yield*/, (0, prompts_1.default)({
|
53
|
-
type: 'password',
|
54
|
-
name: 'value',
|
55
|
-
message: 'Enter a long, complex string for Payload’s encryption key',
|
56
|
-
validate: function (value) { return value.length; },
|
57
|
-
}, {
|
58
|
-
onCancel: function () {
|
59
|
-
process.exit(0);
|
60
|
-
},
|
61
|
-
})];
|
62
|
-
case 1:
|
63
|
-
response = _a.sent();
|
64
|
-
return [2 /*return*/, response.value];
|
65
|
-
}
|
66
|
-
});
|
67
|
-
});
|
68
|
-
}
|
69
|
-
exports.getPayloadSecret = getPayloadSecret;
|
@@ -1,75 +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.getLatestPayloadVersion = void 0;
|
43
|
-
var execa_1 = __importDefault(require("execa"));
|
44
|
-
var log_1 = require("../utils/log");
|
45
|
-
function getLatestPayloadVersion(betaFlag) {
|
46
|
-
if (betaFlag === void 0) { betaFlag = false; }
|
47
|
-
return __awaiter(this, void 0, void 0, function () {
|
48
|
-
var packageWithTag, stdout, err_1, msg;
|
49
|
-
return __generator(this, function (_a) {
|
50
|
-
switch (_a.label) {
|
51
|
-
case 0:
|
52
|
-
_a.trys.push([0, 2, , 3]);
|
53
|
-
packageWithTag = 'payload';
|
54
|
-
if (betaFlag)
|
55
|
-
packageWithTag += '@beta';
|
56
|
-
return [4 /*yield*/, (0, execa_1.default)("npm info ".concat(packageWithTag, " version"), [], {
|
57
|
-
shell: true,
|
58
|
-
})];
|
59
|
-
case 1:
|
60
|
-
stdout = (_a.sent()).stdout;
|
61
|
-
return [2 /*return*/, "^".concat(stdout)];
|
62
|
-
case 2:
|
63
|
-
err_1 = _a.sent();
|
64
|
-
msg = "Unable to get latest Payload version.";
|
65
|
-
if (err_1 instanceof Error)
|
66
|
-
msg += " ".concat(err_1.message);
|
67
|
-
(0, log_1.error)(msg);
|
68
|
-
process.exit(1);
|
69
|
-
return [3 /*break*/, 3];
|
70
|
-
case 3: return [2 /*return*/];
|
71
|
-
}
|
72
|
-
});
|
73
|
-
});
|
74
|
-
}
|
75
|
-
exports.getLatestPayloadVersion = getLatestPayloadVersion;
|
@@ -1,20 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"name": "payload-blog",
|
3
|
-
"description": "Blog 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.0.8",
|
14
|
-
"dotenv": "^8.2.0",
|
15
|
-
"express": "^4.17.1"
|
16
|
-
},
|
17
|
-
"devDependencies": {
|
18
|
-
"nodemon": "^2.0.6"
|
19
|
-
}
|
20
|
-
}
|
@@ -1,20 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"name": "payload-starter-javascript",
|
3
|
-
"description": "Simple to-do list example",
|
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.0.8",
|
14
|
-
"dotenv": "^8.2.0",
|
15
|
-
"express": "^4.17.1"
|
16
|
-
},
|
17
|
-
"devDependencies": {
|
18
|
-
"nodemon": "^2.0.6"
|
19
|
-
}
|
20
|
-
}
|
@@ -1,30 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"name": "payload-blog-typescript",
|
3
|
-
"description": "Blog 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": "yarn copyfiles && yarn build:payload && yarn 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.0.8",
|
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.1.3"
|
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,30 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"name": "payload-starter-typescript",
|
3
|
-
"description": "Simple to-do list example",
|
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": "yarn copyfiles && yarn build:payload && yarn 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.0.8",
|
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.1.3"
|
29
|
-
}
|
30
|
-
}
|