create-towns-protocol-app 0.0.189

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/dist/index.js ADDED
@@ -0,0 +1,1129 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __commonJS = (cb, mod) => function __require() {
9
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+
28
+ // ../../node_modules/minimist/index.js
29
+ var require_minimist = __commonJS({
30
+ "../../node_modules/minimist/index.js"(exports2, module2) {
31
+ "use strict";
32
+ function hasKey(obj, keys) {
33
+ var o = obj;
34
+ keys.slice(0, -1).forEach(function(key2) {
35
+ o = o[key2] || {};
36
+ });
37
+ var key = keys[keys.length - 1];
38
+ return key in o;
39
+ }
40
+ function isNumber(x) {
41
+ if (typeof x === "number") {
42
+ return true;
43
+ }
44
+ if (/^0x[0-9a-f]+$/i.test(x)) {
45
+ return true;
46
+ }
47
+ return /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x);
48
+ }
49
+ function isConstructorOrProto(obj, key) {
50
+ return key === "constructor" && typeof obj[key] === "function" || key === "__proto__";
51
+ }
52
+ module2.exports = function(args, opts) {
53
+ if (!opts) {
54
+ opts = {};
55
+ }
56
+ var flags = {
57
+ bools: {},
58
+ strings: {},
59
+ unknownFn: null
60
+ };
61
+ if (typeof opts.unknown === "function") {
62
+ flags.unknownFn = opts.unknown;
63
+ }
64
+ if (typeof opts.boolean === "boolean" && opts.boolean) {
65
+ flags.allBools = true;
66
+ } else {
67
+ [].concat(opts.boolean).filter(Boolean).forEach(function(key2) {
68
+ flags.bools[key2] = true;
69
+ });
70
+ }
71
+ var aliases = {};
72
+ function aliasIsBoolean(key2) {
73
+ return aliases[key2].some(function(x) {
74
+ return flags.bools[x];
75
+ });
76
+ }
77
+ Object.keys(opts.alias || {}).forEach(function(key2) {
78
+ aliases[key2] = [].concat(opts.alias[key2]);
79
+ aliases[key2].forEach(function(x) {
80
+ aliases[x] = [key2].concat(aliases[key2].filter(function(y) {
81
+ return x !== y;
82
+ }));
83
+ });
84
+ });
85
+ [].concat(opts.string).filter(Boolean).forEach(function(key2) {
86
+ flags.strings[key2] = true;
87
+ if (aliases[key2]) {
88
+ [].concat(aliases[key2]).forEach(function(k) {
89
+ flags.strings[k] = true;
90
+ });
91
+ }
92
+ });
93
+ var defaults = opts.default || {};
94
+ var argv2 = { _: [] };
95
+ function argDefined(key2, arg2) {
96
+ return flags.allBools && /^--[^=]+$/.test(arg2) || flags.strings[key2] || flags.bools[key2] || aliases[key2];
97
+ }
98
+ function setKey(obj, keys, value2) {
99
+ var o = obj;
100
+ for (var i2 = 0; i2 < keys.length - 1; i2++) {
101
+ var key2 = keys[i2];
102
+ if (isConstructorOrProto(o, key2)) {
103
+ return;
104
+ }
105
+ if (o[key2] === void 0) {
106
+ o[key2] = {};
107
+ }
108
+ if (o[key2] === Object.prototype || o[key2] === Number.prototype || o[key2] === String.prototype) {
109
+ o[key2] = {};
110
+ }
111
+ if (o[key2] === Array.prototype) {
112
+ o[key2] = [];
113
+ }
114
+ o = o[key2];
115
+ }
116
+ var lastKey = keys[keys.length - 1];
117
+ if (isConstructorOrProto(o, lastKey)) {
118
+ return;
119
+ }
120
+ if (o === Object.prototype || o === Number.prototype || o === String.prototype) {
121
+ o = {};
122
+ }
123
+ if (o === Array.prototype) {
124
+ o = [];
125
+ }
126
+ if (o[lastKey] === void 0 || flags.bools[lastKey] || typeof o[lastKey] === "boolean") {
127
+ o[lastKey] = value2;
128
+ } else if (Array.isArray(o[lastKey])) {
129
+ o[lastKey].push(value2);
130
+ } else {
131
+ o[lastKey] = [o[lastKey], value2];
132
+ }
133
+ }
134
+ function setArg(key2, val, arg2) {
135
+ if (arg2 && flags.unknownFn && !argDefined(key2, arg2)) {
136
+ if (flags.unknownFn(arg2) === false) {
137
+ return;
138
+ }
139
+ }
140
+ var value2 = !flags.strings[key2] && isNumber(val) ? Number(val) : val;
141
+ setKey(argv2, key2.split("."), value2);
142
+ (aliases[key2] || []).forEach(function(x) {
143
+ setKey(argv2, x.split("."), value2);
144
+ });
145
+ }
146
+ Object.keys(flags.bools).forEach(function(key2) {
147
+ setArg(key2, defaults[key2] === void 0 ? false : defaults[key2]);
148
+ });
149
+ var notFlags = [];
150
+ if (args.indexOf("--") !== -1) {
151
+ notFlags = args.slice(args.indexOf("--") + 1);
152
+ args = args.slice(0, args.indexOf("--"));
153
+ }
154
+ for (var i = 0; i < args.length; i++) {
155
+ var arg = args[i];
156
+ var key;
157
+ var next;
158
+ if (/^--.+=/.test(arg)) {
159
+ var m = arg.match(/^--([^=]+)=([\s\S]*)$/);
160
+ key = m[1];
161
+ var value = m[2];
162
+ if (flags.bools[key]) {
163
+ value = value !== "false";
164
+ }
165
+ setArg(key, value, arg);
166
+ } else if (/^--no-.+/.test(arg)) {
167
+ key = arg.match(/^--no-(.+)/)[1];
168
+ setArg(key, false, arg);
169
+ } else if (/^--.+/.test(arg)) {
170
+ key = arg.match(/^--(.+)/)[1];
171
+ next = args[i + 1];
172
+ if (next !== void 0 && !/^(-|--)[^-]/.test(next) && !flags.bools[key] && !flags.allBools && (aliases[key] ? !aliasIsBoolean(key) : true)) {
173
+ setArg(key, next, arg);
174
+ i += 1;
175
+ } else if (/^(true|false)$/.test(next)) {
176
+ setArg(key, next === "true", arg);
177
+ i += 1;
178
+ } else {
179
+ setArg(key, flags.strings[key] ? "" : true, arg);
180
+ }
181
+ } else if (/^-[^-]+/.test(arg)) {
182
+ var letters = arg.slice(1, -1).split("");
183
+ var broken = false;
184
+ for (var j = 0; j < letters.length; j++) {
185
+ next = arg.slice(j + 2);
186
+ if (next === "-") {
187
+ setArg(letters[j], next, arg);
188
+ continue;
189
+ }
190
+ if (/[A-Za-z]/.test(letters[j]) && next[0] === "=") {
191
+ setArg(letters[j], next.slice(1), arg);
192
+ broken = true;
193
+ break;
194
+ }
195
+ if (/[A-Za-z]/.test(letters[j]) && /-?\d+(\.\d*)?(e-?\d+)?$/.test(next)) {
196
+ setArg(letters[j], next, arg);
197
+ broken = true;
198
+ break;
199
+ }
200
+ if (letters[j + 1] && letters[j + 1].match(/\W/)) {
201
+ setArg(letters[j], arg.slice(j + 2), arg);
202
+ broken = true;
203
+ break;
204
+ } else {
205
+ setArg(letters[j], flags.strings[letters[j]] ? "" : true, arg);
206
+ }
207
+ }
208
+ key = arg.slice(-1)[0];
209
+ if (!broken && key !== "-") {
210
+ if (args[i + 1] && !/^(-|--)[^-]/.test(args[i + 1]) && !flags.bools[key] && (aliases[key] ? !aliasIsBoolean(key) : true)) {
211
+ setArg(key, args[i + 1], arg);
212
+ i += 1;
213
+ } else if (args[i + 1] && /^(true|false)$/.test(args[i + 1])) {
214
+ setArg(key, args[i + 1] === "true", arg);
215
+ i += 1;
216
+ } else {
217
+ setArg(key, flags.strings[key] ? "" : true, arg);
218
+ }
219
+ }
220
+ } else {
221
+ if (!flags.unknownFn || flags.unknownFn(arg) !== false) {
222
+ argv2._.push(flags.strings._ || !isNumber(arg) ? arg : Number(arg));
223
+ }
224
+ if (opts.stopEarly) {
225
+ argv2._.push.apply(argv2._, args.slice(i + 1));
226
+ break;
227
+ }
228
+ }
229
+ }
230
+ Object.keys(defaults).forEach(function(k) {
231
+ if (!hasKey(argv2, k.split("."))) {
232
+ setKey(argv2, k.split("."), defaults[k]);
233
+ (aliases[k] || []).forEach(function(x) {
234
+ setKey(argv2, x.split("."), defaults[k]);
235
+ });
236
+ }
237
+ });
238
+ if (opts["--"]) {
239
+ argv2["--"] = notFlags.slice();
240
+ } else {
241
+ notFlags.forEach(function(k) {
242
+ argv2._.push(k);
243
+ });
244
+ }
245
+ return argv2;
246
+ };
247
+ }
248
+ });
249
+
250
+ // ../../node_modules/picocolors/picocolors.js
251
+ var require_picocolors = __commonJS({
252
+ "../../node_modules/picocolors/picocolors.js"(exports2, module2) {
253
+ "use strict";
254
+ var p = process || {};
255
+ var argv2 = p.argv || [];
256
+ var env = p.env || {};
257
+ var isColorSupported = !(!!env.NO_COLOR || argv2.includes("--no-color")) && (!!env.FORCE_COLOR || argv2.includes("--color") || p.platform === "win32" || (p.stdout || {}).isTTY && env.TERM !== "dumb" || !!env.CI);
258
+ var formatter = (open, close, replace = open) => (input) => {
259
+ let string = "" + input, index = string.indexOf(close, open.length);
260
+ return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
261
+ };
262
+ var replaceClose = (string, close, replace, index) => {
263
+ let result = "", cursor = 0;
264
+ do {
265
+ result += string.substring(cursor, index) + replace;
266
+ cursor = index + close.length;
267
+ index = string.indexOf(close, cursor);
268
+ } while (~index);
269
+ return result + string.substring(cursor);
270
+ };
271
+ var createColors = (enabled = isColorSupported) => {
272
+ let f = enabled ? formatter : () => String;
273
+ return {
274
+ isColorSupported: enabled,
275
+ reset: f("\x1B[0m", "\x1B[0m"),
276
+ bold: f("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
277
+ dim: f("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
278
+ italic: f("\x1B[3m", "\x1B[23m"),
279
+ underline: f("\x1B[4m", "\x1B[24m"),
280
+ inverse: f("\x1B[7m", "\x1B[27m"),
281
+ hidden: f("\x1B[8m", "\x1B[28m"),
282
+ strikethrough: f("\x1B[9m", "\x1B[29m"),
283
+ black: f("\x1B[30m", "\x1B[39m"),
284
+ red: f("\x1B[31m", "\x1B[39m"),
285
+ green: f("\x1B[32m", "\x1B[39m"),
286
+ yellow: f("\x1B[33m", "\x1B[39m"),
287
+ blue: f("\x1B[34m", "\x1B[39m"),
288
+ magenta: f("\x1B[35m", "\x1B[39m"),
289
+ cyan: f("\x1B[36m", "\x1B[39m"),
290
+ white: f("\x1B[37m", "\x1B[39m"),
291
+ gray: f("\x1B[90m", "\x1B[39m"),
292
+ bgBlack: f("\x1B[40m", "\x1B[49m"),
293
+ bgRed: f("\x1B[41m", "\x1B[49m"),
294
+ bgGreen: f("\x1B[42m", "\x1B[49m"),
295
+ bgYellow: f("\x1B[43m", "\x1B[49m"),
296
+ bgBlue: f("\x1B[44m", "\x1B[49m"),
297
+ bgMagenta: f("\x1B[45m", "\x1B[49m"),
298
+ bgCyan: f("\x1B[46m", "\x1B[49m"),
299
+ bgWhite: f("\x1B[47m", "\x1B[49m"),
300
+ blackBright: f("\x1B[90m", "\x1B[39m"),
301
+ redBright: f("\x1B[91m", "\x1B[39m"),
302
+ greenBright: f("\x1B[92m", "\x1B[39m"),
303
+ yellowBright: f("\x1B[93m", "\x1B[39m"),
304
+ blueBright: f("\x1B[94m", "\x1B[39m"),
305
+ magentaBright: f("\x1B[95m", "\x1B[39m"),
306
+ cyanBright: f("\x1B[96m", "\x1B[39m"),
307
+ whiteBright: f("\x1B[97m", "\x1B[39m"),
308
+ bgBlackBright: f("\x1B[100m", "\x1B[49m"),
309
+ bgRedBright: f("\x1B[101m", "\x1B[49m"),
310
+ bgGreenBright: f("\x1B[102m", "\x1B[49m"),
311
+ bgYellowBright: f("\x1B[103m", "\x1B[49m"),
312
+ bgBlueBright: f("\x1B[104m", "\x1B[49m"),
313
+ bgMagentaBright: f("\x1B[105m", "\x1B[49m"),
314
+ bgCyanBright: f("\x1B[106m", "\x1B[49m"),
315
+ bgWhiteBright: f("\x1B[107m", "\x1B[49m")
316
+ };
317
+ };
318
+ module2.exports = createColors();
319
+ module2.exports.createColors = createColors;
320
+ }
321
+ });
322
+
323
+ // ../../node_modules/isexe/windows.js
324
+ var require_windows = __commonJS({
325
+ "../../node_modules/isexe/windows.js"(exports2, module2) {
326
+ "use strict";
327
+ module2.exports = isexe;
328
+ isexe.sync = sync;
329
+ var fs2 = require("fs");
330
+ function checkPathExt(path5, options) {
331
+ var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
332
+ if (!pathext) {
333
+ return true;
334
+ }
335
+ pathext = pathext.split(";");
336
+ if (pathext.indexOf("") !== -1) {
337
+ return true;
338
+ }
339
+ for (var i = 0; i < pathext.length; i++) {
340
+ var p = pathext[i].toLowerCase();
341
+ if (p && path5.substr(-p.length).toLowerCase() === p) {
342
+ return true;
343
+ }
344
+ }
345
+ return false;
346
+ }
347
+ function checkStat(stat, path5, options) {
348
+ if (!stat.isSymbolicLink() && !stat.isFile()) {
349
+ return false;
350
+ }
351
+ return checkPathExt(path5, options);
352
+ }
353
+ function isexe(path5, options, cb) {
354
+ fs2.stat(path5, function(er, stat) {
355
+ cb(er, er ? false : checkStat(stat, path5, options));
356
+ });
357
+ }
358
+ function sync(path5, options) {
359
+ return checkStat(fs2.statSync(path5), path5, options);
360
+ }
361
+ }
362
+ });
363
+
364
+ // ../../node_modules/isexe/mode.js
365
+ var require_mode = __commonJS({
366
+ "../../node_modules/isexe/mode.js"(exports2, module2) {
367
+ "use strict";
368
+ module2.exports = isexe;
369
+ isexe.sync = sync;
370
+ var fs2 = require("fs");
371
+ function isexe(path5, options, cb) {
372
+ fs2.stat(path5, function(er, stat) {
373
+ cb(er, er ? false : checkStat(stat, options));
374
+ });
375
+ }
376
+ function sync(path5, options) {
377
+ return checkStat(fs2.statSync(path5), options);
378
+ }
379
+ function checkStat(stat, options) {
380
+ return stat.isFile() && checkMode(stat, options);
381
+ }
382
+ function checkMode(stat, options) {
383
+ var mod = stat.mode;
384
+ var uid = stat.uid;
385
+ var gid = stat.gid;
386
+ var myUid = options.uid !== void 0 ? options.uid : process.getuid && process.getuid();
387
+ var myGid = options.gid !== void 0 ? options.gid : process.getgid && process.getgid();
388
+ var u = parseInt("100", 8);
389
+ var g = parseInt("010", 8);
390
+ var o = parseInt("001", 8);
391
+ var ug = u | g;
392
+ var ret = mod & o || mod & g && gid === myGid || mod & u && uid === myUid || mod & ug && myUid === 0;
393
+ return ret;
394
+ }
395
+ }
396
+ });
397
+
398
+ // ../../node_modules/isexe/index.js
399
+ var require_isexe = __commonJS({
400
+ "../../node_modules/isexe/index.js"(exports2, module2) {
401
+ "use strict";
402
+ var fs2 = require("fs");
403
+ var core;
404
+ if (process.platform === "win32" || global.TESTING_WINDOWS) {
405
+ core = require_windows();
406
+ } else {
407
+ core = require_mode();
408
+ }
409
+ module2.exports = isexe;
410
+ isexe.sync = sync;
411
+ function isexe(path5, options, cb) {
412
+ if (typeof options === "function") {
413
+ cb = options;
414
+ options = {};
415
+ }
416
+ if (!cb) {
417
+ if (typeof Promise !== "function") {
418
+ throw new TypeError("callback not provided");
419
+ }
420
+ return new Promise(function(resolve, reject) {
421
+ isexe(path5, options || {}, function(er, is) {
422
+ if (er) {
423
+ reject(er);
424
+ } else {
425
+ resolve(is);
426
+ }
427
+ });
428
+ });
429
+ }
430
+ core(path5, options || {}, function(er, is) {
431
+ if (er) {
432
+ if (er.code === "EACCES" || options && options.ignoreErrors) {
433
+ er = null;
434
+ is = false;
435
+ }
436
+ }
437
+ cb(er, is);
438
+ });
439
+ }
440
+ function sync(path5, options) {
441
+ try {
442
+ return core.sync(path5, options || {});
443
+ } catch (er) {
444
+ if (options && options.ignoreErrors || er.code === "EACCES") {
445
+ return false;
446
+ } else {
447
+ throw er;
448
+ }
449
+ }
450
+ }
451
+ }
452
+ });
453
+
454
+ // ../../node_modules/cross-spawn/node_modules/which/which.js
455
+ var require_which = __commonJS({
456
+ "../../node_modules/cross-spawn/node_modules/which/which.js"(exports2, module2) {
457
+ "use strict";
458
+ var isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
459
+ var path5 = require("path");
460
+ var COLON = isWindows ? ";" : ":";
461
+ var isexe = require_isexe();
462
+ var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
463
+ var getPathInfo = (cmd, opt) => {
464
+ const colon = opt.colon || COLON;
465
+ const pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? [""] : [
466
+ // windows always checks the cwd first
467
+ ...isWindows ? [process.cwd()] : [],
468
+ ...(opt.path || process.env.PATH || /* istanbul ignore next: very unusual */
469
+ "").split(colon)
470
+ ];
471
+ const pathExtExe = isWindows ? opt.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "";
472
+ const pathExt = isWindows ? pathExtExe.split(colon) : [""];
473
+ if (isWindows) {
474
+ if (cmd.indexOf(".") !== -1 && pathExt[0] !== "")
475
+ pathExt.unshift("");
476
+ }
477
+ return {
478
+ pathEnv,
479
+ pathExt,
480
+ pathExtExe
481
+ };
482
+ };
483
+ var which = (cmd, opt, cb) => {
484
+ if (typeof opt === "function") {
485
+ cb = opt;
486
+ opt = {};
487
+ }
488
+ if (!opt)
489
+ opt = {};
490
+ const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
491
+ const found = [];
492
+ const step = (i) => new Promise((resolve, reject) => {
493
+ if (i === pathEnv.length)
494
+ return opt.all && found.length ? resolve(found) : reject(getNotFoundError(cmd));
495
+ const ppRaw = pathEnv[i];
496
+ const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
497
+ const pCmd = path5.join(pathPart, cmd);
498
+ const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
499
+ resolve(subStep(p, i, 0));
500
+ });
501
+ const subStep = (p, i, ii) => new Promise((resolve, reject) => {
502
+ if (ii === pathExt.length)
503
+ return resolve(step(i + 1));
504
+ const ext = pathExt[ii];
505
+ isexe(p + ext, { pathExt: pathExtExe }, (er, is) => {
506
+ if (!er && is) {
507
+ if (opt.all)
508
+ found.push(p + ext);
509
+ else
510
+ return resolve(p + ext);
511
+ }
512
+ return resolve(subStep(p, i, ii + 1));
513
+ });
514
+ });
515
+ return cb ? step(0).then((res) => cb(null, res), cb) : step(0);
516
+ };
517
+ var whichSync = (cmd, opt) => {
518
+ opt = opt || {};
519
+ const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
520
+ const found = [];
521
+ for (let i = 0; i < pathEnv.length; i++) {
522
+ const ppRaw = pathEnv[i];
523
+ const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
524
+ const pCmd = path5.join(pathPart, cmd);
525
+ const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
526
+ for (let j = 0; j < pathExt.length; j++) {
527
+ const cur = p + pathExt[j];
528
+ try {
529
+ const is = isexe.sync(cur, { pathExt: pathExtExe });
530
+ if (is) {
531
+ if (opt.all)
532
+ found.push(cur);
533
+ else
534
+ return cur;
535
+ }
536
+ } catch (ex) {
537
+ }
538
+ }
539
+ }
540
+ if (opt.all && found.length)
541
+ return found;
542
+ if (opt.nothrow)
543
+ return null;
544
+ throw getNotFoundError(cmd);
545
+ };
546
+ module2.exports = which;
547
+ which.sync = whichSync;
548
+ }
549
+ });
550
+
551
+ // ../../node_modules/path-key/index.js
552
+ var require_path_key = __commonJS({
553
+ "../../node_modules/path-key/index.js"(exports2, module2) {
554
+ "use strict";
555
+ var pathKey = (options = {}) => {
556
+ const environment = options.env || process.env;
557
+ const platform = options.platform || process.platform;
558
+ if (platform !== "win32") {
559
+ return "PATH";
560
+ }
561
+ return Object.keys(environment).reverse().find((key) => key.toUpperCase() === "PATH") || "Path";
562
+ };
563
+ module2.exports = pathKey;
564
+ module2.exports.default = pathKey;
565
+ }
566
+ });
567
+
568
+ // ../../node_modules/cross-spawn/lib/util/resolveCommand.js
569
+ var require_resolveCommand = __commonJS({
570
+ "../../node_modules/cross-spawn/lib/util/resolveCommand.js"(exports2, module2) {
571
+ "use strict";
572
+ var path5 = require("path");
573
+ var which = require_which();
574
+ var getPathKey = require_path_key();
575
+ function resolveCommandAttempt(parsed, withoutPathExt) {
576
+ const env = parsed.options.env || process.env;
577
+ const cwd = process.cwd();
578
+ const hasCustomCwd = parsed.options.cwd != null;
579
+ const shouldSwitchCwd = hasCustomCwd && process.chdir !== void 0 && !process.chdir.disabled;
580
+ if (shouldSwitchCwd) {
581
+ try {
582
+ process.chdir(parsed.options.cwd);
583
+ } catch (err) {
584
+ }
585
+ }
586
+ let resolved;
587
+ try {
588
+ resolved = which.sync(parsed.command, {
589
+ path: env[getPathKey({ env })],
590
+ pathExt: withoutPathExt ? path5.delimiter : void 0
591
+ });
592
+ } catch (e) {
593
+ } finally {
594
+ if (shouldSwitchCwd) {
595
+ process.chdir(cwd);
596
+ }
597
+ }
598
+ if (resolved) {
599
+ resolved = path5.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
600
+ }
601
+ return resolved;
602
+ }
603
+ function resolveCommand(parsed) {
604
+ return resolveCommandAttempt(parsed) || resolveCommandAttempt(parsed, true);
605
+ }
606
+ module2.exports = resolveCommand;
607
+ }
608
+ });
609
+
610
+ // ../../node_modules/cross-spawn/lib/util/escape.js
611
+ var require_escape = __commonJS({
612
+ "../../node_modules/cross-spawn/lib/util/escape.js"(exports2, module2) {
613
+ "use strict";
614
+ var metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g;
615
+ function escapeCommand(arg) {
616
+ arg = arg.replace(metaCharsRegExp, "^$1");
617
+ return arg;
618
+ }
619
+ function escapeArgument(arg, doubleEscapeMetaChars) {
620
+ arg = `${arg}`;
621
+ arg = arg.replace(/(?=(\\+?)?)\1"/g, '$1$1\\"');
622
+ arg = arg.replace(/(?=(\\+?)?)\1$/, "$1$1");
623
+ arg = `"${arg}"`;
624
+ arg = arg.replace(metaCharsRegExp, "^$1");
625
+ if (doubleEscapeMetaChars) {
626
+ arg = arg.replace(metaCharsRegExp, "^$1");
627
+ }
628
+ return arg;
629
+ }
630
+ module2.exports.command = escapeCommand;
631
+ module2.exports.argument = escapeArgument;
632
+ }
633
+ });
634
+
635
+ // ../../node_modules/shebang-regex/index.js
636
+ var require_shebang_regex = __commonJS({
637
+ "../../node_modules/shebang-regex/index.js"(exports2, module2) {
638
+ "use strict";
639
+ module2.exports = /^#!(.*)/;
640
+ }
641
+ });
642
+
643
+ // ../../node_modules/shebang-command/index.js
644
+ var require_shebang_command = __commonJS({
645
+ "../../node_modules/shebang-command/index.js"(exports2, module2) {
646
+ "use strict";
647
+ var shebangRegex = require_shebang_regex();
648
+ module2.exports = (string = "") => {
649
+ const match = string.match(shebangRegex);
650
+ if (!match) {
651
+ return null;
652
+ }
653
+ const [path5, argument] = match[0].replace(/#! ?/, "").split(" ");
654
+ const binary = path5.split("/").pop();
655
+ if (binary === "env") {
656
+ return argument;
657
+ }
658
+ return argument ? `${binary} ${argument}` : binary;
659
+ };
660
+ }
661
+ });
662
+
663
+ // ../../node_modules/cross-spawn/lib/util/readShebang.js
664
+ var require_readShebang = __commonJS({
665
+ "../../node_modules/cross-spawn/lib/util/readShebang.js"(exports2, module2) {
666
+ "use strict";
667
+ var fs2 = require("fs");
668
+ var shebangCommand = require_shebang_command();
669
+ function readShebang(command) {
670
+ const size = 150;
671
+ const buffer = Buffer.alloc(size);
672
+ let fd;
673
+ try {
674
+ fd = fs2.openSync(command, "r");
675
+ fs2.readSync(fd, buffer, 0, size, 0);
676
+ fs2.closeSync(fd);
677
+ } catch (e) {
678
+ }
679
+ return shebangCommand(buffer.toString());
680
+ }
681
+ module2.exports = readShebang;
682
+ }
683
+ });
684
+
685
+ // ../../node_modules/cross-spawn/lib/parse.js
686
+ var require_parse = __commonJS({
687
+ "../../node_modules/cross-spawn/lib/parse.js"(exports2, module2) {
688
+ "use strict";
689
+ var path5 = require("path");
690
+ var resolveCommand = require_resolveCommand();
691
+ var escape = require_escape();
692
+ var readShebang = require_readShebang();
693
+ var isWin = process.platform === "win32";
694
+ var isExecutableRegExp = /\.(?:com|exe)$/i;
695
+ var isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
696
+ function detectShebang(parsed) {
697
+ parsed.file = resolveCommand(parsed);
698
+ const shebang = parsed.file && readShebang(parsed.file);
699
+ if (shebang) {
700
+ parsed.args.unshift(parsed.file);
701
+ parsed.command = shebang;
702
+ return resolveCommand(parsed);
703
+ }
704
+ return parsed.file;
705
+ }
706
+ function parseNonShell(parsed) {
707
+ if (!isWin) {
708
+ return parsed;
709
+ }
710
+ const commandFile = detectShebang(parsed);
711
+ const needsShell = !isExecutableRegExp.test(commandFile);
712
+ if (parsed.options.forceShell || needsShell) {
713
+ const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
714
+ parsed.command = path5.normalize(parsed.command);
715
+ parsed.command = escape.command(parsed.command);
716
+ parsed.args = parsed.args.map((arg) => escape.argument(arg, needsDoubleEscapeMetaChars));
717
+ const shellCommand = [parsed.command].concat(parsed.args).join(" ");
718
+ parsed.args = ["/d", "/s", "/c", `"${shellCommand}"`];
719
+ parsed.command = process.env.comspec || "cmd.exe";
720
+ parsed.options.windowsVerbatimArguments = true;
721
+ }
722
+ return parsed;
723
+ }
724
+ function parse2(command, args, options) {
725
+ if (args && !Array.isArray(args)) {
726
+ options = args;
727
+ args = null;
728
+ }
729
+ args = args ? args.slice(0) : [];
730
+ options = Object.assign({}, options);
731
+ const parsed = {
732
+ command,
733
+ args,
734
+ options,
735
+ file: void 0,
736
+ original: {
737
+ command,
738
+ args
739
+ }
740
+ };
741
+ return options.shell ? parsed : parseNonShell(parsed);
742
+ }
743
+ module2.exports = parse2;
744
+ }
745
+ });
746
+
747
+ // ../../node_modules/cross-spawn/lib/enoent.js
748
+ var require_enoent = __commonJS({
749
+ "../../node_modules/cross-spawn/lib/enoent.js"(exports2, module2) {
750
+ "use strict";
751
+ var isWin = process.platform === "win32";
752
+ function notFoundError(original, syscall) {
753
+ return Object.assign(new Error(`${syscall} ${original.command} ENOENT`), {
754
+ code: "ENOENT",
755
+ errno: "ENOENT",
756
+ syscall: `${syscall} ${original.command}`,
757
+ path: original.command,
758
+ spawnargs: original.args
759
+ });
760
+ }
761
+ function hookChildProcess(cp, parsed) {
762
+ if (!isWin) {
763
+ return;
764
+ }
765
+ const originalEmit = cp.emit;
766
+ cp.emit = function(name, arg1) {
767
+ if (name === "exit") {
768
+ const err = verifyENOENT(arg1, parsed);
769
+ if (err) {
770
+ return originalEmit.call(cp, "error", err);
771
+ }
772
+ }
773
+ return originalEmit.apply(cp, arguments);
774
+ };
775
+ }
776
+ function verifyENOENT(status, parsed) {
777
+ if (isWin && status === 1 && !parsed.file) {
778
+ return notFoundError(parsed.original, "spawn");
779
+ }
780
+ return null;
781
+ }
782
+ function verifyENOENTSync(status, parsed) {
783
+ if (isWin && status === 1 && !parsed.file) {
784
+ return notFoundError(parsed.original, "spawnSync");
785
+ }
786
+ return null;
787
+ }
788
+ module2.exports = {
789
+ hookChildProcess,
790
+ verifyENOENT,
791
+ verifyENOENTSync,
792
+ notFoundError
793
+ };
794
+ }
795
+ });
796
+
797
+ // ../../node_modules/cross-spawn/index.js
798
+ var require_cross_spawn = __commonJS({
799
+ "../../node_modules/cross-spawn/index.js"(exports2, module2) {
800
+ "use strict";
801
+ var cp = require("child_process");
802
+ var parse2 = require_parse();
803
+ var enoent = require_enoent();
804
+ function spawn3(command, args, options) {
805
+ const parsed = parse2(command, args, options);
806
+ const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
807
+ enoent.hookChildProcess(spawned, parsed);
808
+ return spawned;
809
+ }
810
+ function spawnSync(command, args, options) {
811
+ const parsed = parse2(command, args, options);
812
+ const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);
813
+ result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
814
+ return result;
815
+ }
816
+ module2.exports = spawn3;
817
+ module2.exports.spawn = spawn3;
818
+ module2.exports.sync = spawnSync;
819
+ module2.exports._parse = parse2;
820
+ module2.exports._enoent = enoent;
821
+ }
822
+ });
823
+
824
+ // src/index.ts
825
+ var import_minimist = __toESM(require_minimist());
826
+ var import_node_path4 = __toESM(require("path"));
827
+ var import_picocolors3 = __toESM(require_picocolors());
828
+
829
+ // src/utils.ts
830
+ var import_node_fs = require("fs");
831
+ var import_node_path = __toESM(require("path"));
832
+ var getPackageManager = () => {
833
+ if (process.env.npm_config_user_agent) {
834
+ const agent = process.env.npm_config_user_agent;
835
+ if (agent.startsWith("yarn")) return "yarn";
836
+ if (agent.startsWith("npm")) return "npm";
837
+ if (agent.startsWith("pnpm")) return "pnpm";
838
+ if (agent.startsWith("bun")) return "bun";
839
+ }
840
+ return "npm";
841
+ };
842
+ var addDependencies = async (projectDir, cfg) => {
843
+ const packageJsonPath = import_node_path.default.join(projectDir, "package.json");
844
+ const packageJson = JSON.parse((0, import_node_fs.readFileSync)(packageJsonPath, "utf8"));
845
+ const { dependencies, devDependencies } = cfg(packageJson);
846
+ if (devDependencies && devDependencies.length > 0) {
847
+ if (!packageJson.devDependencies) {
848
+ packageJson.devDependencies = {};
849
+ }
850
+ for (const dep of devDependencies) {
851
+ if (Array.isArray(dep)) {
852
+ packageJson.devDependencies[dep[0]] = dep[1];
853
+ } else {
854
+ packageJson.devDependencies[dep] = "latest";
855
+ }
856
+ }
857
+ }
858
+ if (!packageJson.dependencies) {
859
+ packageJson.dependencies = {};
860
+ }
861
+ for (const dep of dependencies) {
862
+ if (Array.isArray(dep)) {
863
+ packageJson.dependencies[dep[0]] = dep[1];
864
+ } else {
865
+ packageJson.dependencies[dep] = "latest";
866
+ }
867
+ }
868
+ (0, import_node_fs.writeFileSync)(packageJsonPath, JSON.stringify(packageJson, null, 2) + "\n");
869
+ };
870
+ var formatTargetDir = (targetDir) => targetDir?.trim().replace(/\/+$/g, "");
871
+
872
+ // src/modules/vite-react.ts
873
+ var import_cross_spawn = __toESM(require_cross_spawn());
874
+ var import_node_path2 = __toESM(require("path"));
875
+ var import_node_fs2 = require("fs");
876
+ var import_picocolors = __toESM(require_picocolors());
877
+ var buildRiverReactApp = async (cfg) => {
878
+ const result = await scaffoldViteReactApp(cfg);
879
+ if (result.signal === "SIGINT" || result.signal === "SIGTERM") {
880
+ console.log("\nOperation cancelled");
881
+ process.exit(1);
882
+ }
883
+ if (result.status !== 0) {
884
+ console.error(import_picocolors.default.red("\nFailed to scaffold project."));
885
+ process.exit(1);
886
+ }
887
+ console.log(import_picocolors.default.green("\nVite project created successfully."));
888
+ console.log(import_picocolors.default.blue("\nAdding River SDK dependencies..."));
889
+ await addDependencies(cfg.projectDir, () => ({
890
+ dependencies: ["@towns-protocol/react-sdk", "@towns-protocol/sdk"],
891
+ devDependencies: ["vite-plugin-node-polyfills"]
892
+ }));
893
+ console.log(import_picocolors.default.green("\nRiver SDK dependencies added successfully."));
894
+ console.log(import_picocolors.default.blue("\nUpdating vite.config.ts..."));
895
+ await updateViteConfigWithPolyfills(cfg);
896
+ console.log(import_picocolors.default.green("\nvite.config.ts updated successfully."));
897
+ };
898
+ var scaffoldViteReactApp = async (cfg) => {
899
+ const { targetDir, packageName, viteTemplate = "react-ts" } = cfg;
900
+ const pkgManager = getPackageManager();
901
+ const createViteCommand = (() => {
902
+ const nameForViteScript = targetDir === "." ? "." : packageName;
903
+ switch (pkgManager) {
904
+ case "yarn":
905
+ return ["create", "vite", nameForViteScript, "--template", viteTemplate];
906
+ case "pnpm":
907
+ return ["create", "vite", nameForViteScript, "--template", viteTemplate];
908
+ case "bun":
909
+ return ["create", "vite", nameForViteScript, "--template", viteTemplate];
910
+ default:
911
+ return [
912
+ "create",
913
+ "vite@latest",
914
+ nameForViteScript,
915
+ "--",
916
+ "--template",
917
+ viteTemplate
918
+ ];
919
+ }
920
+ })();
921
+ return import_cross_spawn.default.sync(pkgManager, createViteCommand, { stdio: "inherit" });
922
+ };
923
+ var updateViteConfigWithPolyfills = async (cfg) => {
924
+ const { projectDir, viteTemplate } = cfg;
925
+ const isJsTemplate = viteTemplate === "react";
926
+ const viteConfigPath = import_node_path2.default.join(projectDir, isJsTemplate ? "vite.config.js" : "vite.config.ts");
927
+ let viteConfig = (0, import_node_fs2.readFileSync)(viteConfigPath, "utf8");
928
+ viteConfig = `import { nodePolyfills } from 'vite-plugin-node-polyfills'
929
+ ${viteConfig}`;
930
+ viteConfig = viteConfig.replace(/plugins:\s*\[([\s\S]*?)\]/, (_, pluginsContent) => {
931
+ const trimmedContent = pluginsContent.trim();
932
+ const separator = trimmedContent ? ",\n " : "";
933
+ return `plugins: [${pluginsContent}${separator}nodePolyfills()
934
+ ]`;
935
+ });
936
+ (0, import_node_fs2.writeFileSync)(viteConfigPath, viteConfig);
937
+ };
938
+
939
+ // src/modules/clone-playground.ts
940
+ var import_cross_spawn2 = __toESM(require_cross_spawn());
941
+ var import_node_path3 = __toESM(require("path"));
942
+ var import_picocolors2 = __toESM(require_picocolors());
943
+ var import_node_fs3 = __toESM(require("fs"));
944
+ var jsoncParser = __toESM(require("jsonc-parser"));
945
+ var clonePlayground = async (cfg) => {
946
+ console.log(import_picocolors2.default.blue("\nCloning Towns Protocol Playground..."));
947
+ const result = await cloneRepo(cfg);
948
+ if (!result) return;
949
+ if (result?.signal === "SIGINT" || result?.signal === "SIGTERM") {
950
+ console.log("\nOperation cancelled");
951
+ process.exit(1);
952
+ }
953
+ if (result && result.status !== 0) {
954
+ console.error(import_picocolors2.default.red("\nFailed to clone playground."));
955
+ process.exit(1);
956
+ }
957
+ console.log(import_picocolors2.default.green("\nPlayground cloned successfully."));
958
+ console.log(import_picocolors2.default.blue("\nUpdating dependencies..."));
959
+ await updateDependencies(cfg);
960
+ console.log(import_picocolors2.default.green("\nDependencies updated successfully."));
961
+ await fixTsConfig(cfg);
962
+ import_cross_spawn2.default.sync("git", ["init"], {
963
+ stdio: "inherit",
964
+ cwd: cfg.targetDir
965
+ });
966
+ };
967
+ var cloneRepo = async (cfg) => {
968
+ const { targetDir } = cfg;
969
+ const tempDir = `${targetDir}-temp`;
970
+ const latestSdkTag = getLatestSdkTag();
971
+ if (!latestSdkTag) {
972
+ console.error(import_picocolors2.default.red("\nFailed to get latest SDK tag."));
973
+ return;
974
+ }
975
+ const cloneResult = import_cross_spawn2.default.sync(
976
+ "git",
977
+ [
978
+ "clone",
979
+ "--no-checkout",
980
+ "--depth",
981
+ "1",
982
+ "--sparse",
983
+ "--branch",
984
+ latestSdkTag,
985
+ "https://github.com/towns-protocol/towns.git",
986
+ tempDir
987
+ ],
988
+ { stdio: "inherit" }
989
+ );
990
+ if (cloneResult.status !== 0) return cloneResult;
991
+ const sparseResult = import_cross_spawn2.default.sync("git", ["sparse-checkout", "set", "packages/playground"], {
992
+ stdio: "inherit",
993
+ cwd: tempDir
994
+ });
995
+ if (sparseResult.status !== 0) return sparseResult;
996
+ const checkoutResult = import_cross_spawn2.default.sync("git", ["checkout"], {
997
+ stdio: "inherit",
998
+ cwd: tempDir
999
+ });
1000
+ if (checkoutResult.status !== 0) return checkoutResult;
1001
+ const playgroundDir = import_node_path3.default.join(tempDir, "packages/playground");
1002
+ const baseTsConfigPath = import_node_path3.default.join(tempDir, "packages/tsconfig.base.json");
1003
+ if (!import_node_fs3.default.existsSync(playgroundDir)) {
1004
+ console.error(import_picocolors2.default.red(`
1005
+ Playground directory not found at ${playgroundDir}`));
1006
+ return;
1007
+ }
1008
+ import_node_fs3.default.mkdirSync(targetDir, { recursive: true });
1009
+ import_node_fs3.default.cpSync(playgroundDir, targetDir, { recursive: true });
1010
+ if (import_node_fs3.default.existsSync(baseTsConfigPath)) {
1011
+ import_node_fs3.default.copyFileSync(baseTsConfigPath, import_node_path3.default.join(targetDir, "tsconfig.base.json"));
1012
+ }
1013
+ import_node_fs3.default.rmSync(tempDir, { recursive: true, force: true });
1014
+ return checkoutResult;
1015
+ };
1016
+ var updateDependencies = async (cfg) => {
1017
+ const { projectDir } = cfg;
1018
+ await addDependencies(projectDir, (json) => {
1019
+ const allTownsProtocolDeps = Object.keys(json.dependencies).filter(
1020
+ (dep) => dep.startsWith("@towns-protocol")
1021
+ );
1022
+ const allTownsProtocolDevDeps = Object.keys(json.devDependencies).filter(
1023
+ (dep) => dep.startsWith("@towns-protocol")
1024
+ );
1025
+ return {
1026
+ dependencies: allTownsProtocolDeps,
1027
+ devDependencies: [
1028
+ ...allTownsProtocolDevDeps,
1029
+ // hardcoded for now. if we add ^ in front of the version (e.g. ^5.1.6)
1030
+ // it will make npm install to get the latest 5.x.x
1031
+ ["typescript", "5.1.6"]
1032
+ ]
1033
+ };
1034
+ });
1035
+ };
1036
+ var fixTsConfig = async (cfg) => {
1037
+ const { projectDir } = cfg;
1038
+ const tsConfigPath = import_node_path3.default.join(projectDir, "tsconfig.json");
1039
+ if (import_node_fs3.default.existsSync(tsConfigPath)) {
1040
+ const tsConfigContent = import_node_fs3.default.readFileSync(tsConfigPath, "utf8");
1041
+ const tsConfig = jsoncParser.parse(tsConfigContent);
1042
+ if (tsConfig.extends === "./../tsconfig.base.json") {
1043
+ const edits = jsoncParser.modify(tsConfigContent, ["extends"], "./tsconfig.base.json", {
1044
+ formattingOptions: { tabSize: 2 }
1045
+ });
1046
+ const updatedContent = jsoncParser.applyEdits(tsConfigContent, edits);
1047
+ import_node_fs3.default.writeFileSync(tsConfigPath, updatedContent);
1048
+ }
1049
+ }
1050
+ };
1051
+ function getLatestSdkTag() {
1052
+ const tagsResult = import_cross_spawn2.default.sync(
1053
+ "git",
1054
+ ["ls-remote", "--tags", "https://github.com/towns-protocol/towns.git", "sdk-*"],
1055
+ { encoding: "utf8" }
1056
+ );
1057
+ if (tagsResult.status !== 0 || !tagsResult.stdout) return null;
1058
+ const tags = tagsResult.stdout.split("\n").filter(Boolean).map((line) => {
1059
+ const [_hash, ref] = line.split(" ");
1060
+ const tag = ref.replace("refs/tags/", "").replace(/\^{}$/, "");
1061
+ const match = tag.match(/^sdk-[0-9a-f]+-(\d+)\.(\d+)\.(\d+)$/);
1062
+ if (!match) return null;
1063
+ return {
1064
+ tag,
1065
+ version: [parseInt(match[1]), parseInt(match[2]), parseInt(match[3])]
1066
+ };
1067
+ }).filter(
1068
+ (item) => item !== null && Array.isArray(item.version) && item.version.length === 3
1069
+ ).sort((a, b) => {
1070
+ for (let i = 0; i < 3; i++) {
1071
+ if (a.version[i] !== b.version[i]) {
1072
+ return b.version[i] - a.version[i];
1073
+ }
1074
+ }
1075
+ return 0;
1076
+ });
1077
+ return tags.length > 0 ? tags[0].tag : null;
1078
+ }
1079
+
1080
+ // src/index.ts
1081
+ var argv = (0, import_minimist.default)(process.argv.slice(2), {
1082
+ default: { help: false, template: "playground" },
1083
+ alias: { h: "help", t: "template" },
1084
+ string: ["_"]
1085
+ });
1086
+ var helpMessage = `Usage: create-towns-protocol-app [OPTION]... [DIRECTORY]
1087
+
1088
+ Create a new Towns Protocol app.
1089
+ With no arguments, creates a new app in the current directory.
1090
+
1091
+ Options:
1092
+ -t, --template NAME use a specific template
1093
+
1094
+ Available templates:
1095
+ ${import_picocolors3.default.yellow("react-ts react playground")}
1096
+ `;
1097
+ var build = {
1098
+ "react-ts": buildRiverReactApp,
1099
+ react: buildRiverReactApp,
1100
+ playground: clonePlayground
1101
+ };
1102
+ async function init() {
1103
+ const targetDir = formatTargetDir(argv._[0]) || ".";
1104
+ const packageName = targetDir === "." ? import_node_path4.default.basename(process.cwd()) : targetDir;
1105
+ const projectDir = targetDir === "." ? process.cwd() : import_node_path4.default.join(process.cwd(), targetDir);
1106
+ const pkgManager = getPackageManager();
1107
+ const template = argv.template || argv.t;
1108
+ const help = argv.help;
1109
+ if (help) {
1110
+ console.log(helpMessage);
1111
+ return;
1112
+ }
1113
+ console.log(import_picocolors3.default.blue(`
1114
+ Scaffolding project in ${packageName}...`));
1115
+ await build[template]({
1116
+ projectDir,
1117
+ packageName,
1118
+ targetDir,
1119
+ viteTemplate: template !== "playground" ? template : void 0
1120
+ });
1121
+ console.log(import_picocolors3.default.green("\nDone! \u{1F389}"));
1122
+ console.log(import_picocolors3.default.blue("\nNow run: cd " + targetDir + " && " + pkgManager + ` install`));
1123
+ console.log(import_picocolors3.default.blue("\nThen run: " + pkgManager + " dev"));
1124
+ }
1125
+ init().catch((e) => {
1126
+ console.error(e);
1127
+ process.exit(1);
1128
+ });
1129
+ //# sourceMappingURL=index.js.map