@quilted/create 0.1.29 → 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 +6 -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/tsconfig.json +6 -1
package/build/esm/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import require$$0 from 'node:tty';
|
|
2
|
-
import
|
|
2
|
+
import 'node:fs';
|
|
3
3
|
import 'node:path';
|
|
4
4
|
import 'node:url';
|
|
5
5
|
import require$$0$1 from 'node:readline';
|
|
@@ -11,202 +11,6 @@ function getDefaultExportFromCjs (x) {
|
|
|
11
11
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
const flagSymbol = Symbol('arg flag');
|
|
15
|
-
|
|
16
|
-
class ArgError extends Error {
|
|
17
|
-
constructor(msg, code) {
|
|
18
|
-
super(msg);
|
|
19
|
-
this.name = 'ArgError';
|
|
20
|
-
this.code = code;
|
|
21
|
-
|
|
22
|
-
Object.setPrototypeOf(this, ArgError.prototype);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
function arg(
|
|
27
|
-
opts,
|
|
28
|
-
{
|
|
29
|
-
argv = process.argv.slice(2),
|
|
30
|
-
permissive = false,
|
|
31
|
-
stopAtPositional = false
|
|
32
|
-
} = {}
|
|
33
|
-
) {
|
|
34
|
-
if (!opts) {
|
|
35
|
-
throw new ArgError(
|
|
36
|
-
'argument specification object is required',
|
|
37
|
-
'ARG_CONFIG_NO_SPEC'
|
|
38
|
-
);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
const result = { _: [] };
|
|
42
|
-
|
|
43
|
-
const aliases = {};
|
|
44
|
-
const handlers = {};
|
|
45
|
-
|
|
46
|
-
for (const key of Object.keys(opts)) {
|
|
47
|
-
if (!key) {
|
|
48
|
-
throw new ArgError(
|
|
49
|
-
'argument key cannot be an empty string',
|
|
50
|
-
'ARG_CONFIG_EMPTY_KEY'
|
|
51
|
-
);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
if (key[0] !== '-') {
|
|
55
|
-
throw new ArgError(
|
|
56
|
-
`argument key must start with '-' but found: '${key}'`,
|
|
57
|
-
'ARG_CONFIG_NONOPT_KEY'
|
|
58
|
-
);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
if (key.length === 1) {
|
|
62
|
-
throw new ArgError(
|
|
63
|
-
`argument key must have a name; singular '-' keys are not allowed: ${key}`,
|
|
64
|
-
'ARG_CONFIG_NONAME_KEY'
|
|
65
|
-
);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
if (typeof opts[key] === 'string') {
|
|
69
|
-
aliases[key] = opts[key];
|
|
70
|
-
continue;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
let type = opts[key];
|
|
74
|
-
let isFlag = false;
|
|
75
|
-
|
|
76
|
-
if (
|
|
77
|
-
Array.isArray(type) &&
|
|
78
|
-
type.length === 1 &&
|
|
79
|
-
typeof type[0] === 'function'
|
|
80
|
-
) {
|
|
81
|
-
const [fn] = type;
|
|
82
|
-
type = (value, name, prev = []) => {
|
|
83
|
-
prev.push(fn(value, name, prev[prev.length - 1]));
|
|
84
|
-
return prev;
|
|
85
|
-
};
|
|
86
|
-
isFlag = fn === Boolean || fn[flagSymbol] === true;
|
|
87
|
-
} else if (typeof type === 'function') {
|
|
88
|
-
isFlag = type === Boolean || type[flagSymbol] === true;
|
|
89
|
-
} else {
|
|
90
|
-
throw new ArgError(
|
|
91
|
-
`type missing or not a function or valid array type: ${key}`,
|
|
92
|
-
'ARG_CONFIG_VAD_TYPE'
|
|
93
|
-
);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
if (key[1] !== '-' && key.length > 2) {
|
|
97
|
-
throw new ArgError(
|
|
98
|
-
`short argument keys (with a single hyphen) must have only one character: ${key}`,
|
|
99
|
-
'ARG_CONFIG_SHORTOPT_TOOLONG'
|
|
100
|
-
);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
handlers[key] = [type, isFlag];
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
for (let i = 0, len = argv.length; i < len; i++) {
|
|
107
|
-
const wholeArg = argv[i];
|
|
108
|
-
|
|
109
|
-
if (stopAtPositional && result._.length > 0) {
|
|
110
|
-
result._ = result._.concat(argv.slice(i));
|
|
111
|
-
break;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
if (wholeArg === '--') {
|
|
115
|
-
result._ = result._.concat(argv.slice(i + 1));
|
|
116
|
-
break;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
if (wholeArg.length > 1 && wholeArg[0] === '-') {
|
|
120
|
-
/* eslint-disable operator-linebreak */
|
|
121
|
-
const separatedArguments =
|
|
122
|
-
wholeArg[1] === '-' || wholeArg.length === 2
|
|
123
|
-
? [wholeArg]
|
|
124
|
-
: wholeArg
|
|
125
|
-
.slice(1)
|
|
126
|
-
.split('')
|
|
127
|
-
.map((a) => `-${a}`);
|
|
128
|
-
/* eslint-enable operator-linebreak */
|
|
129
|
-
|
|
130
|
-
for (let j = 0; j < separatedArguments.length; j++) {
|
|
131
|
-
const arg = separatedArguments[j];
|
|
132
|
-
const [originalArgName, argStr] =
|
|
133
|
-
arg[1] === '-' ? arg.split(/=(.*)/, 2) : [arg, undefined];
|
|
134
|
-
|
|
135
|
-
let argName = originalArgName;
|
|
136
|
-
while (argName in aliases) {
|
|
137
|
-
argName = aliases[argName];
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
if (!(argName in handlers)) {
|
|
141
|
-
if (permissive) {
|
|
142
|
-
result._.push(arg);
|
|
143
|
-
continue;
|
|
144
|
-
} else {
|
|
145
|
-
throw new ArgError(
|
|
146
|
-
`unknown or unexpected option: ${originalArgName}`,
|
|
147
|
-
'ARG_UNKNOWN_OPTION'
|
|
148
|
-
);
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
const [type, isFlag] = handlers[argName];
|
|
153
|
-
|
|
154
|
-
if (!isFlag && j + 1 < separatedArguments.length) {
|
|
155
|
-
throw new ArgError(
|
|
156
|
-
`option requires argument (but was followed by another short argument): ${originalArgName}`,
|
|
157
|
-
'ARG_MISSING_REQUIRED_SHORTARG'
|
|
158
|
-
);
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
if (isFlag) {
|
|
162
|
-
result[argName] = type(true, argName, result[argName]);
|
|
163
|
-
} else if (argStr === undefined) {
|
|
164
|
-
if (
|
|
165
|
-
argv.length < i + 2 ||
|
|
166
|
-
(argv[i + 1].length > 1 &&
|
|
167
|
-
argv[i + 1][0] === '-' &&
|
|
168
|
-
!(
|
|
169
|
-
argv[i + 1].match(/^-?\d*(\.(?=\d))?\d*$/) &&
|
|
170
|
-
(type === Number ||
|
|
171
|
-
// eslint-disable-next-line no-undef
|
|
172
|
-
(typeof BigInt !== 'undefined' && type === BigInt))
|
|
173
|
-
))
|
|
174
|
-
) {
|
|
175
|
-
const extended =
|
|
176
|
-
originalArgName === argName ? '' : ` (alias for ${argName})`;
|
|
177
|
-
throw new ArgError(
|
|
178
|
-
`option requires argument: ${originalArgName}${extended}`,
|
|
179
|
-
'ARG_MISSING_REQUIRED_LONGARG'
|
|
180
|
-
);
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
result[argName] = type(argv[i + 1], argName, result[argName]);
|
|
184
|
-
++i;
|
|
185
|
-
} else {
|
|
186
|
-
result[argName] = type(argStr, argName, result[argName]);
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
} else {
|
|
190
|
-
result._.push(wholeArg);
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
return result;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
arg.flag = (fn) => {
|
|
198
|
-
fn[flagSymbol] = true;
|
|
199
|
-
return fn;
|
|
200
|
-
};
|
|
201
|
-
|
|
202
|
-
// Utility types
|
|
203
|
-
arg.COUNT = arg.flag((v, name, existingCount) => (existingCount || 0) + 1);
|
|
204
|
-
|
|
205
|
-
// Expose error class
|
|
206
|
-
arg.ArgError = ArgError;
|
|
207
|
-
|
|
208
|
-
var arg_1 = arg;
|
|
209
|
-
|
|
210
14
|
var colorette = {};
|
|
211
15
|
|
|
212
16
|
Object.defineProperty(colorette, '__esModule', { value: true });
|
|
@@ -233,22 +37,27 @@ function _interopNamespace(e) {
|
|
|
233
37
|
|
|
234
38
|
var tty__namespace = /*#__PURE__*/_interopNamespace(tty);
|
|
235
39
|
|
|
236
|
-
const
|
|
237
|
-
|
|
40
|
+
const {
|
|
41
|
+
env = {},
|
|
42
|
+
argv = [],
|
|
43
|
+
platform = "",
|
|
44
|
+
} = typeof process === "undefined" ? {} : process;
|
|
238
45
|
|
|
239
46
|
const isDisabled = "NO_COLOR" in env || argv.includes("--no-color");
|
|
240
47
|
const isForced = "FORCE_COLOR" in env || argv.includes("--color");
|
|
241
|
-
const isWindows =
|
|
48
|
+
const isWindows = platform === "win32";
|
|
49
|
+
const isDumbTerminal = env.TERM === "dumb";
|
|
242
50
|
|
|
243
51
|
const isCompatibleTerminal =
|
|
244
|
-
tty__namespace && tty__namespace.isatty && tty__namespace.isatty(1) && env.TERM &&
|
|
52
|
+
tty__namespace && tty__namespace.isatty && tty__namespace.isatty(1) && env.TERM && !isDumbTerminal;
|
|
245
53
|
|
|
246
54
|
const isCI =
|
|
247
55
|
"CI" in env &&
|
|
248
56
|
("GITHUB_ACTIONS" in env || "GITLAB_CI" in env || "CIRCLECI" in env);
|
|
249
57
|
|
|
250
58
|
const isColorSupported =
|
|
251
|
-
!isDisabled &&
|
|
59
|
+
!isDisabled &&
|
|
60
|
+
(isForced || (isWindows && !isDumbTerminal) || isCompatibleTerminal || isCI);
|
|
252
61
|
|
|
253
62
|
const replaceClose = (
|
|
254
63
|
index,
|
|
@@ -325,13 +134,11 @@ const colors = {
|
|
|
325
134
|
bgWhiteBright: init$1(107, 49),
|
|
326
135
|
};
|
|
327
136
|
|
|
328
|
-
const none = (any) => any;
|
|
329
|
-
|
|
330
137
|
const createColors = ({ useColor = isColorSupported } = {}) =>
|
|
331
138
|
useColor
|
|
332
139
|
? colors
|
|
333
140
|
: Object.keys(colors).reduce(
|
|
334
|
-
(colors, key) => ({ ...colors, [key]:
|
|
141
|
+
(colors, key) => ({ ...colors, [key]: String }),
|
|
335
142
|
{}
|
|
336
143
|
);
|
|
337
144
|
|
|
@@ -423,6 +230,44 @@ colorette.whiteBright = whiteBright;
|
|
|
423
230
|
colorette.yellow = yellow;
|
|
424
231
|
colorette.yellowBright = yellowBright;
|
|
425
232
|
|
|
233
|
+
var defineProperty = {exports: {}};
|
|
234
|
+
|
|
235
|
+
(function (module) {
|
|
236
|
+
function _defineProperty(obj, key, value) {
|
|
237
|
+
if (key in obj) {
|
|
238
|
+
Object.defineProperty(obj, key, {
|
|
239
|
+
value: value,
|
|
240
|
+
enumerable: true,
|
|
241
|
+
configurable: true,
|
|
242
|
+
writable: true
|
|
243
|
+
});
|
|
244
|
+
} else {
|
|
245
|
+
obj[key] = value;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
return obj;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
module.exports = _defineProperty, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
252
|
+
}(defineProperty));
|
|
253
|
+
|
|
254
|
+
var _defineProperty$1 = /*@__PURE__*/getDefaultExportFromCjs(defineProperty.exports);
|
|
255
|
+
|
|
256
|
+
class AbortError extends Error {
|
|
257
|
+
static test(error) {
|
|
258
|
+
return error != null && error.code === 'ABORT_ERR';
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
constructor(message = 'The operation was aborted') {
|
|
262
|
+
super(message);
|
|
263
|
+
|
|
264
|
+
_defineProperty$1(this, "code", 'ABORT_ERR');
|
|
265
|
+
|
|
266
|
+
_defineProperty$1(this, "name", 'AbortError');
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
}
|
|
270
|
+
|
|
426
271
|
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
427
272
|
|
|
428
273
|
var _templateObject = _taggedTemplateLiteral(['', ''], ['', '']);
|
|
@@ -782,151 +627,207 @@ new TemplateTag(inlineArrayTransformer, replaceResultTransformer(/(?:\s+)/g, ' '
|
|
|
782
627
|
|
|
783
628
|
var stripIndent = new TemplateTag(stripIndentTransformer, trimResultTransformer);
|
|
784
629
|
|
|
630
|
+
var stripIndent$1 = stripIndent;
|
|
631
|
+
|
|
785
632
|
new TemplateTag(stripIndentTransformer('all'), trimResultTransformer);
|
|
786
633
|
|
|
787
|
-
|
|
634
|
+
const flagSymbol = Symbol('arg flag');
|
|
788
635
|
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
enumerable: true,
|
|
795
|
-
configurable: true,
|
|
796
|
-
writable: true
|
|
797
|
-
});
|
|
798
|
-
} else {
|
|
799
|
-
obj[key] = value;
|
|
800
|
-
}
|
|
636
|
+
class ArgError extends Error {
|
|
637
|
+
constructor(msg, code) {
|
|
638
|
+
super(msg);
|
|
639
|
+
this.name = 'ArgError';
|
|
640
|
+
this.code = code;
|
|
801
641
|
|
|
802
|
-
|
|
642
|
+
Object.setPrototypeOf(this, ArgError.prototype);
|
|
643
|
+
}
|
|
803
644
|
}
|
|
804
645
|
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
646
|
+
function arg(
|
|
647
|
+
opts,
|
|
648
|
+
{
|
|
649
|
+
argv = process.argv.slice(2),
|
|
650
|
+
permissive = false,
|
|
651
|
+
stopAtPositional = false
|
|
652
|
+
} = {}
|
|
653
|
+
) {
|
|
654
|
+
if (!opts) {
|
|
655
|
+
throw new ArgError(
|
|
656
|
+
'argument specification object is required',
|
|
657
|
+
'ARG_CONFIG_NO_SPEC'
|
|
658
|
+
);
|
|
659
|
+
}
|
|
809
660
|
|
|
810
|
-
|
|
811
|
-
static test(error) {
|
|
812
|
-
return error != null && error.code === 'ABORT_ERR';
|
|
813
|
-
}
|
|
661
|
+
const result = { _: [] };
|
|
814
662
|
|
|
815
|
-
|
|
816
|
-
|
|
663
|
+
const aliases = {};
|
|
664
|
+
const handlers = {};
|
|
817
665
|
|
|
818
|
-
|
|
666
|
+
for (const key of Object.keys(opts)) {
|
|
667
|
+
if (!key) {
|
|
668
|
+
throw new ArgError(
|
|
669
|
+
'argument key cannot be an empty string',
|
|
670
|
+
'ARG_CONFIG_EMPTY_KEY'
|
|
671
|
+
);
|
|
672
|
+
}
|
|
819
673
|
|
|
820
|
-
|
|
821
|
-
|
|
674
|
+
if (key[0] !== '-') {
|
|
675
|
+
throw new ArgError(
|
|
676
|
+
`argument key must start with '-' but found: '${key}'`,
|
|
677
|
+
'ARG_CONFIG_NONOPT_KEY'
|
|
678
|
+
);
|
|
679
|
+
}
|
|
822
680
|
|
|
823
|
-
|
|
681
|
+
if (key.length === 1) {
|
|
682
|
+
throw new ArgError(
|
|
683
|
+
`argument key must have a name; singular '-' keys are not allowed: ${key}`,
|
|
684
|
+
'ARG_CONFIG_NONAME_KEY'
|
|
685
|
+
);
|
|
686
|
+
}
|
|
824
687
|
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
_t4;
|
|
830
|
-
function printHelp({
|
|
831
|
-
kind,
|
|
832
|
-
options: customOptions,
|
|
833
|
-
packageManager
|
|
834
|
-
}) {
|
|
835
|
-
const command = createCommand(packageManager);
|
|
836
|
-
const usage = stripIndent(_t$1 || (_t$1 = _$1`
|
|
837
|
-
${0} ${0} ${0} ${0} ${0}
|
|
838
|
-
`), bold_1('Usage:'), command, kind ? magenta_1(kind) : magenta_1('[kind]'), green_1('[name]'), cyan_1('[options]'));
|
|
839
|
-
console.log(usage);
|
|
840
|
-
const example = stripIndent(_t2 || (_t2 = _$1`
|
|
841
|
-
${0} ${0} ${0} ${0} ${0}
|
|
842
|
-
`), bold_1('Example:'), command, magenta_1(kind !== null && kind !== void 0 ? kind : 'app'), green_1(`my-${kind !== null && kind !== void 0 ? kind : 'app'}`), cyan_1('--install'));
|
|
843
|
-
console.log(dim_1(example));
|
|
688
|
+
if (typeof opts[key] === 'string') {
|
|
689
|
+
aliases[key] = opts[key];
|
|
690
|
+
continue;
|
|
691
|
+
}
|
|
844
692
|
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
${0} can be one of the following project types:
|
|
693
|
+
let type = opts[key];
|
|
694
|
+
let isFlag = false;
|
|
848
695
|
|
|
849
|
-
|
|
850
|
-
|
|
696
|
+
if (
|
|
697
|
+
Array.isArray(type) &&
|
|
698
|
+
type.length === 1 &&
|
|
699
|
+
typeof type[0] === 'function'
|
|
700
|
+
) {
|
|
701
|
+
const [fn] = type;
|
|
702
|
+
type = (value, name, prev = []) => {
|
|
703
|
+
prev.push(fn(value, name, prev[prev.length - 1]));
|
|
704
|
+
return prev;
|
|
705
|
+
};
|
|
706
|
+
isFlag = fn === Boolean || fn[flagSymbol] === true;
|
|
707
|
+
} else if (typeof type === 'function') {
|
|
708
|
+
isFlag = type === Boolean || type[flagSymbol] === true;
|
|
709
|
+
} else {
|
|
710
|
+
throw new ArgError(
|
|
711
|
+
`type missing or not a function or valid array type: ${key}`,
|
|
712
|
+
'ARG_CONFIG_VAD_TYPE'
|
|
713
|
+
);
|
|
714
|
+
}
|
|
851
715
|
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
716
|
+
if (key[1] !== '-' && key.length > 2) {
|
|
717
|
+
throw new ArgError(
|
|
718
|
+
`short argument keys (with a single hyphen) must have only one character: ${key}`,
|
|
719
|
+
'ARG_CONFIG_SHORTOPT_TOOLONG'
|
|
720
|
+
);
|
|
721
|
+
}
|
|
857
722
|
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
The name of the project. When creating a package, you should use the public name you
|
|
861
|
-
want for the package, including any scope you want to use (example: ${0}).
|
|
862
|
-
If you don’t provide a name with this flag, this command will ask you for one later.
|
|
723
|
+
handlers[key] = [type, isFlag];
|
|
724
|
+
}
|
|
863
725
|
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
a default directory based on the kind of the project and the name you provided.
|
|
726
|
+
for (let i = 0, len = argv.length; i < len; i++) {
|
|
727
|
+
const wholeArg = argv[i];
|
|
867
728
|
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
729
|
+
if (stopAtPositional && result._.length > 0) {
|
|
730
|
+
result._ = result._.concat(argv.slice(i));
|
|
731
|
+
break;
|
|
732
|
+
}
|
|
872
733
|
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
734
|
+
if (wholeArg === '--') {
|
|
735
|
+
result._ = result._.concat(argv.slice(i + 1));
|
|
736
|
+
break;
|
|
737
|
+
}
|
|
876
738
|
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
739
|
+
if (wholeArg.length > 1 && wholeArg[0] === '-') {
|
|
740
|
+
/* eslint-disable operator-linebreak */
|
|
741
|
+
const separatedArguments =
|
|
742
|
+
wholeArg[1] === '-' || wholeArg.length === 2
|
|
743
|
+
? [wholeArg]
|
|
744
|
+
: wholeArg
|
|
745
|
+
.slice(1)
|
|
746
|
+
.split('')
|
|
747
|
+
.map((a) => `-${a}`);
|
|
748
|
+
/* eslint-enable operator-linebreak */
|
|
880
749
|
|
|
881
|
-
|
|
750
|
+
for (let j = 0; j < separatedArguments.length; j++) {
|
|
751
|
+
const arg = separatedArguments[j];
|
|
752
|
+
const [originalArgName, argStr] =
|
|
753
|
+
arg[1] === '-' ? arg.split(/=(.*)/, 2) : [arg, undefined];
|
|
882
754
|
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
enable any of the following tools:
|
|
755
|
+
let argName = originalArgName;
|
|
756
|
+
while (argName in aliases) {
|
|
757
|
+
argName = aliases[argName];
|
|
758
|
+
}
|
|
888
759
|
|
|
889
|
-
|
|
890
|
-
|
|
760
|
+
if (!(argName in handlers)) {
|
|
761
|
+
if (permissive) {
|
|
762
|
+
result._.push(arg);
|
|
763
|
+
continue;
|
|
764
|
+
} else {
|
|
765
|
+
throw new ArgError(
|
|
766
|
+
`unknown or unexpected option: ${originalArgName}`,
|
|
767
|
+
'ARG_UNKNOWN_OPTION'
|
|
768
|
+
);
|
|
769
|
+
}
|
|
770
|
+
}
|
|
891
771
|
|
|
892
|
-
|
|
893
|
-
Answers “yes” to any question this command would have asked.
|
|
772
|
+
const [type, isFlag] = handlers[argName];
|
|
894
773
|
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
774
|
+
if (!isFlag && j + 1 < separatedArguments.length) {
|
|
775
|
+
throw new ArgError(
|
|
776
|
+
`option requires argument (but was followed by another short argument): ${originalArgName}`,
|
|
777
|
+
'ARG_MISSING_REQUIRED_SHORTARG'
|
|
778
|
+
);
|
|
779
|
+
}
|
|
900
780
|
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
781
|
+
if (isFlag) {
|
|
782
|
+
result[argName] = type(true, argName, result[argName]);
|
|
783
|
+
} else if (argStr === undefined) {
|
|
784
|
+
if (
|
|
785
|
+
argv.length < i + 2 ||
|
|
786
|
+
(argv[i + 1].length > 1 &&
|
|
787
|
+
argv[i + 1][0] === '-' &&
|
|
788
|
+
!(
|
|
789
|
+
argv[i + 1].match(/^-?\d*(\.(?=\d))?\d*$/) &&
|
|
790
|
+
(type === Number ||
|
|
791
|
+
// eslint-disable-next-line no-undef
|
|
792
|
+
(typeof BigInt !== 'undefined' && type === BigInt))
|
|
793
|
+
))
|
|
794
|
+
) {
|
|
795
|
+
const extended =
|
|
796
|
+
originalArgName === argName ? '' : ` (alias for ${argName})`;
|
|
797
|
+
throw new ArgError(
|
|
798
|
+
`option requires argument: ${originalArgName}${extended}`,
|
|
799
|
+
'ARG_MISSING_REQUIRED_LONGARG'
|
|
800
|
+
);
|
|
801
|
+
}
|
|
905
802
|
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
}
|
|
803
|
+
result[argName] = type(argv[i + 1], argName, result[argName]);
|
|
804
|
+
++i;
|
|
805
|
+
} else {
|
|
806
|
+
result[argName] = type(argStr, argName, result[argName]);
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
} else {
|
|
810
|
+
result._.push(wholeArg);
|
|
811
|
+
}
|
|
812
|
+
}
|
|
909
813
|
|
|
910
|
-
|
|
911
|
-
return section.split('\n').map(line => line.length > 0 ? ` ${line}` : line).join('\n');
|
|
814
|
+
return result;
|
|
912
815
|
}
|
|
913
816
|
|
|
914
|
-
|
|
915
|
-
|
|
817
|
+
arg.flag = (fn) => {
|
|
818
|
+
fn[flagSymbol] = true;
|
|
819
|
+
return fn;
|
|
820
|
+
};
|
|
916
821
|
|
|
917
|
-
|
|
918
|
-
|
|
822
|
+
// Utility types
|
|
823
|
+
arg.COUNT = arg.flag((v, name, existingCount) => (existingCount || 0) + 1);
|
|
919
824
|
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
} else if (npmUserAgent.includes('yarn') || explicitPackageManager === 'yarn') {
|
|
923
|
-
packageManager = 'yarn';
|
|
924
|
-
} else {
|
|
925
|
-
packageManager = 'npm';
|
|
926
|
-
}
|
|
825
|
+
// Expose error class
|
|
826
|
+
arg.ArgError = ArgError;
|
|
927
827
|
|
|
928
|
-
|
|
929
|
-
|
|
828
|
+
var arg_1 = arg;
|
|
829
|
+
|
|
830
|
+
var parseArguments = arg_1;
|
|
930
831
|
|
|
931
832
|
var prompts$4 = {};
|
|
932
833
|
|
|
@@ -6623,87 +6524,111 @@ async function prompt(prompt) {
|
|
|
6623
6524
|
});
|
|
6624
6525
|
return result.value;
|
|
6625
6526
|
}
|
|
6626
|
-
async function getCreateAsMonorepo(argv) {
|
|
6627
|
-
let createAsMonorepo;
|
|
6628
6527
|
|
|
6629
|
-
|
|
6630
|
-
|
|
6631
|
-
|
|
6632
|
-
|
|
6633
|
-
|
|
6634
|
-
|
|
6635
|
-
|
|
6636
|
-
|
|
6637
|
-
|
|
6638
|
-
|
|
6528
|
+
let _$1 = t => t,
|
|
6529
|
+
_t$1,
|
|
6530
|
+
_t2,
|
|
6531
|
+
_t3,
|
|
6532
|
+
_t4;
|
|
6533
|
+
function printHelp({
|
|
6534
|
+
kind,
|
|
6535
|
+
options: customOptions,
|
|
6536
|
+
packageManager
|
|
6537
|
+
}) {
|
|
6538
|
+
const command = createCommand(packageManager);
|
|
6539
|
+
const usage = stripIndent$1(_t$1 || (_t$1 = _$1`
|
|
6540
|
+
${0} ${0} ${0} ${0} ${0}
|
|
6541
|
+
`), bold_1('Usage:'), command, kind ? magenta_1(kind) : magenta_1('[kind]'), green_1('[name]'), cyan_1('[options]'));
|
|
6542
|
+
console.log(usage);
|
|
6543
|
+
const example = stripIndent$1(_t2 || (_t2 = _$1`
|
|
6544
|
+
${0} ${0} ${0} ${0} ${0}
|
|
6545
|
+
`), bold_1('Example:'), command, magenta_1(kind !== null && kind !== void 0 ? kind : 'app'), green_1(`my-${kind !== null && kind !== void 0 ? kind : 'app'}`), cyan_1('--install'));
|
|
6546
|
+
console.log(dim_1(example));
|
|
6547
|
+
|
|
6548
|
+
if (!kind) {
|
|
6549
|
+
const kindSection = stripIndent$1(_t3 || (_t3 = _$1`
|
|
6550
|
+
${0} can be one of the following project types:
|
|
6551
|
+
|
|
6552
|
+
- ${0}, a web application
|
|
6553
|
+
- ${0}, a shared library of code
|
|
6554
|
+
|
|
6555
|
+
You’ll be asked a few additional questions based on the kind you choose.
|
|
6556
|
+
`), bold_1(magenta_1('kind')), magenta_1('app'), magenta_1('package'));
|
|
6557
|
+
console.log();
|
|
6558
|
+
console.log(kindSection);
|
|
6639
6559
|
}
|
|
6640
6560
|
|
|
6641
|
-
|
|
6642
|
-
}
|
|
6643
|
-
|
|
6644
|
-
|
|
6561
|
+
const optionsSection = stripIndent$1(_t4 || (_t4 = _$1`
|
|
6562
|
+
${0}
|
|
6563
|
+
The name of the project. When creating a package, you should use the public name you
|
|
6564
|
+
want for the package, including any scope you want to use (example: ${0}).
|
|
6565
|
+
If you don’t provide a name with this flag, this command will ask you for one later.
|
|
6645
6566
|
|
|
6646
|
-
|
|
6647
|
-
|
|
6648
|
-
|
|
6649
|
-
|
|
6650
|
-
|
|
6651
|
-
|
|
6652
|
-
|
|
6653
|
-
|
|
6654
|
-
|
|
6655
|
-
}
|
|
6567
|
+
${0}
|
|
6568
|
+
The directory to create the project in. If you don’t provide this flag, Quilt will pick
|
|
6569
|
+
a default directory based on the kind of the project and the name you provided.
|
|
6570
|
+
|
|
6571
|
+
${0}, ${0}
|
|
6572
|
+
If you aren’t already in a monorepo, this flag will create your new project with some
|
|
6573
|
+
additional structure that allows it to be a monorepo — that is, you will be able to add
|
|
6574
|
+
multiple projects to a single repository.
|
|
6575
|
+
|
|
6576
|
+
${0}, ${0}
|
|
6577
|
+
Whether to install dependencies in the newly created project. If you do not provide this
|
|
6578
|
+
flag, Quilt will ask you about it later.
|
|
6579
|
+
|
|
6580
|
+
${0}
|
|
6581
|
+
The package manager to use for your new project. This choice will be used to populate
|
|
6582
|
+
some commands, and will be used to install dependencies if the ${0} flag is set.
|
|
6583
|
+
|
|
6584
|
+
Must be one of the following: ${0}, ${0}, or ${0}.
|
|
6585
|
+
|
|
6586
|
+
${0}, ${0}
|
|
6587
|
+
Extra developer tools to configure when creating your new project. This option only
|
|
6588
|
+
applies when creating a brand new project, not when adding a project to an existing
|
|
6589
|
+
workspace. You can include this flag multiple times to add multiple tools. You can
|
|
6590
|
+
enable any of the following tools:
|
|
6591
|
+
|
|
6592
|
+
- ${0}, which adds a continuous integration (CI) GitHub Action to your project.
|
|
6593
|
+
- ${0}, which adds some basic VSCode settings to your project.
|
|
6594
|
+
|
|
6595
|
+
${0}, ${0}
|
|
6596
|
+
Answers “yes” to any question this command would have asked.
|
|
6597
|
+
|
|
6598
|
+
${0}, ${0}
|
|
6599
|
+
Prints this help documentation.
|
|
6600
|
+
`), cyan_1('--name'), bold_1('@my-org/my-package'), cyan_1('--directory'), cyan_1(`--monorepo`), cyan_1(`--no-monorepo`), cyan_1(`--install`), cyan_1(`--no-install`), cyan_1('--package-manager'), cyan_1('--install'), bold_1('pnpm'), bold_1('npm'), bold_1('yarn'), cyan_1(`--extras`), cyan_1(`--no-extras`), bold_1('github'), bold_1('vscode'), cyan_1('--yes'), cyan_1('-y'), cyan_1('--help'), cyan_1('-h'));
|
|
6601
|
+
console.log();
|
|
6602
|
+
console.log(`${bold_1(cyan_1('options'))} can include any of these flags:`);
|
|
6603
|
+
|
|
6604
|
+
if (customOptions) {
|
|
6605
|
+
console.log();
|
|
6606
|
+
console.log(printOptionsSection(customOptions));
|
|
6656
6607
|
}
|
|
6657
6608
|
|
|
6658
|
-
|
|
6609
|
+
console.log();
|
|
6610
|
+
console.log(printOptionsSection(optionsSection));
|
|
6659
6611
|
}
|
|
6660
|
-
const VALID_PACKAGE_MANAGERS = new Set(['pnpm', 'npm', 'yarn']);
|
|
6661
|
-
async function getPackageManager(argv) {
|
|
6662
|
-
let packageManager;
|
|
6663
6612
|
|
|
6664
|
-
|
|
6665
|
-
|
|
6666
|
-
|
|
6667
|
-
|
|
6668
|
-
|
|
6613
|
+
function printOptionsSection(section) {
|
|
6614
|
+
return section.split('\n').map(line => line.length > 0 ? ` ${line}` : line).join('\n');
|
|
6615
|
+
}
|
|
6616
|
+
|
|
6617
|
+
function createCommand(explicitPackageManager) {
|
|
6618
|
+
var _process$env$npm_conf;
|
|
6669
6619
|
|
|
6670
|
-
|
|
6620
|
+
let packageManager;
|
|
6621
|
+
const npmUserAgent = (_process$env$npm_conf = process.env['npm_config_user_agent']) !== null && _process$env$npm_conf !== void 0 ? _process$env$npm_conf : 'npm';
|
|
6671
6622
|
|
|
6672
|
-
|
|
6673
|
-
|
|
6674
|
-
|
|
6675
|
-
|
|
6676
|
-
|
|
6677
|
-
|
|
6678
|
-
}
|
|
6623
|
+
if (npmUserAgent.includes('pnpm') || explicitPackageManager === 'pnpm') {
|
|
6624
|
+
packageManager = 'pnpm';
|
|
6625
|
+
} else if (npmUserAgent.includes('yarn') || explicitPackageManager === 'yarn') {
|
|
6626
|
+
packageManager = 'yarn';
|
|
6627
|
+
} else {
|
|
6628
|
+
packageManager = 'npm';
|
|
6679
6629
|
}
|
|
6680
6630
|
|
|
6681
|
-
return packageManager
|
|
6682
|
-
}
|
|
6683
|
-
const VALID_EXTRAS = new Set(['github', 'vscode']);
|
|
6684
|
-
async function getExtrasToSetup(argv, {
|
|
6685
|
-
inWorkspace
|
|
6686
|
-
}) {
|
|
6687
|
-
if (inWorkspace || argv['--no-extras']) return new Set();
|
|
6688
|
-
|
|
6689
|
-
if (argv['--extras']) {
|
|
6690
|
-
return new Set(argv['--extras'].filter(extra => VALID_EXTRAS.has(extra)));
|
|
6691
|
-
}
|
|
6692
|
-
|
|
6693
|
-
const setupExtras = await prompt({
|
|
6694
|
-
type: 'multiselect',
|
|
6695
|
-
message: 'Which additional tools would you like to configure?',
|
|
6696
|
-
instructions: dim_1(`\n Use ${bold_1('space')} to select, ${bold_1('a')} to select all, ${bold_1('return')} to submit`),
|
|
6697
|
-
choices: [{
|
|
6698
|
-
title: 'VSCode',
|
|
6699
|
-
value: 'vscode'
|
|
6700
|
-
}, {
|
|
6701
|
-
title: 'GitHub',
|
|
6702
|
-
value: 'github'
|
|
6703
|
-
}]
|
|
6704
|
-
});
|
|
6705
|
-
const extrasToSetup = new Set(setupExtras);
|
|
6706
|
-
return extrasToSetup;
|
|
6631
|
+
return `${packageManager} create @quilted`;
|
|
6707
6632
|
}
|
|
6708
6633
|
|
|
6709
6634
|
let _ = t => t,
|
|
@@ -6718,7 +6643,7 @@ run().catch(error => {
|
|
|
6718
6643
|
async function run() {
|
|
6719
6644
|
var _permissiveArgs$_$;
|
|
6720
6645
|
|
|
6721
|
-
const permissiveArgs =
|
|
6646
|
+
const permissiveArgs = parseArguments({
|
|
6722
6647
|
'--help': Boolean,
|
|
6723
6648
|
'-h': '--help',
|
|
6724
6649
|
'--package-manager': String
|
|
@@ -6734,7 +6659,7 @@ async function run() {
|
|
|
6734
6659
|
}
|
|
6735
6660
|
|
|
6736
6661
|
let kind = firstArgument == null || !VALID_PROJECT_KINDS.has(firstArgument) ? undefined : firstArgument;
|
|
6737
|
-
const header = stripIndent(_t || (_t = _`
|
|
6662
|
+
const header = stripIndent$1(_t || (_t = _`
|
|
6738
6663
|
🧵 ${0}
|
|
6739
6664
|
`), bold_1('quilt create'));
|
|
6740
6665
|
console.log(header);
|
|
@@ -6784,4 +6709,4 @@ async function run() {
|
|
|
6784
6709
|
}
|
|
6785
6710
|
}
|
|
6786
6711
|
|
|
6787
|
-
export {
|
|
6712
|
+
export { prompt as a, bold_1 as b, cyan_1 as c, dim_1 as d, parseArguments as e, commonjsGlobal as f, getDefaultExportFromCjs as g, magenta_1 as m, printHelp as p, stripIndent$1 as s, underline_1 as u };
|