@quilted/create 0.2.0 → 0.2.2
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.
- package/CHANGELOG.md +16 -0
- package/build/esm/app.mjs +32 -61
- package/build/esm/module.mjs +5 -7
- package/build/esm/package.mjs +4 -6
- package/build/esm/server.mjs +38 -72
- package/build/esnext/app.esnext +54 -80
- package/build/esnext/module.esnext +8 -10
- package/build/esnext/package.esnext +8 -10
- package/build/esnext/server.esnext +55 -87
- package/build/tsconfig.tsbuildinfo +1 -1
- package/build/typescript/app.d.ts.map +1 -1
- package/build/typescript/module.d.ts.map +1 -1
- package/build/typescript/package.d.ts.map +1 -1
- package/build/typescript/server.d.ts.map +1 -1
- package/build/typescript/shared.d.ts +1 -1
- package/build/typescript/shared.d.ts.map +1 -1
- package/package.json +1 -1
- package/source/app.ts +66 -109
- package/source/module.ts +9 -11
- package/source/package.ts +8 -10
- package/source/server.ts +66 -116
- package/source/shared.ts +0 -1
- package/templates/app-basic/package.json +6 -3
- package/templates/app-basic/rollup.config.js +6 -0
- package/templates/app-basic/server.tsx +1 -1
- package/templates/app-basic/tsconfig.json +1 -1
- package/templates/app-basic/vite.config.js +6 -0
- package/templates/app-empty/package.json +6 -3
- package/templates/app-empty/rollup.config.js +6 -0
- package/templates/app-empty/server.tsx +1 -1
- package/templates/app-empty/tsconfig.json +1 -1
- package/templates/app-empty/vite.config.js +6 -0
- package/templates/app-graphql/package.json +6 -3
- package/templates/app-graphql/rollup.config.js +6 -0
- package/templates/app-graphql/server.tsx +1 -1
- package/templates/app-graphql/tsconfig.json +1 -1
- package/templates/app-graphql/vite.config.js +6 -0
- package/templates/app-trpc/package.json +6 -3
- package/templates/app-trpc/rollup.config.js +6 -0
- package/templates/app-trpc/server.tsx +1 -1
- package/templates/app-trpc/tsconfig.json +1 -1
- package/templates/app-trpc/vite.config.js +6 -0
- package/templates/package/vite.config.js +6 -0
- package/templates/server-basic/rollup.config.js +3 -0
- package/templates/workspace/_gitignore +1 -2
- package/templates/workspace/_nvmrc +1 -1
- package/templates/workspace/_prettierignore +1 -2
- package/templates/workspace/package.json +22 -26
- package/templates/workspace/tsconfig.json +1 -6
- package/templates/workspace-simple/_gitignore +0 -12
- package/templates/workspace-simple/_nvmrc +0 -1
- package/templates/workspace-simple/_prettierignore +0 -8
- package/templates/workspace-simple/package.json +0 -30
- package/templates/workspace-simple/tsconfig.json +0 -8
package/source/app.ts
CHANGED
|
@@ -94,88 +94,12 @@ export async function createApp() {
|
|
|
94
94
|
const appTemplate = loadTemplate(`app-${template}`);
|
|
95
95
|
const workspaceTemplate = loadTemplate('workspace');
|
|
96
96
|
|
|
97
|
-
// If we aren’t already in a workspace, copy the workspace files over, which
|
|
98
|
-
// are needed if we are making a monorepo or not.
|
|
99
97
|
if (!inWorkspace) {
|
|
100
98
|
await workspaceTemplate.copy(directory, (file) => {
|
|
101
|
-
//
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
// We need to make some adjustments to the root package.json
|
|
105
|
-
if (file === 'package.json') return false;
|
|
106
|
-
|
|
107
|
-
return true;
|
|
99
|
+
// We will adjust the package.json before writing it
|
|
100
|
+
return file !== 'package.json';
|
|
108
101
|
});
|
|
109
102
|
|
|
110
|
-
// If we are creating a monorepo, we need to add the root package.json and
|
|
111
|
-
// package manager workspace configuration.
|
|
112
|
-
if (createAsMonorepo) {
|
|
113
|
-
const appRelativeToRoot = relativeDirectoryForDisplay(
|
|
114
|
-
path.relative(directory, appDirectory),
|
|
115
|
-
);
|
|
116
|
-
|
|
117
|
-
const workspacePackageJson = JSON.parse(
|
|
118
|
-
await workspaceTemplate.read('package.json'),
|
|
119
|
-
);
|
|
120
|
-
|
|
121
|
-
workspacePackageJson.name = toValidPackageName(name!);
|
|
122
|
-
workspacePackageJson.workspaces = [appRelativeToRoot, './packages/*'];
|
|
123
|
-
|
|
124
|
-
if (packageManager.type === 'pnpm') {
|
|
125
|
-
await outputRoot.write(
|
|
126
|
-
'pnpm-workspace.yaml',
|
|
127
|
-
await format(
|
|
128
|
-
`
|
|
129
|
-
packages:
|
|
130
|
-
- '${appRelativeToRoot}'
|
|
131
|
-
- './packages/*'
|
|
132
|
-
`,
|
|
133
|
-
{as: 'yaml'},
|
|
134
|
-
),
|
|
135
|
-
);
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
await outputRoot.write(
|
|
139
|
-
'package.json',
|
|
140
|
-
await format(JSON.stringify(workspacePackageJson), {
|
|
141
|
-
as: 'json-stringify',
|
|
142
|
-
}),
|
|
143
|
-
);
|
|
144
|
-
} else {
|
|
145
|
-
const [projectPackageJson, projectTSConfig, workspacePackageJson] =
|
|
146
|
-
await Promise.all([
|
|
147
|
-
appTemplate
|
|
148
|
-
.read('package.json')
|
|
149
|
-
.then((content) => JSON.parse(content)),
|
|
150
|
-
appTemplate
|
|
151
|
-
.read('tsconfig.json')
|
|
152
|
-
.then((content) => JSON.parse(content)),
|
|
153
|
-
workspaceTemplate
|
|
154
|
-
.read('package.json')
|
|
155
|
-
.then((content) => JSON.parse(content)),
|
|
156
|
-
]);
|
|
157
|
-
|
|
158
|
-
const combinedPackageJson = mergeWorkspaceAndProjectPackageJsons(
|
|
159
|
-
projectPackageJson,
|
|
160
|
-
workspacePackageJson,
|
|
161
|
-
);
|
|
162
|
-
|
|
163
|
-
combinedPackageJson.name = toValidPackageName(name!);
|
|
164
|
-
delete combinedPackageJson.workspaces;
|
|
165
|
-
|
|
166
|
-
await outputRoot.write(
|
|
167
|
-
'package.json',
|
|
168
|
-
await format(JSON.stringify(combinedPackageJson), {
|
|
169
|
-
as: 'json-stringify',
|
|
170
|
-
}),
|
|
171
|
-
);
|
|
172
|
-
|
|
173
|
-
await outputRoot.write(
|
|
174
|
-
'tsconfig.json',
|
|
175
|
-
await format(JSON.stringify(projectTSConfig), {as: 'json'}),
|
|
176
|
-
);
|
|
177
|
-
}
|
|
178
|
-
|
|
179
103
|
if (setupExtras.has('github')) {
|
|
180
104
|
await loadTemplate('github').copy(directory);
|
|
181
105
|
}
|
|
@@ -185,43 +109,44 @@ export async function createApp() {
|
|
|
185
109
|
}
|
|
186
110
|
}
|
|
187
111
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
// We need to merge the project gitignore with the workspace one
|
|
195
|
-
if (file === '_gitignore') return partOfMonorepo;
|
|
112
|
+
if (createAsMonorepo) {
|
|
113
|
+
const workspacePackageJson = JSON.parse(
|
|
114
|
+
await workspaceTemplate.read('package.json'),
|
|
115
|
+
);
|
|
196
116
|
|
|
197
|
-
|
|
198
|
-
// quilt config file
|
|
199
|
-
if (file === 'package.json' || file === 'quilt.project.ts') return false;
|
|
117
|
+
workspacePackageJson.name = toValidPackageName(name!);
|
|
200
118
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
let quiltProject = await appTemplate.read('quilt.project.ts');
|
|
119
|
+
const moduleRelativeToRoot = relativeDirectoryForDisplay(
|
|
120
|
+
path.relative(directory, appDirectory),
|
|
121
|
+
);
|
|
205
122
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
123
|
+
await outputRoot.write(
|
|
124
|
+
'pnpm-workspace.yaml',
|
|
125
|
+
await format(
|
|
126
|
+
`
|
|
127
|
+
packages:
|
|
128
|
+
- './packages/*'
|
|
129
|
+
- '${moduleRelativeToRoot}'
|
|
130
|
+
`,
|
|
131
|
+
{as: 'yaml'},
|
|
132
|
+
),
|
|
133
|
+
);
|
|
210
134
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
);
|
|
218
|
-
}
|
|
135
|
+
await outputRoot.write(
|
|
136
|
+
'package.json',
|
|
137
|
+
await format(JSON.stringify(workspacePackageJson), {
|
|
138
|
+
as: 'json-stringify',
|
|
139
|
+
}),
|
|
140
|
+
);
|
|
219
141
|
}
|
|
220
142
|
|
|
221
|
-
await
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
143
|
+
await appTemplate.copy(appDirectory, (file) => {
|
|
144
|
+
// We need to merge the project gitignore with the workspace one
|
|
145
|
+
if (file === '_gitignore') return partOfMonorepo;
|
|
146
|
+
|
|
147
|
+
// We will adjust the package.json before writing it
|
|
148
|
+
return file !== 'package.json';
|
|
149
|
+
});
|
|
225
150
|
|
|
226
151
|
if (template === 'graphql' && !inWorkspace) {
|
|
227
152
|
const relativeFromRootToAppPath = (filePath: string) =>
|
|
@@ -272,6 +197,38 @@ export async function createApp() {
|
|
|
272
197
|
packageManager.type,
|
|
273
198
|
),
|
|
274
199
|
]);
|
|
200
|
+
} else {
|
|
201
|
+
// Write the package’s package.json by combining elements of the root and
|
|
202
|
+
// package templates
|
|
203
|
+
const [projectPackageJson, workspacePackageJson] = await Promise.all([
|
|
204
|
+
appTemplate.read('package.json').then((content) => JSON.parse(content)),
|
|
205
|
+
workspaceTemplate
|
|
206
|
+
.read('package.json')
|
|
207
|
+
.then((content) => JSON.parse(content)),
|
|
208
|
+
]);
|
|
209
|
+
|
|
210
|
+
const mergedPackageJson = mergeWorkspaceAndProjectPackageJsons(
|
|
211
|
+
projectPackageJson,
|
|
212
|
+
workspacePackageJson,
|
|
213
|
+
);
|
|
214
|
+
|
|
215
|
+
mergedPackageJson.name = path.basename(appDirectory);
|
|
216
|
+
|
|
217
|
+
await outputRoot.write(
|
|
218
|
+
'package.json',
|
|
219
|
+
await format(JSON.stringify(mergedPackageJson), {
|
|
220
|
+
as: 'json-stringify',
|
|
221
|
+
}),
|
|
222
|
+
);
|
|
223
|
+
|
|
224
|
+
if (await appTemplate.has('_gitignore')) {
|
|
225
|
+
await outputRoot.write(
|
|
226
|
+
path.join(appDirectory, '.gitignore'),
|
|
227
|
+
`${await outputRoot.read('.gitignore')}\n${await appTemplate.read(
|
|
228
|
+
'_gitignore',
|
|
229
|
+
)}`,
|
|
230
|
+
);
|
|
231
|
+
}
|
|
275
232
|
}
|
|
276
233
|
|
|
277
234
|
if (shouldInstall) {
|
package/source/module.ts
CHANGED
|
@@ -86,7 +86,7 @@ export async function createModule() {
|
|
|
86
86
|
const rootDirectory = inWorkspace ? process.cwd() : directory;
|
|
87
87
|
const outputRoot = createOutputTarget(rootDirectory);
|
|
88
88
|
const moduleTemplate = loadTemplate('module');
|
|
89
|
-
const workspaceTemplate = loadTemplate('workspace
|
|
89
|
+
const workspaceTemplate = loadTemplate('workspace');
|
|
90
90
|
|
|
91
91
|
if (!inWorkspace) {
|
|
92
92
|
await workspaceTemplate.copy(directory, (file) => {
|
|
@@ -114,19 +114,17 @@ export async function createModule() {
|
|
|
114
114
|
path.relative(directory, moduleDirectory),
|
|
115
115
|
);
|
|
116
116
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
`
|
|
117
|
+
await outputRoot.write(
|
|
118
|
+
'pnpm-workspace.yaml',
|
|
119
|
+
await format(
|
|
120
|
+
`
|
|
122
121
|
packages:
|
|
123
122
|
- './packages/*'
|
|
124
123
|
- '${moduleRelativeToRoot}'
|
|
125
124
|
`,
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
}
|
|
125
|
+
{as: 'yaml'},
|
|
126
|
+
),
|
|
127
|
+
);
|
|
130
128
|
|
|
131
129
|
await outputRoot.write(
|
|
132
130
|
'package.json',
|
|
@@ -137,7 +135,7 @@ export async function createModule() {
|
|
|
137
135
|
}
|
|
138
136
|
|
|
139
137
|
await moduleTemplate.copy(moduleDirectory, (file) => {
|
|
140
|
-
// We will adjust the package.json before writing
|
|
138
|
+
// We will adjust the package.json before writing it
|
|
141
139
|
return file !== 'package.json';
|
|
142
140
|
});
|
|
143
141
|
|
package/source/package.ts
CHANGED
|
@@ -103,7 +103,7 @@ export async function createProject() {
|
|
|
103
103
|
const rootDirectory = inWorkspace ? process.cwd() : directory;
|
|
104
104
|
const outputRoot = createOutputTarget(rootDirectory);
|
|
105
105
|
const packageTemplate = loadTemplate('package');
|
|
106
|
-
const workspaceTemplate = loadTemplate('workspace
|
|
106
|
+
const workspaceTemplate = loadTemplate('workspace');
|
|
107
107
|
|
|
108
108
|
if (!inWorkspace) {
|
|
109
109
|
await workspaceTemplate.copy(directory, (file) => {
|
|
@@ -127,18 +127,16 @@ export async function createProject() {
|
|
|
127
127
|
|
|
128
128
|
workspacePackageJson.name = toValidPackageName(name!);
|
|
129
129
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
`
|
|
130
|
+
await outputRoot.write(
|
|
131
|
+
'pnpm-workspace.yaml',
|
|
132
|
+
await format(
|
|
133
|
+
`
|
|
135
134
|
packages:
|
|
136
135
|
- './packages/*'
|
|
137
136
|
`,
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
}
|
|
137
|
+
{as: 'yaml'},
|
|
138
|
+
),
|
|
139
|
+
);
|
|
142
140
|
|
|
143
141
|
await outputRoot.write(
|
|
144
142
|
'package.json',
|
package/source/server.ts
CHANGED
|
@@ -57,18 +57,18 @@ export async function createServer() {
|
|
|
57
57
|
|
|
58
58
|
const partOfMonorepo = inWorkspace || createAsMonorepo;
|
|
59
59
|
|
|
60
|
-
const
|
|
60
|
+
const serverDirectory = createAsMonorepo
|
|
61
61
|
? path.join(directory, toValidPackageName(name))
|
|
62
62
|
: directory;
|
|
63
63
|
|
|
64
64
|
if (fs.existsSync(directory)) {
|
|
65
65
|
await emptyDirectory(directory);
|
|
66
66
|
|
|
67
|
-
if (
|
|
68
|
-
fs.mkdirSync(
|
|
67
|
+
if (serverDirectory !== directory) {
|
|
68
|
+
fs.mkdirSync(serverDirectory, {recursive: true});
|
|
69
69
|
}
|
|
70
70
|
} else {
|
|
71
|
-
fs.mkdirSync(
|
|
71
|
+
fs.mkdirSync(serverDirectory, {recursive: true});
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
const rootDirectory = inWorkspace ? process.cwd() : directory;
|
|
@@ -76,88 +76,12 @@ export async function createServer() {
|
|
|
76
76
|
const serverTemplate = loadTemplate('server-basic');
|
|
77
77
|
const workspaceTemplate = loadTemplate('workspace');
|
|
78
78
|
|
|
79
|
-
// If we aren’t already in a workspace, copy the workspace files over, which
|
|
80
|
-
// are needed if we are making a monorepo or not.
|
|
81
79
|
if (!inWorkspace) {
|
|
82
80
|
await workspaceTemplate.copy(directory, (file) => {
|
|
83
|
-
//
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
// We need to make some adjustments to the root package.json
|
|
87
|
-
if (file === 'package.json') return false;
|
|
88
|
-
|
|
89
|
-
return true;
|
|
81
|
+
// We will adjust the package.json before writing it
|
|
82
|
+
return file !== 'package.json';
|
|
90
83
|
});
|
|
91
84
|
|
|
92
|
-
// If we are creating a monorepo, we need to add the root package.json and
|
|
93
|
-
// package manager workspace configuration.
|
|
94
|
-
if (createAsMonorepo) {
|
|
95
|
-
const serviceRelativeToRoot = relativeDirectoryForDisplay(
|
|
96
|
-
path.relative(directory, serviceDirectory),
|
|
97
|
-
);
|
|
98
|
-
|
|
99
|
-
const workspacePackageJson = JSON.parse(
|
|
100
|
-
await workspaceTemplate.read('package.json'),
|
|
101
|
-
);
|
|
102
|
-
|
|
103
|
-
workspacePackageJson.name = toValidPackageName(name!);
|
|
104
|
-
workspacePackageJson.workspaces = [serviceRelativeToRoot, './packages/*'];
|
|
105
|
-
|
|
106
|
-
if (packageManager.type === 'pnpm') {
|
|
107
|
-
await outputRoot.write(
|
|
108
|
-
'pnpm-workspace.yaml',
|
|
109
|
-
await format(
|
|
110
|
-
`
|
|
111
|
-
packages:
|
|
112
|
-
- '${serviceRelativeToRoot}'
|
|
113
|
-
- './packages/*'
|
|
114
|
-
`,
|
|
115
|
-
{as: 'yaml'},
|
|
116
|
-
),
|
|
117
|
-
);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
await outputRoot.write(
|
|
121
|
-
'package.json',
|
|
122
|
-
await format(JSON.stringify(workspacePackageJson), {
|
|
123
|
-
as: 'json-stringify',
|
|
124
|
-
}),
|
|
125
|
-
);
|
|
126
|
-
} else {
|
|
127
|
-
const [projectPackageJson, projectTSConfig, workspacePackageJson] =
|
|
128
|
-
await Promise.all([
|
|
129
|
-
serverTemplate
|
|
130
|
-
.read('package.json')
|
|
131
|
-
.then((content) => JSON.parse(content)),
|
|
132
|
-
serverTemplate
|
|
133
|
-
.read('tsconfig.json')
|
|
134
|
-
.then((content) => JSON.parse(content)),
|
|
135
|
-
workspaceTemplate
|
|
136
|
-
.read('package.json')
|
|
137
|
-
.then((content) => JSON.parse(content)),
|
|
138
|
-
]);
|
|
139
|
-
|
|
140
|
-
const combinedPackageJson = mergeWorkspaceAndProjectPackageJsons(
|
|
141
|
-
projectPackageJson,
|
|
142
|
-
workspacePackageJson,
|
|
143
|
-
);
|
|
144
|
-
|
|
145
|
-
adjustPackageJson(combinedPackageJson, {name, entry});
|
|
146
|
-
delete combinedPackageJson.workspaces;
|
|
147
|
-
|
|
148
|
-
await outputRoot.write(
|
|
149
|
-
'package.json',
|
|
150
|
-
await format(JSON.stringify(combinedPackageJson), {
|
|
151
|
-
as: 'json-stringify',
|
|
152
|
-
}),
|
|
153
|
-
);
|
|
154
|
-
|
|
155
|
-
await outputRoot.write(
|
|
156
|
-
'tsconfig.json',
|
|
157
|
-
await format(JSON.stringify(projectTSConfig), {as: 'json'}),
|
|
158
|
-
);
|
|
159
|
-
}
|
|
160
|
-
|
|
161
85
|
if (setupExtras.has('github')) {
|
|
162
86
|
await loadTemplate('github').copy(directory);
|
|
163
87
|
}
|
|
@@ -167,43 +91,41 @@ export async function createServer() {
|
|
|
167
91
|
}
|
|
168
92
|
}
|
|
169
93
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
}
|
|
94
|
+
if (createAsMonorepo) {
|
|
95
|
+
const workspacePackageJson = JSON.parse(
|
|
96
|
+
await workspaceTemplate.read('package.json'),
|
|
97
|
+
);
|
|
175
98
|
|
|
176
|
-
|
|
177
|
-
if (file === 'service.ts' || file === 'quilt.project.ts') {
|
|
178
|
-
return false;
|
|
179
|
-
}
|
|
99
|
+
workspacePackageJson.name = toValidPackageName(name!);
|
|
180
100
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
101
|
+
const moduleRelativeToRoot = relativeDirectoryForDisplay(
|
|
102
|
+
path.relative(directory, serverDirectory),
|
|
103
|
+
);
|
|
184
104
|
|
|
185
|
-
|
|
105
|
+
await outputRoot.write(
|
|
106
|
+
'pnpm-workspace.yaml',
|
|
107
|
+
await format(
|
|
108
|
+
`
|
|
109
|
+
packages:
|
|
110
|
+
- './packages/*'
|
|
111
|
+
- '${moduleRelativeToRoot}'
|
|
112
|
+
`,
|
|
113
|
+
{as: 'yaml'},
|
|
114
|
+
),
|
|
115
|
+
);
|
|
186
116
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
.
|
|
190
|
-
|
|
117
|
+
await outputRoot.write(
|
|
118
|
+
'package.json',
|
|
119
|
+
await format(JSON.stringify(workspacePackageJson), {
|
|
120
|
+
as: 'json-stringify',
|
|
121
|
+
}),
|
|
122
|
+
);
|
|
191
123
|
}
|
|
192
124
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
);
|
|
197
|
-
|
|
198
|
-
await outputRoot.write(
|
|
199
|
-
path.join(serviceDirectory, 'quilt.project.ts'),
|
|
200
|
-
await format(quiltProject, {as: 'typescript'}),
|
|
201
|
-
);
|
|
202
|
-
|
|
203
|
-
await outputRoot.write(
|
|
204
|
-
path.join(serviceDirectory, entry),
|
|
205
|
-
await serverTemplate.read('service.ts'),
|
|
206
|
-
);
|
|
125
|
+
await serverTemplate.copy(serverDirectory, (file) => {
|
|
126
|
+
// We will adjust the package.json before writing it
|
|
127
|
+
return file !== 'package.json';
|
|
128
|
+
});
|
|
207
129
|
|
|
208
130
|
if (partOfMonorepo) {
|
|
209
131
|
// Write the app’s package.json (the root one was already created)
|
|
@@ -214,20 +136,48 @@ export async function createServer() {
|
|
|
214
136
|
adjustPackageJson(projectPackageJson, {name, entry});
|
|
215
137
|
|
|
216
138
|
await outputRoot.write(
|
|
217
|
-
path.join(
|
|
139
|
+
path.join(serverDirectory, 'package.json'),
|
|
218
140
|
await format(JSON.stringify(projectPackageJson), {
|
|
219
141
|
as: 'json-stringify',
|
|
220
142
|
}),
|
|
221
143
|
);
|
|
222
144
|
|
|
223
145
|
await Promise.all([
|
|
224
|
-
addToTsConfig(
|
|
146
|
+
addToTsConfig(serverDirectory, outputRoot),
|
|
225
147
|
addToPackageManagerWorkspaces(
|
|
226
|
-
|
|
148
|
+
serverDirectory,
|
|
227
149
|
outputRoot,
|
|
228
150
|
packageManager.type,
|
|
229
151
|
),
|
|
230
152
|
]);
|
|
153
|
+
} else {
|
|
154
|
+
// Write the package’s package.json by combining elements of the root and
|
|
155
|
+
// package templates
|
|
156
|
+
const [projectPackageJson, workspacePackageJson] = await Promise.all([
|
|
157
|
+
serverTemplate
|
|
158
|
+
.read('package.json')
|
|
159
|
+
.then((content) => JSON.parse(content)),
|
|
160
|
+
workspaceTemplate
|
|
161
|
+
.read('package.json')
|
|
162
|
+
.then((content) => JSON.parse(content)),
|
|
163
|
+
]);
|
|
164
|
+
|
|
165
|
+
const mergedPackageJson = mergeWorkspaceAndProjectPackageJsons(
|
|
166
|
+
projectPackageJson,
|
|
167
|
+
workspacePackageJson,
|
|
168
|
+
);
|
|
169
|
+
|
|
170
|
+
adjustPackageJson(mergedPackageJson, {
|
|
171
|
+
name: toValidPackageName(name!),
|
|
172
|
+
entry,
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
await outputRoot.write(
|
|
176
|
+
'package.json',
|
|
177
|
+
await format(JSON.stringify(mergedPackageJson), {
|
|
178
|
+
as: 'json-stringify',
|
|
179
|
+
}),
|
|
180
|
+
);
|
|
231
181
|
}
|
|
232
182
|
|
|
233
183
|
if (shouldInstall) {
|
package/source/shared.ts
CHANGED
|
@@ -21,13 +21,16 @@
|
|
|
21
21
|
],
|
|
22
22
|
"browserslist": {
|
|
23
23
|
"defaults": [
|
|
24
|
-
"
|
|
24
|
+
"defaults and not dead"
|
|
25
25
|
],
|
|
26
26
|
"modules": [
|
|
27
|
-
"
|
|
27
|
+
"defaults and fully supports es6-module and fully supports es6-module-dynamic-import"
|
|
28
28
|
],
|
|
29
29
|
"evergreen": [
|
|
30
|
-
"
|
|
30
|
+
"last 1 firefox version",
|
|
31
|
+
"last 1 safari version",
|
|
32
|
+
"last 1 edge version",
|
|
33
|
+
"last 1 chrome version"
|
|
31
34
|
]
|
|
32
35
|
},
|
|
33
36
|
"eslintConfig": {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import '@quilted/quilt/globals';
|
|
2
2
|
import {RequestRouter} from '@quilted/quilt/request-router';
|
|
3
|
-
import {BrowserAssets} from '
|
|
3
|
+
import {BrowserAssets} from 'quilt:module/assets';
|
|
4
4
|
|
|
5
5
|
const router = new RequestRouter();
|
|
6
6
|
const assets = new BrowserAssets();
|
|
@@ -21,13 +21,16 @@
|
|
|
21
21
|
],
|
|
22
22
|
"browserslist": {
|
|
23
23
|
"defaults": [
|
|
24
|
-
"
|
|
24
|
+
"defaults and not dead"
|
|
25
25
|
],
|
|
26
26
|
"modules": [
|
|
27
|
-
"
|
|
27
|
+
"defaults and fully supports es6-module and fully supports es6-module-dynamic-import"
|
|
28
28
|
],
|
|
29
29
|
"evergreen": [
|
|
30
|
-
"
|
|
30
|
+
"last 1 firefox version",
|
|
31
|
+
"last 1 safari version",
|
|
32
|
+
"last 1 edge version",
|
|
33
|
+
"last 1 chrome version"
|
|
31
34
|
]
|
|
32
35
|
},
|
|
33
36
|
"eslintConfig": {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import '@quilted/quilt/globals';
|
|
2
2
|
import {RequestRouter} from '@quilted/quilt/request-router';
|
|
3
|
-
import {BrowserAssets} from '
|
|
3
|
+
import {BrowserAssets} from 'quilt:module/assets';
|
|
4
4
|
|
|
5
5
|
const router = new RequestRouter();
|
|
6
6
|
const assets = new BrowserAssets();
|
|
@@ -24,13 +24,16 @@
|
|
|
24
24
|
],
|
|
25
25
|
"browserslist": {
|
|
26
26
|
"defaults": [
|
|
27
|
-
"
|
|
27
|
+
"defaults and not dead"
|
|
28
28
|
],
|
|
29
29
|
"modules": [
|
|
30
|
-
"
|
|
30
|
+
"defaults and fully supports es6-module and fully supports es6-module-dynamic-import"
|
|
31
31
|
],
|
|
32
32
|
"evergreen": [
|
|
33
|
-
"
|
|
33
|
+
"last 1 firefox version",
|
|
34
|
+
"last 1 safari version",
|
|
35
|
+
"last 1 edge version",
|
|
36
|
+
"last 1 chrome version"
|
|
34
37
|
]
|
|
35
38
|
},
|
|
36
39
|
"eslintConfig": {
|