@icebreakers/monorepo 0.1.1 → 0.1.3

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/README.md CHANGED
@@ -3,3 +3,5 @@
3
3
  ```sh
4
4
  npx @icebreakers/monorepo@latest
5
5
  ```
6
+
7
+ Nodejs >= `v20.11.0`
@@ -37,7 +37,7 @@
37
37
  "@types/lint-staged": "^13.3.0",
38
38
  "@types/lodash": "^4.17.7",
39
39
  "@types/lodash-es": "^4.17.12",
40
- "@types/node": "^22.4.1",
40
+ "@types/node": "^22.5.0",
41
41
  "@types/set-value": "^4.0.3",
42
42
  "@vitest/coverage-v8": "^2.0.5",
43
43
  "ci-info": "^4.0.0",
@@ -45,7 +45,7 @@
45
45
  "eslint": "^9.9.0",
46
46
  "fs-extra": "^11.2.0",
47
47
  "get-value": "^3.0.1",
48
- "husky": "^9.1.4",
48
+ "husky": "^9.1.5",
49
49
  "klaw": "^4.1.0",
50
50
  "lint-staged": "^15.2.8",
51
51
  "lodash": "^4.17.21",
@@ -7,6 +7,7 @@
7
7
  "vitest/globals"
8
8
  ],
9
9
  "strict": true,
10
+ "allowSyntheticDefaultImports": true,
10
11
  "esModuleInterop": true,
11
12
  "skipLibCheck": true
12
13
  }
@@ -315,6 +315,27 @@ import process from "node:process";
315
315
  import path from "pathe";
316
316
  import fs from "fs-extra";
317
317
  import klaw from "klaw";
318
+ import PQueue from "p-queue";
319
+ import checkbox from "@inquirer/checkbox";
320
+
321
+ // src/logger.ts
322
+ init_esm_shims();
323
+ import { createConsola } from "consola";
324
+ var logger = createConsola();
325
+
326
+ // src/utils.ts
327
+ init_esm_shims();
328
+ function escapeStringRegexp(str) {
329
+ return str.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
330
+ }
331
+ function isMatch(str, arr) {
332
+ for (const reg of arr) {
333
+ if (reg.test(str)) {
334
+ return true;
335
+ }
336
+ }
337
+ return false;
338
+ }
318
339
 
319
340
  // src/git.ts
320
341
  init_esm_shims();
@@ -339,56 +360,119 @@ var GitClient = class {
339
360
  }
340
361
  };
341
362
 
363
+ // src/targets.ts
364
+ init_esm_shims();
365
+ function getTargets(raw) {
366
+ const list = [
367
+ ".changeset",
368
+ ".husky",
369
+ ".vscode",
370
+ ".editorconfig",
371
+ ".gitattributes",
372
+ ".gitignore",
373
+ ".npmrc",
374
+ "commitlint.config.ts",
375
+ "eslint.config.js",
376
+ "lint-staged.config.js",
377
+ "package.json",
378
+ // pnpm
379
+ "pnpm-workspace.yaml",
380
+ // base tsconfig
381
+ "tsconfig.json",
382
+ // turbo
383
+ "turbo.json",
384
+ // vitest
385
+ "vitest.workspace.ts",
386
+ // #region docker
387
+ "Dockerfile",
388
+ ".dockerignore"
389
+ // #endregion
390
+ ];
391
+ if (!raw) {
392
+ list.push(".github", "LICENSE", "renovate.json", "SECURITY.md", "CODE_OF_CONDUCT.md", "CONTRIBUTING.md");
393
+ }
394
+ return list;
395
+ }
396
+
342
397
  // src/lib.ts
398
+ var queue = new PQueue({ concurrency: 1 });
343
399
  var __filename2 = fileURLToPath(import.meta.url);
344
400
  var __dirname2 = path.dirname(__filename2);
345
401
  var assetsDir = path.join(__dirname2, "../assets");
346
402
  var cwd = process.cwd();
