@quilted/create 0.1.68 → 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 +6 -0
- package/build/cjs/cli.cjs +12 -1
- 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/service.cjs +298 -0
- package/build/esm/app.mjs +2 -2
- package/build/esm/cli.mjs +14 -3
- 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/package.mjs +2 -2
- package/build/esm/service.mjs +276 -0
- package/build/esnext/module.esnext +2 -2
- 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 +2 -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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @quilted/create
|
|
2
2
|
|
|
3
|
+
## 0.1.69
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`741949fa`](https://github.com/lemonmade/quilt/commit/741949faf946b7d98150c48c29310ffd74ab2e27) Thanks [@lemonmade](https://github.com/lemonmade)! - Add service template
|
|
8
|
+
|
|
3
9
|
## 0.1.68
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
package/build/cjs/cli.cjs
CHANGED
|
@@ -23,7 +23,7 @@ var index$1 = require('./node_modules/.pnpm/colorette@2.0.19/node_modules/colore
|
|
|
23
23
|
|
|
24
24
|
/* eslint no-console: off */
|
|
25
25
|
|
|
26
|
-
const VALID_PROJECT_KINDS = new Set(['app', 'package', 'module']);
|
|
26
|
+
const VALID_PROJECT_KINDS = new Set(['app', 'package', 'module', 'service']);
|
|
27
27
|
run().catch(error => {
|
|
28
28
|
if (AbortError.AbortError.test(error)) return;
|
|
29
29
|
console.error(error);
|
|
@@ -68,6 +68,9 @@ async function run() {
|
|
|
68
68
|
}, {
|
|
69
69
|
title: 'Package',
|
|
70
70
|
value: 'package'
|
|
71
|
+
}, {
|
|
72
|
+
title: 'Backend service',
|
|
73
|
+
value: 'service'
|
|
71
74
|
}]
|
|
72
75
|
});
|
|
73
76
|
}
|
|
@@ -96,5 +99,13 @@ async function run() {
|
|
|
96
99
|
await createProject();
|
|
97
100
|
break;
|
|
98
101
|
}
|
|
102
|
+
case 'service':
|
|
103
|
+
{
|
|
104
|
+
const {
|
|
105
|
+
createService
|
|
106
|
+
} = await Promise.resolve().then(function () { return require('./service.cjs'); });
|
|
107
|
+
await createService();
|
|
108
|
+
break;
|
|
109
|
+
}
|
|
99
110
|
}
|
|
100
111
|
}
|
package/build/cjs/module.cjs
CHANGED
|
@@ -76,7 +76,7 @@ async function createModule() {
|
|
|
76
76
|
root: directory
|
|
77
77
|
});
|
|
78
78
|
const partOfMonorepo = inWorkspace || createAsMonorepo;
|
|
79
|
-
const moduleDirectory = createAsMonorepo ? path__namespace.join(directory,
|
|
79
|
+
const moduleDirectory = createAsMonorepo ? path__namespace.join(directory, shared.toValidPackageName(name)) : directory;
|
|
80
80
|
if (fs__namespace.existsSync(directory)) {
|
|
81
81
|
await shared.emptyDirectory(directory);
|
|
82
82
|
if (moduleDirectory !== directory) {
|
|
@@ -200,6 +200,6 @@ arg.ArgError = ArgError;
|
|
|
200
200
|
|
|
201
201
|
var arg_1 = arg;
|
|
202
202
|
|
|
203
|
-
var
|
|
203
|
+
var arg$1 = /*@__PURE__*/_commonjsHelpers.getDefaultExportFromCjs(arg_1);
|
|
204
204
|
|
|
205
|
-
exports["default"] =
|
|
205
|
+
exports["default"] = arg$1;
|
|
@@ -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/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
2
|
import { AbortError } from './packages/events/source/abort/AbortError.mjs';
|
|
3
|
-
import
|
|
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 };
|
package/build/esm/package.mjs
CHANGED
|
@@ -20,7 +20,7 @@ import './node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/oneLi
|
|
|
20
20
|
import './node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/inlineLists/inlineLists.mjs';
|
|
21
21
|
import './node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/oneLineInlineLists/oneLineInlineLists.mjs';
|
|
22
22
|
import './node_modules/.pnpm/common-tags@1.8.2/node_modules/common-tags/es/stripIndents/stripIndents.mjs';
|
|
23
|
-
import
|
|
23
|
+
import arg from './node_modules/.pnpm/arg@5.0.2/node_modules/arg/index.mjs';
|
|
24
24
|
import { prompt } from './packages/cli-kit/source/prompt.mjs';
|
|
25
25
|
import { cyan as cyan_1, dim as dim_1, bold as bold_1, underline as underline_1, magenta as magenta_1 } from './node_modules/.pnpm/colorette@2.0.19/node_modules/colorette/index.mjs';
|
|
26
26
|
|
|
@@ -276,7 +276,7 @@ async function createProject() {
|
|
|
276
276
|
// Argument handling
|
|
277
277
|
|
|
278
278
|
function getArguments() {
|
|
279
|
-
const args =
|
|
279
|
+
const args = arg({
|
|
280
280
|
'--yes': Boolean,
|
|
281
281
|
'-y': '--yes',
|
|
282
282
|
'--name': String,
|