@nemo-cli/shared 0.1.3 → 0.1.5
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/adapters-C49sidhk.js +246 -0
- package/dist/adapters-C49sidhk.js.map +1 -0
- package/dist/adapters-CRVRGWT9.js +246 -0
- package/dist/adapters-CRVRGWT9.js.map +1 -0
- package/dist/adapters-VexOYXht.js +234 -0
- package/dist/adapters-VexOYXht.js.map +1 -0
- package/dist/index.d.ts +323 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1335 -265
- package/dist/index.js.map +1 -1
- package/dist/prompts-BpcevOrt.js +380 -0
- package/dist/prompts-BpcevOrt.js.map +1 -0
- package/package.json +5 -6
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
|
-
import path, { dirname as dirname$1, resolve } from "node:path";
|
|
2
|
+
import path, { basename, dirname as dirname$1, join, parse, resolve } from "node:path";
|
|
3
3
|
import fse from "fs-extra";
|
|
4
4
|
import { glob as glob$1 } from "glob";
|
|
5
5
|
import { cancel, confirm, group, groupMultiselect, intro, isCancel, log as log$1, multiselect, note, outro, progress, select, spinner, stream, taskLog, tasks, text } from "@clack/prompts";
|
|
@@ -7,20 +7,19 @@ import ansiEscapes, { clearScreen as clearScreen$1, clearTerminal as clearTermin
|
|
|
7
7
|
import chalk, { default as colors } from "chalk";
|
|
8
8
|
import winston from "winston";
|
|
9
9
|
import { fileURLToPath } from "node:url";
|
|
10
|
-
import {
|
|
11
|
-
import open, { apps, openApp } from "open";
|
|
10
|
+
import fs, { existsSync } from "node:fs";
|
|
12
11
|
import process$1 from "node:process";
|
|
12
|
+
import fs$1 from "node:fs/promises";
|
|
13
13
|
import { Command } from "commander";
|
|
14
14
|
import { x as x$1 } from "tinyexec";
|
|
15
15
|
import { $ } from "zx";
|
|
16
16
|
import { ErrorMessage } from "@nemo-cli/ui";
|
|
17
|
-
import { existsSync } from "node:fs";
|
|
18
|
-
import { homedir } from "node:os";
|
|
19
|
-
import Configstore from "configstore";
|
|
20
17
|
import { search } from "@inquirer/prompts";
|
|
21
18
|
import Fuse from "fuse.js";
|
|
19
|
+
import open, { apps, openApp } from "open";
|
|
20
|
+
import { homedir } from "node:os";
|
|
21
|
+
import Configstore from "configstore";
|
|
22
22
|
import instance, { spinners } from "ora";
|
|
23
|
-
import fs from "node:fs/promises";
|
|
24
23
|
import yaml from "yaml";
|
|
25
24
|
|
|
26
25
|
//#region \0rolldown/runtime.js
|
|
@@ -201,9 +200,520 @@ const log = {
|
|
|
201
200
|
const filename = (importMate) => fileURLToPath(importMate.url);
|
|
202
201
|
const dirname = (importMate) => dirname$1(filename(importMate));
|
|
203
202
|
const cwdPathname = (dirname) => resolve(process.cwd(), dirname);
|
|
203
|
+
/**
|
|
204
|
+
* Join path segments and resolve to absolute path from current working directory
|
|
205
|
+
* @param segments - Path segments to join
|
|
206
|
+
* @returns Absolute path
|
|
207
|
+
*
|
|
208
|
+
* @example
|
|
209
|
+
* joinPath('packages', 'workspace', 'package.json')
|
|
210
|
+
* // Returns: /Users/user/project/packages/workspace/package.json
|
|
211
|
+
*/
|
|
212
|
+
const joinPath = (...segments) => resolve(process.cwd(), join(...segments));
|
|
204
213
|
const REGEXP_SPLIT_NAMES = /\W+/gm;
|
|
205
214
|
const parseNames = (names) => names.split(REGEXP_SPLIT_NAMES);
|
|
206
215
|
|
|
216
|
+
//#endregion
|
|
217
|
+
//#region ../../node_modules/.pnpm/unconfig@7.4.2/node_modules/unconfig/dist/dist-A9poGcY_.mjs
|
|
218
|
+
function toArray(array) {
|
|
219
|
+
array = array ?? [];
|
|
220
|
+
return Array.isArray(array) ? array : [array];
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
//#endregion
|
|
224
|
+
//#region ../../node_modules/.pnpm/quansync@1.0.0/node_modules/quansync/dist/src-C2Pm6gXo.js
|
|
225
|
+
const GET_IS_ASYNC = Symbol.for("quansync.getIsAsync");
|
|
226
|
+
var QuansyncError = class extends Error {
|
|
227
|
+
constructor(message = "Unexpected promise in sync context") {
|
|
228
|
+
super(message);
|
|
229
|
+
this.name = "QuansyncError";
|
|
230
|
+
}
|
|
231
|
+
};
|
|
232
|
+
function isThenable(value) {
|
|
233
|
+
return value && typeof value === "object" && typeof value.then === "function";
|
|
234
|
+
}
|
|
235
|
+
function isQuansyncGenerator(value) {
|
|
236
|
+
return value && typeof value === "object" && typeof value[Symbol.iterator] === "function" && "__quansync" in value;
|
|
237
|
+
}
|
|
238
|
+
function fromObject(options) {
|
|
239
|
+
const generator = function* (...args) {
|
|
240
|
+
if (yield GET_IS_ASYNC) return yield options.async.apply(this, args);
|
|
241
|
+
return options.sync.apply(this, args);
|
|
242
|
+
};
|
|
243
|
+
function fn(...args) {
|
|
244
|
+
const iter = generator.apply(this, args);
|
|
245
|
+
iter.then = (...thenArgs) => options.async.apply(this, args).then(...thenArgs);
|
|
246
|
+
iter.__quansync = true;
|
|
247
|
+
return iter;
|
|
248
|
+
}
|
|
249
|
+
fn.sync = options.sync;
|
|
250
|
+
fn.async = options.async;
|
|
251
|
+
return fn;
|
|
252
|
+
}
|
|
253
|
+
function fromPromise(promise) {
|
|
254
|
+
return fromObject({
|
|
255
|
+
async: () => Promise.resolve(promise),
|
|
256
|
+
sync: () => {
|
|
257
|
+
if (isThenable(promise)) throw new QuansyncError();
|
|
258
|
+
return promise;
|
|
259
|
+
}
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
function unwrapYield(value, isAsync) {
|
|
263
|
+
if (value === GET_IS_ASYNC) return isAsync;
|
|
264
|
+
if (isQuansyncGenerator(value)) return isAsync ? iterateAsync(value) : iterateSync(value);
|
|
265
|
+
if (!isAsync && isThenable(value)) throw new QuansyncError();
|
|
266
|
+
return value;
|
|
267
|
+
}
|
|
268
|
+
const DEFAULT_ON_YIELD = (value) => value;
|
|
269
|
+
function iterateSync(generator, onYield = DEFAULT_ON_YIELD) {
|
|
270
|
+
let current = generator.next();
|
|
271
|
+
while (!current.done) try {
|
|
272
|
+
current = generator.next(unwrapYield(onYield(current.value, false)));
|
|
273
|
+
} catch (err) {
|
|
274
|
+
current = generator.throw(err);
|
|
275
|
+
}
|
|
276
|
+
return unwrapYield(current.value);
|
|
277
|
+
}
|
|
278
|
+
async function iterateAsync(generator, onYield = DEFAULT_ON_YIELD) {
|
|
279
|
+
let current = generator.next();
|
|
280
|
+
while (!current.done) try {
|
|
281
|
+
current = generator.next(await unwrapYield(onYield(current.value, true), true));
|
|
282
|
+
} catch (err) {
|
|
283
|
+
current = generator.throw(err);
|
|
284
|
+
}
|
|
285
|
+
return current.value;
|
|
286
|
+
}
|
|
287
|
+
function fromGeneratorFn(generatorFn, options) {
|
|
288
|
+
return fromObject({
|
|
289
|
+
name: generatorFn.name,
|
|
290
|
+
async(...args) {
|
|
291
|
+
return iterateAsync(generatorFn.apply(this, args), options?.onYield);
|
|
292
|
+
},
|
|
293
|
+
sync(...args) {
|
|
294
|
+
return iterateSync(generatorFn.apply(this, args), options?.onYield);
|
|
295
|
+
}
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
function quansync$1(input, options) {
|
|
299
|
+
if (isThenable(input)) return fromPromise(input);
|
|
300
|
+
if (typeof input === "function") return fromGeneratorFn(input, options);
|
|
301
|
+
else return fromObject(input);
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* @returns `true` if the current context is async, `false` otherwise.
|
|
305
|
+
*/
|
|
306
|
+
const getIsAsync = quansync$1({
|
|
307
|
+
async: () => Promise.resolve(true),
|
|
308
|
+
sync: () => false
|
|
309
|
+
});
|
|
310
|
+
|
|
311
|
+
//#endregion
|
|
312
|
+
//#region ../../node_modules/.pnpm/@quansync+fs@1.0.0/node_modules/@quansync/fs/dist/index.mjs
|
|
313
|
+
/**
|
|
314
|
+
* @link https://nodejs.org/api/fs.html#fspromisesreadfilepath-options
|
|
315
|
+
*/
|
|
316
|
+
const readFile$1 = quansync$1({
|
|
317
|
+
sync: fs.readFileSync,
|
|
318
|
+
async: fs.promises.readFile
|
|
319
|
+
});
|
|
320
|
+
/**
|
|
321
|
+
* @link https://nodejs.org/api/fs.html#fspromiseswritefilefile-data-options
|
|
322
|
+
*/
|
|
323
|
+
const writeFile = quansync$1({
|
|
324
|
+
sync: fs.writeFileSync,
|
|
325
|
+
async: fs.promises.writeFile
|
|
326
|
+
});
|
|
327
|
+
/**
|
|
328
|
+
* @link https://nodejs.org/api/fs.html#fspromisesunlinkpath
|
|
329
|
+
*/
|
|
330
|
+
const unlink = quansync$1({
|
|
331
|
+
sync: fs.unlinkSync,
|
|
332
|
+
async: fs.promises.unlink
|
|
333
|
+
});
|
|
334
|
+
/**
|
|
335
|
+
* @link https://nodejs.org/api/fs.html#fspromisesaccesspath-mode
|
|
336
|
+
*/
|
|
337
|
+
const access = quansync$1({
|
|
338
|
+
sync: fs.accessSync,
|
|
339
|
+
async: fs.promises.access
|
|
340
|
+
});
|
|
341
|
+
/**
|
|
342
|
+
* @link https://nodejs.org/api/fs.html#fspromisesstatpath-options
|
|
343
|
+
*/
|
|
344
|
+
const stat = quansync$1({
|
|
345
|
+
sync: fs.statSync,
|
|
346
|
+
async: fs.promises.stat
|
|
347
|
+
});
|
|
348
|
+
const lstat = quansync$1({
|
|
349
|
+
sync: fs.lstatSync,
|
|
350
|
+
async: fs.promises.lstat
|
|
351
|
+
});
|
|
352
|
+
/**
|
|
353
|
+
* @link https://nodejs.org/api/fs.html#fspromisescpsrc-dest-options
|
|
354
|
+
*/
|
|
355
|
+
const cp = quansync$1({
|
|
356
|
+
sync: fs.copyFileSync,
|
|
357
|
+
async: fs.promises.copyFile
|
|
358
|
+
});
|
|
359
|
+
/**
|
|
360
|
+
* @link https://nodejs.org/api/fs.html#fspromisesrmpath-options
|
|
361
|
+
*/
|
|
362
|
+
const rm = quansync$1({
|
|
363
|
+
sync: fs.rmSync,
|
|
364
|
+
async: fs.promises.rm
|
|
365
|
+
});
|
|
366
|
+
/**
|
|
367
|
+
* @link https://nodejs.org/api/fs.html#fspromisesmkdirpath-options
|
|
368
|
+
*/
|
|
369
|
+
const mkdir = quansync$1({
|
|
370
|
+
sync: fs.mkdirSync,
|
|
371
|
+
async: fs.promises.mkdir
|
|
372
|
+
});
|
|
373
|
+
/**
|
|
374
|
+
* @link https://nodejs.org/api/fs.html#fspromisesrenameoldpath-newpath
|
|
375
|
+
*/
|
|
376
|
+
const rename = quansync$1({
|
|
377
|
+
sync: fs.renameSync,
|
|
378
|
+
async: fs.promises.rename
|
|
379
|
+
});
|
|
380
|
+
/**
|
|
381
|
+
* @link https://nodejs.org/api/fs.html#fspromisesreaddirpath-options
|
|
382
|
+
*/
|
|
383
|
+
const readdir = quansync$1({
|
|
384
|
+
sync: fs.readdirSync,
|
|
385
|
+
async: fs.promises.readdir
|
|
386
|
+
});
|
|
387
|
+
/**
|
|
388
|
+
* @link https://nodejs.org/api/fs.html#fspromisesrealpathpath-options
|
|
389
|
+
*/
|
|
390
|
+
const realpath = quansync$1({
|
|
391
|
+
sync: fs.realpathSync,
|
|
392
|
+
async: fs.promises.realpath
|
|
393
|
+
});
|
|
394
|
+
/**
|
|
395
|
+
* @link https://nodejs.org/api/fs.html#fspromisesreadlinkpath-options
|
|
396
|
+
*/
|
|
397
|
+
const readlink = quansync$1({
|
|
398
|
+
sync: fs.readlinkSync,
|
|
399
|
+
async: fs.promises.readlink
|
|
400
|
+
});
|
|
401
|
+
/**
|
|
402
|
+
* @link https://nodejs.org/api/fs.html#fspromisessymlinktarget-path-type
|
|
403
|
+
*/
|
|
404
|
+
const symlink = quansync$1({
|
|
405
|
+
sync: fs.symlinkSync,
|
|
406
|
+
async: fs.promises.symlink
|
|
407
|
+
});
|
|
408
|
+
/**
|
|
409
|
+
* @link https://nodejs.org/api/fs.html#fspromiseschownpath-uid-gid
|
|
410
|
+
*/
|
|
411
|
+
const chown = quansync$1({
|
|
412
|
+
sync: fs.chownSync,
|
|
413
|
+
async: fs.promises.chown
|
|
414
|
+
});
|
|
415
|
+
/**
|
|
416
|
+
* @link https://nodejs.org/api/fs.html#fspromiseslchownpath-uid-gid
|
|
417
|
+
*/
|
|
418
|
+
const lchown = quansync$1({
|
|
419
|
+
sync: fs.lchownSync,
|
|
420
|
+
async: fs.promises.lchown
|
|
421
|
+
});
|
|
422
|
+
/**
|
|
423
|
+
* @link https://nodejs.org/api/fs.html#fspromiseschmodpath-mode
|
|
424
|
+
*/
|
|
425
|
+
const chmod = quansync$1({
|
|
426
|
+
sync: fs.chmodSync,
|
|
427
|
+
async: fs.promises.chmod
|
|
428
|
+
});
|
|
429
|
+
/**
|
|
430
|
+
* @link https://nodejs.org/api/fs.html#fspromisesutimespath-atime-mtime
|
|
431
|
+
*/
|
|
432
|
+
const utimes = quansync$1({
|
|
433
|
+
sync: fs.utimesSync,
|
|
434
|
+
async: fs.promises.utimes
|
|
435
|
+
});
|
|
436
|
+
/**
|
|
437
|
+
* @link https://nodejs.org/api/fs.html#fspromiseslutimespath-atime-mtime
|
|
438
|
+
*/
|
|
439
|
+
const lutimes = quansync$1({
|
|
440
|
+
sync: fs.lutimesSync,
|
|
441
|
+
async: fs.promises.lutimes
|
|
442
|
+
});
|
|
443
|
+
/**
|
|
444
|
+
* @link https://nodejs.org/api/fs.html#fspromisesmkdtempprefix-options
|
|
445
|
+
*/
|
|
446
|
+
const mkdtemp = quansync$1({
|
|
447
|
+
sync: fs.mkdtempSync,
|
|
448
|
+
async: fs.promises.mkdtemp
|
|
449
|
+
});
|
|
450
|
+
|
|
451
|
+
//#endregion
|
|
452
|
+
//#region ../../node_modules/.pnpm/defu@6.1.4/node_modules/defu/dist/defu.mjs
|
|
453
|
+
function isPlainObject$2(value) {
|
|
454
|
+
if (value === null || typeof value !== "object") return false;
|
|
455
|
+
const prototype = Object.getPrototypeOf(value);
|
|
456
|
+
if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) return false;
|
|
457
|
+
if (Symbol.iterator in value) return false;
|
|
458
|
+
if (Symbol.toStringTag in value) return Object.prototype.toString.call(value) === "[object Module]";
|
|
459
|
+
return true;
|
|
460
|
+
}
|
|
461
|
+
function _defu(baseObject, defaults, namespace = ".", merger) {
|
|
462
|
+
if (!isPlainObject$2(defaults)) return _defu(baseObject, {}, namespace, merger);
|
|
463
|
+
const object = Object.assign({}, defaults);
|
|
464
|
+
for (const key in baseObject) {
|
|
465
|
+
if (key === "__proto__" || key === "constructor") continue;
|
|
466
|
+
const value = baseObject[key];
|
|
467
|
+
if (value === null || value === void 0) continue;
|
|
468
|
+
if (merger && merger(object, key, value, namespace)) continue;
|
|
469
|
+
if (Array.isArray(value) && Array.isArray(object[key])) object[key] = [...value, ...object[key]];
|
|
470
|
+
else if (isPlainObject$2(value) && isPlainObject$2(object[key])) object[key] = _defu(value, object[key], (namespace ? `${namespace}.` : "") + key.toString(), merger);
|
|
471
|
+
else object[key] = value;
|
|
472
|
+
}
|
|
473
|
+
return object;
|
|
474
|
+
}
|
|
475
|
+
function createDefu(merger) {
|
|
476
|
+
return (...arguments_) => arguments_.reduce((p, c) => _defu(p, c, "", merger), {});
|
|
477
|
+
}
|
|
478
|
+
const defu = createDefu();
|
|
479
|
+
const defuFn = createDefu((object, key, currentValue) => {
|
|
480
|
+
if (object[key] !== void 0 && typeof currentValue === "function") {
|
|
481
|
+
object[key] = currentValue(object[key]);
|
|
482
|
+
return true;
|
|
483
|
+
}
|
|
484
|
+
});
|
|
485
|
+
const defuArrayFn = createDefu((object, key, currentValue) => {
|
|
486
|
+
if (Array.isArray(object[key]) && typeof currentValue === "function") {
|
|
487
|
+
object[key] = currentValue(object[key]);
|
|
488
|
+
return true;
|
|
489
|
+
}
|
|
490
|
+
});
|
|
491
|
+
|
|
492
|
+
//#endregion
|
|
493
|
+
//#region ../../node_modules/.pnpm/quansync@1.0.0/node_modules/quansync/dist/macro.js
|
|
494
|
+
/**
|
|
495
|
+
* This function is equivalent to `quansync` from main entry
|
|
496
|
+
* but accepts a fake argument type of async functions.
|
|
497
|
+
*
|
|
498
|
+
* This requires to be used with the macro transformer `unplugin-quansync`.
|
|
499
|
+
* Do NOT use it directly.
|
|
500
|
+
*
|
|
501
|
+
* @internal
|
|
502
|
+
*/
|
|
503
|
+
const quansync = quansync$1;
|
|
504
|
+
|
|
505
|
+
//#endregion
|
|
506
|
+
//#region ../../node_modules/.pnpm/unconfig-core@7.4.2/node_modules/unconfig-core/dist/index.mjs
|
|
507
|
+
const isFile = quansync(function* (path, allowSymlinks) {
|
|
508
|
+
try {
|
|
509
|
+
return (yield (allowSymlinks ? stat : lstat)(path)).isFile();
|
|
510
|
+
} catch {
|
|
511
|
+
return false;
|
|
512
|
+
}
|
|
513
|
+
});
|
|
514
|
+
const findUp = quansync(function* (paths, options = {}) {
|
|
515
|
+
const { cwd = process$1.cwd(), stopAt = parse(cwd).root, multiple = false, allowSymlinks = true } = options;
|
|
516
|
+
let current = cwd;
|
|
517
|
+
const files = [];
|
|
518
|
+
while (current && current !== stopAt) {
|
|
519
|
+
for (const path of paths) {
|
|
520
|
+
const filepath = resolve(current, path);
|
|
521
|
+
if (yield isFile(filepath, allowSymlinks)) {
|
|
522
|
+
files.push(filepath);
|
|
523
|
+
if (!multiple) return files;
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
const parent = dirname$1(current);
|
|
527
|
+
if (parent === current) break;
|
|
528
|
+
current = parent;
|
|
529
|
+
}
|
|
530
|
+
return files;
|
|
531
|
+
});
|
|
532
|
+
const loadConfigFile$1 = quansync(function* (filepath, source) {
|
|
533
|
+
try {
|
|
534
|
+
const config = yield source.parser(filepath);
|
|
535
|
+
if (!config) return;
|
|
536
|
+
return {
|
|
537
|
+
config,
|
|
538
|
+
source: filepath
|
|
539
|
+
};
|
|
540
|
+
} catch (e) {
|
|
541
|
+
if (source.skipOnError) return;
|
|
542
|
+
throw e;
|
|
543
|
+
}
|
|
544
|
+
});
|
|
545
|
+
function createConfigCoreLoader(options) {
|
|
546
|
+
const { cwd = process$1.cwd(), multiple, sources } = options;
|
|
547
|
+
const results = [];
|
|
548
|
+
let matchedFiles;
|
|
549
|
+
const findConfigs = quansync(function* () {
|
|
550
|
+
if (matchedFiles == null) matchedFiles = [];
|
|
551
|
+
matchedFiles.length = 0;
|
|
552
|
+
for (const source of sources) {
|
|
553
|
+
const { extensions } = source;
|
|
554
|
+
const files = yield findUp(source.files.flatMap((file) => !extensions?.length ? [file] : extensions.map((ext) => ext ? `${file}.${ext}` : file)), {
|
|
555
|
+
cwd,
|
|
556
|
+
stopAt: options.stopAt,
|
|
557
|
+
multiple
|
|
558
|
+
});
|
|
559
|
+
matchedFiles.push([source, files]);
|
|
560
|
+
}
|
|
561
|
+
return matchedFiles.flatMap((i) => i[1]);
|
|
562
|
+
});
|
|
563
|
+
return {
|
|
564
|
+
load: quansync(function* (force = false) {
|
|
565
|
+
if (matchedFiles == null || force) yield findConfigs();
|
|
566
|
+
for (const [source, files] of matchedFiles) {
|
|
567
|
+
if (!files.length) continue;
|
|
568
|
+
if (!multiple) {
|
|
569
|
+
const result = yield loadConfigFile$1(files[0], source);
|
|
570
|
+
if (result) return [result];
|
|
571
|
+
} else for (const file of files) {
|
|
572
|
+
const result = yield loadConfigFile$1(file, source);
|
|
573
|
+
if (result) results.push(result);
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
return results;
|
|
577
|
+
}),
|
|
578
|
+
findConfigs
|
|
579
|
+
};
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
//#endregion
|
|
583
|
+
//#region ../../node_modules/.pnpm/unconfig@7.4.2/node_modules/unconfig/dist/index.mjs
|
|
584
|
+
function interopDefault(mod) {
|
|
585
|
+
if (mod == null || typeof mod !== "object" || !("default" in mod) || mod.default == null) return mod;
|
|
586
|
+
const defaultValue = mod.default;
|
|
587
|
+
if (typeof defaultValue !== "object") return defaultValue;
|
|
588
|
+
for (const key in mod) try {
|
|
589
|
+
if (key in defaultValue || key === "default" || mod[key] === defaultValue) continue;
|
|
590
|
+
Object.defineProperty(defaultValue, key, {
|
|
591
|
+
configurable: true,
|
|
592
|
+
enumerable: true,
|
|
593
|
+
get() {
|
|
594
|
+
return mod[key];
|
|
595
|
+
}
|
|
596
|
+
});
|
|
597
|
+
} catch {}
|
|
598
|
+
return defaultValue;
|
|
599
|
+
}
|
|
600
|
+
const defaultExtensions = [
|
|
601
|
+
"mts",
|
|
602
|
+
"cts",
|
|
603
|
+
"ts",
|
|
604
|
+
"mjs",
|
|
605
|
+
"cjs",
|
|
606
|
+
"js",
|
|
607
|
+
"json",
|
|
608
|
+
""
|
|
609
|
+
];
|
|
610
|
+
const require$2 = createRequire(import.meta.url);
|
|
611
|
+
const loadConfigFile = quansync(function* (filepath, source) {
|
|
612
|
+
let config;
|
|
613
|
+
let parser = source.parser || "auto";
|
|
614
|
+
let bundleFilepath = filepath;
|
|
615
|
+
let code;
|
|
616
|
+
let dependencies;
|
|
617
|
+
const read = quansync(function* () {
|
|
618
|
+
if (code == null) code = yield readFile$1(filepath, "utf8");
|
|
619
|
+
return code;
|
|
620
|
+
});
|
|
621
|
+
const importModule = quansync({
|
|
622
|
+
sync: () => {
|
|
623
|
+
const { createJiti } = require$2("jiti");
|
|
624
|
+
const jiti = createJiti(import.meta.url, {
|
|
625
|
+
fsCache: false,
|
|
626
|
+
moduleCache: false,
|
|
627
|
+
interopDefault: true
|
|
628
|
+
});
|
|
629
|
+
config = interopDefault(jiti(bundleFilepath));
|
|
630
|
+
dependencies = Object.values(jiti.cache).map((i) => i.filename).filter(Boolean);
|
|
631
|
+
},
|
|
632
|
+
async: async () => {
|
|
633
|
+
const { createJiti } = await import("jiti");
|
|
634
|
+
const jiti = createJiti(import.meta.url, {
|
|
635
|
+
fsCache: false,
|
|
636
|
+
moduleCache: false,
|
|
637
|
+
interopDefault: true
|
|
638
|
+
});
|
|
639
|
+
config = interopDefault(await jiti.import(bundleFilepath, { default: true }));
|
|
640
|
+
dependencies = Object.values(jiti.cache).map((i) => i.filename).filter(Boolean);
|
|
641
|
+
}
|
|
642
|
+
});
|
|
643
|
+
if (source.transform) {
|
|
644
|
+
const transformed = yield source.transform(yield read(), filepath);
|
|
645
|
+
if (transformed) {
|
|
646
|
+
bundleFilepath = join(dirname$1(filepath), `__unconfig_${basename(filepath)}`);
|
|
647
|
+
yield writeFile(bundleFilepath, transformed, "utf8");
|
|
648
|
+
code = transformed;
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
if (parser === "auto") try {
|
|
652
|
+
config = JSON.parse(yield read());
|
|
653
|
+
parser = "json";
|
|
654
|
+
} catch {
|
|
655
|
+
parser = "import";
|
|
656
|
+
}
|
|
657
|
+
try {
|
|
658
|
+
if (!config) {
|
|
659
|
+
if (typeof parser === "function") config = yield parser(filepath);
|
|
660
|
+
else if (parser === "import") yield importModule();
|
|
661
|
+
else if (parser === "json") config = JSON.parse(yield read());
|
|
662
|
+
}
|
|
663
|
+
if (!config) return;
|
|
664
|
+
const rewritten = source.rewrite ? yield source.rewrite(config, filepath) : config;
|
|
665
|
+
if (!rewritten) return void 0;
|
|
666
|
+
return [rewritten, dependencies];
|
|
667
|
+
} finally {
|
|
668
|
+
if (bundleFilepath !== filepath) try {
|
|
669
|
+
yield unlink(bundleFilepath);
|
|
670
|
+
} catch {}
|
|
671
|
+
}
|
|
672
|
+
});
|
|
673
|
+
function createConfigLoader(options) {
|
|
674
|
+
const { merge, defaults, sources, ...coreOptions } = options;
|
|
675
|
+
const coreSources = toArray(sources || []).map((source) => {
|
|
676
|
+
return {
|
|
677
|
+
...source,
|
|
678
|
+
files: toArray(source.files),
|
|
679
|
+
extensions: source.extensions || defaultExtensions,
|
|
680
|
+
parser: (filepath) => loadConfigFile(filepath, source)
|
|
681
|
+
};
|
|
682
|
+
});
|
|
683
|
+
const core = createConfigCoreLoader({
|
|
684
|
+
...coreOptions,
|
|
685
|
+
multiple: merge,
|
|
686
|
+
sources: coreSources
|
|
687
|
+
});
|
|
688
|
+
return {
|
|
689
|
+
load: quansync(function* (force = false) {
|
|
690
|
+
const results = yield core.load(force);
|
|
691
|
+
if (!results.length) return {
|
|
692
|
+
config: defaults,
|
|
693
|
+
sources: []
|
|
694
|
+
};
|
|
695
|
+
if (!merge) return {
|
|
696
|
+
config: results[0].config[0],
|
|
697
|
+
sources: [results[0].source],
|
|
698
|
+
dependencies: results[0].config[1]
|
|
699
|
+
};
|
|
700
|
+
return {
|
|
701
|
+
config: applyDefaults(...results.map((i) => i.config[0]), defaults),
|
|
702
|
+
sources: results.map((i) => i.source),
|
|
703
|
+
dependencies: results.flatMap((i) => i.config[1] || [])
|
|
704
|
+
};
|
|
705
|
+
}),
|
|
706
|
+
findConfigs: core.findConfigs
|
|
707
|
+
};
|
|
708
|
+
}
|
|
709
|
+
function applyDefaults(...args) {
|
|
710
|
+
return defu(...args.map((i) => ({ config: i }))).config;
|
|
711
|
+
}
|
|
712
|
+
const loadConfig = quansync(function* (options) {
|
|
713
|
+
return createConfigLoader(options).load();
|
|
714
|
+
});
|
|
715
|
+
const loadConfigSync = loadConfig.sync;
|
|
716
|
+
|
|
207
717
|
//#endregion
|
|
208
718
|
//#region src/utils/file.ts
|
|
209
719
|
const readPackage = (importMeta, ...paths) => {
|
|
@@ -271,20 +781,698 @@ const readGitignore = (cwd = process.cwd()) => {
|
|
|
271
781
|
log.verbose("gitignore", `未找到 .gitignore 文件: ${gitignorePath}`);
|
|
272
782
|
return [];
|
|
273
783
|
}
|
|
274
|
-
try {
|
|
275
|
-
const content = fse.readFileSync(gitignorePath, "utf-8");
|
|
276
|
-
log.verbose("gitignore", `成功读取 .gitignore 文件: ${gitignorePath}`);
|
|
277
|
-
return content.split("\n");
|
|
278
|
-
} catch (err) {
|
|
279
|
-
log.error("gitignore", `读取 .gitignore 文件失败: ${err.message}`);
|
|
280
|
-
return [];
|
|
784
|
+
try {
|
|
785
|
+
const content = fse.readFileSync(gitignorePath, "utf-8");
|
|
786
|
+
log.verbose("gitignore", `成功读取 .gitignore 文件: ${gitignorePath}`);
|
|
787
|
+
return content.split("\n");
|
|
788
|
+
} catch (err) {
|
|
789
|
+
log.error("gitignore", `读取 .gitignore 文件失败: ${err.message}`);
|
|
790
|
+
return [];
|
|
791
|
+
}
|
|
792
|
+
};
|
|
793
|
+
|
|
794
|
+
//#endregion
|
|
795
|
+
//#region src/constants.ts
|
|
796
|
+
const LOWEST_NODE_VERSION = "18.0.0";
|
|
797
|
+
const CONFIG_NAME = ".nemoclirc";
|
|
798
|
+
|
|
799
|
+
//#endregion
|
|
800
|
+
//#region src/package-manager/adapters/bun.ts
|
|
801
|
+
/**
|
|
802
|
+
* Bun adapter - translates operations to bun-specific commands
|
|
803
|
+
*/
|
|
804
|
+
var BunAdapter = class {
|
|
805
|
+
name = "bun";
|
|
806
|
+
supportsWorkspaces = true;
|
|
807
|
+
command = "bun";
|
|
808
|
+
buildAddCommand(packages, options) {
|
|
809
|
+
const args = ["add"];
|
|
810
|
+
args.push(...packages);
|
|
811
|
+
if (options.saveDev) args.push("--development");
|
|
812
|
+
if (options.exact) args.push("--exact");
|
|
813
|
+
if (options.root) args.push("--workspace");
|
|
814
|
+
else if (options.workspaces && options.workspaces.length > 0) options.workspaces.forEach((ws) => {
|
|
815
|
+
args.push("--workspace", ws);
|
|
816
|
+
});
|
|
817
|
+
return args;
|
|
818
|
+
}
|
|
819
|
+
buildRemoveCommand(packages, options) {
|
|
820
|
+
const args = ["remove", ...packages];
|
|
821
|
+
if (options.root) args.push("--workspace");
|
|
822
|
+
else if (options.workspaces && options.workspaces.length > 0) options.workspaces.forEach((ws) => {
|
|
823
|
+
args.push("--workspace", ws);
|
|
824
|
+
});
|
|
825
|
+
return args;
|
|
826
|
+
}
|
|
827
|
+
buildUpgradeCommand(packages, options) {
|
|
828
|
+
const target = options.target || "latest";
|
|
829
|
+
const packagesWithTarget = packages.map((pkg) => `${pkg}@${target}`);
|
|
830
|
+
return this.buildAddCommand(packagesWithTarget, {});
|
|
831
|
+
}
|
|
832
|
+
parsePackageSpec(packageSpec) {
|
|
833
|
+
const match = packageSpec.match(/^(@?[^@]+)(?:@(.+))?$/);
|
|
834
|
+
if (!match) return { name: packageSpec };
|
|
835
|
+
return {
|
|
836
|
+
name: match[1] ?? packageSpec,
|
|
837
|
+
version: match[2]
|
|
838
|
+
};
|
|
839
|
+
}
|
|
840
|
+
};
|
|
841
|
+
|
|
842
|
+
//#endregion
|
|
843
|
+
//#region src/package-manager/adapters/deno.ts
|
|
844
|
+
/**
|
|
845
|
+
* Deno adapter - translates operations to deno-specific commands
|
|
846
|
+
*
|
|
847
|
+
* Note: Deno has a different model (URL-based imports) so some operations
|
|
848
|
+
* are limited or not applicable.
|
|
849
|
+
*/
|
|
850
|
+
var DenoAdapter = class {
|
|
851
|
+
name = "deno";
|
|
852
|
+
supportsWorkspaces = false;
|
|
853
|
+
command = "deno";
|
|
854
|
+
buildAddCommand(packages, options) {
|
|
855
|
+
const args = ["add", ...packages];
|
|
856
|
+
if (options.saveDev) args.push("--dev");
|
|
857
|
+
return args;
|
|
858
|
+
}
|
|
859
|
+
buildRemoveCommand(packages, options) {
|
|
860
|
+
return ["remove", ...packages];
|
|
861
|
+
}
|
|
862
|
+
buildUpgradeCommand(packages, options) {
|
|
863
|
+
return this.buildAddCommand(packages, {});
|
|
864
|
+
}
|
|
865
|
+
parsePackageSpec(packageSpec) {
|
|
866
|
+
const match = packageSpec.match(/^(@?[^@]+)(?:@(.+))?$/);
|
|
867
|
+
if (!match) return { name: packageSpec };
|
|
868
|
+
return {
|
|
869
|
+
name: match[1] ?? packageSpec,
|
|
870
|
+
version: match[2]
|
|
871
|
+
};
|
|
872
|
+
}
|
|
873
|
+
};
|
|
874
|
+
|
|
875
|
+
//#endregion
|
|
876
|
+
//#region src/package-manager/adapters/npm.ts
|
|
877
|
+
/**
|
|
878
|
+
* NPM adapter - translates operations to npm-specific commands
|
|
879
|
+
*/
|
|
880
|
+
var NpmAdapter = class {
|
|
881
|
+
name = "npm";
|
|
882
|
+
supportsWorkspaces = true;
|
|
883
|
+
command = "npm";
|
|
884
|
+
buildAddCommand(packages, options) {
|
|
885
|
+
const args = ["install"];
|
|
886
|
+
args.push(...packages);
|
|
887
|
+
if (options.saveDev) args.push("--save-dev");
|
|
888
|
+
if (options.exact) args.push("--save-exact");
|
|
889
|
+
if (options.savePeer) args.push("--save-peer");
|
|
890
|
+
if (options.saveOptional) args.push("--save-optional");
|
|
891
|
+
if (options.root) args.push("-w");
|
|
892
|
+
else if (options.workspaces && options.workspaces.length > 0) if (options.workspaces.length === 1) args.push("--workspace", options.workspaces[0] ?? "");
|
|
893
|
+
else options.workspaces.forEach((ws) => {
|
|
894
|
+
args.push("--workspace", ws);
|
|
895
|
+
});
|
|
896
|
+
return args;
|
|
897
|
+
}
|
|
898
|
+
buildRemoveCommand(packages, options) {
|
|
899
|
+
const args = ["uninstall", ...packages];
|
|
900
|
+
if (options.root) args.push("-w");
|
|
901
|
+
else if (options.workspaces && options.workspaces.length > 0) if (options.workspaces.length === 1) args.push("--workspace", options.workspaces[0] ?? "");
|
|
902
|
+
else options.workspaces.forEach((ws) => {
|
|
903
|
+
args.push("--workspace", ws);
|
|
904
|
+
});
|
|
905
|
+
return args;
|
|
906
|
+
}
|
|
907
|
+
buildUpgradeCommand(packages, options) {
|
|
908
|
+
const target = options.target || "latest";
|
|
909
|
+
const packagesWithTarget = packages.map((pkg) => `${pkg}@${target}`);
|
|
910
|
+
return this.buildAddCommand(packagesWithTarget, {});
|
|
911
|
+
}
|
|
912
|
+
parsePackageSpec(packageSpec) {
|
|
913
|
+
const match = packageSpec.match(/^(@?[^@]+)(?:@(.+))?$/);
|
|
914
|
+
if (!match) return { name: packageSpec };
|
|
915
|
+
return {
|
|
916
|
+
name: match[1] ?? packageSpec,
|
|
917
|
+
version: match[2]
|
|
918
|
+
};
|
|
919
|
+
}
|
|
920
|
+
};
|
|
921
|
+
|
|
922
|
+
//#endregion
|
|
923
|
+
//#region src/package-manager/adapters/pnpm.ts
|
|
924
|
+
/**
|
|
925
|
+
* pnpm adapter - translates operations to pnpm-specific commands
|
|
926
|
+
*/
|
|
927
|
+
var PnpmAdapter = class {
|
|
928
|
+
name = "pnpm";
|
|
929
|
+
supportsWorkspaces = true;
|
|
930
|
+
command = "pnpm";
|
|
931
|
+
buildAddCommand(packages, options) {
|
|
932
|
+
const args = ["add"];
|
|
933
|
+
args.push(...packages);
|
|
934
|
+
if (options.saveDev) args.push("--save-dev");
|
|
935
|
+
if (options.exact) args.push("--save-exact");
|
|
936
|
+
if (options.savePeer) args.push("--save-peer");
|
|
937
|
+
if (options.saveOptional) args.push("--save-optional");
|
|
938
|
+
if (options.root) args.push("-w");
|
|
939
|
+
else if (options.workspaces && options.workspaces.length > 0) options.workspaces.forEach((ws) => {
|
|
940
|
+
args.push("--filter", ws);
|
|
941
|
+
});
|
|
942
|
+
return args;
|
|
943
|
+
}
|
|
944
|
+
buildRemoveCommand(packages, options) {
|
|
945
|
+
const args = ["remove", ...packages];
|
|
946
|
+
if (options.root) args.push("-w");
|
|
947
|
+
else if (options.workspaces && options.workspaces.length > 0) options.workspaces.forEach((ws) => {
|
|
948
|
+
args.push("--filter", ws);
|
|
949
|
+
});
|
|
950
|
+
return args;
|
|
951
|
+
}
|
|
952
|
+
buildUpgradeCommand(packages, options) {
|
|
953
|
+
const target = options.target || "latest";
|
|
954
|
+
const packagesWithTarget = packages.map((pkg) => `${pkg}@${target}`);
|
|
955
|
+
return this.buildAddCommand(packagesWithTarget, {});
|
|
956
|
+
}
|
|
957
|
+
parsePackageSpec(packageSpec) {
|
|
958
|
+
const match = packageSpec.match(/^(@?[^@]+)(?:@(.+))?$/);
|
|
959
|
+
if (!match) return { name: packageSpec };
|
|
960
|
+
return {
|
|
961
|
+
name: match[1] ?? packageSpec,
|
|
962
|
+
version: match[2]
|
|
963
|
+
};
|
|
964
|
+
}
|
|
965
|
+
};
|
|
966
|
+
|
|
967
|
+
//#endregion
|
|
968
|
+
//#region src/package-manager/adapters/yarn.ts
|
|
969
|
+
/**
|
|
970
|
+
* Yarn adapter - translates operations to yarn-specific commands
|
|
971
|
+
*/
|
|
972
|
+
var YarnAdapter = class {
|
|
973
|
+
name = "yarn";
|
|
974
|
+
supportsWorkspaces = true;
|
|
975
|
+
command = "yarn";
|
|
976
|
+
buildAddCommand(packages, options) {
|
|
977
|
+
const args = ["add"];
|
|
978
|
+
args.push(...packages);
|
|
979
|
+
if (options.saveDev) args.push("--dev");
|
|
980
|
+
if (options.exact) args.push("--exact");
|
|
981
|
+
if (options.savePeer) args.push("--peer");
|
|
982
|
+
if (options.saveOptional) args.push("--optional");
|
|
983
|
+
if (options.root) args.push("-W");
|
|
984
|
+
else if (options.workspaces && options.workspaces.length > 0) {
|
|
985
|
+
if (options.workspaces.length === 1) args.unshift("-c", "--", `workspace:${options.workspaces[0]}`);
|
|
986
|
+
}
|
|
987
|
+
return args;
|
|
988
|
+
}
|
|
989
|
+
buildRemoveCommand(packages, options) {
|
|
990
|
+
const args = ["remove", ...packages];
|
|
991
|
+
if (options.root) args.push("-W");
|
|
992
|
+
else if (options.workspaces && options.workspaces.length > 0) {
|
|
993
|
+
if (options.workspaces.length === 1) args.unshift("-c", "--", `workspace:${options.workspaces[0]}`);
|
|
994
|
+
}
|
|
995
|
+
return args;
|
|
996
|
+
}
|
|
997
|
+
buildUpgradeCommand(packages, options) {
|
|
998
|
+
const target = options.target || "latest";
|
|
999
|
+
const packagesWithTarget = packages.map((pkg) => `${pkg}@${target}`);
|
|
1000
|
+
return this.buildAddCommand(packagesWithTarget, {});
|
|
1001
|
+
}
|
|
1002
|
+
parsePackageSpec(packageSpec) {
|
|
1003
|
+
const match = packageSpec.match(/^(@?[^@]+)(?:@(.+))?$/);
|
|
1004
|
+
if (!match) return { name: packageSpec };
|
|
1005
|
+
return {
|
|
1006
|
+
name: match[1] ?? packageSpec,
|
|
1007
|
+
version: match[2]
|
|
1008
|
+
};
|
|
1009
|
+
}
|
|
1010
|
+
};
|
|
1011
|
+
|
|
1012
|
+
//#endregion
|
|
1013
|
+
//#region src/package-manager/adapters/index.ts
|
|
1014
|
+
/**
|
|
1015
|
+
* Adapter registry
|
|
1016
|
+
*/
|
|
1017
|
+
const adapters = {
|
|
1018
|
+
npm: new NpmAdapter(),
|
|
1019
|
+
pnpm: new PnpmAdapter(),
|
|
1020
|
+
yarn: new YarnAdapter(),
|
|
1021
|
+
bun: new BunAdapter(),
|
|
1022
|
+
deno: new DenoAdapter()
|
|
1023
|
+
};
|
|
1024
|
+
/**
|
|
1025
|
+
* Get adapter for a specific package manager
|
|
1026
|
+
*/
|
|
1027
|
+
function getAdapter(packageManager) {
|
|
1028
|
+
return adapters[packageManager];
|
|
1029
|
+
}
|
|
1030
|
+
/**
|
|
1031
|
+
* Get all available adapters
|
|
1032
|
+
*/
|
|
1033
|
+
function getAllAdapters() {
|
|
1034
|
+
return { ...adapters };
|
|
1035
|
+
}
|
|
1036
|
+
|
|
1037
|
+
//#endregion
|
|
1038
|
+
//#region ../../node_modules/.pnpm/es-toolkit@1.44.0/node_modules/es-toolkit/dist/predicate/isPlainObject.mjs
|
|
1039
|
+
function isPlainObject$1(value) {
|
|
1040
|
+
if (!value || typeof value !== "object") return false;
|
|
1041
|
+
const proto = Object.getPrototypeOf(value);
|
|
1042
|
+
if (!(proto === null || proto === Object.prototype || Object.getPrototypeOf(proto) === null)) return false;
|
|
1043
|
+
return Object.prototype.toString.call(value) === "[object Object]";
|
|
1044
|
+
}
|
|
1045
|
+
|
|
1046
|
+
//#endregion
|
|
1047
|
+
//#region ../../node_modules/.pnpm/es-toolkit@1.44.0/node_modules/es-toolkit/dist/_internal/isUnsafeProperty.mjs
|
|
1048
|
+
function isUnsafeProperty(key) {
|
|
1049
|
+
return key === "__proto__";
|
|
1050
|
+
}
|
|
1051
|
+
|
|
1052
|
+
//#endregion
|
|
1053
|
+
//#region ../../node_modules/.pnpm/es-toolkit@1.44.0/node_modules/es-toolkit/dist/object/merge.mjs
|
|
1054
|
+
function merge(target, source) {
|
|
1055
|
+
const sourceKeys = Object.keys(source);
|
|
1056
|
+
for (let i = 0; i < sourceKeys.length; i++) {
|
|
1057
|
+
const key = sourceKeys[i];
|
|
1058
|
+
if (isUnsafeProperty(key)) continue;
|
|
1059
|
+
const sourceValue = source[key];
|
|
1060
|
+
const targetValue = target[key];
|
|
1061
|
+
if (isMergeableValue(sourceValue) && isMergeableValue(targetValue)) target[key] = merge(targetValue, sourceValue);
|
|
1062
|
+
else if (Array.isArray(sourceValue)) target[key] = merge([], sourceValue);
|
|
1063
|
+
else if (isPlainObject$1(sourceValue)) target[key] = merge({}, sourceValue);
|
|
1064
|
+
else if (targetValue === void 0 || sourceValue !== void 0) target[key] = sourceValue;
|
|
1065
|
+
}
|
|
1066
|
+
return target;
|
|
1067
|
+
}
|
|
1068
|
+
function isMergeableValue(value) {
|
|
1069
|
+
return isPlainObject$1(value) || Array.isArray(value);
|
|
1070
|
+
}
|
|
1071
|
+
|
|
1072
|
+
//#endregion
|
|
1073
|
+
//#region src/utils/error.ts
|
|
1074
|
+
const handleError = (err, message) => {
|
|
1075
|
+
if (isError(err)) ErrorMessage({ text: `${message}: ${err.message}` });
|
|
1076
|
+
else if (isString(err)) ErrorMessage({ text: `${message}: ${err}` });
|
|
1077
|
+
else log.error(message, err);
|
|
1078
|
+
};
|
|
1079
|
+
|
|
1080
|
+
//#endregion
|
|
1081
|
+
//#region src/utils/command.ts
|
|
1082
|
+
const exit = (code) => process$1.exit(code);
|
|
1083
|
+
const createHelpExample = (...commands) => {
|
|
1084
|
+
return `
|
|
1085
|
+
Example:
|
|
1086
|
+
${commands.map((command) => ` $ ${command}`).join("\n")}
|
|
1087
|
+
`;
|
|
1088
|
+
};
|
|
1089
|
+
const createCommand = (name) => {
|
|
1090
|
+
const command = new Command(name);
|
|
1091
|
+
command.allowExcessArguments();
|
|
1092
|
+
command.allowUnknownOption();
|
|
1093
|
+
return command;
|
|
1094
|
+
};
|
|
1095
|
+
const buildCommand = (command, dynamicParts = []) => {
|
|
1096
|
+
return {
|
|
1097
|
+
command,
|
|
1098
|
+
parts: dynamicParts.filter((part) => !isEmpty(part)).map((part) => part?.toString())
|
|
1099
|
+
};
|
|
1100
|
+
};
|
|
1101
|
+
const x = (command, args, options = {}) => {
|
|
1102
|
+
return x$1(command, args, merge({
|
|
1103
|
+
nodeOptions: {
|
|
1104
|
+
cwd: process$1.cwd(),
|
|
1105
|
+
FORCE_COLOR: "1"
|
|
1106
|
+
},
|
|
1107
|
+
throwOnError: true
|
|
1108
|
+
}, options));
|
|
1109
|
+
};
|
|
1110
|
+
const zx = (baseCommand, dynamicParts = [], options = {}) => {
|
|
1111
|
+
const { command, parts } = buildCommand(baseCommand, dynamicParts);
|
|
1112
|
+
const { signal } = new AbortController();
|
|
1113
|
+
try {
|
|
1114
|
+
return (isEmpty(options) ? $ : $({
|
|
1115
|
+
...options,
|
|
1116
|
+
signal
|
|
1117
|
+
}))`${command} ${parts}`;
|
|
1118
|
+
} catch (error) {
|
|
1119
|
+
handleError(error, `Failed to execute dynamic command: ${command}`);
|
|
1120
|
+
throw error;
|
|
1121
|
+
}
|
|
1122
|
+
};
|
|
1123
|
+
const xASync = async (command, args, options) => {
|
|
1124
|
+
try {
|
|
1125
|
+
const { timeout, quiet, ...execOptions } = options ?? {};
|
|
1126
|
+
const execPromise = x$1(command, args, merge({
|
|
1127
|
+
nodeOptions: {
|
|
1128
|
+
cwd: process$1.cwd(),
|
|
1129
|
+
FORCE_COLOR: "1"
|
|
1130
|
+
},
|
|
1131
|
+
throwOnError: true
|
|
1132
|
+
}, execOptions));
|
|
1133
|
+
let result;
|
|
1134
|
+
if (timeout) {
|
|
1135
|
+
let timer;
|
|
1136
|
+
const timeoutPromise = new Promise((_, reject) => {
|
|
1137
|
+
timer = setTimeout(() => reject(/* @__PURE__ */ new Error(`Command timeout after ${timeout}ms`)), timeout);
|
|
1138
|
+
});
|
|
1139
|
+
try {
|
|
1140
|
+
result = await Promise.race([execPromise, timeoutPromise]);
|
|
1141
|
+
} finally {
|
|
1142
|
+
timer && clearTimeout(timer);
|
|
1143
|
+
}
|
|
1144
|
+
} else result = await execPromise;
|
|
1145
|
+
if (result.exitCode) {
|
|
1146
|
+
if (!quiet) {
|
|
1147
|
+
log.show(`Failed to execute command ${command}. Command exited with code ${result.exitCode}.`, { type: "error" });
|
|
1148
|
+
log.show(result.stderr, { type: "error" });
|
|
1149
|
+
}
|
|
1150
|
+
return [new Error(result.stderr), null];
|
|
1151
|
+
}
|
|
1152
|
+
return [null, result];
|
|
1153
|
+
} catch (error) {
|
|
1154
|
+
handleError(error, `Failed to execute command ${command}.`);
|
|
1155
|
+
return [isError(error) ? error : new Error(error), null];
|
|
1156
|
+
}
|
|
1157
|
+
};
|
|
1158
|
+
|
|
1159
|
+
//#endregion
|
|
1160
|
+
//#region src/utils/prompts.ts
|
|
1161
|
+
const createOptions = (options) => options.map((option) => ({
|
|
1162
|
+
label: option.toString(),
|
|
1163
|
+
value: option
|
|
1164
|
+
}));
|
|
1165
|
+
const createPrompt = (fn) => {
|
|
1166
|
+
return async (options) => {
|
|
1167
|
+
const result = await fn(options);
|
|
1168
|
+
if (isCancel(result)) {
|
|
1169
|
+
cancel("User cancelled");
|
|
1170
|
+
exit(0);
|
|
1171
|
+
}
|
|
1172
|
+
return result;
|
|
1173
|
+
};
|
|
1174
|
+
};
|
|
1175
|
+
const createShowList = createPrompt((options) => {
|
|
1176
|
+
options.map((option) => {
|
|
1177
|
+
return isString(option) ? option : option.label;
|
|
1178
|
+
}).forEach((item) => {
|
|
1179
|
+
log.show(item, { type: "step" });
|
|
1180
|
+
});
|
|
1181
|
+
});
|
|
1182
|
+
const createSearch = ({ message, options }) => {
|
|
1183
|
+
const fuse = new Fuse(options, { keys: ["label"] });
|
|
1184
|
+
return search({
|
|
1185
|
+
message,
|
|
1186
|
+
source: (term) => {
|
|
1187
|
+
if (!term) return options;
|
|
1188
|
+
return fuse.search(term).map(({ item }) => item);
|
|
1189
|
+
}
|
|
1190
|
+
});
|
|
1191
|
+
};
|
|
1192
|
+
process.on("uncaughtException", (error) => {
|
|
1193
|
+
if (error instanceof Error && error.name === "ExitPromptError") log.show("User cancelled", { type: "error" });
|
|
1194
|
+
else throw error;
|
|
1195
|
+
});
|
|
1196
|
+
const createCheckbox = async (opts) => {
|
|
1197
|
+
const result = await multiselect(opts);
|
|
1198
|
+
if (isCancel(result)) {
|
|
1199
|
+
cancel("User cancelled");
|
|
1200
|
+
exit(0);
|
|
1201
|
+
}
|
|
1202
|
+
return result;
|
|
1203
|
+
};
|
|
1204
|
+
const createNote = ({ message = "", title = "", opts }) => note(message, title, opts);
|
|
1205
|
+
const createConfirm = createPrompt(confirm);
|
|
1206
|
+
const createTasks = createPrompt(tasks);
|
|
1207
|
+
const createSelect = async (opts) => {
|
|
1208
|
+
const result = await select(opts);
|
|
1209
|
+
if (isCancel(result)) {
|
|
1210
|
+
cancel("User cancelled");
|
|
1211
|
+
exit(0);
|
|
1212
|
+
}
|
|
1213
|
+
return result;
|
|
1214
|
+
};
|
|
1215
|
+
const createInput = async (opts) => {
|
|
1216
|
+
const result = await text(opts);
|
|
1217
|
+
if (isCancel(result)) {
|
|
1218
|
+
cancel("User cancelled");
|
|
1219
|
+
exit(0);
|
|
1220
|
+
}
|
|
1221
|
+
return result;
|
|
1222
|
+
};
|
|
1223
|
+
const createGroupMultiSelect = async (opts) => {
|
|
1224
|
+
const result = await groupMultiselect(opts);
|
|
1225
|
+
if (isCancel(result)) {
|
|
1226
|
+
cancel("User cancelled");
|
|
1227
|
+
process.exit(0);
|
|
1228
|
+
}
|
|
1229
|
+
return result;
|
|
1230
|
+
};
|
|
1231
|
+
const createGroup = async (opts) => {
|
|
1232
|
+
const result = await group(opts);
|
|
1233
|
+
if (isCancel(result)) {
|
|
1234
|
+
cancel("User cancelled");
|
|
1235
|
+
exit(0);
|
|
1236
|
+
}
|
|
1237
|
+
return result;
|
|
1238
|
+
};
|
|
1239
|
+
const createSpinner = (message, options) => {
|
|
1240
|
+
const s = spinner(options);
|
|
1241
|
+
s.start(message);
|
|
1242
|
+
return s;
|
|
1243
|
+
};
|
|
1244
|
+
const createTaskLog = (title, options) => taskLog({
|
|
1245
|
+
title,
|
|
1246
|
+
...options
|
|
1247
|
+
});
|
|
1248
|
+
|
|
1249
|
+
//#endregion
|
|
1250
|
+
//#region src/package-manager/types.ts
|
|
1251
|
+
/**
|
|
1252
|
+
* Lock file patterns for detection
|
|
1253
|
+
*/
|
|
1254
|
+
const LOCK_FILE_PATTERNS = {
|
|
1255
|
+
npm: ["package-lock.json"],
|
|
1256
|
+
pnpm: ["pnpm-lock.yaml"],
|
|
1257
|
+
yarn: ["yarn.lock"],
|
|
1258
|
+
bun: ["bun.lockb", "bun.lock"],
|
|
1259
|
+
deno: ["deno.json", "deno.jsonc"]
|
|
1260
|
+
};
|
|
1261
|
+
/**
|
|
1262
|
+
* Package manager display names
|
|
1263
|
+
*/
|
|
1264
|
+
const PACKAGE_MANAGER_NAMES = {
|
|
1265
|
+
npm: "npm",
|
|
1266
|
+
pnpm: "pnpm",
|
|
1267
|
+
yarn: "yarn",
|
|
1268
|
+
bun: "Bun",
|
|
1269
|
+
deno: "Deno"
|
|
1270
|
+
};
|
|
1271
|
+
|
|
1272
|
+
//#endregion
|
|
1273
|
+
//#region src/package-manager/detector.ts
|
|
1274
|
+
/**
|
|
1275
|
+
* Cache file location
|
|
1276
|
+
*/
|
|
1277
|
+
const CACHE_FILE = ".nemo/package-manager.json";
|
|
1278
|
+
const CACHE_DURATION = 10080 * 60 * 1e3;
|
|
1279
|
+
/**
|
|
1280
|
+
* PackageManagerDetector - Detects the package manager used by a project
|
|
1281
|
+
*
|
|
1282
|
+
* Detection priority:
|
|
1283
|
+
* 1. Lock file analysis (package-lock.json, pnpm-lock.yaml, yarn.lock, bun.lockb)
|
|
1284
|
+
* 2. package.json packageManager field
|
|
1285
|
+
* 3. Interactive user selection
|
|
1286
|
+
*/
|
|
1287
|
+
var PackageManagerDetector = class {
|
|
1288
|
+
projectRoot;
|
|
1289
|
+
cachePath;
|
|
1290
|
+
constructor(projectRoot = process.cwd()) {
|
|
1291
|
+
console.log("🚀 : PackageManagerDetector : constructor : projectRoot:", projectRoot);
|
|
1292
|
+
this.projectRoot = projectRoot;
|
|
1293
|
+
this.cachePath = path.join(projectRoot, CACHE_FILE);
|
|
1294
|
+
}
|
|
1295
|
+
/**
|
|
1296
|
+
* Detect the package manager for the project
|
|
1297
|
+
*/
|
|
1298
|
+
async detect(forceRefresh = false) {
|
|
1299
|
+
if (!forceRefresh) {
|
|
1300
|
+
const cached = await this.loadCache();
|
|
1301
|
+
if (cached && !this.isCacheExpired(cached)) {
|
|
1302
|
+
log.info(`Using cached package manager: ${cached.result.packageManager}`);
|
|
1303
|
+
return cached.result;
|
|
1304
|
+
}
|
|
1305
|
+
}
|
|
1306
|
+
const lockFileResult = await this.detectByLockFile();
|
|
1307
|
+
if (lockFileResult) {
|
|
1308
|
+
const result = await this.createDetectionResult(lockFileResult, "lock-file");
|
|
1309
|
+
await this.saveCache(result);
|
|
1310
|
+
return result;
|
|
1311
|
+
}
|
|
1312
|
+
const packageJsonResult = await this.detectByPackageJson();
|
|
1313
|
+
if (packageJsonResult) {
|
|
1314
|
+
const result = await this.createDetectionResult(packageJsonResult, "package-json");
|
|
1315
|
+
await this.saveCache(result);
|
|
1316
|
+
return result;
|
|
1317
|
+
}
|
|
1318
|
+
log.warn("Could not auto-detect package manager");
|
|
1319
|
+
const userSelection = await this.promptUser();
|
|
1320
|
+
const result = await this.createDetectionResult(userSelection, "user-selection");
|
|
1321
|
+
await this.saveCache(result);
|
|
1322
|
+
return result;
|
|
1323
|
+
}
|
|
1324
|
+
/**
|
|
1325
|
+
* Detect package manager from lock files
|
|
1326
|
+
*/
|
|
1327
|
+
async detectByLockFile() {
|
|
1328
|
+
for (const pm of [
|
|
1329
|
+
"pnpm",
|
|
1330
|
+
"yarn",
|
|
1331
|
+
"npm",
|
|
1332
|
+
"bun",
|
|
1333
|
+
"deno"
|
|
1334
|
+
]) {
|
|
1335
|
+
const patterns = LOCK_FILE_PATTERNS[pm];
|
|
1336
|
+
for (const pattern of patterns) {
|
|
1337
|
+
const lockFilePath = path.join(this.projectRoot, pattern);
|
|
1338
|
+
console.log("🚀 : PackageManagerDetector : detectByLockFile : lockFilePath:", lockFilePath);
|
|
1339
|
+
if (existsSync(lockFilePath)) {
|
|
1340
|
+
log.info(`Detected ${pm} from lock file: ${pattern}`);
|
|
1341
|
+
return pm;
|
|
1342
|
+
}
|
|
1343
|
+
}
|
|
1344
|
+
}
|
|
1345
|
+
return null;
|
|
1346
|
+
}
|
|
1347
|
+
/**
|
|
1348
|
+
* Detect package manager from package.json packageManager field
|
|
1349
|
+
*/
|
|
1350
|
+
async detectByPackageJson() {
|
|
1351
|
+
const packageJsonPath = path.join(this.projectRoot, "package.json");
|
|
1352
|
+
try {
|
|
1353
|
+
const content = await fs$1.readFile(packageJsonPath, "utf-8");
|
|
1354
|
+
const packageManagerField = JSON.parse(content).packageManager;
|
|
1355
|
+
if (!packageManagerField) return null;
|
|
1356
|
+
const match = packageManagerField.match(/^([a-z]+)@/);
|
|
1357
|
+
if (match) {
|
|
1358
|
+
const pm = match[1];
|
|
1359
|
+
if (this.isValidPackageManager(pm)) {
|
|
1360
|
+
log.info(`Detected ${pm} from package.json packageManager field`);
|
|
1361
|
+
return pm;
|
|
1362
|
+
}
|
|
1363
|
+
}
|
|
1364
|
+
return null;
|
|
1365
|
+
} catch (error) {
|
|
1366
|
+
log.error(`Could not read package.json: ${error}`);
|
|
1367
|
+
return null;
|
|
1368
|
+
}
|
|
1369
|
+
}
|
|
1370
|
+
/**
|
|
1371
|
+
* Prompt user to select package manager interactively
|
|
1372
|
+
*/
|
|
1373
|
+
async promptUser() {
|
|
1374
|
+
const selected = await createSelect({
|
|
1375
|
+
message: "Could not detect package manager. Please select one:",
|
|
1376
|
+
options: Object.entries(PACKAGE_MANAGER_NAMES).map(([value, label]) => ({
|
|
1377
|
+
value,
|
|
1378
|
+
label
|
|
1379
|
+
}))
|
|
1380
|
+
});
|
|
1381
|
+
if (!selected || !this.isValidPackageManager(selected)) {
|
|
1382
|
+
log.error("Invalid selection. Defaulting to npm.");
|
|
1383
|
+
return "npm";
|
|
1384
|
+
}
|
|
1385
|
+
return selected;
|
|
1386
|
+
}
|
|
1387
|
+
/**
|
|
1388
|
+
* Check if a package manager is installed and available
|
|
1389
|
+
*/
|
|
1390
|
+
async checkAvailability(pm) {
|
|
1391
|
+
try {
|
|
1392
|
+
return (await x(pm, ["--version"])).exitCode === 0;
|
|
1393
|
+
} catch {
|
|
1394
|
+
return false;
|
|
1395
|
+
}
|
|
1396
|
+
}
|
|
1397
|
+
/**
|
|
1398
|
+
* Create a detection result with metadata
|
|
1399
|
+
*/
|
|
1400
|
+
async createDetectionResult(packageManager, method) {
|
|
1401
|
+
const isAvailable = await this.checkAvailability(packageManager);
|
|
1402
|
+
return {
|
|
1403
|
+
packageManager,
|
|
1404
|
+
method,
|
|
1405
|
+
detectedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1406
|
+
isAvailable
|
|
1407
|
+
};
|
|
1408
|
+
}
|
|
1409
|
+
/**
|
|
1410
|
+
* Load cached detection result
|
|
1411
|
+
*/
|
|
1412
|
+
async loadCache() {
|
|
1413
|
+
try {
|
|
1414
|
+
if (!existsSync(this.cachePath)) return null;
|
|
1415
|
+
const content = await fs$1.readFile(this.cachePath, "utf-8");
|
|
1416
|
+
return JSON.parse(content);
|
|
1417
|
+
} catch {
|
|
1418
|
+
return null;
|
|
1419
|
+
}
|
|
1420
|
+
}
|
|
1421
|
+
/**
|
|
1422
|
+
* Save detection result to cache
|
|
1423
|
+
*/
|
|
1424
|
+
async saveCache(result) {
|
|
1425
|
+
try {
|
|
1426
|
+
const cacheDir = path.dirname(this.cachePath);
|
|
1427
|
+
await fs$1.mkdir(cacheDir, { recursive: true });
|
|
1428
|
+
const cache = {
|
|
1429
|
+
result,
|
|
1430
|
+
expiresAt: new Date(Date.now() + CACHE_DURATION).toISOString()
|
|
1431
|
+
};
|
|
1432
|
+
await fs$1.writeFile(this.cachePath, JSON.stringify(cache, null, 2));
|
|
1433
|
+
} catch (error) {
|
|
1434
|
+
log.error(`Could not save cache: ${error}`);
|
|
1435
|
+
}
|
|
1436
|
+
}
|
|
1437
|
+
/**
|
|
1438
|
+
* Check if cache has expired
|
|
1439
|
+
*/
|
|
1440
|
+
isCacheExpired(cache) {
|
|
1441
|
+
return new Date(cache.expiresAt) < /* @__PURE__ */ new Date();
|
|
1442
|
+
}
|
|
1443
|
+
/**
|
|
1444
|
+
* Validate package manager enum
|
|
1445
|
+
*/
|
|
1446
|
+
isValidPackageManager(pm) {
|
|
1447
|
+
return [
|
|
1448
|
+
"npm",
|
|
1449
|
+
"pnpm",
|
|
1450
|
+
"yarn",
|
|
1451
|
+
"bun",
|
|
1452
|
+
"deno"
|
|
1453
|
+
].includes(pm);
|
|
1454
|
+
}
|
|
1455
|
+
/**
|
|
1456
|
+
* Clear the cache (useful for testing or force re-detection)
|
|
1457
|
+
*/
|
|
1458
|
+
async clearCache() {
|
|
1459
|
+
try {
|
|
1460
|
+
if (existsSync(this.cachePath)) {
|
|
1461
|
+
await fs$1.unlink(this.cachePath);
|
|
1462
|
+
log.info("Package manager cache cleared");
|
|
1463
|
+
}
|
|
1464
|
+
} catch (error) {
|
|
1465
|
+
log.error(`Could not clear cache: ${error}`);
|
|
1466
|
+
}
|
|
281
1467
|
}
|
|
282
1468
|
};
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
const
|
|
1469
|
+
/**
|
|
1470
|
+
* Get adapter for detected or specified package manager
|
|
1471
|
+
*/
|
|
1472
|
+
async function getPackageManagerAdapter(packageManager) {
|
|
1473
|
+
const detector = new PackageManagerDetector();
|
|
1474
|
+
return getAdapter(packageManager || (await detector.detect()).packageManager);
|
|
1475
|
+
}
|
|
288
1476
|
|
|
289
1477
|
//#endregion
|
|
290
1478
|
//#region src/utils/browser.ts
|
|
@@ -303,113 +1491,6 @@ const getBrowserApps = () => {
|
|
|
303
1491
|
const clearScreen = () => console.log(clearScreen$1);
|
|
304
1492
|
const clearTerminal = () => console.log(clearTerminal$1);
|
|
305
1493
|
|
|
306
|
-
//#endregion
|
|
307
|
-
//#region ../../node_modules/.pnpm/es-toolkit@1.44.0/node_modules/es-toolkit/dist/predicate/isPlainObject.mjs
|
|
308
|
-
function isPlainObject$1(value) {
|
|
309
|
-
if (!value || typeof value !== "object") return false;
|
|
310
|
-
const proto = Object.getPrototypeOf(value);
|
|
311
|
-
if (!(proto === null || proto === Object.prototype || Object.getPrototypeOf(proto) === null)) return false;
|
|
312
|
-
return Object.prototype.toString.call(value) === "[object Object]";
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
//#endregion
|
|
316
|
-
//#region ../../node_modules/.pnpm/es-toolkit@1.44.0/node_modules/es-toolkit/dist/_internal/isUnsafeProperty.mjs
|
|
317
|
-
function isUnsafeProperty(key) {
|
|
318
|
-
return key === "__proto__";
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
//#endregion
|
|
322
|
-
//#region ../../node_modules/.pnpm/es-toolkit@1.44.0/node_modules/es-toolkit/dist/object/merge.mjs
|
|
323
|
-
function merge(target, source) {
|
|
324
|
-
const sourceKeys = Object.keys(source);
|
|
325
|
-
for (let i = 0; i < sourceKeys.length; i++) {
|
|
326
|
-
const key = sourceKeys[i];
|
|
327
|
-
if (isUnsafeProperty(key)) continue;
|
|
328
|
-
const sourceValue = source[key];
|
|
329
|
-
const targetValue = target[key];
|
|
330
|
-
if (isMergeableValue(sourceValue) && isMergeableValue(targetValue)) target[key] = merge(targetValue, sourceValue);
|
|
331
|
-
else if (Array.isArray(sourceValue)) target[key] = merge([], sourceValue);
|
|
332
|
-
else if (isPlainObject$1(sourceValue)) target[key] = merge({}, sourceValue);
|
|
333
|
-
else if (targetValue === void 0 || sourceValue !== void 0) target[key] = sourceValue;
|
|
334
|
-
}
|
|
335
|
-
return target;
|
|
336
|
-
}
|
|
337
|
-
function isMergeableValue(value) {
|
|
338
|
-
return isPlainObject$1(value) || Array.isArray(value);
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
//#endregion
|
|
342
|
-
//#region src/utils/error.ts
|
|
343
|
-
const handleError = (err, message) => {
|
|
344
|
-
if (isError(err)) ErrorMessage({ text: `${message}: ${err.message}` });
|
|
345
|
-
else if (isString(err)) ErrorMessage({ text: `${message}: ${err}` });
|
|
346
|
-
else log.error(message, err);
|
|
347
|
-
};
|
|
348
|
-
|
|
349
|
-
//#endregion
|
|
350
|
-
//#region src/utils/command.ts
|
|
351
|
-
const exit = (code) => process$1.exit(code);
|
|
352
|
-
const createHelpExample = (...commands) => {
|
|
353
|
-
return `
|
|
354
|
-
Example:
|
|
355
|
-
${commands.map((command) => ` $ ${command}`).join("\n")}
|
|
356
|
-
`;
|
|
357
|
-
};
|
|
358
|
-
const createCommand = (name) => {
|
|
359
|
-
const command = new Command(name);
|
|
360
|
-
command.allowExcessArguments();
|
|
361
|
-
command.allowUnknownOption();
|
|
362
|
-
return command;
|
|
363
|
-
};
|
|
364
|
-
const buildCommand = (command, dynamicParts = []) => {
|
|
365
|
-
return {
|
|
366
|
-
command,
|
|
367
|
-
parts: dynamicParts.filter((part) => !isEmpty(part)).map((part) => part?.toString())
|
|
368
|
-
};
|
|
369
|
-
};
|
|
370
|
-
const x = (command, args, options = {}) => {
|
|
371
|
-
return x$1(command, args, merge({
|
|
372
|
-
nodeOptions: {
|
|
373
|
-
cwd: process$1.cwd(),
|
|
374
|
-
FORCE_COLOR: "1"
|
|
375
|
-
},
|
|
376
|
-
throwOnError: true
|
|
377
|
-
}, options));
|
|
378
|
-
};
|
|
379
|
-
const zx = (baseCommand, dynamicParts = [], options = {}) => {
|
|
380
|
-
const { command, parts } = buildCommand(baseCommand, dynamicParts);
|
|
381
|
-
const { signal } = new AbortController();
|
|
382
|
-
try {
|
|
383
|
-
return (isEmpty(options) ? $ : $({
|
|
384
|
-
...options,
|
|
385
|
-
signal
|
|
386
|
-
}))`${command} ${parts}`;
|
|
387
|
-
} catch (error) {
|
|
388
|
-
handleError(error, `Failed to execute dynamic command: ${command}`);
|
|
389
|
-
throw error;
|
|
390
|
-
}
|
|
391
|
-
};
|
|
392
|
-
const xASync = async (command, args, options) => {
|
|
393
|
-
try {
|
|
394
|
-
const result = await x$1(command, args, merge({
|
|
395
|
-
nodeOptions: {
|
|
396
|
-
cwd: process$1.cwd(),
|
|
397
|
-
FORCE_COLOR: "1"
|
|
398
|
-
},
|
|
399
|
-
throwOnError: true
|
|
400
|
-
}, options ?? {}));
|
|
401
|
-
if (result.exitCode) {
|
|
402
|
-
!options?.quiet && log.show(`Failed to execute command ${command}. Command exited with code ${result.exitCode}.`, { type: "error" });
|
|
403
|
-
!options?.quiet && log.show(result.stderr, { type: "error" });
|
|
404
|
-
return [new Error(result.stderr), null];
|
|
405
|
-
}
|
|
406
|
-
return [null, result];
|
|
407
|
-
} catch (error) {
|
|
408
|
-
handleError(error, `Failed to execute command ${command}.`);
|
|
409
|
-
return [isError(error) ? error : new Error(error), null];
|
|
410
|
-
}
|
|
411
|
-
};
|
|
412
|
-
|
|
413
1494
|
//#endregion
|
|
414
1495
|
//#region src/utils/common.ts
|
|
415
1496
|
const cached = (fn) => {
|
|
@@ -429,11 +1510,11 @@ const sleep = (millisecond, controller) => {
|
|
|
429
1510
|
};
|
|
430
1511
|
|
|
431
1512
|
//#endregion
|
|
432
|
-
//#region ../../node_modules/.pnpm/dotenv@17.2.
|
|
1513
|
+
//#region ../../node_modules/.pnpm/dotenv@17.2.4/node_modules/dotenv/package.json
|
|
433
1514
|
var require_package = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
434
1515
|
module.exports = {
|
|
435
1516
|
"name": "dotenv",
|
|
436
|
-
"version": "17.2.
|
|
1517
|
+
"version": "17.2.4",
|
|
437
1518
|
"description": "Loads environment variables from .env file",
|
|
438
1519
|
"main": "lib/main.js",
|
|
439
1520
|
"types": "lib/main.d.ts",
|
|
@@ -492,9 +1573,9 @@ var require_package = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
492
1573
|
}));
|
|
493
1574
|
|
|
494
1575
|
//#endregion
|
|
495
|
-
//#region ../../node_modules/.pnpm/dotenv@17.2.
|
|
1576
|
+
//#region ../../node_modules/.pnpm/dotenv@17.2.4/node_modules/dotenv/lib/main.js
|
|
496
1577
|
var require_main = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
497
|
-
const fs$
|
|
1578
|
+
const fs$3 = __require("fs");
|
|
498
1579
|
const path$13 = __require("path");
|
|
499
1580
|
const os = __require("os");
|
|
500
1581
|
const crypto = __require("crypto");
|
|
@@ -631,10 +1712,10 @@ var require_main = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
631
1712
|
function _vaultPath(options) {
|
|
632
1713
|
let possibleVaultPath = null;
|
|
633
1714
|
if (options && options.path && options.path.length > 0) if (Array.isArray(options.path)) {
|
|
634
|
-
for (const filepath of options.path) if (fs$
|
|
1715
|
+
for (const filepath of options.path) if (fs$3.existsSync(filepath)) possibleVaultPath = filepath.endsWith(".vault") ? filepath : `${filepath}.vault`;
|
|
635
1716
|
} else possibleVaultPath = options.path.endsWith(".vault") ? options.path : `${options.path}.vault`;
|
|
636
1717
|
else possibleVaultPath = path$13.resolve(process.cwd(), ".env.vault");
|
|
637
|
-
if (fs$
|
|
1718
|
+
if (fs$3.existsSync(possibleVaultPath)) return possibleVaultPath;
|
|
638
1719
|
return null;
|
|
639
1720
|
}
|
|
640
1721
|
function _resolveHome(envPath) {
|
|
@@ -668,7 +1749,7 @@ var require_main = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
668
1749
|
let lastError;
|
|
669
1750
|
const parsedAll = {};
|
|
670
1751
|
for (const path of optionPaths) try {
|
|
671
|
-
const parsed = DotenvModule.parse(fs$
|
|
1752
|
+
const parsed = DotenvModule.parse(fs$3.readFileSync(path, { encoding }));
|
|
672
1753
|
DotenvModule.populate(parsedAll, parsed, options);
|
|
673
1754
|
} catch (e) {
|
|
674
1755
|
if (debug) _debug(`Failed to load ${path} ${e.message}`);
|
|
@@ -783,7 +1864,14 @@ const loadEnv = (importMeta, ...paths) => {
|
|
|
783
1864
|
});
|
|
784
1865
|
return;
|
|
785
1866
|
}
|
|
786
|
-
|
|
1867
|
+
const examplePath = providedPath + ".example";
|
|
1868
|
+
if (existsSync(examplePath)) {
|
|
1869
|
+
(0, import_main.config)({
|
|
1870
|
+
path: examplePath,
|
|
1871
|
+
quiet: true
|
|
1872
|
+
});
|
|
1873
|
+
return;
|
|
1874
|
+
}
|
|
787
1875
|
};
|
|
788
1876
|
const createStore = (name, options) => {
|
|
789
1877
|
if (!options.path) throw Error("Store subpath is necessary!");
|
|
@@ -1241,7 +2329,7 @@ var require_clone = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1241
2329
|
//#endregion
|
|
1242
2330
|
//#region ../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/graceful-fs.js
|
|
1243
2331
|
var require_graceful_fs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1244
|
-
var fs$
|
|
2332
|
+
var fs$2 = __require("fs");
|
|
1245
2333
|
var polyfills = require_polyfills();
|
|
1246
2334
|
var legacy = require_legacy_streams();
|
|
1247
2335
|
var clone = require_clone();
|
|
@@ -1270,36 +2358,36 @@ var require_graceful_fs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1270
2358
|
m = "GFS4: " + m.split(/\n/).join("\nGFS4: ");
|
|
1271
2359
|
console.error(m);
|
|
1272
2360
|
};
|
|
1273
|
-
if (!fs$
|
|
1274
|
-
publishQueue(fs$
|
|
1275
|
-
fs$
|
|
2361
|
+
if (!fs$2[gracefulQueue]) {
|
|
2362
|
+
publishQueue(fs$2, global[gracefulQueue] || []);
|
|
2363
|
+
fs$2.close = (function(fs$close) {
|
|
1276
2364
|
function close(fd, cb) {
|
|
1277
|
-
return fs$close.call(fs$
|
|
2365
|
+
return fs$close.call(fs$2, fd, function(err) {
|
|
1278
2366
|
if (!err) resetQueue();
|
|
1279
2367
|
if (typeof cb === "function") cb.apply(this, arguments);
|
|
1280
2368
|
});
|
|
1281
2369
|
}
|
|
1282
2370
|
Object.defineProperty(close, previousSymbol, { value: fs$close });
|
|
1283
2371
|
return close;
|
|
1284
|
-
})(fs$
|
|
1285
|
-
fs$
|
|
2372
|
+
})(fs$2.close);
|
|
2373
|
+
fs$2.closeSync = (function(fs$closeSync) {
|
|
1286
2374
|
function closeSync(fd) {
|
|
1287
|
-
fs$closeSync.apply(fs$
|
|
2375
|
+
fs$closeSync.apply(fs$2, arguments);
|
|
1288
2376
|
resetQueue();
|
|
1289
2377
|
}
|
|
1290
2378
|
Object.defineProperty(closeSync, previousSymbol, { value: fs$closeSync });
|
|
1291
2379
|
return closeSync;
|
|
1292
|
-
})(fs$
|
|
2380
|
+
})(fs$2.closeSync);
|
|
1293
2381
|
if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) process.on("exit", function() {
|
|
1294
|
-
debug(fs$
|
|
1295
|
-
__require("assert").equal(fs$
|
|
2382
|
+
debug(fs$2[gracefulQueue]);
|
|
2383
|
+
__require("assert").equal(fs$2[gracefulQueue].length, 0);
|
|
1296
2384
|
});
|
|
1297
2385
|
}
|
|
1298
|
-
if (!global[gracefulQueue]) publishQueue(global, fs$
|
|
1299
|
-
module.exports = patch(clone(fs$
|
|
1300
|
-
if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs$
|
|
1301
|
-
module.exports = patch(fs$
|
|
1302
|
-
fs$
|
|
2386
|
+
if (!global[gracefulQueue]) publishQueue(global, fs$2[gracefulQueue]);
|
|
2387
|
+
module.exports = patch(clone(fs$2));
|
|
2388
|
+
if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs$2.__patched) {
|
|
2389
|
+
module.exports = patch(fs$2);
|
|
2390
|
+
fs$2.__patched = true;
|
|
1303
2391
|
}
|
|
1304
2392
|
function patch(fs) {
|
|
1305
2393
|
polyfills(fs);
|
|
@@ -1554,23 +2642,23 @@ var require_graceful_fs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1554
2642
|
}
|
|
1555
2643
|
function enqueue(elem) {
|
|
1556
2644
|
debug("ENQUEUE", elem[0].name, elem[1]);
|
|
1557
|
-
fs$
|
|
2645
|
+
fs$2[gracefulQueue].push(elem);
|
|
1558
2646
|
retry();
|
|
1559
2647
|
}
|
|
1560
2648
|
var retryTimer;
|
|
1561
2649
|
function resetQueue() {
|
|
1562
2650
|
var now = Date.now();
|
|
1563
|
-
for (var i = 0; i < fs$
|
|
1564
|
-
fs$
|
|
1565
|
-
fs$
|
|
2651
|
+
for (var i = 0; i < fs$2[gracefulQueue].length; ++i) if (fs$2[gracefulQueue][i].length > 2) {
|
|
2652
|
+
fs$2[gracefulQueue][i][3] = now;
|
|
2653
|
+
fs$2[gracefulQueue][i][4] = now;
|
|
1566
2654
|
}
|
|
1567
2655
|
retry();
|
|
1568
2656
|
}
|
|
1569
2657
|
function retry() {
|
|
1570
2658
|
clearTimeout(retryTimer);
|
|
1571
2659
|
retryTimer = void 0;
|
|
1572
|
-
if (fs$
|
|
1573
|
-
var elem = fs$
|
|
2660
|
+
if (fs$2[gracefulQueue].length === 0) return;
|
|
2661
|
+
var elem = fs$2[gracefulQueue].shift();
|
|
1574
2662
|
var fn = elem[0];
|
|
1575
2663
|
var args = elem[1];
|
|
1576
2664
|
var err = elem[2];
|
|
@@ -1589,7 +2677,7 @@ var require_graceful_fs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1589
2677
|
if (sinceAttempt >= Math.min(sinceStart * 1.2, 100)) {
|
|
1590
2678
|
debug("RETRY", fn.name, args);
|
|
1591
2679
|
fn.apply(null, args.concat([startTime]));
|
|
1592
|
-
} else fs$
|
|
2680
|
+
} else fs$2[gracefulQueue].push(elem);
|
|
1593
2681
|
}
|
|
1594
2682
|
if (retryTimer === void 0) retryTimer = setTimeout(retry, 0);
|
|
1595
2683
|
}
|
|
@@ -2881,96 +3969,6 @@ const safeAwait = async (promise) => {
|
|
|
2881
3969
|
}
|
|
2882
3970
|
};
|
|
2883
3971
|
|
|
2884
|
-
//#endregion
|
|
2885
|
-
//#region src/utils/prompts.ts
|
|
2886
|
-
const createOptions = (options) => options.map((option) => ({
|
|
2887
|
-
label: option.toString(),
|
|
2888
|
-
value: option
|
|
2889
|
-
}));
|
|
2890
|
-
const createPrompt = (fn) => {
|
|
2891
|
-
return async (options) => {
|
|
2892
|
-
const result = await fn(options);
|
|
2893
|
-
if (isCancel(result)) {
|
|
2894
|
-
cancel("User cancelled");
|
|
2895
|
-
exit(0);
|
|
2896
|
-
}
|
|
2897
|
-
return result;
|
|
2898
|
-
};
|
|
2899
|
-
};
|
|
2900
|
-
const createShowList = createPrompt((options) => {
|
|
2901
|
-
options.map((option) => {
|
|
2902
|
-
return isString(option) ? option : option.label;
|
|
2903
|
-
}).forEach((item) => {
|
|
2904
|
-
log.show(item, { type: "step" });
|
|
2905
|
-
});
|
|
2906
|
-
});
|
|
2907
|
-
const createSearch = ({ message, options }) => {
|
|
2908
|
-
const fuse = new Fuse(options, { keys: ["label"] });
|
|
2909
|
-
return search({
|
|
2910
|
-
message,
|
|
2911
|
-
source: (term) => {
|
|
2912
|
-
if (!term) return options;
|
|
2913
|
-
return fuse.search(term).map(({ item }) => item);
|
|
2914
|
-
}
|
|
2915
|
-
});
|
|
2916
|
-
};
|
|
2917
|
-
process.on("uncaughtException", (error) => {
|
|
2918
|
-
if (error instanceof Error && error.name === "ExitPromptError") log.show("User cancelled", { type: "error" });
|
|
2919
|
-
else throw error;
|
|
2920
|
-
});
|
|
2921
|
-
const createCheckbox = async (opts) => {
|
|
2922
|
-
const result = await multiselect(opts);
|
|
2923
|
-
if (isCancel(result)) {
|
|
2924
|
-
cancel("User cancelled");
|
|
2925
|
-
exit(0);
|
|
2926
|
-
}
|
|
2927
|
-
return result;
|
|
2928
|
-
};
|
|
2929
|
-
const createNote = ({ message = "", title = "", opts }) => note(message, title, opts);
|
|
2930
|
-
const createConfirm = createPrompt(confirm);
|
|
2931
|
-
const createTasks = createPrompt(tasks);
|
|
2932
|
-
const createSelect = async (opts) => {
|
|
2933
|
-
const result = await select(opts);
|
|
2934
|
-
if (isCancel(result)) {
|
|
2935
|
-
cancel("User cancelled");
|
|
2936
|
-
exit(0);
|
|
2937
|
-
}
|
|
2938
|
-
return result;
|
|
2939
|
-
};
|
|
2940
|
-
const createInput = async (opts) => {
|
|
2941
|
-
const result = await text(opts);
|
|
2942
|
-
if (isCancel(result)) {
|
|
2943
|
-
cancel("User cancelled");
|
|
2944
|
-
exit(0);
|
|
2945
|
-
}
|
|
2946
|
-
return result;
|
|
2947
|
-
};
|
|
2948
|
-
const createGroupMultiSelect = async (opts) => {
|
|
2949
|
-
const result = await groupMultiselect(opts);
|
|
2950
|
-
if (isCancel(result)) {
|
|
2951
|
-
cancel("User cancelled");
|
|
2952
|
-
process.exit(0);
|
|
2953
|
-
}
|
|
2954
|
-
return result;
|
|
2955
|
-
};
|
|
2956
|
-
const createGroup = async (opts) => {
|
|
2957
|
-
const result = await group(opts);
|
|
2958
|
-
if (isCancel(result)) {
|
|
2959
|
-
cancel("User cancelled");
|
|
2960
|
-
exit(0);
|
|
2961
|
-
}
|
|
2962
|
-
return result;
|
|
2963
|
-
};
|
|
2964
|
-
const createSpinner = (message, options) => {
|
|
2965
|
-
const s = spinner(options);
|
|
2966
|
-
s.start(message);
|
|
2967
|
-
return s;
|
|
2968
|
-
};
|
|
2969
|
-
const createTaskLog = (title, options) => taskLog({
|
|
2970
|
-
title,
|
|
2971
|
-
...options
|
|
2972
|
-
});
|
|
2973
|
-
|
|
2974
3972
|
//#endregion
|
|
2975
3973
|
//#region src/utils/spinner.ts
|
|
2976
3974
|
const BASE_OPTIONS = { timeout: 1e4 };
|
|
@@ -2984,34 +3982,103 @@ const ora = (options) => {
|
|
|
2984
3982
|
|
|
2985
3983
|
//#endregion
|
|
2986
3984
|
//#region src/utils/workspace.ts
|
|
3985
|
+
/**
|
|
3986
|
+
* Workspace configuration files and their detection patterns
|
|
3987
|
+
*/
|
|
3988
|
+
const WORKSPACE_CONFIGS = {
|
|
3989
|
+
pnpm: { file: "pnpm-workspace.yaml" },
|
|
3990
|
+
yarn: {
|
|
3991
|
+
file: "package.json",
|
|
3992
|
+
checkField: "workspaces"
|
|
3993
|
+
},
|
|
3994
|
+
npm: {
|
|
3995
|
+
file: "package.json",
|
|
3996
|
+
checkField: "workspaces"
|
|
3997
|
+
},
|
|
3998
|
+
bun: {
|
|
3999
|
+
file: "package.json",
|
|
4000
|
+
checkField: "workspaces"
|
|
4001
|
+
},
|
|
4002
|
+
deno: {
|
|
4003
|
+
file: "package.json",
|
|
4004
|
+
checkField: "workspaces"
|
|
4005
|
+
}
|
|
4006
|
+
};
|
|
4007
|
+
/**
|
|
4008
|
+
* Priority order for workspace detection (matches package manager detector)
|
|
4009
|
+
*/
|
|
4010
|
+
const WORKSPACE_PRIORITY = [
|
|
4011
|
+
"pnpm",
|
|
4012
|
+
"yarn",
|
|
4013
|
+
"npm",
|
|
4014
|
+
"bun"
|
|
4015
|
+
];
|
|
4016
|
+
/**
|
|
4017
|
+
* Find workspace root by detecting workspace configuration files
|
|
4018
|
+
* Supports pnpm, yarn, npm, and bun workspace configurations
|
|
4019
|
+
*/
|
|
2987
4020
|
async function findWorkspaceRoot(startDir = process.cwd()) {
|
|
2988
4021
|
let currentDir = startDir;
|
|
2989
|
-
while (true)
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
4022
|
+
while (true) {
|
|
4023
|
+
for (const pm of WORKSPACE_PRIORITY) {
|
|
4024
|
+
const config = WORKSPACE_CONFIGS[pm];
|
|
4025
|
+
const configPath = path.join(currentDir, config.file);
|
|
4026
|
+
try {
|
|
4027
|
+
await fs$1.access(configPath);
|
|
4028
|
+
if (config.checkField === "workspaces") {
|
|
4029
|
+
if (readJSON(configPath)?.workspaces) {
|
|
4030
|
+
log.info(`Found ${pm} workspace at: ${currentDir}`);
|
|
4031
|
+
return {
|
|
4032
|
+
root: currentDir,
|
|
4033
|
+
packageManager: pm
|
|
4034
|
+
};
|
|
4035
|
+
}
|
|
4036
|
+
} else {
|
|
4037
|
+
log.info(`Found ${pm} workspace at: ${currentDir}`);
|
|
4038
|
+
return {
|
|
4039
|
+
root: currentDir,
|
|
4040
|
+
packageManager: pm
|
|
4041
|
+
};
|
|
4042
|
+
}
|
|
4043
|
+
} catch {}
|
|
4044
|
+
}
|
|
2993
4045
|
const parentDir = path.dirname(currentDir);
|
|
2994
|
-
if (parentDir === currentDir) throw new Error("pnpm-workspace.yaml
|
|
4046
|
+
if (parentDir === currentDir) throw new Error("Workspace configuration not found. Supported: pnpm-workspace.yaml or package.json with workspaces field");
|
|
2995
4047
|
currentDir = parentDir;
|
|
2996
4048
|
}
|
|
2997
4049
|
}
|
|
4050
|
+
/**
|
|
4051
|
+
* Get workspace directories based on detected package manager
|
|
4052
|
+
* Supports pnpm-workspace.yaml and package.json workspaces field
|
|
4053
|
+
*/
|
|
2998
4054
|
async function getWorkspaceDirs() {
|
|
2999
|
-
const workspaceRoot = await findWorkspaceRoot();
|
|
4055
|
+
const { root: workspaceRoot, packageManager } = await findWorkspaceRoot();
|
|
3000
4056
|
try {
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
4057
|
+
let packagePatterns = [];
|
|
4058
|
+
if (packageManager === "pnpm") {
|
|
4059
|
+
const workspaceConfigPath = path.join(workspaceRoot, "pnpm-workspace.yaml");
|
|
4060
|
+
const configFileContent = await fs$1.readFile(workspaceConfigPath, "utf8");
|
|
4061
|
+
const workspaceConfig = yaml.parse(configFileContent);
|
|
4062
|
+
if (workspaceConfig?.packages?.length) packagePatterns = workspaceConfig.packages;
|
|
4063
|
+
} else {
|
|
4064
|
+
const packageJsonPath = path.join(workspaceRoot, "package.json");
|
|
4065
|
+
const packageJson = JSON.parse(await fs$1.readFile(packageJsonPath, "utf8"));
|
|
4066
|
+
if (packageJson?.workspaces) {
|
|
4067
|
+
if (Array.isArray(packageJson.workspaces)) packagePatterns = packageJson.workspaces;
|
|
4068
|
+
else if (packageJson.workspaces?.packages && Array.isArray(packageJson.workspaces.packages)) packagePatterns = packageJson.workspaces.packages;
|
|
4069
|
+
}
|
|
4070
|
+
}
|
|
4071
|
+
if (!packagePatterns.length) {
|
|
4072
|
+
log.warn("No packages defined in workspace configuration or file is empty.");
|
|
3007
4073
|
return {
|
|
3008
4074
|
root: workspaceRoot,
|
|
3009
|
-
packages: []
|
|
4075
|
+
packages: [],
|
|
4076
|
+
packageManager
|
|
3010
4077
|
};
|
|
3011
4078
|
}
|
|
3012
|
-
log.info(`Workspace package patterns: ${
|
|
4079
|
+
log.info(`Workspace package patterns: ${packagePatterns.join(", ")}`);
|
|
3013
4080
|
const dirs = [];
|
|
3014
|
-
for (const pattern of
|
|
4081
|
+
for (const pattern of packagePatterns) {
|
|
3015
4082
|
const packagePaths = await glob(pattern, {
|
|
3016
4083
|
cwd: workspaceRoot,
|
|
3017
4084
|
absolute: true
|
|
@@ -3020,13 +4087,15 @@ async function getWorkspaceDirs() {
|
|
|
3020
4087
|
}
|
|
3021
4088
|
return {
|
|
3022
4089
|
root: workspaceRoot,
|
|
3023
|
-
packages: filterDirList(dirs)
|
|
4090
|
+
packages: filterDirList(dirs),
|
|
4091
|
+
packageManager
|
|
3024
4092
|
};
|
|
3025
4093
|
} catch (err) {
|
|
3026
4094
|
handleError(err, "Failed to get workspace dirs: ");
|
|
3027
4095
|
return {
|
|
3028
4096
|
root: workspaceRoot,
|
|
3029
|
-
packages: []
|
|
4097
|
+
packages: [],
|
|
4098
|
+
packageManager
|
|
3030
4099
|
};
|
|
3031
4100
|
}
|
|
3032
4101
|
}
|
|
@@ -3034,6 +4103,7 @@ async function getWorkspaceNames() {
|
|
|
3034
4103
|
const workspacePackages = [];
|
|
3035
4104
|
try {
|
|
3036
4105
|
const { root, packages } = await getWorkspaceDirs();
|
|
4106
|
+
console.log("🚀 : getWorkspaceNames : root, packages:", root, packages);
|
|
3037
4107
|
for (const packageDir of packages) {
|
|
3038
4108
|
const packageJson = readJSON(`${packageDir}/package.json`);
|
|
3039
4109
|
if (packageJson) workspacePackages.push({
|
|
@@ -3055,5 +4125,5 @@ async function getWorkspaceNames() {
|
|
|
3055
4125
|
const pkg = readPackage(import.meta, "..");
|
|
3056
4126
|
|
|
3057
4127
|
//#endregion
|
|
3058
|
-
export { $, BASE_OPTIONS, CONFIG_NAME, Configstore, LOWEST_NODE_VERSION, addFiles, buildCommand, cached, checkFile, clearScreen, clearTerminal, colors, copyFile, createCheckbox, createCommand, createConfirm, createGroup, createGroupMultiSelect, createHelpExample, createInput, createNote, createOptions, createSearch, createSelect, createShowList, createSpinner, createStore, createTaskLog, createTasks, cwdPathname, deleteFile, deleteFiles, dirList, dirname, emptyDir, emptyDirs, exit, fileList, filename, filterDirList, getBrowserApps, getCurrentBranch, getDiffFiles, getGitStatus, getLocalBranches, getPackageDependencies, getWorkspaceDirs, getWorkspaceNames, glob, handleError, has, hasOwn, intro, isArray, isBoolean, isChinese, isDate, isDebug, isEmpty, isEmptyDir, isError, isFormData, isFunction, isMap, isNull, isNumber, isPlainObject, isPromise, isSet, isString, isSymbol, isURLSearchParams, isUndefined, loadConfig, loadEnv, log, logger, openBrowser, openBrowserApp, ora, outro, parseNames, pkg, progress, readFile, readGitignore, readJSON, readPackage, require$1 as require, safeAwait, sleep, stream, writeJSON, x, xASync, zx };
|
|
4128
|
+
export { $, BASE_OPTIONS, CONFIG_NAME, Configstore, LOCK_FILE_PATTERNS, LOWEST_NODE_VERSION, PACKAGE_MANAGER_NAMES, PackageManagerDetector, addFiles, buildCommand, cached, checkFile, clearScreen, clearTerminal, colors, copyFile, createCheckbox, createCommand, createConfirm, createGroup, createGroupMultiSelect, createHelpExample, createInput, createNote, createOptions, createSearch, createSelect, createShowList, createSpinner, createStore, createTaskLog, createTasks, cwdPathname, deleteFile, deleteFiles, dirList, dirname, emptyDir, emptyDirs, exit, fileList, filename, filterDirList, getAdapter, getAllAdapters, getBrowserApps, getCurrentBranch, getDiffFiles, getGitStatus, getLocalBranches, getPackageDependencies, getPackageManagerAdapter, getWorkspaceDirs, getWorkspaceNames, glob, handleError, has, hasOwn, intro, isArray, isBoolean, isChinese, isDate, isDebug, isEmpty, isEmptyDir, isError, isFormData, isFunction, isMap, isNull, isNumber, isPlainObject, isPromise, isSet, isString, isSymbol, isURLSearchParams, isUndefined, joinPath, loadConfig, loadEnv, log, logger, openBrowser, openBrowserApp, ora, outro, parseNames, pkg, progress, readFile, readGitignore, readJSON, readPackage, require$1 as require, safeAwait, sleep, stream, writeJSON, x, xASync, zx };
|
|
3059
4129
|
//# sourceMappingURL=index.js.map
|