@icebreakers/monorepo 0.6.7 → 0.6.9
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/assets/package.json +5 -5
- package/dist/{chunk-VZY3ZJJ6.js → chunk-653WXXRS.js} +38 -25
- package/dist/cli.cjs +38 -25
- package/dist/cli.js +1 -1
- package/dist/index.cjs +38 -25
- package/dist/index.js +1 -1
- package/package.json +3 -3
package/assets/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"type": "module",
|
|
4
4
|
"version": "0.0.0",
|
|
5
5
|
"private": true,
|
|
6
|
-
"packageManager": "pnpm@9.12.
|
|
6
|
+
"packageManager": "pnpm@9.12.2",
|
|
7
7
|
"author": "ice breaker <1324318532@qq.com>",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
@@ -46,17 +46,17 @@
|
|
|
46
46
|
"@types/git-url-parse": "^9.0.3",
|
|
47
47
|
"@types/klaw": "^3.0.6",
|
|
48
48
|
"@types/lint-staged": "^13.3.0",
|
|
49
|
-
"@types/lodash": "^4.17.
|
|
49
|
+
"@types/lodash": "^4.17.11",
|
|
50
50
|
"@types/lodash-es": "^4.17.12",
|
|
51
51
|
"@types/micromatch": "^4.0.9",
|
|
52
|
-
"@types/node": "^22.7.
|
|
52
|
+
"@types/node": "^22.7.6",
|
|
53
53
|
"@types/set-value": "^4.0.3",
|
|
54
54
|
"@vitest/coverage-v8": "~2.1.3",
|
|
55
55
|
"ci-info": "^4.0.0",
|
|
56
56
|
"cross-env": "^7.0.3",
|
|
57
57
|
"defu": "^6.1.4",
|
|
58
58
|
"eslint": "^9.12.0",
|
|
59
|
-
"execa": "^9.4.
|
|
59
|
+
"execa": "^9.4.1",
|
|
60
60
|
"fs-extra": "^11.2.0",
|
|
61
61
|
"get-value": "^3.0.1",
|
|
62
62
|
"husky": "^9.1.6",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"pkg-types": "^1.2.1",
|
|
70
70
|
"rimraf": "^6.0.1",
|
|
71
71
|
"set-value": "^4.1.0",
|
|
72
|
-
"tslib": "^2.
|
|
72
|
+
"tslib": "^2.8.0",
|
|
73
73
|
"tsup": "^8.3.0",
|
|
74
74
|
"tsx": "^4.19.1",
|
|
75
75
|
"turbo": "^2.1.3",
|
|
@@ -51,27 +51,27 @@ var require_get_value = __commonJS({
|
|
|
51
51
|
"use strict";
|
|
52
52
|
init_esm_shims();
|
|
53
53
|
var isObject = require_isobject();
|
|
54
|
-
module.exports = function(target,
|
|
54
|
+
module.exports = function(target, path9, options) {
|
|
55
55
|
if (!isObject(options)) {
|
|
56
56
|
options = { default: options };
|
|
57
57
|
}
|
|
58
58
|
if (!isValidObject(target)) {
|
|
59
59
|
return typeof options.default !== "undefined" ? options.default : target;
|
|
60
60
|
}
|
|
61
|
-
if (typeof
|
|
62
|
-
|
|
61
|
+
if (typeof path9 === "number") {
|
|
62
|
+
path9 = String(path9);
|
|
63
63
|
}
|
|
64
|
-
const isArray = Array.isArray(
|
|
65
|
-
const isString = typeof
|
|
64
|
+
const isArray = Array.isArray(path9);
|
|
65
|
+
const isString = typeof path9 === "string";
|
|
66
66
|
const splitChar = options.separator || ".";
|
|
67
67
|
const joinChar = options.joinChar || (typeof splitChar === "string" ? splitChar : ".");
|
|
68
68
|
if (!isString && !isArray) {
|
|
69
69
|
return target;
|
|
70
70
|
}
|
|
71
|
-
if (isString &&
|
|
72
|
-
return isValid(
|
|
71
|
+
if (isString && path9 in target) {
|
|
72
|
+
return isValid(path9, target, options) ? target[path9] : options.default;
|
|
73
73
|
}
|
|
74
|
-
let segs = isArray ?
|
|
74
|
+
let segs = isArray ? path9 : split(path9, splitChar, options);
|
|
75
75
|
let len = segs.length;
|
|
76
76
|
let idx = 0;
|
|
77
77
|
do {
|
|
@@ -117,11 +117,11 @@ var require_get_value = __commonJS({
|
|
|
117
117
|
}
|
|
118
118
|
return segs[0] + joinChar + segs[1];
|
|
119
119
|
}
|
|
120
|
-
function split(
|
|
120
|
+
function split(path9, splitChar, options) {
|
|
121
121
|
if (typeof options.split === "function") {
|
|
122
|
-
return options.split(
|
|
122
|
+
return options.split(path9);
|
|
123
123
|
}
|
|
124
|
-
return
|
|
124
|
+
return path9.split(splitChar);
|
|
125
125
|
}
|
|
126
126
|
function isValid(key, target, options) {
|
|
127
127
|
if (typeof options.isValid === "function") {
|
|
@@ -271,9 +271,9 @@ var require_set_value = __commonJS({
|
|
|
271
271
|
}
|
|
272
272
|
return obj;
|
|
273
273
|
};
|
|
274
|
-
var setValue = (target,
|
|
275
|
-
if (!
|
|
276
|
-
const keys = split(
|
|
274
|
+
var setValue = (target, path9, value, options) => {
|
|
275
|
+
if (!path9 || !isObject(target)) return target;
|
|
276
|
+
const keys = split(path9, options);
|
|
277
277
|
let obj = target;
|
|
278
278
|
for (let i = 0; i < keys.length; i++) {
|
|
279
279
|
const key = keys[i];
|
|
@@ -405,7 +405,7 @@ init_esm_shims();
|
|
|
405
405
|
|
|
406
406
|
// package.json
|
|
407
407
|
var name = "@icebreakers/monorepo";
|
|
408
|
-
var version = "0.6.
|
|
408
|
+
var version = "0.6.9";
|
|
409
409
|
|
|
410
410
|
// src/logger.ts
|
|
411
411
|
init_esm_shims();
|
|
@@ -645,6 +645,7 @@ async function setVscodeBinaryMirror(cwd2) {
|
|
|
645
645
|
|
|
646
646
|
// src/monorepo/clean.ts
|
|
647
647
|
init_esm_shims();
|
|
648
|
+
var import_set_value3 = __toESM(require_set_value(), 1);
|
|
648
649
|
import fs3 from "fs-extra";
|
|
649
650
|
import path3 from "pathe";
|
|
650
651
|
var dirs = [
|
|
@@ -660,6 +661,12 @@ async function cleanProjects(cwd2) {
|
|
|
660
661
|
})) {
|
|
661
662
|
await fs3.remove(dir);
|
|
662
663
|
}
|
|
664
|
+
const name2 = "package.json";
|
|
665
|
+
const pkgJson = await fs3.readJson(name2);
|
|
666
|
+
(0, import_set_value3.default)(pkgJson, "devDependencies.@icebreakers/monorepo", "latest", { preservePaths: false });
|
|
667
|
+
await fs3.outputJson(name2, pkgJson, {
|
|
668
|
+
spaces: 2
|
|
669
|
+
});
|
|
663
670
|
}
|
|
664
671
|
|
|
665
672
|
// src/monorepo/workspace.ts
|
|
@@ -777,9 +784,13 @@ async function createContext(cwd2) {
|
|
|
777
784
|
const git = new GitClient();
|
|
778
785
|
const workspaceFilepath = path5.resolve(cwd2, "pnpm-workspace.yaml");
|
|
779
786
|
const projects = await getWorkspacePackages(cwd2);
|
|
787
|
+
const gitUrl = await git.getGitUrl();
|
|
788
|
+
const gitUser = await git.getUser();
|
|
780
789
|
return {
|
|
781
790
|
cwd: cwd2,
|
|
782
791
|
git,
|
|
792
|
+
gitUrl,
|
|
793
|
+
gitUser,
|
|
783
794
|
workspaceFilepath,
|
|
784
795
|
projects
|
|
785
796
|
};
|
|
@@ -787,18 +798,16 @@ async function createContext(cwd2) {
|
|
|
787
798
|
|
|
788
799
|
// src/monorepo/setPkgJson.ts
|
|
789
800
|
init_esm_shims();
|
|
790
|
-
var
|
|
801
|
+
var import_set_value4 = __toESM(require_set_value(), 1);
|
|
791
802
|
import fs4 from "fs-extra";
|
|
792
803
|
import path6 from "pathe";
|
|
793
804
|
async function setPkgJson_default(ctx) {
|
|
794
|
-
const {
|
|
795
|
-
const gitUrl = await git.getGitUrl();
|
|
796
|
-
const gitUser = await git.getUser();
|
|
805
|
+
const { gitUrl, gitUser, projects, cwd: cwd2, workspaceFilepath } = ctx;
|
|
797
806
|
if (gitUrl && await fs4.exists(workspaceFilepath)) {
|
|
798
807
|
for (const project of projects) {
|
|
799
808
|
const pkgJson = project.manifest;
|
|
800
809
|
const directory = path6.relative(cwd2, project.rootDir);
|
|
801
|
-
(0,
|
|
810
|
+
(0, import_set_value4.default)(pkgJson, "bugs.url", `https://github.com/${gitUrl.full_name}/issues`);
|
|
802
811
|
const repository = {
|
|
803
812
|
type: "git",
|
|
804
813
|
url: `git+https://github.com/${gitUrl.full_name}.git`
|
|
@@ -806,9 +815,9 @@ async function setPkgJson_default(ctx) {
|
|
|
806
815
|
if (directory) {
|
|
807
816
|
repository.directory = directory;
|
|
808
817
|
}
|
|
809
|
-
(0,
|
|
818
|
+
(0, import_set_value4.default)(pkgJson, "repository", repository);
|
|
810
819
|
if (gitUser) {
|
|
811
|
-
(0,
|
|
820
|
+
(0, import_set_value4.default)(pkgJson, "author", `${gitUser.name} <${gitUser.email}>`);
|
|
812
821
|
}
|
|
813
822
|
await fs4.writeJSON(project.pkgJsonPath, pkgJson, {
|
|
814
823
|
spaces: 2
|
|
@@ -873,16 +882,20 @@ init_esm_shims();
|
|
|
873
882
|
import os from "node:os";
|
|
874
883
|
import { execa } from "execa";
|
|
875
884
|
import PQueue2 from "p-queue";
|
|
885
|
+
import path8 from "pathe";
|
|
876
886
|
import pc2 from "picocolors";
|
|
877
887
|
async function syncNpmMirror(cwd2) {
|
|
878
888
|
const packages = await getWorkspacePackages(cwd2);
|
|
879
|
-
|
|
889
|
+
logger.info(`[\u5F53\u524D\u5DE5\u4F5C\u533ARepo]:
|
|
890
|
+
${packages.map((x) => `- ${pc2.green(x.manifest.name)} : ${path8.relative(cwd2, x.rootDir)}`).join("\n")}
|
|
891
|
+
`);
|
|
892
|
+
const set5 = new Set(packages.map((x) => x.manifest.name));
|
|
880
893
|
logger.info(`[\u5373\u5C06\u540C\u6B65\u7684\u5305]:
|
|
881
|
-
${Array.from(
|
|
894
|
+
${Array.from(set5).map((x) => `- ${pc2.green(x)}`).join("\n")}
|
|
882
895
|
`);
|
|
883
896
|
const concurrency = Math.max(os.cpus().length, 1);
|
|
884
897
|
const queue2 = new PQueue2({ concurrency });
|
|
885
|
-
for (const pkgName of
|
|
898
|
+
for (const pkgName of set5) {
|
|
886
899
|
if (pkgName) {
|
|
887
900
|
await queue2.add(async () => {
|
|
888
901
|
return execa({
|
package/dist/cli.cjs
CHANGED
|
@@ -55,27 +55,27 @@ var require_get_value = __commonJS({
|
|
|
55
55
|
"use strict";
|
|
56
56
|
init_cjs_shims();
|
|
57
57
|
var isObject = require_isobject();
|
|
58
|
-
module2.exports = function(target,
|
|
58
|
+
module2.exports = function(target, path9, options) {
|
|
59
59
|
if (!isObject(options)) {
|
|
60
60
|
options = { default: options };
|
|
61
61
|
}
|
|
62
62
|
if (!isValidObject(target)) {
|
|
63
63
|
return typeof options.default !== "undefined" ? options.default : target;
|
|
64
64
|
}
|
|
65
|
-
if (typeof
|
|
66
|
-
|
|
65
|
+
if (typeof path9 === "number") {
|
|
66
|
+
path9 = String(path9);
|
|
67
67
|
}
|
|
68
|
-
const isArray = Array.isArray(
|
|
69
|
-
const isString = typeof
|
|
68
|
+
const isArray = Array.isArray(path9);
|
|
69
|
+
const isString = typeof path9 === "string";
|
|
70
70
|
const splitChar = options.separator || ".";
|
|
71
71
|
const joinChar = options.joinChar || (typeof splitChar === "string" ? splitChar : ".");
|
|
72
72
|
if (!isString && !isArray) {
|
|
73
73
|
return target;
|
|
74
74
|
}
|
|
75
|
-
if (isString &&
|
|
76
|
-
return isValid(
|
|
75
|
+
if (isString && path9 in target) {
|
|
76
|
+
return isValid(path9, target, options) ? target[path9] : options.default;
|
|
77
77
|
}
|
|
78
|
-
let segs = isArray ?
|
|
78
|
+
let segs = isArray ? path9 : split(path9, splitChar, options);
|
|
79
79
|
let len = segs.length;
|
|
80
80
|
let idx = 0;
|
|
81
81
|
do {
|
|
@@ -121,11 +121,11 @@ var require_get_value = __commonJS({
|
|
|
121
121
|
}
|
|
122
122
|
return segs[0] + joinChar + segs[1];
|
|
123
123
|
}
|
|
124
|
-
function split(
|
|
124
|
+
function split(path9, splitChar, options) {
|
|
125
125
|
if (typeof options.split === "function") {
|
|
126
|
-
return options.split(
|
|
126
|
+
return options.split(path9);
|
|
127
127
|
}
|
|
128
|
-
return
|
|
128
|
+
return path9.split(splitChar);
|
|
129
129
|
}
|
|
130
130
|
function isValid(key, target, options) {
|
|
131
131
|
if (typeof options.isValid === "function") {
|
|
@@ -275,9 +275,9 @@ var require_set_value = __commonJS({
|
|
|
275
275
|
}
|
|
276
276
|
return obj;
|
|
277
277
|
};
|
|
278
|
-
var setValue = (target,
|
|
279
|
-
if (!
|
|
280
|
-
const keys = split(
|
|
278
|
+
var setValue = (target, path9, value, options) => {
|
|
279
|
+
if (!path9 || !isObject(target)) return target;
|
|
280
|
+
const keys = split(path9, options);
|
|
281
281
|
let obj = target;
|
|
282
282
|
for (let i = 0; i < keys.length; i++) {
|
|
283
283
|
const key = keys[i];
|
|
@@ -320,7 +320,7 @@ init_cjs_shims();
|
|
|
320
320
|
|
|
321
321
|
// package.json
|
|
322
322
|
var name = "@icebreakers/monorepo";
|
|
323
|
-
var version = "0.6.
|
|
323
|
+
var version = "0.6.9";
|
|
324
324
|
|
|
325
325
|
// src/lib.ts
|
|
326
326
|
init_cjs_shims();
|
|
@@ -662,6 +662,7 @@ async function setVscodeBinaryMirror(cwd3) {
|
|
|
662
662
|
init_cjs_shims();
|
|
663
663
|
var import_fs_extra3 = __toESM(require("fs-extra"), 1);
|
|
664
664
|
var import_pathe3 = __toESM(require("pathe"), 1);
|
|
665
|
+
var import_set_value3 = __toESM(require_set_value(), 1);
|
|
665
666
|
var dirs = [
|
|
666
667
|
"packages/monorepo",
|
|
667
668
|
"packages/foo",
|
|
@@ -675,6 +676,12 @@ async function cleanProjects(cwd3) {
|
|
|
675
676
|
})) {
|
|
676
677
|
await import_fs_extra3.default.remove(dir);
|
|
677
678
|
}
|
|
679
|
+
const name2 = "package.json";
|
|
680
|
+
const pkgJson = await import_fs_extra3.default.readJson(name2);
|
|
681
|
+
(0, import_set_value3.default)(pkgJson, "devDependencies.@icebreakers/monorepo", "latest", { preservePaths: false });
|
|
682
|
+
await import_fs_extra3.default.outputJson(name2, pkgJson, {
|
|
683
|
+
spaces: 2
|
|
684
|
+
});
|
|
678
685
|
}
|
|
679
686
|
|
|
680
687
|
// src/monorepo/init.ts
|
|
@@ -794,9 +801,13 @@ async function createContext(cwd3) {
|
|
|
794
801
|
const git = new GitClient();
|
|
795
802
|
const workspaceFilepath = import_pathe5.default.resolve(cwd3, "pnpm-workspace.yaml");
|
|
796
803
|
const projects = await getWorkspacePackages(cwd3);
|
|
804
|
+
const gitUrl = await git.getGitUrl();
|
|
805
|
+
const gitUser = await git.getUser();
|
|
797
806
|
return {
|
|
798
807
|
cwd: cwd3,
|
|
799
808
|
git,
|
|
809
|
+
gitUrl,
|
|
810
|
+
gitUser,
|
|
800
811
|
workspaceFilepath,
|
|
801
812
|
projects
|
|
802
813
|
};
|
|
@@ -806,16 +817,14 @@ async function createContext(cwd3) {
|
|
|
806
817
|
init_cjs_shims();
|
|
807
818
|
var import_fs_extra4 = __toESM(require("fs-extra"), 1);
|
|
808
819
|
var import_pathe6 = __toESM(require("pathe"), 1);
|
|
809
|
-
var
|
|
820
|
+
var import_set_value4 = __toESM(require_set_value(), 1);
|
|
810
821
|
async function setPkgJson_default(ctx) {
|
|
811
|
-
const {
|
|
812
|
-
const gitUrl = await git.getGitUrl();
|
|
813
|
-
const gitUser = await git.getUser();
|
|
822
|
+
const { gitUrl, gitUser, projects, cwd: cwd3, workspaceFilepath } = ctx;
|
|
814
823
|
if (gitUrl && await import_fs_extra4.default.exists(workspaceFilepath)) {
|
|
815
824
|
for (const project of projects) {
|
|
816
825
|
const pkgJson = project.manifest;
|
|
817
826
|
const directory = import_pathe6.default.relative(cwd3, project.rootDir);
|
|
818
|
-
(0,
|
|
827
|
+
(0, import_set_value4.default)(pkgJson, "bugs.url", `https://github.com/${gitUrl.full_name}/issues`);
|
|
819
828
|
const repository = {
|
|
820
829
|
type: "git",
|
|
821
830
|
url: `git+https://github.com/${gitUrl.full_name}.git`
|
|
@@ -823,9 +832,9 @@ async function setPkgJson_default(ctx) {
|
|
|
823
832
|
if (directory) {
|
|
824
833
|
repository.directory = directory;
|
|
825
834
|
}
|
|
826
|
-
(0,
|
|
835
|
+
(0, import_set_value4.default)(pkgJson, "repository", repository);
|
|
827
836
|
if (gitUser) {
|
|
828
|
-
(0,
|
|
837
|
+
(0, import_set_value4.default)(pkgJson, "author", `${gitUser.name} <${gitUser.email}>`);
|
|
829
838
|
}
|
|
830
839
|
await import_fs_extra4.default.writeJSON(project.pkgJsonPath, pkgJson, {
|
|
831
840
|
spaces: 2
|
|
@@ -890,16 +899,20 @@ init_cjs_shims();
|
|
|
890
899
|
var import_node_os = __toESM(require("os"), 1);
|
|
891
900
|
var import_execa = require("execa");
|
|
892
901
|
var import_p_queue2 = __toESM(require("p-queue"), 1);
|
|
902
|
+
var import_pathe8 = __toESM(require("pathe"), 1);
|
|
893
903
|
var import_picocolors2 = __toESM(require("picocolors"), 1);
|
|
894
904
|
async function syncNpmMirror(cwd3) {
|
|
895
905
|
const packages = await getWorkspacePackages(cwd3);
|
|
896
|
-
|
|
906
|
+
logger.info(`[\u5F53\u524D\u5DE5\u4F5C\u533ARepo]:
|
|
907
|
+
${packages.map((x) => `- ${import_picocolors2.default.green(x.manifest.name)} : ${import_pathe8.default.relative(cwd3, x.rootDir)}`).join("\n")}
|
|
908
|
+
`);
|
|
909
|
+
const set5 = new Set(packages.map((x) => x.manifest.name));
|
|
897
910
|
logger.info(`[\u5373\u5C06\u540C\u6B65\u7684\u5305]:
|
|
898
|
-
${Array.from(
|
|
911
|
+
${Array.from(set5).map((x) => `- ${import_picocolors2.default.green(x)}`).join("\n")}
|
|
899
912
|
`);
|
|
900
913
|
const concurrency = Math.max(import_node_os.default.cpus().length, 1);
|
|
901
914
|
const queue2 = new import_p_queue2.default({ concurrency });
|
|
902
|
-
for (const pkgName of
|
|
915
|
+
for (const pkgName of set5) {
|
|
903
916
|
if (pkgName) {
|
|
904
917
|
await queue2.add(async () => {
|
|
905
918
|
return (0, import_execa.execa)({
|
package/dist/cli.js
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -60,27 +60,27 @@ var require_get_value = __commonJS({
|
|
|
60
60
|
"use strict";
|
|
61
61
|
init_cjs_shims();
|
|
62
62
|
var isObject = require_isobject();
|
|
63
|
-
module2.exports = function(target,
|
|
63
|
+
module2.exports = function(target, path9, options) {
|
|
64
64
|
if (!isObject(options)) {
|
|
65
65
|
options = { default: options };
|
|
66
66
|
}
|
|
67
67
|
if (!isValidObject(target)) {
|
|
68
68
|
return typeof options.default !== "undefined" ? options.default : target;
|
|
69
69
|
}
|
|
70
|
-
if (typeof
|
|
71
|
-
|
|
70
|
+
if (typeof path9 === "number") {
|
|
71
|
+
path9 = String(path9);
|
|
72
72
|
}
|
|
73
|
-
const isArray = Array.isArray(
|
|
74
|
-
const isString = typeof
|
|
73
|
+
const isArray = Array.isArray(path9);
|
|
74
|
+
const isString = typeof path9 === "string";
|
|
75
75
|
const splitChar = options.separator || ".";
|
|
76
76
|
const joinChar = options.joinChar || (typeof splitChar === "string" ? splitChar : ".");
|
|
77
77
|
if (!isString && !isArray) {
|
|
78
78
|
return target;
|
|
79
79
|
}
|
|
80
|
-
if (isString &&
|
|
81
|
-
return isValid(
|
|
80
|
+
if (isString && path9 in target) {
|
|
81
|
+
return isValid(path9, target, options) ? target[path9] : options.default;
|
|
82
82
|
}
|
|
83
|
-
let segs = isArray ?
|
|
83
|
+
let segs = isArray ? path9 : split(path9, splitChar, options);
|
|
84
84
|
let len = segs.length;
|
|
85
85
|
let idx = 0;
|
|
86
86
|
do {
|
|
@@ -126,11 +126,11 @@ var require_get_value = __commonJS({
|
|
|
126
126
|
}
|
|
127
127
|
return segs[0] + joinChar + segs[1];
|
|
128
128
|
}
|
|
129
|
-
function split(
|
|
129
|
+
function split(path9, splitChar, options) {
|
|
130
130
|
if (typeof options.split === "function") {
|
|
131
|
-
return options.split(
|
|
131
|
+
return options.split(path9);
|
|
132
132
|
}
|
|
133
|
-
return
|
|
133
|
+
return path9.split(splitChar);
|
|
134
134
|
}
|
|
135
135
|
function isValid(key, target, options) {
|
|
136
136
|
if (typeof options.isValid === "function") {
|
|
@@ -280,9 +280,9 @@ var require_set_value = __commonJS({
|
|
|
280
280
|
}
|
|
281
281
|
return obj;
|
|
282
282
|
};
|
|
283
|
-
var setValue = (target,
|
|
284
|
-
if (!
|
|
285
|
-
const keys = split(
|
|
283
|
+
var setValue = (target, path9, value, options) => {
|
|
284
|
+
if (!path9 || !isObject(target)) return target;
|
|
285
|
+
const keys = split(path9, options);
|
|
286
286
|
let obj = target;
|
|
287
287
|
for (let i = 0; i < keys.length; i++) {
|
|
288
288
|
const key = keys[i];
|
|
@@ -351,7 +351,7 @@ init_cjs_shims();
|
|
|
351
351
|
|
|
352
352
|
// package.json
|
|
353
353
|
var name = "@icebreakers/monorepo";
|
|
354
|
-
var version = "0.6.
|
|
354
|
+
var version = "0.6.9";
|
|
355
355
|
|
|
356
356
|
// src/logger.ts
|
|
357
357
|
init_cjs_shims();
|
|
@@ -679,6 +679,7 @@ async function setVscodeBinaryMirror(cwd2) {
|
|
|
679
679
|
init_cjs_shims();
|
|
680
680
|
var import_fs_extra3 = __toESM(require("fs-extra"), 1);
|
|
681
681
|
var import_pathe3 = __toESM(require("pathe"), 1);
|
|
682
|
+
var import_set_value3 = __toESM(require_set_value(), 1);
|
|
682
683
|
var dirs = [
|
|
683
684
|
"packages/monorepo",
|
|
684
685
|
"packages/foo",
|
|
@@ -692,6 +693,12 @@ async function cleanProjects(cwd2) {
|
|
|
692
693
|
})) {
|
|
693
694
|
await import_fs_extra3.default.remove(dir);
|
|
694
695
|
}
|
|
696
|
+
const name2 = "package.json";
|
|
697
|
+
const pkgJson = await import_fs_extra3.default.readJson(name2);
|
|
698
|
+
(0, import_set_value3.default)(pkgJson, "devDependencies.@icebreakers/monorepo", "latest", { preservePaths: false });
|
|
699
|
+
await import_fs_extra3.default.outputJson(name2, pkgJson, {
|
|
700
|
+
spaces: 2
|
|
701
|
+
});
|
|
695
702
|
}
|
|
696
703
|
|
|
697
704
|
// src/monorepo/init.ts
|
|
@@ -811,9 +818,13 @@ async function createContext(cwd2) {
|
|
|
811
818
|
const git = new GitClient();
|
|
812
819
|
const workspaceFilepath = import_pathe5.default.resolve(cwd2, "pnpm-workspace.yaml");
|
|
813
820
|
const projects = await getWorkspacePackages(cwd2);
|
|
821
|
+
const gitUrl = await git.getGitUrl();
|
|
822
|
+
const gitUser = await git.getUser();
|
|
814
823
|
return {
|
|
815
824
|
cwd: cwd2,
|
|
816
825
|
git,
|
|
826
|
+
gitUrl,
|
|
827
|
+
gitUser,
|
|
817
828
|
workspaceFilepath,
|
|
818
829
|
projects
|
|
819
830
|
};
|
|
@@ -823,16 +834,14 @@ async function createContext(cwd2) {
|
|
|
823
834
|
init_cjs_shims();
|
|
824
835
|
var import_fs_extra4 = __toESM(require("fs-extra"), 1);
|
|
825
836
|
var import_pathe6 = __toESM(require("pathe"), 1);
|
|
826
|
-
var
|
|
837
|
+
var import_set_value4 = __toESM(require_set_value(), 1);
|
|
827
838
|
async function setPkgJson_default(ctx) {
|
|
828
|
-
const {
|
|
829
|
-
const gitUrl = await git.getGitUrl();
|
|
830
|
-
const gitUser = await git.getUser();
|
|
839
|
+
const { gitUrl, gitUser, projects, cwd: cwd2, workspaceFilepath } = ctx;
|
|
831
840
|
if (gitUrl && await import_fs_extra4.default.exists(workspaceFilepath)) {
|
|
832
841
|
for (const project of projects) {
|
|
833
842
|
const pkgJson = project.manifest;
|
|
834
843
|
const directory = import_pathe6.default.relative(cwd2, project.rootDir);
|
|
835
|
-
(0,
|
|
844
|
+
(0, import_set_value4.default)(pkgJson, "bugs.url", `https://github.com/${gitUrl.full_name}/issues`);
|
|
836
845
|
const repository = {
|
|
837
846
|
type: "git",
|
|
838
847
|
url: `git+https://github.com/${gitUrl.full_name}.git`
|
|
@@ -840,9 +849,9 @@ async function setPkgJson_default(ctx) {
|
|
|
840
849
|
if (directory) {
|
|
841
850
|
repository.directory = directory;
|
|
842
851
|
}
|
|
843
|
-
(0,
|
|
852
|
+
(0, import_set_value4.default)(pkgJson, "repository", repository);
|
|
844
853
|
if (gitUser) {
|
|
845
|
-
(0,
|
|
854
|
+
(0, import_set_value4.default)(pkgJson, "author", `${gitUser.name} <${gitUser.email}>`);
|
|
846
855
|
}
|
|
847
856
|
await import_fs_extra4.default.writeJSON(project.pkgJsonPath, pkgJson, {
|
|
848
857
|
spaces: 2
|
|
@@ -907,16 +916,20 @@ init_cjs_shims();
|
|
|
907
916
|
var import_node_os = __toESM(require("os"), 1);
|
|
908
917
|
var import_execa = require("execa");
|
|
909
918
|
var import_p_queue2 = __toESM(require("p-queue"), 1);
|
|
919
|
+
var import_pathe8 = __toESM(require("pathe"), 1);
|
|
910
920
|
var import_picocolors2 = __toESM(require("picocolors"), 1);
|
|
911
921
|
async function syncNpmMirror(cwd2) {
|
|
912
922
|
const packages = await getWorkspacePackages(cwd2);
|
|
913
|
-
|
|
923
|
+
logger.info(`[\u5F53\u524D\u5DE5\u4F5C\u533ARepo]:
|
|
924
|
+
${packages.map((x) => `- ${import_picocolors2.default.green(x.manifest.name)} : ${import_pathe8.default.relative(cwd2, x.rootDir)}`).join("\n")}
|
|
925
|
+
`);
|
|
926
|
+
const set5 = new Set(packages.map((x) => x.manifest.name));
|
|
914
927
|
logger.info(`[\u5373\u5C06\u540C\u6B65\u7684\u5305]:
|
|
915
|
-
${Array.from(
|
|
928
|
+
${Array.from(set5).map((x) => `- ${import_picocolors2.default.green(x)}`).join("\n")}
|
|
916
929
|
`);
|
|
917
930
|
const concurrency = Math.max(import_node_os.default.cpus().length, 1);
|
|
918
931
|
const queue2 = new import_p_queue2.default({ concurrency });
|
|
919
|
-
for (const pkgName of
|
|
932
|
+
for (const pkgName of set5) {
|
|
920
933
|
if (pkgName) {
|
|
921
934
|
await queue2.add(async () => {
|
|
922
935
|
return (0, import_execa.execa)({
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@icebreakers/monorepo",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.6.
|
|
4
|
+
"version": "0.6.9",
|
|
5
5
|
"description": "icebreaker's monorepo config generator",
|
|
6
6
|
"author": "ice breaker <1324318532@qq.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -42,13 +42,13 @@
|
|
|
42
42
|
"commander": "^12.1.0",
|
|
43
43
|
"comment-json": "^4.2.5",
|
|
44
44
|
"consola": "^3.2.3",
|
|
45
|
-
"execa": "^9.4.
|
|
45
|
+
"execa": "^9.4.1",
|
|
46
46
|
"fs-extra": "^11.2.0",
|
|
47
47
|
"git-url-parse": "^15.0.0",
|
|
48
48
|
"klaw": "^4.1.0",
|
|
49
49
|
"p-queue": "^8.0.1",
|
|
50
50
|
"pathe": "^1.1.2",
|
|
51
|
-
"picocolors": "^1.1.
|
|
51
|
+
"picocolors": "^1.1.1",
|
|
52
52
|
"simple-git": "^3.27.0"
|
|
53
53
|
},
|
|
54
54
|
"scripts": {
|