347
- async function main(outdir = "") {
348
- const absOutDir = path.isAbsolute(outdir) ? outdir : path.join(cwd, outdir);
403
+ async function main(opts) {
404
+ const { outDir = "", raw, interactive } = opts;
405
+ const absOutDir = path.isAbsolute(outDir) ? outDir : path.join(cwd, outDir);
349
406
  const gitClient = new GitClient({
350
407
  baseDir: cwd
351
408
  });
352
409
  const repoName = await gitClient.getRepoName();
353
- for await (const file of klaw(assetsDir)) {
354
- if (file.stats.isFile()) {
355
- const relPath = path.relative(assetsDir, file.path);
356
- const targetPath = path.resolve(absOutDir, relPath);
357
- if (relPath === "package.json") {
358
- const sourcePath = file.path;
359
- if (await fs.exists(targetPath) && await fs.exists(sourcePath)) {
360
- const sourcePkgJson = await fs.readJson(sourcePath);
361
- const targetPkgJson = await fs.readJson(targetPath);
362
- const deps = (0, import_get_value2.default)(sourcePkgJson, "dependencies", { default: {} });
363
- const devDeps = (0, import_get_value2.default)(sourcePkgJson, "devDependencies", { default: {} });
364
- Object.entries(deps).forEach((x) => {
365
- (0, import_set_value.default)(targetPkgJson, `dependencies.${x[0]}`, x[1], { preservePaths: false });
366
- });
367
- Object.entries(devDeps).forEach((x) => {
368
- (0, import_set_value.default)(targetPkgJson, `devDependencies.${x[0]}`, x[1], { preservePaths: false });
369
- });
370
- await fs.writeJson(targetPath, targetPkgJson, {
410
+ let targets = getTargets(raw);
411
+ if (interactive) {
412
+ targets = await checkbox({
413
+ message: "\u9009\u62E9\u4F60\u9700\u8981\u7684\u6587\u4EF6",
414
+ choices: targets.map((x) => {
415
+ return {
416
+ value: x,
417
+ checked: true
418
+ };
419
+ })
420
+ });
421
+ }
422
+ const regexpArr = targets.map((x) => {
423
+ return new RegExp(`^${escapeStringRegexp(x)}`);
424
+ });
425
+ for await (const file of klaw(assetsDir, {
426
+ filter(p) {
427
+ const str = path.relative(assetsDir, p);
428
+ return isMatch(str, regexpArr);
429
+ }
430
+ })) {
431
+ await queue.add(async () => {
432
+ if (file.stats.isFile()) {
433
+ const relPath = path.relative(assetsDir, file.path);
434
+ const targetPath = path.resolve(absOutDir, relPath);
435
+ if (relPath === "package.json") {
436
+ const sourcePath = file.path;
437
+ if (await fs.exists(targetPath) && await fs.exists(sourcePath)) {
438
+ const sourcePkgJson = await fs.readJson(sourcePath);
439
+ const targetPkgJson = await fs.readJson(targetPath);
440
+ const deps = (0, import_get_value2.default)(sourcePkgJson, "dependencies", { default: {} });
441
+ const devDeps = (0, import_get_value2.default)(sourcePkgJson, "devDependencies", { default: {} });
442
+ Object.entries(deps).forEach((x) => {
443
+ (0, import_set_value.default)(targetPkgJson, `dependencies.${x[0]}`, x[1], { preservePaths: false });
444
+ });
445
+ Object.entries(devDeps).forEach((x) => {
446
+ (0, import_set_value.default)(targetPkgJson, `devDependencies.${x[0]}`, x[1], { preservePaths: false });
447
+ });
448
+ await fs.writeJson(targetPath, targetPkgJson, {
449
+ spaces: 2
450
+ });
451
+ logger.success(targetPath);
452
+ }
453
+ } else if (relPath === ".changeset/config.json" && repoName && await fs.exists(file.path)) {
454
+ const changesetJson = await fs.readJson(file.path);
455
+ (0, import_set_value.default)(changesetJson, "changelog.1.repo", repoName);
456
+ await fs.ensureDir(path.dirname(targetPath));
457
+ await fs.writeJson(targetPath, changesetJson, {
371
458
  spaces: 2
372
459
  });
460
+ logger.success(targetPath);
461
+ } else {
462
+ await fs.copy(
463
+ file.path,
464
+ targetPath
465
+ );
466
+ logger.success(targetPath);
373
467
  }
374
- } else if (relPath === ".changeset/config.json" && repoName && await fs.exists(file.path)) {
375
- const changesetJson = await fs.readJson(file.path);
376
- (0, import_set_value.default)(changesetJson, "changelog.1.repo", repoName);
377
- await fs.writeJson(targetPath, changesetJson, {
378
- spaces: 2
379
- });
380
- } else {
381
- await fs.copy(
382
- file.path,
383
- path.resolve(absOutDir, relPath)
384
- );
385
468
  }
386
- }
469
+ });
387
470
  }
388
471
  }
389
472
 
390
473
  export {
391
474
  init_esm_shims,
475
+ logger,
392
476
  main
393
477
  };
394
478
  /*! Bundled license information:
package/dist/cli.cjs CHANGED
@@ -310,6 +310,19 @@ var require_set_value = __commonJS({
310
310
  // src/cli.ts
311
311
  init_cjs_shims();
312
312
 
313
+ // src/program.ts
314
+ init_cjs_shims();
315
+ var import_commander = require("commander");
316
+
317
+ // package.json
318
+ var name = "@icebreakers/monorepo";
319
+ var version = "0.1.3";
320
+
321
+ // src/logger.ts
322
+ init_cjs_shims();
323
+ var import_consola = require("consola");
324
+ var logger = (0, import_consola.createConsola)();
325
+
313
326
  // src/lib.ts
314
327
  init_cjs_shims();
315
328
  var import_node_url = require("url");
@@ -319,6 +332,22 @@ var import_fs_extra = __toESM(require("fs-extra"), 1);
319
332
  var import_get_value2 = __toESM(require_get_value(), 1);
320
333
  var import_set_value = __toESM(require_set_value(), 1);
321
334
  var import_klaw = __toESM(require("klaw"), 1);
335
+ var import_p_queue = __toESM(require("p-queue"), 1);
336
+ var import_checkbox = __toESM(require("@inquirer/checkbox"), 1);
337
+
338
+ // src/utils.ts
339
+ init_cjs_shims();
340
+ function escapeStringRegexp(str) {
341
+ return str.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
342
+ }
343
+ function isMatch(str, arr) {
344
+ for (const reg of arr) {
345
+ if (reg.test(str)) {
346
+ return true;
347
+ }
348
+ }
349
+ return false;
350
+ }
322
351
 
323
352
  // src/git.ts
324
353
  init_cjs_shims();
@@ -343,58 +372,126 @@ var GitClient = class {
343
372
  }
344
373
  };
345
374
 
375
+ // src/targets.ts
376
+ init_cjs_shims();
377
+ function getTargets(raw) {
378
+ const list = [
379
+ ".changeset",
380
+ ".husky",
381
+ ".vscode",
382
+ ".editorconfig",
383
+ ".gitattributes",
384
+ ".gitignore",
385
+ ".npmrc",
386
+ "commitlint.config.ts",
387
+ "eslint.config.js",
388
+ "lint-staged.config.js",
389
+ "package.json",
390
+ // pnpm
391
+ "pnpm-workspace.yaml",
392
+ // base tsconfig
393
+ "tsconfig.json",
394
+ // turbo
395
+ "turbo.json",
396
+ // vitest
397
+ "vitest.workspace.ts",
398
+ // #region docker
399
+ "Dockerfile",
400
+ ".dockerignore"
401
+ // #endregion
402
+ ];
403
+ if (!raw) {
404
+ list.push(".github", "LICENSE", "renovate.json", "SECURITY.md", "CODE_OF_CONDUCT.md", "CONTRIBUTING.md");
405
+ }
406
+ return list;
407
+ }
408
+
346
409
  // src/lib.ts
410
+ var queue = new import_p_queue.default({ concurrency: 1 });
347
411
  var __filename2 = (0, import_node_url.fileURLToPath)(importMetaUrl);
348
412
  var __dirname = import_pathe.default.dirname(__filename2);
349
413
  var assetsDir = import_pathe.default.join(__dirname, "../assets");
350
414
  var cwd = import_node_process.default.cwd();
351
- async function main(outdir = "") {
352
- const absOutDir = import_pathe.default.isAbsolute(outdir) ? outdir : import_pathe.default.join(cwd, outdir);
415
+ async function main(opts) {
416
+ const { outDir = "", raw, interactive } = opts;
417
+ const absOutDir = import_pathe.default.isAbsolute(outDir) ? outDir : import_pathe.default.join(cwd, outDir);
353
418
  const gitClient = new GitClient({
354
419
  baseDir: cwd
355
420
  });
356
421
  const repoName = await gitClient.getRepoName();
357
- for await (const file of (0, import_klaw.default)(assetsDir)) {
358
- if (file.stats.isFile()) {
359
- const relPath = import_pathe.default.relative(assetsDir, file.path);
360
- const targetPath = import_pathe.default.resolve(absOutDir, relPath);
361
- if (relPath === "package.json") {
362
- const sourcePath = file.path;
363
- if (await import_fs_extra.default.exists(targetPath) && await import_fs_extra.default.exists(sourcePath)) {
364
- const sourcePkgJson = await import_fs_extra.default.readJson(sourcePath);
365
- const targetPkgJson = await import_fs_extra.default.readJson(targetPath);
366
- const deps = (0, import_get_value2.default)(sourcePkgJson, "dependencies", { default: {} });
367
- const devDeps = (0, import_get_value2.default)(sourcePkgJson, "devDependencies", { default: {} });
368
- Object.entries(deps).forEach((x) => {
369
- (0, import_set_value.default)(targetPkgJson, `dependencies.${x[0]}`, x[1], { preservePaths: false });
370
- });
371
- Object.entries(devDeps).forEach((x) => {
372
- (0, import_set_value.default)(targetPkgJson, `devDependencies.${x[0]}`, x[1], { preservePaths: false });
373
- });
374
- await import_fs_extra.default.writeJson(targetPath, targetPkgJson, {
422
+ let targets = getTargets(raw);
423
+ if (interactive) {
424
+ targets = await (0, import_checkbox.default)({
425
+ message: "\u9009\u62E9\u4F60\u9700\u8981\u7684\u6587\u4EF6",
426
+ choices: targets.map((x) => {
427
+ return {
428
+ value: x,
429
+ checked: true
430
+ };
431
+ })
432
+ });
433
+ }
434
+ const regexpArr = targets.map((x) => {
435
+ return new RegExp(`^${escapeStringRegexp(x)}`);
436
+ });
437
+ for await (const file of (0, import_klaw.default)(assetsDir, {
438
+ filter(p) {
439
+ const str = import_pathe.default.relative(assetsDir, p);
440
+ return isMatch(str, regexpArr);
441
+ }
442
+ })) {
443
+ await queue.add(async () => {
444
+ if (file.stats.isFile()) {
445
+ const relPath = import_pathe.default.relative(assetsDir, file.path);
446
+ const targetPath = import_pathe.default.resolve(absOutDir, relPath);
447
+ if (relPath === "package.json") {
448
+ const sourcePath = file.path;
449
+ if (await import_fs_extra.default.exists(targetPath) && await import_fs_extra.default.exists(sourcePath)) {
450
+ const sourcePkgJson = await import_fs_extra.default.readJson(sourcePath);
451
+ const targetPkgJson = await import_fs_extra.default.readJson(targetPath);
452
+ const deps = (0, import_get_value2.default)(sourcePkgJson, "dependencies", { default: {} });
453
+ const devDeps = (0, import_get_value2.default)(sourcePkgJson, "devDependencies", { default: {} });
454
+ Object.entries(deps).forEach((x) => {
455
+ (0, import_set_value.default)(targetPkgJson, `dependencies.${x[0]}`, x[1], { preservePaths: false });
456
+ });
457
+ Object.entries(devDeps).forEach((x) => {
458
+ (0, import_set_value.default)(targetPkgJson, `devDependencies.${x[0]}`, x[1], { preservePaths: false });
459
+ });
460
+ await import_fs_extra.default.writeJson(targetPath, targetPkgJson, {
461
+ spaces: 2
462
+ });
463
+ logger.success(targetPath);
464
+ }
465
+ } else if (relPath === ".changeset/config.json" && repoName && await import_fs_extra.default.exists(file.path)) {
466
+ const changesetJson = await import_fs_extra.default.readJson(file.path);
467
+ (0, import_set_value.default)(changesetJson, "changelog.1.repo", repoName);
468
+ await import_fs_extra.default.ensureDir(import_pathe.default.dirname(targetPath));
469
+ await import_fs_extra.default.writeJson(targetPath, changesetJson, {
375
470
  spaces: 2
376
471
  });
472
+ logger.success(targetPath);
473
+ } else {
474
+ await import_fs_extra.default.copy(
475
+ file.path,
476
+ targetPath
477
+ );
478
+ logger.success(targetPath);
377
479
  }
378
- } else if (relPath === ".changeset/config.json" && repoName && await import_fs_extra.default.exists(file.path)) {
379
- const changesetJson = await import_fs_extra.default.readJson(file.path);
380
- (0, import_set_value.default)(changesetJson, "changelog.1.repo", repoName);
381
- await import_fs_extra.default.writeJson(targetPath, changesetJson, {
382
- spaces: 2
383
- });
384
- } else {
385
- await import_fs_extra.default.copy(
386
- file.path,
387
- import_pathe.default.resolve(absOutDir, relPath)
388
- );
389
480
  }
390
- }
481
+ });
391
482
  }
392
483
  }
393
484
 
394
- // src/cli.ts
395
- main().then(() => {
396
- console.log("upgrade @icebreakers/monorepo ok!");
485
+ // src/program.ts
486
+ import_commander.program.name(name).version(version);
487
+ import_commander.program.option("-i,--interactive").option("--raw", "raw mode").option("--outDir <dir>", "Output directory").action(async (opts) => {
488
+ await main(opts);
489
+ logger.success("upgrade @icebreakers/monorepo ok!");
397
490
  });
491
+ var program_default = import_commander.program;
492
+
493
+ // src/cli.ts
494
+ program_default.parse();
398
495
  /*! Bundled license information:
399
496
 
400
497
  isobject/index.js:
package/dist/cli.js CHANGED
@@ -1,10 +1,27 @@
1
1
  import {
2
2
  init_esm_shims,
3
+ logger,
3
4
  main
4
- } from "./chunk-VFW6IW2P.js";
5
+ } from "./chunk-7ZK7QSXQ.js";
5
6
 
6
7
  // src/cli.ts
7
8
  init_esm_shims();
8
- main().then(() => {
9
- console.log("upgrade @icebreakers/monorepo ok!");
9
+
10
+ // src/program.ts
11
+ init_esm_shims();
12
+ import { program } from "commander";
13
+
14
+ // package.json
15
+ var name = "@icebreakers/monorepo";
16
+ var version = "0.1.3";
17
+
18
+ // src/program.ts
19
+ program.name(name).version(version);
20
+ program.option("-i,--interactive").option("--raw", "raw mode").option("--outDir <dir>", "Output directory").action(async (opts) => {
21
+ await main(opts);
22
+ logger.success("upgrade @icebreakers/monorepo ok!");
10
23
  });
24
+ var program_default = program;
25
+
26
+ // src/cli.ts
27
+ program_default.parse();
package/dist/index.cjs CHANGED
@@ -329,6 +329,27 @@ var import_fs_extra = __toESM(require("fs-extra"), 1);
329
329
  var import_get_value2 = __toESM(require_get_value(), 1);
330
330
  var import_set_value = __toESM(require_set_value(), 1);
331
331
  var import_klaw = __toESM(require("klaw"), 1);
332
+ var import_p_queue = __toESM(require("p-queue"), 1);
333
+ var import_checkbox = __toESM(require("@inquirer/checkbox"), 1);
334
+
335
+ // src/logger.ts
336
+ init_cjs_shims();
337
+ var import_consola = require("consola");
338
+ var logger = (0, import_consola.createConsola)();
339
+
340
+ // src/utils.ts
341
+ init_cjs_shims();
342
+ function escapeStringRegexp(str) {
343
+ return str.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
344
+ }
345
+ function isMatch(str, arr) {
346
+ for (const reg of arr) {
347
+ if (reg.test(str)) {
348
+ return true;
349
+ }
350
+ }
351
+ return false;
352
+ }
332
353
 
333
354
  // src/git.ts
334
355
  init_cjs_shims();
@@ -353,51 +374,113 @@ var GitClient = class {
353
374
  }
354
375
  };
355
376
 
377
+ // src/targets.ts
378
+ init_cjs_shims();
379
+ function getTargets(raw) {
380
+ const list = [
381
+ ".changeset",
382
+ ".husky",
383
+ ".vscode",
384
+ ".editorconfig",
385
+ ".gitattributes",
386
+ ".gitignore",
387
+ ".npmrc",
388
+ "commitlint.config.ts",
389
+ "eslint.config.js",
390
+ "lint-staged.config.js",
391
+ "package.json",
392
+ // pnpm
393
+ "pnpm-workspace.yaml",
394
+ // base tsconfig
395
+ "tsconfig.json",
396
+ // turbo
397
+ "turbo.json",
398
+ // vitest
399
+ "vitest.workspace.ts",
400
+ // #region docker
401
+ "Dockerfile",
402
+ ".dockerignore"
403
+ // #endregion
404
+ ];
405
+ if (!raw) {
406
+ list.push(".github", "LICENSE", "renovate.json", "SECURITY.md", "CODE_OF_CONDUCT.md", "CONTRIBUTING.md");
407
+ }
408
+ return list;
409
+ }
410
+
356
411
  // src/lib.ts
412
+ var queue = new import_p_queue.default({ concurrency: 1 });
357
413
  var __filename2 = (0, import_node_url.fileURLToPath)(importMetaUrl);
358
414
  var __dirname = import_pathe.default.dirname(__filename2);
359
415
  var assetsDir = import_pathe.default.join(__dirname, "../assets");
360
416
  var cwd = import_node_process.default.cwd();
361
- async function main(outdir = "") {
362
- const absOutDir = import_pathe.default.isAbsolute(outdir) ? outdir : import_pathe.default.join(cwd, outdir);
417
+ async function main(opts) {
418
+ const { outDir = "", raw, interactive } = opts;
419
+ const absOutDir = import_pathe.default.isAbsolute(outDir) ? outDir : import_pathe.default.join(cwd, outDir);
363
420
  const gitClient = new GitClient({
364
421
  baseDir: cwd
365
422
  });
366
423
  const repoName = await gitClient.getRepoName();
367
- for await (const file of (0, import_klaw.default)(assetsDir)) {
368
- if (file.stats.isFile()) {
369
- const relPath = import_pathe.default.relative(assetsDir, file.path);
370
- const targetPath = import_pathe.default.resolve(absOutDir, relPath);
371
- if (relPath === "package.json") {
372
- const sourcePath = file.path;
373
- if (await import_fs_extra.default.exists(targetPath) && await import_fs_extra.default.exists(sourcePath)) {
374
- const sourcePkgJson = await import_fs_extra.default.readJson(sourcePath);
375
- const targetPkgJson = await import_fs_extra.default.readJson(targetPath);
376
- const deps = (0, import_get_value2.default)(sourcePkgJson, "dependencies", { default: {} });
377
- const devDeps = (0, import_get_value2.default)(sourcePkgJson, "devDependencies", { default: {} });
378
- Object.entries(deps).forEach((x) => {
379
- (0, import_set_value.default)(targetPkgJson, `dependencies.${x[0]}`, x[1], { preservePaths: false });
380
- });
381
- Object.entries(devDeps).forEach((x) => {
382
- (0, import_set_value.default)(targetPkgJson, `devDependencies.${x[0]}`, x[1], { preservePaths: false });
383
- });
384
- await import_fs_extra.default.writeJson(targetPath, targetPkgJson, {
424
+ let targets = getTargets(raw);
425
+ if (interactive) {
426
+ targets = await (0, import_checkbox.default)({
427
+ message: "\u9009\u62E9\u4F60\u9700\u8981\u7684\u6587\u4EF6",
428
+ choices: targets.map((x) => {
429
+ return {
430
+ value: x,
431
+ checked: true
432
+ };
433
+ })
434
+ });
435
+ }
436
+ const regexpArr = targets.map((x) => {
437
+ return new RegExp(`^${escapeStringRegexp(x)}`);
438
+ });
439
+ for await (const file of (0, import_klaw.default)(assetsDir, {
440
+ filter(p) {
441
+ const str = import_pathe.default.relative(assetsDir, p);
442
+ return isMatch(str, regexpArr);
443
+ }
444
+ })) {
445
+ await queue.add(async () => {
446
+ if (file.stats.isFile()) {
447
+ const relPath = import_pathe.default.relative(assetsDir, file.path);
448
+ const targetPath = import_pathe.default.resolve(absOutDir, relPath);
449
+ if (relPath === "package.json") {
450
+ const sourcePath = file.path;
451
+ if (await import_fs_extra.default.exists(targetPath) && await import_fs_extra.default.exists(sourcePath)) {
452
+ const sourcePkgJson = await import_fs_extra.default.readJson(sourcePath);
453
+ const targetPkgJson = await import_fs_extra.default.readJson(targetPath);
454
+ const deps = (0, import_get_value2.default)(sourcePkgJson, "dependencies", { default: {} });
455
+ const devDeps = (0, import_get_value2.default)(sourcePkgJson, "devDependencies", { default: {} });
456
+ Object.entries(deps).forEach((x) => {
457
+ (0, import_set_value.default)(targetPkgJson, `dependencies.${x[0]}`, x[1], { preservePaths: false });
458
+ });
459
+ Object.entries(devDeps).forEach((x) => {
460
+ (0, import_set_value.default)(targetPkgJson, `devDependencies.${x[0]}`, x[1], { preservePaths: false });
461
+ });
462
+ await import_fs_extra.default.writeJson(targetPath, targetPkgJson, {
463
+ spaces: 2
464
+ });
465
+ logger.success(targetPath);
466
+ }
467
+ } else if (relPath === ".changeset/config.json" && repoName && await import_fs_extra.default.exists(file.path)) {
468
+ const changesetJson = await import_fs_extra.default.readJson(file.path);
469
+ (0, import_set_value.default)(changesetJson, "changelog.1.repo", repoName);
470
+ await import_fs_extra.default.ensureDir(import_pathe.default.dirname(targetPath));
471
+ await import_fs_extra.default.writeJson(targetPath, changesetJson, {
385
472
  spaces: 2
386
473
  });
474
+ logger.success(targetPath);
475
+ } else {
476
+ await import_fs_extra.default.copy(
477
+ file.path,
478
+ targetPath
479
+ );
480
+ logger.success(targetPath);
387
481
  }
388
- } else if (relPath === ".changeset/config.json" && repoName && await import_fs_extra.default.exists(file.path)) {
389
- const changesetJson = await import_fs_extra.default.readJson(file.path);
390
- (0, import_set_value.default)(changesetJson, "changelog.1.repo", repoName);
391
- await import_fs_extra.default.writeJson(targetPath, changesetJson, {
392
- spaces: 2
393
- });
394
- } else {
395
- await import_fs_extra.default.copy(
396
- file.path,
397
- import_pathe.default.resolve(absOutDir, relPath)
398
- );
399
482
  }
400
- }
483
+ });
401
484
  }
402
485
  }
403
486
  // Annotate the CommonJS export names for ESM import in node:
package/dist/index.d.cts CHANGED
@@ -1,3 +1,9 @@
1
- declare function main(outdir?: string): Promise<void>;
1
+ interface CliOpts {
2
+ interactive?: boolean;
3
+ raw?: boolean;
4
+ outDir?: string;
5
+ }
6
+
7
+ declare function main(opts: CliOpts): Promise<void>;
2
8
 
3
9
  export { main };
package/dist/index.d.ts CHANGED
@@ -1,3 +1,9 @@
1
- declare function main(outdir?: string): Promise<void>;
1
+ interface CliOpts {
2
+ interactive?: boolean;
3
+ raw?: boolean;
4
+ outDir?: string;
5
+ }
6
+
7
+ declare function main(opts: CliOpts): Promise<void>;
2
8
 
3
9
  export { main };
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  main
3
- } from "./chunk-VFW6IW2P.js";
3
+ } from "./chunk-7ZK7QSXQ.js";
4
4
  export {
5
5
  main
6
6
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@icebreakers/monorepo",
3
3
  "type": "module",
4
- "version": "0.1.1",
4
+ "version": "0.1.3",
5
5
  "description": "my monorepo config copyer",
6
6
  "author": "sonofmagic",
7
7
  "license": "MIT",
@@ -24,9 +24,13 @@
24
24
  "dist"
25
25
  ],
26
26
  "dependencies": {
27
+ "@inquirer/checkbox": "^2.4.7",
28
+ "commander": "^12.1.0",
29
+ "consola": "^3.2.3",
27
30
  "fs-extra": "^11.2.0",
28
31
  "git-url-parse": "^14.1.0",
29
32
  "klaw": "^4.1.0",
33
+ "p-queue": "^8.0.1",
30
34
  "pathe": "^1.1.2",
31
35
  "simple-git": "^3.25.0"
32
36
  },