create-payload-app 0.3.25 → 0.3.27
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/lib/create-project.test.js +0 -1
- package/dist/lib/get-db-connection.js +1 -1
- package/dist/lib/write-common-files.js +12 -19
- package/dist/templates/blank/src/payload.config.ts +2 -2
- package/dist/templates/blog/src/payload.config.ts +4 -10
- package/dist/templates/todo/src/payload.config.ts +4 -7
- package/package.json +1 -1
- package/dist/lib/common-files/npmrc.template +0 -1
@@ -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');
|
@@ -54,7 +54,7 @@ function getDatabaseConnection(args, projectName) {
|
|
54
54
|
type: 'text',
|
55
55
|
name: 'value',
|
56
56
|
message: 'Enter MongoDB connection',
|
57
|
-
initial: "mongodb://
|
57
|
+
initial: "mongodb://127.0.0.1/".concat(projectName === '.'
|
58
58
|
? "payload-".concat(getRandomDigitSuffix())
|
59
59
|
: (0, slugify_1.default)(projectName)),
|
60
60
|
validate: function (value) { return !!value.length; },
|
@@ -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,
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
117
|
+
case 11:
|
125
118
|
_a.sent();
|
126
119
|
return [2 /*return*/];
|
127
120
|
}
|
@@ -4,7 +4,7 @@ import path from 'path';
|
|
4
4
|
import Users from './collections/Users';
|
5
5
|
|
6
6
|
export default buildConfig({
|
7
|
-
serverURL: 'http://
|
7
|
+
serverURL: 'http://127.0.0.1:3000',
|
8
8
|
admin: {
|
9
9
|
user: Users.slug,
|
10
10
|
},
|
@@ -19,4 +19,4 @@ export default buildConfig({
|
|
19
19
|
graphQL: {
|
20
20
|
schemaOutputFile: path.resolve(__dirname, 'generated-schema.graphql'),
|
21
21
|
},
|
22
|
-
})
|
22
|
+
})
|
@@ -7,21 +7,15 @@ import Users from './collections/Users';
|
|
7
7
|
import Media from './collections/Media';
|
8
8
|
|
9
9
|
export default buildConfig({
|
10
|
-
serverURL: 'http://
|
10
|
+
serverURL: 'http://127.0.0.1:3000',
|
11
11
|
admin: {
|
12
12
|
user: Users.slug,
|
13
13
|
},
|
14
|
-
collections: [
|
15
|
-
Categories,
|
16
|
-
Posts,
|
17
|
-
Tags,
|
18
|
-
Users,
|
19
|
-
Media,
|
20
|
-
],
|
14
|
+
collections: [Categories, Posts, Tags, Users, Media],
|
21
15
|
typescript: {
|
22
|
-
outputFile: path.resolve(__dirname, 'payload-types.ts')
|
16
|
+
outputFile: path.resolve(__dirname, 'payload-types.ts'),
|
23
17
|
},
|
24
18
|
graphQL: {
|
25
19
|
schemaOutputFile: path.resolve(__dirname, 'generated-schema.graphql'),
|
26
20
|
},
|
27
|
-
})
|
21
|
+
})
|
@@ -4,18 +4,15 @@ import TodoLists from './collections/TodoLists';
|
|
4
4
|
import Users from './collections/Users';
|
5
5
|
|
6
6
|
export default buildConfig({
|
7
|
-
serverURL: 'http://
|
7
|
+
serverURL: 'http://127.0.0.1:3000',
|
8
8
|
admin: {
|
9
9
|
user: Users.slug,
|
10
10
|
},
|
11
|
-
collections: [
|
12
|
-
TodoLists,
|
13
|
-
Users,
|
14
|
-
],
|
11
|
+
collections: [TodoLists, Users],
|
15
12
|
typescript: {
|
16
|
-
outputFile: path.resolve(__dirname, 'payload-types.ts')
|
13
|
+
outputFile: path.resolve(__dirname, 'payload-types.ts'),
|
17
14
|
},
|
18
15
|
graphQL: {
|
19
16
|
schemaOutputFile: path.resolve(__dirname, 'generated-schema.graphql'),
|
20
17
|
},
|
21
|
-
})
|
18
|
+
})
|
package/package.json
CHANGED
@@ -1 +0,0 @@
|
|
1
|
-
legacy-peer-deps=true
|