@quilted/create 0.1.50 → 0.1.52
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 +16 -211
- package/build/cjs/index.cjs +13 -1
- package/build/cjs/index2.cjs +157 -326
- package/build/cjs/index3.cjs +307 -7793
- package/build/cjs/index4.cjs +7402 -7181
- package/build/cjs/index5.cjs +7633 -0
- package/build/cjs/module.cjs +318 -0
- package/build/cjs/package.cjs +1 -1
- package/build/cjs/shared/package-manager.cjs +2 -2
- package/build/esm/app.mjs +1 -196
- package/build/esm/index.mjs +13 -1
- package/build/esm/index2.mjs +157 -325
- package/build/esm/index3.mjs +306 -7793
- package/build/esm/index4.mjs +7402 -7174
- package/build/esm/index5.mjs +7624 -0
- package/build/esm/module.mjs +296 -0
- package/build/esm/package.mjs +1 -1
- package/build/esm/shared/package-manager.mjs +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/module.d.ts +2 -0
- package/build/typescript/module.d.ts.map +1 -0
- package/build/typescript/shared/prompts.d.ts +2 -2
- 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/create.ts +7 -1
- package/source/help.ts +6 -1
- package/source/module.ts +426 -0
- package/source/shared/prompts.ts +2 -2
- package/source/shared.ts +2 -0
- package/templates/module/module.ts +3 -0
- package/templates/module/package.json +24 -0
- package/templates/module/quilt.project.ts +5 -0
- package/templates/module/tsconfig.json +9 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @quilted/create
|
|
2
2
|
|
|
3
|
+
## 0.1.52
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`313e10fc`](https://github.com/lemonmade/quilt/commit/313e10fcc0eb4c45737bac241e96f01659efc6cf) Thanks [@lemonmade](https://github.com/lemonmade)! - Fix module create command
|
|
8
|
+
|
|
9
|
+
## 0.1.51
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`aa62176c`](https://github.com/lemonmade/quilt/commit/aa62176c695993d43e34a4ef08400c7effda8a76) Thanks [@lemonmade](https://github.com/lemonmade)! - Add basic ability to create a module
|
|
14
|
+
|
|
3
15
|
## 0.1.50
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/build/cjs/app.cjs
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var fs = require('node:fs');
|
|
4
4
|
var path = require('node:path');
|
|
5
|
+
var index$1 = require('./index2.cjs');
|
|
5
6
|
var packageManager = require('./shared/package-manager.cjs');
|
|
6
7
|
var index = require('./index.cjs');
|
|
7
8
|
require('node:tty');
|
|
@@ -11,221 +12,25 @@ require('node:readline');
|
|
|
11
12
|
require('node:events');
|
|
12
13
|
|
|
13
14
|
function _interopNamespaceDefault(e) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
15
|
+
var n = Object.create(null);
|
|
16
|
+
if (e) {
|
|
17
|
+
Object.keys(e).forEach(function (k) {
|
|
18
|
+
if (k !== 'default') {
|
|
19
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
20
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: function () { return e[k]; }
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
n["default"] = e;
|
|
28
|
+
return Object.freeze(n);
|
|
28
29
|
}
|
|
29
30
|
|
|
30
31
|
var fs__namespace = /*#__PURE__*/_interopNamespaceDefault(fs);
|
|
31
32
|
var path__namespace = /*#__PURE__*/_interopNamespaceDefault(path);
|
|
32
33
|
|
|
33
|
-
const flagSymbol = Symbol('arg flag');
|
|
34
|
-
|
|
35
|
-
class ArgError extends Error {
|
|
36
|
-
constructor(msg, code) {
|
|
37
|
-
super(msg);
|
|
38
|
-
this.name = 'ArgError';
|
|
39
|
-
this.code = code;
|
|
40
|
-
|
|
41
|
-
Object.setPrototypeOf(this, ArgError.prototype);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
function arg(
|
|
46
|
-
opts,
|
|
47
|
-
{
|
|
48
|
-
argv = process.argv.slice(2),
|
|
49
|
-
permissive = false,
|
|
50
|
-
stopAtPositional = false
|
|
51
|
-
} = {}
|
|
52
|
-
) {
|
|
53
|
-
if (!opts) {
|
|
54
|
-
throw new ArgError(
|
|
55
|
-
'argument specification object is required',
|
|
56
|
-
'ARG_CONFIG_NO_SPEC'
|
|
57
|
-
);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
const result = { _: [] };
|
|
61
|
-
|
|
62
|
-
const aliases = {};
|
|
63
|
-
const handlers = {};
|
|
64
|
-
|
|
65
|
-
for (const key of Object.keys(opts)) {
|
|
66
|
-
if (!key) {
|
|
67
|
-
throw new ArgError(
|
|
68
|
-
'argument key cannot be an empty string',
|
|
69
|
-
'ARG_CONFIG_EMPTY_KEY'
|
|
70
|
-
);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
if (key[0] !== '-') {
|
|
74
|
-
throw new ArgError(
|
|
75
|
-
`argument key must start with '-' but found: '${key}'`,
|
|
76
|
-
'ARG_CONFIG_NONOPT_KEY'
|
|
77
|
-
);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
if (key.length === 1) {
|
|
81
|
-
throw new ArgError(
|
|
82
|
-
`argument key must have a name; singular '-' keys are not allowed: ${key}`,
|
|
83
|
-
'ARG_CONFIG_NONAME_KEY'
|
|
84
|
-
);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
if (typeof opts[key] === 'string') {
|
|
88
|
-
aliases[key] = opts[key];
|
|
89
|
-
continue;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
let type = opts[key];
|
|
93
|
-
let isFlag = false;
|
|
94
|
-
|
|
95
|
-
if (
|
|
96
|
-
Array.isArray(type) &&
|
|
97
|
-
type.length === 1 &&
|
|
98
|
-
typeof type[0] === 'function'
|
|
99
|
-
) {
|
|
100
|
-
const [fn] = type;
|
|
101
|
-
type = (value, name, prev = []) => {
|
|
102
|
-
prev.push(fn(value, name, prev[prev.length - 1]));
|
|
103
|
-
return prev;
|
|
104
|
-
};
|
|
105
|
-
isFlag = fn === Boolean || fn[flagSymbol] === true;
|
|
106
|
-
} else if (typeof type === 'function') {
|
|
107
|
-
isFlag = type === Boolean || type[flagSymbol] === true;
|
|
108
|
-
} else {
|
|
109
|
-
throw new ArgError(
|
|
110
|
-
`type missing or not a function or valid array type: ${key}`,
|
|
111
|
-
'ARG_CONFIG_VAD_TYPE'
|
|
112
|
-
);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
if (key[1] !== '-' && key.length > 2) {
|
|
116
|
-
throw new ArgError(
|
|
117
|
-
`short argument keys (with a single hyphen) must have only one character: ${key}`,
|
|
118
|
-
'ARG_CONFIG_SHORTOPT_TOOLONG'
|
|
119
|
-
);
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
handlers[key] = [type, isFlag];
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
for (let i = 0, len = argv.length; i < len; i++) {
|
|
126
|
-
const wholeArg = argv[i];
|
|
127
|
-
|
|
128
|
-
if (stopAtPositional && result._.length > 0) {
|
|
129
|
-
result._ = result._.concat(argv.slice(i));
|
|
130
|
-
break;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
if (wholeArg === '--') {
|
|
134
|
-
result._ = result._.concat(argv.slice(i + 1));
|
|
135
|
-
break;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
if (wholeArg.length > 1 && wholeArg[0] === '-') {
|
|
139
|
-
/* eslint-disable operator-linebreak */
|
|
140
|
-
const separatedArguments =
|
|
141
|
-
wholeArg[1] === '-' || wholeArg.length === 2
|
|
142
|
-
? [wholeArg]
|
|
143
|
-
: wholeArg
|
|
144
|
-
.slice(1)
|
|
145
|
-
.split('')
|
|
146
|
-
.map((a) => `-${a}`);
|
|
147
|
-
/* eslint-enable operator-linebreak */
|
|
148
|
-
|
|
149
|
-
for (let j = 0; j < separatedArguments.length; j++) {
|
|
150
|
-
const arg = separatedArguments[j];
|
|
151
|
-
const [originalArgName, argStr] =
|
|
152
|
-
arg[1] === '-' ? arg.split(/=(.*)/, 2) : [arg, undefined];
|
|
153
|
-
|
|
154
|
-
let argName = originalArgName;
|
|
155
|
-
while (argName in aliases) {
|
|
156
|
-
argName = aliases[argName];
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
if (!(argName in handlers)) {
|
|
160
|
-
if (permissive) {
|
|
161
|
-
result._.push(arg);
|
|
162
|
-
continue;
|
|
163
|
-
} else {
|
|
164
|
-
throw new ArgError(
|
|
165
|
-
`unknown or unexpected option: ${originalArgName}`,
|
|
166
|
-
'ARG_UNKNOWN_OPTION'
|
|
167
|
-
);
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
const [type, isFlag] = handlers[argName];
|
|
172
|
-
|
|
173
|
-
if (!isFlag && j + 1 < separatedArguments.length) {
|
|
174
|
-
throw new ArgError(
|
|
175
|
-
`option requires argument (but was followed by another short argument): ${originalArgName}`,
|
|
176
|
-
'ARG_MISSING_REQUIRED_SHORTARG'
|
|
177
|
-
);
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
if (isFlag) {
|
|
181
|
-
result[argName] = type(true, argName, result[argName]);
|
|
182
|
-
} else if (argStr === undefined) {
|
|
183
|
-
if (
|
|
184
|
-
argv.length < i + 2 ||
|
|
185
|
-
(argv[i + 1].length > 1 &&
|
|
186
|
-
argv[i + 1][0] === '-' &&
|
|
187
|
-
!(
|
|
188
|
-
argv[i + 1].match(/^-?\d*(\.(?=\d))?\d*$/) &&
|
|
189
|
-
(type === Number ||
|
|
190
|
-
// eslint-disable-next-line no-undef
|
|
191
|
-
(typeof BigInt !== 'undefined' && type === BigInt))
|
|
192
|
-
))
|
|
193
|
-
) {
|
|
194
|
-
const extended =
|
|
195
|
-
originalArgName === argName ? '' : ` (alias for ${argName})`;
|
|
196
|
-
throw new ArgError(
|
|
197
|
-
`option requires argument: ${originalArgName}${extended}`,
|
|
198
|
-
'ARG_MISSING_REQUIRED_LONGARG'
|
|
199
|
-
);
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
result[argName] = type(argv[i + 1], argName, result[argName]);
|
|
203
|
-
++i;
|
|
204
|
-
} else {
|
|
205
|
-
result[argName] = type(argStr, argName, result[argName]);
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
} else {
|
|
209
|
-
result._.push(wholeArg);
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
return result;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
arg.flag = (fn) => {
|
|
217
|
-
fn[flagSymbol] = true;
|
|
218
|
-
return fn;
|
|
219
|
-
};
|
|
220
|
-
|
|
221
|
-
// Utility types
|
|
222
|
-
arg.COUNT = arg.flag((v, name, existingCount) => (existingCount || 0) + 1);
|
|
223
|
-
|
|
224
|
-
// Expose error class
|
|
225
|
-
arg.ArgError = ArgError;
|
|
226
|
-
|
|
227
|
-
var arg_1 = arg;
|
|
228
|
-
|
|
229
34
|
async function createApp() {
|
|
230
35
|
const argv = getArgv();
|
|
231
36
|
if (argv['--help']) {
|
|
@@ -411,7 +216,7 @@ async function createApp() {
|
|
|
411
216
|
// Argument handling
|
|
412
217
|
|
|
413
218
|
function getArgv() {
|
|
414
|
-
const argv = arg_1({
|
|
219
|
+
const argv = index$1.arg_1({
|
|
415
220
|
'--yes': Boolean,
|
|
416
221
|
'-y': '--yes',
|
|
417
222
|
'--name': String,
|
package/build/cjs/index.cjs
CHANGED
|
@@ -7124,6 +7124,7 @@ function printHelp({
|
|
|
7124
7124
|
|
|
7125
7125
|
- ${magenta_1('app')}, a web application
|
|
7126
7126
|
- ${magenta_1('package')}, a shared library of code
|
|
7127
|
+
- ${magenta_1('module')}, a standalone JavaScript module for a browser
|
|
7127
7128
|
|
|
7128
7129
|
You’ll be asked a few additional questions based on the kind you choose.
|
|
7129
7130
|
`;
|
|
@@ -7196,7 +7197,7 @@ function createCommand(explicitPackageManager) {
|
|
|
7196
7197
|
}
|
|
7197
7198
|
|
|
7198
7199
|
/* eslint no-console: off */
|
|
7199
|
-
const VALID_PROJECT_KINDS = new Set(['app', 'package']);
|
|
7200
|
+
const VALID_PROJECT_KINDS = new Set(['app', 'package', 'module']);
|
|
7200
7201
|
run().catch(error => {
|
|
7201
7202
|
if (AbortError.test(error)) return;
|
|
7202
7203
|
console.error(error);
|
|
@@ -7235,6 +7236,9 @@ async function run() {
|
|
|
7235
7236
|
choices: [{
|
|
7236
7237
|
title: 'App',
|
|
7237
7238
|
value: 'app'
|
|
7239
|
+
}, {
|
|
7240
|
+
title: 'Module',
|
|
7241
|
+
value: 'module'
|
|
7238
7242
|
}, {
|
|
7239
7243
|
title: 'Package',
|
|
7240
7244
|
value: 'package'
|
|
@@ -7250,6 +7254,14 @@ async function run() {
|
|
|
7250
7254
|
await createApp();
|
|
7251
7255
|
break;
|
|
7252
7256
|
}
|
|
7257
|
+
case 'module':
|
|
7258
|
+
{
|
|
7259
|
+
const {
|
|
7260
|
+
createModule
|
|
7261
|
+
} = await Promise.resolve().then(function () { return require('./module.cjs'); });
|
|
7262
|
+
await createModule();
|
|
7263
|
+
break;
|
|
7264
|
+
}
|
|
7253
7265
|
case 'package':
|
|
7254
7266
|
{
|
|
7255
7267
|
const {
|