@quilted/create 0.1.67 → 0.1.69
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 +14 -0
- package/build/cjs/_virtual/estree.cjs +5 -0
- package/build/cjs/cli.cjs +14 -3
- package/build/cjs/module.cjs +1 -1
- package/build/cjs/node_modules/.pnpm/arg@5.0.2/node_modules/arg/index.cjs +2 -2
- package/build/cjs/node_modules/.pnpm/prettier@3.0.0/node_modules/prettier/plugins/estree.cjs +70 -0
- package/build/cjs/packages/cli-kit/source/prompt.cjs +2 -2
- package/build/cjs/packages/events/source/{abort.cjs → abort/AbortError.cjs} +6 -0
- package/build/cjs/service.cjs +298 -0
- package/build/cjs/shared.cjs +4 -8
- package/build/esm/_virtual/estree.mjs +3 -0
- package/build/esm/app.mjs +2 -2
- package/build/esm/cli.mjs +15 -4
- package/build/esm/module.mjs +4 -4
- package/build/esm/node_modules/.pnpm/arg@5.0.2/node_modules/arg/index.mjs +2 -2
- package/build/esm/node_modules/.pnpm/prettier@3.0.0/node_modules/prettier/plugins/estree.mjs +65 -0
- package/build/esm/package.mjs +2 -2
- package/build/esm/packages/cli-kit/source/prompt.mjs +1 -1
- package/build/esm/packages/events/source/{abort.mjs → abort/AbortError.mjs} +6 -0
- package/build/esm/service.mjs +276 -0
- package/build/esm/shared.mjs +4 -8
- package/build/esnext/_virtual/estree.esnext +3 -0
- package/build/esnext/module.esnext +2 -2
- package/build/esnext/node_modules/.pnpm/prettier@3.0.0/node_modules/prettier/plugins/estree.esnext +65 -0
- package/build/esnext/packages/cli-kit/source/prompt.esnext +1 -1
- package/build/esnext/packages/events/source/{abort.esnext → abort/AbortError.esnext} +6 -0
- package/build/esnext/shared.esnext +4 -8
- package/build/tsconfig.tsbuildinfo +1 -1
- package/build/typescript/help.d.ts +1 -1
- package/build/typescript/help.d.ts.map +1 -1
- package/build/typescript/service.d.ts +2 -0
- package/build/typescript/service.d.ts.map +1 -0
- package/build/typescript/shared/prompts.d.ts +1 -1
- package/build/typescript/shared/prompts.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/cli.ts +7 -1
- package/source/help.ts +1 -1
- package/source/module.ts +1 -1
- package/source/service.ts +388 -0
- package/source/shared/prompts.ts +1 -1
- package/source/shared.ts +12 -7
- package/templates/app-basic/features/Start/Start.test.tsx +2 -2
- package/templates/{app-trpc/tests → app-basic/tests/render}/render.tsx +3 -34
- package/templates/app-basic/tests/render/types.ts +29 -0
- package/templates/app-basic/tests/render.ts +6 -0
- package/templates/app-graphql/features/Start/Start.test.tsx +3 -3
- package/templates/app-graphql/tests/render/render.tsx +59 -0
- package/templates/app-graphql/tests/render/types.ts +63 -0
- package/templates/app-graphql/tests/render.ts +7 -0
- package/templates/app-trpc/App.tsx +32 -2
- package/templates/{app-basic/tests → app-trpc/tests/render}/render.tsx +12 -37
- package/templates/app-trpc/tests/render/types.ts +35 -0
- package/templates/app-trpc/tests/render.ts +6 -0
- package/templates/service-basic/package.json +12 -0
- package/templates/service-basic/quilt.project.ts +9 -0
- package/templates/service-basic/service.ts +7 -0
- package/templates/service-basic/tsconfig.json +9 -0
- package/templates/app-graphql/tests/render.tsx +0 -126
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var index = require('../../../node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/index.cjs');
|
|
4
|
-
var
|
|
4
|
+
var AbortError = require('../../events/source/abort/AbortError.cjs');
|
|
5
5
|
|
|
6
6
|
async function prompt(prompt) {
|
|
7
7
|
const result = await index["default"]({
|
|
@@ -9,7 +9,7 @@ async function prompt(prompt) {
|
|
|
9
9
|
...prompt
|
|
10
10
|
}, {
|
|
11
11
|
onCancel() {
|
|
12
|
-
throw new
|
|
12
|
+
throw new AbortError.AbortError();
|
|
13
13
|
}
|
|
14
14
|
});
|
|
15
15
|
return result.value;
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
// @see https://github.com/nodejs/node/blob/master/lib/internal/errors.js#L822-L834
|
|
4
|
+
/**
|
|
5
|
+
* An `Error` that indicates that an operation was aborted before
|
|
6
|
+
* it finished.
|
|
7
|
+
*
|
|
8
|
+
* @see https://github.com/nodejs/node/blob/5c65565108c626884c5c722bb512c7c1e5c1c809/lib/internal/errors.js#L843-L855
|
|
9
|
+
*/
|
|
4
10
|
class AbortError extends Error {
|
|
5
11
|
static test(error) {
|
|
6
12
|
return error != null && error.code === 'ABORT_ERR';
|
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var fs = require('node:fs');
|
|
4
|
+
var path = require('node:path');
|
|
5
|
+
var index$1 = require('./node_modules/.pnpm/arg@5.0.2/node_modules/arg/index.cjs');
|
|
6
|
+
var index = require('./node_modules/.pnpm/colorette@2.0.19/node_modules/colorette/index.cjs');
|
|
7
|
+
require('./node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/TemplateTag/TemplateTag.cjs');
|
|
8
|
+
require('./node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/commaLists/commaLists.cjs');
|
|
9
|
+
require('./node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/commaListsAnd/commaListsAnd.cjs');
|
|
10
|
+
require('./node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/commaListsOr/commaListsOr.cjs');
|
|
11
|
+
require('./node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/html/html.cjs');
|
|
12
|
+
require('./node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/safeHtml/safeHtml.cjs');
|
|
13
|
+
require('./node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/oneLine/oneLine.cjs');
|
|
14
|
+
require('./node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/oneLineTrim/oneLineTrim.cjs');
|
|
15
|
+
require('./node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/oneLineCommaLists/oneLineCommaLists.cjs');
|
|
16
|
+
require('./node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/oneLineCommaListsOr/oneLineCommaListsOr.cjs');
|
|
17
|
+
require('./node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/oneLineCommaListsAnd/oneLineCommaListsAnd.cjs');
|
|
18
|
+
require('./node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/inlineLists/inlineLists.cjs');
|
|
19
|
+
require('./node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/oneLineInlineLists/oneLineInlineLists.cjs');
|
|
20
|
+
var stripIndent = require('./node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/stripIndent/stripIndent.cjs');
|
|
21
|
+
require('./node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/stripIndents/stripIndents.cjs');
|
|
22
|
+
var help = require('./help.cjs');
|
|
23
|
+
var shared = require('./shared.cjs');
|
|
24
|
+
var prompts = require('./shared/prompts.cjs');
|
|
25
|
+
var tsconfig = require('./shared/tsconfig.cjs');
|
|
26
|
+
var packageManager = require('./shared/package-manager.cjs');
|
|
27
|
+
var prompt = require('./packages/cli-kit/source/prompt.cjs');
|
|
28
|
+
|
|
29
|
+
function _interopNamespaceDefault(e) {
|
|
30
|
+
var n = Object.create(null);
|
|
31
|
+
if (e) {
|
|
32
|
+
Object.keys(e).forEach(function (k) {
|
|
33
|
+
if (k !== 'default') {
|
|
34
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
35
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
36
|
+
enumerable: true,
|
|
37
|
+
get: function () { return e[k]; }
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
n["default"] = e;
|
|
43
|
+
return Object.freeze(n);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
var fs__namespace = /*#__PURE__*/_interopNamespaceDefault(fs);
|
|
47
|
+
var path__namespace = /*#__PURE__*/_interopNamespaceDefault(path);
|
|
48
|
+
|
|
49
|
+
async function createService() {
|
|
50
|
+
const argv = getArgv();
|
|
51
|
+
if (argv['--help']) {
|
|
52
|
+
help.printHelp({
|
|
53
|
+
kind: 'service',
|
|
54
|
+
packageManager: argv['--package-manager']?.toLowerCase()
|
|
55
|
+
});
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
const inWorkspace = await prompts.getInWorkspace(argv);
|
|
59
|
+
const name = await getName(argv);
|
|
60
|
+
const directory = await getDirectory(argv, {
|
|
61
|
+
name
|
|
62
|
+
});
|
|
63
|
+
const entry = await getEntry(argv, {
|
|
64
|
+
name
|
|
65
|
+
});
|
|
66
|
+
const createAsMonorepo = !inWorkspace && (await prompts.getCreateAsMonorepo(argv, {
|
|
67
|
+
type: 'service',
|
|
68
|
+
default: false
|
|
69
|
+
}));
|
|
70
|
+
const setupExtras = await prompts.getExtrasToSetup(argv, {
|
|
71
|
+
inWorkspace
|
|
72
|
+
});
|
|
73
|
+
const shouldInstall = await prompts.getShouldInstall(argv);
|
|
74
|
+
const packageManager$1 = await prompts.getPackageManager(argv, {
|
|
75
|
+
root: directory
|
|
76
|
+
});
|
|
77
|
+
const partOfMonorepo = inWorkspace || createAsMonorepo;
|
|
78
|
+
const serviceDirectory = createAsMonorepo ? path__namespace.join(directory, shared.toValidPackageName(name)) : directory;
|
|
79
|
+
if (fs__namespace.existsSync(directory)) {
|
|
80
|
+
await shared.emptyDirectory(directory);
|
|
81
|
+
if (serviceDirectory !== directory) {
|
|
82
|
+
fs__namespace.mkdirSync(serviceDirectory, {
|
|
83
|
+
recursive: true
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
} else {
|
|
87
|
+
fs__namespace.mkdirSync(serviceDirectory, {
|
|
88
|
+
recursive: true
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
const rootDirectory = inWorkspace ? process.cwd() : directory;
|
|
92
|
+
const outputRoot = shared.createOutputTarget(rootDirectory);
|
|
93
|
+
const serviceTemplate = shared.loadTemplate('service-basic');
|
|
94
|
+
const workspaceTemplate = shared.loadTemplate('workspace');
|
|
95
|
+
|
|
96
|
+
// If we aren’t already in a workspace, copy the workspace files over, which
|
|
97
|
+
// are needed if we are making a monorepo or not.
|
|
98
|
+
if (!inWorkspace) {
|
|
99
|
+
await workspaceTemplate.copy(directory, file => {
|
|
100
|
+
// When this is a single project, we use the project’s Quilt configuration as the base.
|
|
101
|
+
if (file === 'quilt.workspace.ts') return createAsMonorepo;
|
|
102
|
+
|
|
103
|
+
// We need to make some adjustments to the root package.json
|
|
104
|
+
if (file === 'package.json') return false;
|
|
105
|
+
return true;
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
// If we are creating a monorepo, we need to add the root package.json and
|
|
109
|
+
// package manager workspace configuration.
|
|
110
|
+
if (createAsMonorepo) {
|
|
111
|
+
const serviceRelativeToRoot = shared.relativeDirectoryForDisplay(path__namespace.relative(directory, serviceDirectory));
|
|
112
|
+
const workspacePackageJson = JSON.parse(await workspaceTemplate.read('package.json'));
|
|
113
|
+
workspacePackageJson.name = shared.toValidPackageName(name);
|
|
114
|
+
workspacePackageJson.workspaces = [serviceRelativeToRoot, './packages/*'];
|
|
115
|
+
if (packageManager$1.type === 'pnpm') {
|
|
116
|
+
await outputRoot.write('pnpm-workspace.yaml', await shared.format(`
|
|
117
|
+
packages:
|
|
118
|
+
- '${serviceRelativeToRoot}'
|
|
119
|
+
- './packages/*'
|
|
120
|
+
`, {
|
|
121
|
+
as: 'yaml'
|
|
122
|
+
}));
|
|
123
|
+
}
|
|
124
|
+
await outputRoot.write('package.json', await shared.format(JSON.stringify(workspacePackageJson), {
|
|
125
|
+
as: 'json-stringify'
|
|
126
|
+
}));
|
|
127
|
+
} else {
|
|
128
|
+
const [projectPackageJson, projectTSConfig, workspacePackageJson] = await Promise.all([serviceTemplate.read('package.json').then(content => JSON.parse(content)), serviceTemplate.read('tsconfig.json').then(content => JSON.parse(content)), workspaceTemplate.read('package.json').then(content => JSON.parse(content))]);
|
|
129
|
+
const combinedPackageJson = shared.mergeWorkspaceAndProjectPackageJsons(projectPackageJson, workspacePackageJson);
|
|
130
|
+
adjustPackageJson(combinedPackageJson, {
|
|
131
|
+
name,
|
|
132
|
+
entry
|
|
133
|
+
});
|
|
134
|
+
delete combinedPackageJson.workspaces;
|
|
135
|
+
let quiltProject = await serviceTemplate.read('quilt.project.ts');
|
|
136
|
+
quiltProject = quiltProject.replace('quiltService', 'quiltWorkspace, quiltService').replace('quiltService(', 'quiltWorkspace(), quiltService(').replace('service.ts', entry.replace(/^\.[/]/, ''));
|
|
137
|
+
await outputRoot.write('quilt.project.ts', await shared.format(quiltProject, {
|
|
138
|
+
as: 'typescript'
|
|
139
|
+
}));
|
|
140
|
+
await outputRoot.write('package.json', await shared.format(JSON.stringify(combinedPackageJson), {
|
|
141
|
+
as: 'json-stringify'
|
|
142
|
+
}));
|
|
143
|
+
await outputRoot.write('tsconfig.json', await shared.format(JSON.stringify(projectTSConfig), {
|
|
144
|
+
as: 'json'
|
|
145
|
+
}));
|
|
146
|
+
}
|
|
147
|
+
if (setupExtras.has('github')) {
|
|
148
|
+
await shared.loadTemplate('github').copy(directory);
|
|
149
|
+
}
|
|
150
|
+
if (setupExtras.has('vscode')) {
|
|
151
|
+
await shared.loadTemplate('vscode').copy(directory);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
await serviceTemplate.copy(serviceDirectory, file => {
|
|
155
|
+
// If we are in a monorepo, we can use all the template files as they are
|
|
156
|
+
if (file === 'tsconfig.json') {
|
|
157
|
+
return partOfMonorepo;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// We will adjust the entry file and quilt project file
|
|
161
|
+
if (file === 'service.ts' || file === 'quilt.project.ts') {
|
|
162
|
+
return false;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
// We need to make some adjustments the project’s package.json
|
|
166
|
+
return file !== 'package.json';
|
|
167
|
+
});
|
|
168
|
+
await outputRoot.write(path__namespace.join(serviceDirectory, entry), await serviceTemplate.read('service.ts'));
|
|
169
|
+
let quiltProject = await serviceTemplate.read('quilt.project.ts');
|
|
170
|
+
quiltProject = quiltProject.replace('service.ts', entry.replace(/^\.[/]/, ''));
|
|
171
|
+
await outputRoot.write(path__namespace.join(serviceDirectory, 'quilt.project.ts'), await shared.format(quiltProject, {
|
|
172
|
+
as: 'typescript'
|
|
173
|
+
}));
|
|
174
|
+
if (partOfMonorepo) {
|
|
175
|
+
// Write the app’s package.json (the root one was already created)
|
|
176
|
+
const projectPackageJson = JSON.parse(await serviceTemplate.read('package.json'));
|
|
177
|
+
adjustPackageJson(projectPackageJson, {
|
|
178
|
+
name,
|
|
179
|
+
entry
|
|
180
|
+
});
|
|
181
|
+
await outputRoot.write(path__namespace.join(serviceDirectory, 'package.json'), await shared.format(JSON.stringify(projectPackageJson), {
|
|
182
|
+
as: 'json-stringify'
|
|
183
|
+
}));
|
|
184
|
+
await Promise.all([tsconfig.addToTsConfig(serviceDirectory, outputRoot), packageManager.addToPackageManagerWorkspaces(serviceDirectory, outputRoot, packageManager$1.type)]);
|
|
185
|
+
}
|
|
186
|
+
if (shouldInstall) {
|
|
187
|
+
console.log();
|
|
188
|
+
// TODO: better loading, handle errors
|
|
189
|
+
await packageManager$1.install();
|
|
190
|
+
}
|
|
191
|
+
const commands = [];
|
|
192
|
+
if (!inWorkspace && directory !== process.cwd()) {
|
|
193
|
+
commands.push(`cd ${index.cyan(shared.relativeDirectoryForDisplay(path__namespace.relative(process.cwd(), directory)))} ${index.dim('# Move into your new service’s directory')}`);
|
|
194
|
+
}
|
|
195
|
+
if (!shouldInstall) {
|
|
196
|
+
commands.push(`${packageManager$1.commands.install()} ${index.dim('# Install all your dependencies')}`);
|
|
197
|
+
}
|
|
198
|
+
if (commands.length === 0) {
|
|
199
|
+
console.log();
|
|
200
|
+
console.log('Your new service is ready to go!');
|
|
201
|
+
} else {
|
|
202
|
+
const whatsNext = stripIndent["default"]`
|
|
203
|
+
Your new service is ready to go! There’s just ${commands.length > 1 ? 'a few more steps' : 'one more step'} you’ll need to take
|
|
204
|
+
in order to start developing:
|
|
205
|
+
`;
|
|
206
|
+
console.log();
|
|
207
|
+
console.log(whatsNext);
|
|
208
|
+
console.log();
|
|
209
|
+
console.log(commands.map(command => ` ${command}`).join('\n'));
|
|
210
|
+
}
|
|
211
|
+
const followUp = stripIndent["default"]`
|
|
212
|
+
Quilt can also help you build, develop, test, lint, and type-check your new service.
|
|
213
|
+
You can learn more about building services with Quilt by reading the documentation:
|
|
214
|
+
${index.underline(index.magenta('https://github.com/lemonmade/quilt/tree/main/documentation'))}
|
|
215
|
+
|
|
216
|
+
Have fun! 🎉
|
|
217
|
+
`;
|
|
218
|
+
console.log();
|
|
219
|
+
console.log(followUp);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
// Argument handling
|
|
223
|
+
|
|
224
|
+
function getArgv() {
|
|
225
|
+
const argv = index$1["default"]({
|
|
226
|
+
'--yes': Boolean,
|
|
227
|
+
'-y': '--yes',
|
|
228
|
+
'--name': String,
|
|
229
|
+
'--directory': String,
|
|
230
|
+
'--entry': String,
|
|
231
|
+
'--install': Boolean,
|
|
232
|
+
'--no-install': Boolean,
|
|
233
|
+
'--monorepo': Boolean,
|
|
234
|
+
'--no-monorepo': Boolean,
|
|
235
|
+
'--package-manager': String,
|
|
236
|
+
'--extras': [String],
|
|
237
|
+
'--no-extras': Boolean,
|
|
238
|
+
'--help': Boolean,
|
|
239
|
+
'-h': '--help'
|
|
240
|
+
}, {
|
|
241
|
+
permissive: true
|
|
242
|
+
});
|
|
243
|
+
return argv;
|
|
244
|
+
}
|
|
245
|
+
async function getName(argv) {
|
|
246
|
+
let {
|
|
247
|
+
'--name': name
|
|
248
|
+
} = argv;
|
|
249
|
+
if (name == null) {
|
|
250
|
+
name = await prompt.prompt({
|
|
251
|
+
type: 'text',
|
|
252
|
+
message: 'What would you like to name your new service?',
|
|
253
|
+
initial: 'my-service'
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
return name;
|
|
257
|
+
}
|
|
258
|
+
async function getEntry(argv, {
|
|
259
|
+
name
|
|
260
|
+
}) {
|
|
261
|
+
if (argv['--entry']) {
|
|
262
|
+
return argv['--entry'];
|
|
263
|
+
}
|
|
264
|
+
return `${shared.toValidPackageName(name)}.ts`;
|
|
265
|
+
}
|
|
266
|
+
async function getDirectory(argv, {
|
|
267
|
+
name
|
|
268
|
+
}) {
|
|
269
|
+
let directory = path__namespace.resolve(argv['--directory'] ?? shared.toValidPackageName(name));
|
|
270
|
+
while (!argv['--yes']) {
|
|
271
|
+
if (fs__namespace.existsSync(directory) && !(await shared.isEmpty(directory))) {
|
|
272
|
+
const relativeDirectory = path__namespace.relative(process.cwd(), directory);
|
|
273
|
+
const empty = await prompt.prompt({
|
|
274
|
+
type: 'confirm',
|
|
275
|
+
message: `Directory ${index.bold(shared.relativeDirectoryForDisplay(relativeDirectory))} is not empty, is it safe to empty it?`,
|
|
276
|
+
initial: true
|
|
277
|
+
});
|
|
278
|
+
if (empty) break;
|
|
279
|
+
const promptDirectory = await prompt.prompt({
|
|
280
|
+
type: 'text',
|
|
281
|
+
message: 'What directory do you want to create your new service in?'
|
|
282
|
+
});
|
|
283
|
+
directory = path__namespace.resolve(promptDirectory);
|
|
284
|
+
} else {
|
|
285
|
+
break;
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
return directory;
|
|
289
|
+
}
|
|
290
|
+
function adjustPackageJson(packageJson, {
|
|
291
|
+
name
|
|
292
|
+
}) {
|
|
293
|
+
packageJson.name = name;
|
|
294
|
+
packageJson.main = `./build/runtime/runtime.js`;
|
|
295
|
+
return packageJson;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
exports.createService = createService;
|
package/build/cjs/shared.cjs
CHANGED
|
@@ -128,13 +128,9 @@ async function format(content, {
|
|
|
128
128
|
const [{
|
|
129
129
|
format: rootFormat,
|
|
130
130
|
default: prettier
|
|
131
|
-
}, {
|
|
132
|
-
|
|
133
|
-
}
|
|
134
|
-
default: typescript
|
|
135
|
-
}, {
|
|
136
|
-
default: yaml
|
|
137
|
-
}] = await Promise.all([Promise.resolve().then(function () { return require('./node_modules/.pnpm/prettier@3.0.0/node_modules/prettier/standalone.cjs'); }).then(function (n) { return n.standalone; }), Promise.resolve().then(function () { return require('./node_modules/.pnpm/prettier@3.0.0/node_modules/prettier/plugins/babel.cjs'); }).then(function (n) { return n.babel; }), Promise.resolve().then(function () { return require('./node_modules/.pnpm/prettier@3.0.0/node_modules/prettier/plugins/typescript.cjs'); }).then(function (n) { return n.typescript; }), Promise.resolve().then(function () { return require('./node_modules/.pnpm/prettier@3.0.0/node_modules/prettier/plugins/yaml.cjs'); }).then(function (n) { return n.yaml; })]);
|
|
131
|
+
}, babel, typescript, yaml, estree] = await Promise.all([Promise.resolve().then(function () { return require('./node_modules/.pnpm/prettier@3.0.0/node_modules/prettier/standalone.cjs'); }).then(function (n) { return n.standalone; }), Promise.resolve().then(function () { return require('./node_modules/.pnpm/prettier@3.0.0/node_modules/prettier/plugins/babel.cjs'); }).then(function (n) { return n.babel; }), Promise.resolve().then(function () { return require('./node_modules/.pnpm/prettier@3.0.0/node_modules/prettier/plugins/typescript.cjs'); }).then(function (n) { return n.typescript; }), Promise.resolve().then(function () { return require('./node_modules/.pnpm/prettier@3.0.0/node_modules/prettier/plugins/yaml.cjs'); }).then(function (n) { return n.yaml; }),
|
|
132
|
+
// @ts-expect-error Types are not generated correctly for this entry
|
|
133
|
+
Promise.resolve().then(function () { return require('./node_modules/.pnpm/prettier@3.0.0/node_modules/prettier/plugins/estree.cjs'); }).then(function (n) { return n.estree; })]);
|
|
138
134
|
|
|
139
135
|
// CJS workaround
|
|
140
136
|
const format = rootFormat ?? prettier.format;
|
|
@@ -144,7 +140,7 @@ async function format(content, {
|
|
|
144
140
|
singleQuote: true,
|
|
145
141
|
trailingComma: 'all',
|
|
146
142
|
parser,
|
|
147
|
-
plugins: [babel, typescript, yaml]
|
|
143
|
+
plugins: [babel, typescript, yaml, estree]
|
|
148
144
|
});
|
|
149
145
|
}
|
|
150
146
|
function mergeDependencies(first = {}, second = {}) {
|
package/build/esm/app.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as fs from 'node:fs';
|
|
2
2
|
import * as path from 'node:path';
|
|
3
|
-
import
|
|
3
|
+
import arg from './node_modules/.pnpm/arg@5.0.2/node_modules/arg/index.mjs';
|
|
4
4
|
import { cyan as cyan_1, bold as bold_1, dim as dim_1, underline as underline_1, magenta as magenta_1 } from './node_modules/.pnpm/colorette@2.0.19/node_modules/colorette/index.mjs';
|
|
5
5
|
import './node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/TemplateTag/TemplateTag.mjs';
|
|
6
6
|
import './node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/commaLists/commaLists.mjs';
|
|
@@ -207,7 +207,7 @@ async function createApp() {
|
|
|
207
207
|
// Argument handling
|
|
208
208
|
|
|
209
209
|
function getArgv() {
|
|
210
|
-
const argv =
|
|
210
|
+
const argv = arg({
|
|
211
211
|
'--yes': Boolean,
|
|
212
212
|
'-y': '--yes',
|
|
213
213
|
'--name': String,
|
package/build/esm/cli.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { printHelp } from './help.mjs';
|
|
2
|
-
import { AbortError } from './packages/events/source/abort.mjs';
|
|
3
|
-
import
|
|
2
|
+
import { AbortError } from './packages/events/source/abort/AbortError.mjs';
|
|
3
|
+
import arg from './node_modules/.pnpm/arg@5.0.2/node_modules/arg/index.mjs';
|
|
4
4
|
import stripIndent from './node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/stripIndent/stripIndent.mjs';
|
|
5
5
|
import './node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/TemplateTag/TemplateTag.mjs';
|
|
6
6
|
import './node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/commaLists/commaLists.mjs';
|
|
@@ -21,14 +21,14 @@ import { bold as bold_1 } from './node_modules/.pnpm/colorette@2.0.19/node_modul
|
|
|
21
21
|
|
|
22
22
|
/* eslint no-console: off */
|
|
23
23
|
|
|
24
|
-
const VALID_PROJECT_KINDS = new Set(['app', 'package', 'module']);
|
|
24
|
+
const VALID_PROJECT_KINDS = new Set(['app', 'package', 'module', 'service']);
|
|
25
25
|
run().catch(error => {
|
|
26
26
|
if (AbortError.test(error)) return;
|
|
27
27
|
console.error(error);
|
|
28
28
|
process.exitCode = 1;
|
|
29
29
|
});
|
|
30
30
|
async function run() {
|
|
31
|
-
const permissiveArgs =
|
|
31
|
+
const permissiveArgs = arg({
|
|
32
32
|
'--help': Boolean,
|
|
33
33
|
'-h': '--help',
|
|
34
34
|
'--package-manager': String
|
|
@@ -66,6 +66,9 @@ async function run() {
|
|
|
66
66
|
}, {
|
|
67
67
|
title: 'Package',
|
|
68
68
|
value: 'package'
|
|
69
|
+
}, {
|
|
70
|
+
title: 'Backend service',
|
|
71
|
+
value: 'service'
|
|
69
72
|
}]
|
|
70
73
|
});
|
|
71
74
|
}
|
|
@@ -94,5 +97,13 @@ async function run() {
|
|
|
94
97
|
await createProject();
|
|
95
98
|
break;
|
|
96
99
|
}
|
|
100
|
+
case 'service':
|
|
101
|
+
{
|
|
102
|
+
const {
|
|
103
|
+
createService
|
|
104
|
+
} = await import('./service.mjs');
|
|
105
|
+
await createService();
|
|
106
|
+
break;
|
|
107
|
+
}
|
|
97
108
|
}
|
|
98
109
|
}
|
package/build/esm/module.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as fs from 'node:fs';
|
|
2
2
|
import * as path from 'node:path';
|
|
3
|
-
import
|
|
3
|
+
import arg from './node_modules/.pnpm/arg@5.0.2/node_modules/arg/index.mjs';
|
|
4
4
|
import { cyan as cyan_1, dim as dim_1, underline as underline_1, magenta as magenta_1, bold as bold_1 } from './node_modules/.pnpm/colorette@2.0.19/node_modules/colorette/index.mjs';
|
|
5
5
|
import './node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/TemplateTag/TemplateTag.mjs';
|
|
6
6
|
import './node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/commaLists/commaLists.mjs';
|
|
@@ -18,7 +18,7 @@ import './node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/oneLi
|
|
|
18
18
|
import stripIndent from './node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/stripIndent/stripIndent.mjs';
|
|
19
19
|
import './node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/stripIndents/stripIndents.mjs';
|
|
20
20
|
import { printHelp } from './help.mjs';
|
|
21
|
-
import { emptyDirectory, relativeDirectoryForDisplay,
|
|
21
|
+
import { toValidPackageName, emptyDirectory, relativeDirectoryForDisplay, format, mergeWorkspaceAndProjectPackageJsons, loadTemplate, isEmpty, createOutputTarget } from './shared.mjs';
|
|
22
22
|
import { getInWorkspace, getCreateAsMonorepo, getExtrasToSetup, getShouldInstall, getPackageManager } from './shared/prompts.mjs';
|
|
23
23
|
import { addToTsConfig } from './shared/tsconfig.mjs';
|
|
24
24
|
import { addToPackageManagerWorkspaces } from './shared/package-manager.mjs';
|
|
@@ -54,7 +54,7 @@ async function createModule() {
|
|
|
54
54
|
root: directory
|
|
55
55
|
});
|
|
56
56
|
const partOfMonorepo = inWorkspace || createAsMonorepo;
|
|
57
|
-
const moduleDirectory = createAsMonorepo ? path.join(directory,
|
|
57
|
+
const moduleDirectory = createAsMonorepo ? path.join(directory, toValidPackageName(name)) : directory;
|
|
58
58
|
if (fs.existsSync(directory)) {
|
|
59
59
|
await emptyDirectory(directory);
|
|
60
60
|
if (moduleDirectory !== directory) {
|
|
@@ -201,7 +201,7 @@ async function createModule() {
|
|
|
201
201
|
// Argument handling
|
|
202
202
|
|
|
203
203
|
function getArgv() {
|
|
204
|
-
const argv =
|
|
204
|
+
const argv = arg({
|
|
205
205
|
'--yes': Boolean,
|
|
206
206
|
'-y': '--yes',
|
|
207
207
|
'--name': String,
|
|
@@ -196,6 +196,6 @@ arg.ArgError = ArgError;
|
|
|
196
196
|
|
|
197
197
|
var arg_1 = arg;
|
|
198
198
|
|
|
199
|
-
var
|
|
199
|
+
var arg$1 = /*@__PURE__*/getDefaultExportFromCjs(arg_1);
|
|
200
200
|
|
|
201
|
-
export {
|
|
201
|
+
export { arg$1 as default };
|