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