@quilted/create 0.1.28 → 0.1.30
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 +12 -0
- package/build/cjs/app.cjs +227 -31
- package/build/cjs/index.cjs +315 -413
- package/build/cjs/package-manager.cjs +314 -3
- package/build/cjs/package.cjs +28 -28
- package/build/esm/app.mjs +198 -2
- package/build/esm/index.mjs +314 -389
- package/build/esm/package-manager.mjs +303 -3
- package/build/esm/package.mjs +30 -30
- package/build/esm/parser-babel.mjs +1 -1
- package/build/esm/parser-typescript.mjs +1 -1
- package/build/esm/parser-yaml.mjs +1 -1
- package/build/esm/standalone.mjs +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/build/typescript/help.d.ts.map +1 -1
- package/build/typescript/package.d.ts.map +1 -1
- package/build/typescript/shared/prompts.d.ts +3 -4
- 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 +2 -2
- package/source/app.ts +2 -2
- package/source/create.ts +2 -5
- package/source/help.ts +1 -2
- package/source/package.ts +30 -33
- package/source/shared/prompts.ts +8 -43
- package/source/shared.ts +1 -2
- package/templates/app-basic/package.json +1 -0
- package/templates/app-single-file/package.json +1 -0
- package/tsconfig.json +6 -1
|
@@ -1,8 +1,28 @@
|
|
|
1
|
+
import require$$0 from 'node:tty';
|
|
2
|
+
import { a as prompt } from './index.mjs';
|
|
3
|
+
import * as fs from 'node:fs';
|
|
4
|
+
import { existsSync } from 'node:fs';
|
|
1
5
|
import * as path from 'node:path';
|
|
2
6
|
import { relative } from 'node:path';
|
|
3
|
-
import * as fs from 'node:fs';
|
|
4
7
|
import { fileURLToPath } from 'node:url';
|
|
5
|
-
|
|
8
|
+
|
|
9
|
+
const VALID_PACKAGE_MANAGERS = new Set(['npm', 'pnpm', 'yarn']);
|
|
10
|
+
async function getPackageManager$1(explicitPackageManager) {
|
|
11
|
+
if (explicitPackageManager) {
|
|
12
|
+
const normalizedPackageManager = explicitPackageManager.toLowerCase();
|
|
13
|
+
return VALID_PACKAGE_MANAGERS.has(normalizedPackageManager) ? normalizedPackageManager : undefined;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const npmUserAgent = process.env['npm_config_user_agent'];
|
|
17
|
+
|
|
18
|
+
if (npmUserAgent !== null && npmUserAgent !== void 0 && npmUserAgent.includes('pnpm') || existsSync('pnpm-lock.yaml')) {
|
|
19
|
+
return 'pnpm';
|
|
20
|
+
} else if (npmUserAgent !== null && npmUserAgent !== void 0 && npmUserAgent.includes('yarn') || existsSync('yarn.lock')) {
|
|
21
|
+
return 'yarn';
|
|
22
|
+
} else if (npmUserAgent !== null && npmUserAgent !== void 0 && npmUserAgent.includes('npm') || existsSync('package-lock.json')) {
|
|
23
|
+
return 'npm';
|
|
24
|
+
}
|
|
25
|
+
}
|
|
6
26
|
|
|
7
27
|
function loadTemplate(name) {
|
|
8
28
|
let templateRootPromise;
|
|
@@ -157,6 +177,286 @@ function mergeDependencies(first = {}, second = {}) {
|
|
|
157
177
|
return merged;
|
|
158
178
|
}
|
|
159
179
|
|
|
180
|
+
var colorette = {};
|
|
181
|
+
|
|
182
|
+
Object.defineProperty(colorette, '__esModule', { value: true });
|
|
183
|
+
|
|
184
|
+
var tty = require$$0;
|
|
185
|
+
|
|
186
|
+
function _interopNamespace(e) {
|
|
187
|
+
if (e && e.__esModule) return e;
|
|
188
|
+
var n = Object.create(null);
|
|
189
|
+
if (e) {
|
|
190
|
+
Object.keys(e).forEach(function (k) {
|
|
191
|
+
if (k !== 'default') {
|
|
192
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
193
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
194
|
+
enumerable: true,
|
|
195
|
+
get: function () { return e[k]; }
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
n["default"] = e;
|
|
201
|
+
return Object.freeze(n);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
var tty__namespace = /*#__PURE__*/_interopNamespace(tty);
|
|
205
|
+
|
|
206
|
+
const env = process.env || {};
|
|
207
|
+
const argv = process.argv || [];
|
|
208
|
+
|
|
209
|
+
const isDisabled = "NO_COLOR" in env || argv.includes("--no-color");
|
|
210
|
+
const isForced = "FORCE_COLOR" in env || argv.includes("--color");
|
|
211
|
+
const isWindows = process.platform === "win32";
|
|
212
|
+
|
|
213
|
+
const isCompatibleTerminal =
|
|
214
|
+
tty__namespace && tty__namespace.isatty && tty__namespace.isatty(1) && env.TERM && env.TERM !== "dumb";
|
|
215
|
+
|
|
216
|
+
const isCI =
|
|
217
|
+
"CI" in env &&
|
|
218
|
+
("GITHUB_ACTIONS" in env || "GITLAB_CI" in env || "CIRCLECI" in env);
|
|
219
|
+
|
|
220
|
+
const isColorSupported =
|
|
221
|
+
!isDisabled && (isForced || isWindows || isCompatibleTerminal || isCI);
|
|
222
|
+
|
|
223
|
+
const replaceClose = (
|
|
224
|
+
index,
|
|
225
|
+
string,
|
|
226
|
+
close,
|
|
227
|
+
replace,
|
|
228
|
+
head = string.substring(0, index) + replace,
|
|
229
|
+
tail = string.substring(index + close.length),
|
|
230
|
+
next = tail.indexOf(close)
|
|
231
|
+
) => head + (next < 0 ? tail : replaceClose(next, tail, close, replace));
|
|
232
|
+
|
|
233
|
+
const clearBleed = (index, string, open, close, replace) =>
|
|
234
|
+
index < 0
|
|
235
|
+
? open + string + close
|
|
236
|
+
: open + replaceClose(index, string, close, replace) + close;
|
|
237
|
+
|
|
238
|
+
const filterEmpty =
|
|
239
|
+
(open, close, replace = open, at = open.length + 1) =>
|
|
240
|
+
(string) =>
|
|
241
|
+
string || !(string === "" || string === undefined)
|
|
242
|
+
? clearBleed(
|
|
243
|
+
("" + string).indexOf(close, at),
|
|
244
|
+
string,
|
|
245
|
+
open,
|
|
246
|
+
close,
|
|
247
|
+
replace
|
|
248
|
+
)
|
|
249
|
+
: "";
|
|
250
|
+
|
|
251
|
+
const init = (open, close, replace) =>
|
|
252
|
+
filterEmpty(`\x1b[${open}m`, `\x1b[${close}m`, replace);
|
|
253
|
+
|
|
254
|
+
const colors = {
|
|
255
|
+
reset: init(0, 0),
|
|
256
|
+
bold: init(1, 22, "\x1b[22m\x1b[1m"),
|
|
257
|
+
dim: init(2, 22, "\x1b[22m\x1b[2m"),
|
|
258
|
+
italic: init(3, 23),
|
|
259
|
+
underline: init(4, 24),
|
|
260
|
+
inverse: init(7, 27),
|
|
261
|
+
hidden: init(8, 28),
|
|
262
|
+
strikethrough: init(9, 29),
|
|
263
|
+
black: init(30, 39),
|
|
264
|
+
red: init(31, 39),
|
|
265
|
+
green: init(32, 39),
|
|
266
|
+
yellow: init(33, 39),
|
|
267
|
+
blue: init(34, 39),
|
|
268
|
+
magenta: init(35, 39),
|
|
269
|
+
cyan: init(36, 39),
|
|
270
|
+
white: init(37, 39),
|
|
271
|
+
gray: init(90, 39),
|
|
272
|
+
bgBlack: init(40, 49),
|
|
273
|
+
bgRed: init(41, 49),
|
|
274
|
+
bgGreen: init(42, 49),
|
|
275
|
+
bgYellow: init(43, 49),
|
|
276
|
+
bgBlue: init(44, 49),
|
|
277
|
+
bgMagenta: init(45, 49),
|
|
278
|
+
bgCyan: init(46, 49),
|
|
279
|
+
bgWhite: init(47, 49),
|
|
280
|
+
blackBright: init(90, 39),
|
|
281
|
+
redBright: init(91, 39),
|
|
282
|
+
greenBright: init(92, 39),
|
|
283
|
+
yellowBright: init(93, 39),
|
|
284
|
+
blueBright: init(94, 39),
|
|
285
|
+
magentaBright: init(95, 39),
|
|
286
|
+
cyanBright: init(96, 39),
|
|
287
|
+
whiteBright: init(97, 39),
|
|
288
|
+
bgBlackBright: init(100, 49),
|
|
289
|
+
bgRedBright: init(101, 49),
|
|
290
|
+
bgGreenBright: init(102, 49),
|
|
291
|
+
bgYellowBright: init(103, 49),
|
|
292
|
+
bgBlueBright: init(104, 49),
|
|
293
|
+
bgMagentaBright: init(105, 49),
|
|
294
|
+
bgCyanBright: init(106, 49),
|
|
295
|
+
bgWhiteBright: init(107, 49),
|
|
296
|
+
};
|
|
297
|
+
|
|
298
|
+
const none = (any) => any;
|
|
299
|
+
|
|
300
|
+
const createColors = ({ useColor = isColorSupported } = {}) =>
|
|
301
|
+
useColor
|
|
302
|
+
? colors
|
|
303
|
+
: Object.keys(colors).reduce(
|
|
304
|
+
(colors, key) => ({ ...colors, [key]: none }),
|
|
305
|
+
{}
|
|
306
|
+
);
|
|
307
|
+
|
|
308
|
+
const {
|
|
309
|
+
reset,
|
|
310
|
+
bold,
|
|
311
|
+
dim,
|
|
312
|
+
italic,
|
|
313
|
+
underline,
|
|
314
|
+
inverse,
|
|
315
|
+
hidden,
|
|
316
|
+
strikethrough,
|
|
317
|
+
black,
|
|
318
|
+
red,
|
|
319
|
+
green,
|
|
320
|
+
yellow,
|
|
321
|
+
blue,
|
|
322
|
+
magenta,
|
|
323
|
+
cyan,
|
|
324
|
+
white,
|
|
325
|
+
gray,
|
|
326
|
+
bgBlack,
|
|
327
|
+
bgRed,
|
|
328
|
+
bgGreen,
|
|
329
|
+
bgYellow,
|
|
330
|
+
bgBlue,
|
|
331
|
+
bgMagenta,
|
|
332
|
+
bgCyan,
|
|
333
|
+
bgWhite,
|
|
334
|
+
blackBright,
|
|
335
|
+
redBright,
|
|
336
|
+
greenBright,
|
|
337
|
+
yellowBright,
|
|
338
|
+
blueBright,
|
|
339
|
+
magentaBright,
|
|
340
|
+
cyanBright,
|
|
341
|
+
whiteBright,
|
|
342
|
+
bgBlackBright,
|
|
343
|
+
bgRedBright,
|
|
344
|
+
bgGreenBright,
|
|
345
|
+
bgYellowBright,
|
|
346
|
+
bgBlueBright,
|
|
347
|
+
bgMagentaBright,
|
|
348
|
+
bgCyanBright,
|
|
349
|
+
bgWhiteBright,
|
|
350
|
+
} = createColors();
|
|
351
|
+
|
|
352
|
+
colorette.bgBlack = bgBlack;
|
|
353
|
+
colorette.bgBlackBright = bgBlackBright;
|
|
354
|
+
colorette.bgBlue = bgBlue;
|
|
355
|
+
colorette.bgBlueBright = bgBlueBright;
|
|
356
|
+
colorette.bgCyan = bgCyan;
|
|
357
|
+
colorette.bgCyanBright = bgCyanBright;
|
|
358
|
+
colorette.bgGreen = bgGreen;
|
|
359
|
+
colorette.bgGreenBright = bgGreenBright;
|
|
360
|
+
colorette.bgMagenta = bgMagenta;
|
|
361
|
+
colorette.bgMagentaBright = bgMagentaBright;
|
|
362
|
+
colorette.bgRed = bgRed;
|
|
363
|
+
colorette.bgRedBright = bgRedBright;
|
|
364
|
+
colorette.bgWhite = bgWhite;
|
|
365
|
+
colorette.bgWhiteBright = bgWhiteBright;
|
|
366
|
+
colorette.bgYellow = bgYellow;
|
|
367
|
+
colorette.bgYellowBright = bgYellowBright;
|
|
368
|
+
colorette.black = black;
|
|
369
|
+
colorette.blackBright = blackBright;
|
|
370
|
+
colorette.blue = blue;
|
|
371
|
+
colorette.blueBright = blueBright;
|
|
372
|
+
var bold_1 = colorette.bold = bold;
|
|
373
|
+
colorette.createColors = createColors;
|
|
374
|
+
var cyan_1 = colorette.cyan = cyan;
|
|
375
|
+
colorette.cyanBright = cyanBright;
|
|
376
|
+
var dim_1 = colorette.dim = dim;
|
|
377
|
+
colorette.gray = gray;
|
|
378
|
+
colorette.green = green;
|
|
379
|
+
colorette.greenBright = greenBright;
|
|
380
|
+
colorette.hidden = hidden;
|
|
381
|
+
colorette.inverse = inverse;
|
|
382
|
+
colorette.isColorSupported = isColorSupported;
|
|
383
|
+
colorette.italic = italic;
|
|
384
|
+
var magenta_1 = colorette.magenta = magenta;
|
|
385
|
+
colorette.magentaBright = magentaBright;
|
|
386
|
+
colorette.red = red;
|
|
387
|
+
colorette.redBright = redBright;
|
|
388
|
+
colorette.reset = reset;
|
|
389
|
+
colorette.strikethrough = strikethrough;
|
|
390
|
+
var underline_1 = colorette.underline = underline;
|
|
391
|
+
colorette.white = white;
|
|
392
|
+
colorette.whiteBright = whiteBright;
|
|
393
|
+
colorette.yellow = yellow;
|
|
394
|
+
colorette.yellowBright = yellowBright;
|
|
395
|
+
|
|
396
|
+
async function getCreateAsMonorepo(argv) {
|
|
397
|
+
let createAsMonorepo;
|
|
398
|
+
|
|
399
|
+
if (argv['--monorepo' ]) {
|
|
400
|
+
createAsMonorepo = true;
|
|
401
|
+
} else if (argv['--no-monorepo']) {
|
|
402
|
+
createAsMonorepo = false;
|
|
403
|
+
} else {
|
|
404
|
+
createAsMonorepo = await prompt({
|
|
405
|
+
type: 'confirm',
|
|
406
|
+
message: 'Do you want to create this app as a monorepo, with room for more projects?',
|
|
407
|
+
initial: true
|
|
408
|
+
});
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
return createAsMonorepo;
|
|
412
|
+
}
|
|
413
|
+
async function getShouldInstall(argv) {
|
|
414
|
+
let shouldInstall;
|
|
415
|
+
|
|
416
|
+
if (argv['--install'] || argv['--yes']) {
|
|
417
|
+
shouldInstall = true;
|
|
418
|
+
} else if (argv['--no-install']) {
|
|
419
|
+
shouldInstall = false;
|
|
420
|
+
} else {
|
|
421
|
+
shouldInstall = await prompt({
|
|
422
|
+
type: 'confirm',
|
|
423
|
+
message: 'Do you want to install dependencies for this app after creating it?',
|
|
424
|
+
initial: true
|
|
425
|
+
});
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
return shouldInstall;
|
|
429
|
+
}
|
|
430
|
+
async function getPackageManager(argv) {
|
|
431
|
+
const packageManager = await getPackageManager$1(argv['--package-manager']);
|
|
432
|
+
return packageManager !== null && packageManager !== void 0 ? packageManager : 'npm';
|
|
433
|
+
}
|
|
434
|
+
const VALID_EXTRAS = new Set(['github', 'vscode']);
|
|
435
|
+
async function getExtrasToSetup(argv, {
|
|
436
|
+
inWorkspace
|
|
437
|
+
}) {
|
|
438
|
+
if (inWorkspace || argv['--no-extras']) return new Set();
|
|
439
|
+
|
|
440
|
+
if (argv['--extras']) {
|
|
441
|
+
return new Set(argv['--extras'].filter(extra => VALID_EXTRAS.has(extra)));
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
const setupExtras = await prompt({
|
|
445
|
+
type: 'multiselect',
|
|
446
|
+
message: 'Which additional tools would you like to configure?',
|
|
447
|
+
instructions: dim_1(`\n Use ${bold_1('space')} to select, ${bold_1('a')} to select all, ${bold_1('return')} to submit`),
|
|
448
|
+
choices: [{
|
|
449
|
+
title: 'VSCode',
|
|
450
|
+
value: 'vscode'
|
|
451
|
+
}, {
|
|
452
|
+
title: 'GitHub',
|
|
453
|
+
value: 'github'
|
|
454
|
+
}]
|
|
455
|
+
});
|
|
456
|
+
const extrasToSetup = new Set(setupExtras);
|
|
457
|
+
return extrasToSetup;
|
|
458
|
+
}
|
|
459
|
+
|
|
160
460
|
const ENDS_WITH_TSCONFIG = /[/]?tsconfig[.a-z0-9]*[.]json/i;
|
|
161
461
|
async function addToTsConfig(directory, output) {
|
|
162
462
|
var _tsconfig$references;
|
|
@@ -296,4 +596,4 @@ async function addToWorkspaces(relative, workspaces) {
|
|
|
296
596
|
return [...workspaces, pretty ? relativeDirectoryForDisplay(relative) : relative].sort((patternOne, patternTwo) => patternOne.localeCompare(patternTwo));
|
|
297
597
|
}
|
|
298
598
|
|
|
299
|
-
export {
|
|
599
|
+
export { getShouldInstall as a, bold_1 as b, cyan_1 as c, getPackageManager as d, getExtrasToSetup as e, emptyDirectory as f, getCreateAsMonorepo as g, format as h, addToTsConfig as i, addToPackageManagerWorkspaces as j, dim_1 as k, loadTemplate as l, mergeDependencies as m, magenta_1 as n, isEmpty as o, createOutputTarget as p, relativeDirectoryForDisplay as r, toValidPackageName as t, underline_1 as u };
|
package/build/esm/package.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as fs from 'node:fs';
|
|
2
2
|
import * as path from 'node:path';
|
|
3
3
|
import { execSync } from 'node:child_process';
|
|
4
|
-
import { s as stripIndent, c as cyan_1, p as printHelp,
|
|
5
|
-
import { t as toValidPackageName,
|
|
4
|
+
import { s as stripIndent, c as cyan_1, p as printHelp, b as bold_1, d as dim_1, u as underline_1, m as magenta_1, e as parseArguments, a as prompt } from './index.mjs';
|
|
5
|
+
import { g as getCreateAsMonorepo, a as getShouldInstall, d as getPackageManager, e as getExtrasToSetup, t as toValidPackageName, f as emptyDirectory, h as format, m as mergeDependencies, l as loadTemplate, i as addToTsConfig, j as addToPackageManagerWorkspaces, r as relativeDirectoryForDisplay, o as isEmpty, p as createOutputTarget } from './package-manager.mjs';
|
|
6
6
|
import 'node:tty';
|
|
7
7
|
import 'node:url';
|
|
8
8
|
import 'node:readline';
|
|
@@ -14,10 +14,10 @@ let _ = t => t,
|
|
|
14
14
|
_t3,
|
|
15
15
|
_t4;
|
|
16
16
|
async function createProject() {
|
|
17
|
-
const
|
|
17
|
+
const args = getArguments();
|
|
18
18
|
|
|
19
|
-
if (
|
|
20
|
-
var
|
|
19
|
+
if (args['--help']) {
|
|
20
|
+
var _args$PackageManag;
|
|
21
21
|
|
|
22
22
|
const additionalOptions = stripIndent(_t || (_t = _`
|
|
23
23
|
${0}, ${0}
|
|
@@ -35,23 +35,23 @@ async function createProject() {
|
|
|
35
35
|
printHelp({
|
|
36
36
|
kind: 'package',
|
|
37
37
|
options: additionalOptions,
|
|
38
|
-
packageManager: (
|
|
38
|
+
packageManager: (_args$PackageManag = args['--package-manager']) === null || _args$PackageManag === void 0 ? void 0 : _args$PackageManag.toLowerCase()
|
|
39
39
|
});
|
|
40
40
|
return;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
const inWorkspace = fs.existsSync('quilt.workspace.ts');
|
|
44
|
-
const name = await getName(
|
|
45
|
-
const directory = await getDirectory(
|
|
44
|
+
const name = await getName(args);
|
|
45
|
+
const directory = await getDirectory(args, {
|
|
46
46
|
name,
|
|
47
47
|
inWorkspace
|
|
48
48
|
});
|
|
49
|
-
const isPublic = await getPublic(
|
|
50
|
-
const useReact = await getReact(
|
|
51
|
-
const createAsMonorepo = !inWorkspace && (await getCreateAsMonorepo(
|
|
52
|
-
const shouldInstall = await getShouldInstall(
|
|
53
|
-
const packageManager = await getPackageManager(
|
|
54
|
-
const setupExtras = await getExtrasToSetup(
|
|
49
|
+
const isPublic = await getPublic(args);
|
|
50
|
+
const useReact = await getReact(args);
|
|
51
|
+
const createAsMonorepo = !inWorkspace && (await getCreateAsMonorepo(args));
|
|
52
|
+
const shouldInstall = await getShouldInstall(args);
|
|
53
|
+
const packageManager = await getPackageManager(args);
|
|
54
|
+
const setupExtras = await getExtrasToSetup(args, {
|
|
55
55
|
inWorkspace
|
|
56
56
|
});
|
|
57
57
|
const partOfMonorepo = inWorkspace || createAsMonorepo;
|
|
@@ -128,7 +128,7 @@ async function createProject() {
|
|
|
128
128
|
name: toValidPackageName(name),
|
|
129
129
|
react: useReact,
|
|
130
130
|
isPublic,
|
|
131
|
-
registry:
|
|
131
|
+
registry: args['--registry']
|
|
132
132
|
});
|
|
133
133
|
quiltProject = quiltProject.replace('quiltPackage', 'quiltWorkspace, quiltPackage').replace('quiltPackage(', 'quiltWorkspace(), quiltPackage(');
|
|
134
134
|
await outputRoot.write('quilt.project.ts', await format(quiltProject, {
|
|
@@ -169,7 +169,7 @@ async function createProject() {
|
|
|
169
169
|
name: toValidPackageName(name),
|
|
170
170
|
react: useReact,
|
|
171
171
|
isPublic,
|
|
172
|
-
registry:
|
|
172
|
+
registry: args['--registry']
|
|
173
173
|
});
|
|
174
174
|
await outputRoot.write(path.join(packageDirectory, 'package.json'), await format(JSON.stringify(projectPackageJson), {
|
|
175
175
|
as: 'json-stringify'
|
|
@@ -238,8 +238,8 @@ async function createProject() {
|
|
|
238
238
|
console.log(followUp);
|
|
239
239
|
} // Argument handling
|
|
240
240
|
|
|
241
|
-
function
|
|
242
|
-
const
|
|
241
|
+
function getArguments() {
|
|
242
|
+
const args = parseArguments({
|
|
243
243
|
'--yes': Boolean,
|
|
244
244
|
'-y': '--yes',
|
|
245
245
|
'--name': String,
|
|
@@ -261,13 +261,13 @@ function getArgv() {
|
|
|
261
261
|
}, {
|
|
262
262
|
permissive: true
|
|
263
263
|
});
|
|
264
|
-
return
|
|
264
|
+
return args;
|
|
265
265
|
}
|
|
266
266
|
|
|
267
|
-
async function getName(
|
|
267
|
+
async function getName(args) {
|
|
268
268
|
let {
|
|
269
269
|
'--name': name
|
|
270
|
-
} =
|
|
270
|
+
} = args;
|
|
271
271
|
|
|
272
272
|
if (name == null) {
|
|
273
273
|
name = await prompt({
|
|
@@ -280,11 +280,11 @@ async function getName(argv) {
|
|
|
280
280
|
return name;
|
|
281
281
|
}
|
|
282
282
|
|
|
283
|
-
async function getDirectory(
|
|
283
|
+
async function getDirectory(args, {
|
|
284
284
|
name,
|
|
285
285
|
inWorkspace
|
|
286
286
|
}) {
|
|
287
|
-
let directory =
|
|
287
|
+
let directory = args['--directory'] ? path.resolve(args['--directory']) : undefined;
|
|
288
288
|
|
|
289
289
|
if (directory == null) {
|
|
290
290
|
const basePackageName = toValidPackageName(name.split('/').pop());
|
|
@@ -296,7 +296,7 @@ async function getDirectory(argv, {
|
|
|
296
296
|
}));
|
|
297
297
|
}
|
|
298
298
|
|
|
299
|
-
while (!
|
|
299
|
+
while (!args['--yes']) {
|
|
300
300
|
if (fs.existsSync(directory) && !(await isEmpty(directory))) {
|
|
301
301
|
const relativeDirectory = path.relative(process.cwd(), directory);
|
|
302
302
|
const empty = await prompt({
|
|
@@ -318,12 +318,12 @@ async function getDirectory(argv, {
|
|
|
318
318
|
return directory;
|
|
319
319
|
}
|
|
320
320
|
|
|
321
|
-
async function getPublic(
|
|
321
|
+
async function getPublic(args) {
|
|
322
322
|
let isPublic;
|
|
323
323
|
|
|
324
|
-
if (
|
|
324
|
+
if (args['--public'] || args['--yes']) {
|
|
325
325
|
isPublic = true;
|
|
326
|
-
} else if (
|
|
326
|
+
} else if (args['--private']) {
|
|
327
327
|
isPublic = false;
|
|
328
328
|
} else {
|
|
329
329
|
isPublic = await prompt({
|
|
@@ -336,12 +336,12 @@ async function getPublic(argv) {
|
|
|
336
336
|
return isPublic;
|
|
337
337
|
}
|
|
338
338
|
|
|
339
|
-
async function getReact(
|
|
339
|
+
async function getReact(args) {
|
|
340
340
|
let useReact;
|
|
341
341
|
|
|
342
|
-
if (
|
|
342
|
+
if (args['--react'] || args['--yes']) {
|
|
343
343
|
useReact = true;
|
|
344
|
-
} else if (
|
|
344
|
+
} else if (args['--no-react']) {
|
|
345
345
|
useReact = false;
|
|
346
346
|
} else {
|
|
347
347
|
useReact = await prompt({
|
package/build/esm/standalone.mjs
CHANGED