@icebreakers/monorepo 0.6.2 → 0.6.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/assets/package.json +3 -3
- package/dist/{chunk-UFDFNNMJ.js → chunk-36LZD73K.js} +16 -4
- package/dist/cli.cjs +101 -11
- package/dist/cli.js +85 -7
- package/dist/index.cjs +18 -5
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/assets/package.json
CHANGED
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"@commitlint/config-conventional": "^19.5.0",
|
|
39
39
|
"@commitlint/prompt-cli": "^19.5.0",
|
|
40
40
|
"@commitlint/types": "^19.5.0",
|
|
41
|
-
"@icebreakers/eslint-config": "^0.
|
|
41
|
+
"@icebreakers/eslint-config": "^0.6.0",
|
|
42
42
|
"@icebreakers/monorepo": "workspace:*",
|
|
43
43
|
"@icebreakers/stylelint-config": "^0.1.1",
|
|
44
44
|
"@types/fs-extra": "^11.0.4",
|
|
@@ -61,13 +61,13 @@
|
|
|
61
61
|
"micromatch": "^4.0.8",
|
|
62
62
|
"only-allow": "^1.2.1",
|
|
63
63
|
"pathe": "^1.1.2",
|
|
64
|
-
"pkg-types": "^1.2.
|
|
64
|
+
"pkg-types": "^1.2.1",
|
|
65
65
|
"rimraf": "^6.0.1",
|
|
66
66
|
"tslib": "^2.7.0",
|
|
67
67
|
"tsup": "^8.3.0",
|
|
68
68
|
"tsx": "^4.19.1",
|
|
69
69
|
"turbo": "^2.1.3",
|
|
70
|
-
"typescript": "^5.6.
|
|
70
|
+
"typescript": "^5.6.3",
|
|
71
71
|
"unbuild": "^2.0.0",
|
|
72
72
|
"vitest": "~2.0.5",
|
|
73
73
|
"yaml": "^2.5.1"
|
|
@@ -13,7 +13,7 @@ import set from "set-value";
|
|
|
13
13
|
|
|
14
14
|
// package.json
|
|
15
15
|
var name = "@icebreakers/monorepo";
|
|
16
|
-
var version = "0.6.
|
|
16
|
+
var version = "0.6.3";
|
|
17
17
|
|
|
18
18
|
// src/logger.ts
|
|
19
19
|
import { createConsola } from "consola";
|
|
@@ -149,19 +149,31 @@ var __dirname2 = path.dirname(__filename2);
|
|
|
149
149
|
var assetsDir = path.join(__dirname2, "../assets");
|
|
150
150
|
var templatesDir = path.join(__dirname2, "../templates");
|
|
151
151
|
var cwd = process.cwd();
|
|
152
|
+
function isWorkspace(version2) {
|
|
153
|
+
if (typeof version2 === "string") {
|
|
154
|
+
return version2.startsWith("workspace:");
|
|
155
|
+
}
|
|
156
|
+
return false;
|
|
157
|
+
}
|
|
152
158
|
function setPkgJson(sourcePkgJson, targetPkgJson) {
|
|
153
159
|
const packageManager = get2(sourcePkgJson, "packageManager", { default: "" });
|
|
154
160
|
const deps = get2(sourcePkgJson, "dependencies", { default: {} });
|
|
155
161
|
const devDeps = get2(sourcePkgJson, "devDependencies", { default: {} });
|
|
162
|
+
const targetDeps = get2(targetPkgJson, "dependencies", { default: {} });
|
|
163
|
+
const targetDevDeps = get2(targetPkgJson, "devDependencies", { default: {} });
|
|
156
164
|
set(targetPkgJson, "packageManager", packageManager);
|
|
157
165
|
Object.entries(deps).forEach((x) => {
|
|
158
|
-
|
|
166
|
+
if (!isWorkspace(targetDeps[x[0]])) {
|
|
167
|
+
set(targetPkgJson, `dependencies.${x[0].replaceAll(".", "\\.")}`, x[1], { preservePaths: false });
|
|
168
|
+
}
|
|
159
169
|
});
|
|
160
170
|
Object.entries(devDeps).forEach((x) => {
|
|
161
|
-
if (x[0] ===
|
|
171
|
+
if (x[0] === name) {
|
|
162
172
|
set(targetPkgJson, `devDependencies.${x[0].replaceAll(".", "\\.")}`, `^${version}`, { preservePaths: false });
|
|
163
173
|
} else {
|
|
164
|
-
|
|
174
|
+
if (!isWorkspace(targetDevDeps[x[0]])) {
|
|
175
|
+
set(targetPkgJson, `devDependencies.${x[0].replaceAll(".", "\\.")}`, x[1], { preservePaths: false });
|
|
176
|
+
}
|
|
165
177
|
}
|
|
166
178
|
});
|
|
167
179
|
for (const [k, v] of scriptsEntries) {
|
package/dist/cli.cjs
CHANGED
|
@@ -22,7 +22,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
22
22
|
mod
|
|
23
23
|
));
|
|
24
24
|
|
|
25
|
-
// ../../node_modules/.pnpm/tsup@8.3.0_jiti@2.3.1_postcss@8.4.47_tsx@4.19.1_typescript@5.6.
|
|
25
|
+
// ../../node_modules/.pnpm/tsup@8.3.0_jiti@2.3.1_postcss@8.4.47_tsx@4.19.1_typescript@5.6.3_yaml@2.5.1/node_modules/tsup/assets/cjs_shims.js
|
|
26
26
|
var getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href;
|
|
27
27
|
var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
|
|
28
28
|
|
|
@@ -32,7 +32,7 @@ var import_commander = require("commander");
|
|
|
32
32
|
|
|
33
33
|
// package.json
|
|
34
34
|
var name = "@icebreakers/monorepo";
|
|
35
|
-
var version = "0.6.
|
|
35
|
+
var version = "0.6.3";
|
|
36
36
|
|
|
37
37
|
// src/lib.ts
|
|
38
38
|
var import_node_process = __toESM(require("process"), 1);
|
|
@@ -181,19 +181,31 @@ var __dirname = import_pathe.default.dirname(__filename2);
|
|
|
181
181
|
var assetsDir = import_pathe.default.join(__dirname, "../assets");
|
|
182
182
|
var templatesDir = import_pathe.default.join(__dirname, "../templates");
|
|
183
183
|
var cwd = import_node_process.default.cwd();
|
|
184
|
+
function isWorkspace(version2) {
|
|
185
|
+
if (typeof version2 === "string") {
|
|
186
|
+
return version2.startsWith("workspace:");
|
|
187
|
+
}
|
|
188
|
+
return false;
|
|
189
|
+
}
|
|
184
190
|
function setPkgJson(sourcePkgJson, targetPkgJson) {
|
|
185
191
|
const packageManager = (0, import_get_value2.default)(sourcePkgJson, "packageManager", { default: "" });
|
|
186
192
|
const deps = (0, import_get_value2.default)(sourcePkgJson, "dependencies", { default: {} });
|
|
187
193
|
const devDeps = (0, import_get_value2.default)(sourcePkgJson, "devDependencies", { default: {} });
|
|
194
|
+
const targetDeps = (0, import_get_value2.default)(targetPkgJson, "dependencies", { default: {} });
|
|
195
|
+
const targetDevDeps = (0, import_get_value2.default)(targetPkgJson, "devDependencies", { default: {} });
|
|
188
196
|
(0, import_set_value.default)(targetPkgJson, "packageManager", packageManager);
|
|
189
197
|
Object.entries(deps).forEach((x) => {
|
|
190
|
-
|
|
198
|
+
if (!isWorkspace(targetDeps[x[0]])) {
|
|
199
|
+
(0, import_set_value.default)(targetPkgJson, `dependencies.${x[0].replaceAll(".", "\\.")}`, x[1], { preservePaths: false });
|
|
200
|
+
}
|
|
191
201
|
});
|
|
192
202
|
Object.entries(devDeps).forEach((x) => {
|
|
193
|
-
if (x[0] ===
|
|
203
|
+
if (x[0] === name) {
|
|
194
204
|
(0, import_set_value.default)(targetPkgJson, `devDependencies.${x[0].replaceAll(".", "\\.")}`, `^${version}`, { preservePaths: false });
|
|
195
205
|
} else {
|
|
196
|
-
|
|
206
|
+
if (!isWorkspace(targetDevDeps[x[0]])) {
|
|
207
|
+
(0, import_set_value.default)(targetPkgJson, `devDependencies.${x[0].replaceAll(".", "\\.")}`, x[1], { preservePaths: false });
|
|
208
|
+
}
|
|
197
209
|
}
|
|
198
210
|
});
|
|
199
211
|
for (const [k, v] of scriptsEntries) {
|
|
@@ -366,20 +378,98 @@ var import_pathe5 = __toESM(require("pathe"), 1);
|
|
|
366
378
|
|
|
367
379
|
// src/monorepo/utils.ts
|
|
368
380
|
var import_workspace = require("@pnpm/workspace.find-packages");
|
|
381
|
+
|
|
382
|
+
// ../../node_modules/.pnpm/defu@6.1.4/node_modules/defu/dist/defu.mjs
|
|
383
|
+
function isPlainObject(value) {
|
|
384
|
+
if (value === null || typeof value !== "object") {
|
|
385
|
+
return false;
|
|
386
|
+
}
|
|
387
|
+
const prototype = Object.getPrototypeOf(value);
|
|
388
|
+
if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) {
|
|
389
|
+
return false;
|
|
390
|
+
}
|
|
391
|
+
if (Symbol.iterator in value) {
|
|
392
|
+
return false;
|
|
393
|
+
}
|
|
394
|
+
if (Symbol.toStringTag in value) {
|
|
395
|
+
return Object.prototype.toString.call(value) === "[object Module]";
|
|
396
|
+
}
|
|
397
|
+
return true;
|
|
398
|
+
}
|
|
399
|
+
function _defu(baseObject, defaults, namespace = ".", merger) {
|
|
400
|
+
if (!isPlainObject(defaults)) {
|
|
401
|
+
return _defu(baseObject, {}, namespace, merger);
|
|
402
|
+
}
|
|
403
|
+
const object = Object.assign({}, defaults);
|
|
404
|
+
for (const key in baseObject) {
|
|
405
|
+
if (key === "__proto__" || key === "constructor") {
|
|
406
|
+
continue;
|
|
407
|
+
}
|
|
408
|
+
const value = baseObject[key];
|
|
409
|
+
if (value === null || value === void 0) {
|
|
410
|
+
continue;
|
|
411
|
+
}
|
|
412
|
+
if (merger && merger(object, key, value, namespace)) {
|
|
413
|
+
continue;
|
|
414
|
+
}
|
|
415
|
+
if (Array.isArray(value) && Array.isArray(object[key])) {
|
|
416
|
+
object[key] = [...value, ...object[key]];
|
|
417
|
+
} else if (isPlainObject(value) && isPlainObject(object[key])) {
|
|
418
|
+
object[key] = _defu(
|
|
419
|
+
value,
|
|
420
|
+
object[key],
|
|
421
|
+
(namespace ? `${namespace}.` : "") + key.toString(),
|
|
422
|
+
merger
|
|
423
|
+
);
|
|
424
|
+
} else {
|
|
425
|
+
object[key] = value;
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
return object;
|
|
429
|
+
}
|
|
430
|
+
function createDefu(merger) {
|
|
431
|
+
return (...arguments_) => (
|
|
432
|
+
// eslint-disable-next-line unicorn/no-array-reduce
|
|
433
|
+
arguments_.reduce((p, c) => _defu(p, c, "", merger), {})
|
|
434
|
+
);
|
|
435
|
+
}
|
|
436
|
+
var defu = createDefu();
|
|
437
|
+
var defuFn = createDefu((object, key, currentValue) => {
|
|
438
|
+
if (object[key] !== void 0 && typeof currentValue === "function") {
|
|
439
|
+
object[key] = currentValue(object[key]);
|
|
440
|
+
return true;
|
|
441
|
+
}
|
|
442
|
+
});
|
|
443
|
+
var defuArrayFn = createDefu((object, key, currentValue) => {
|
|
444
|
+
if (Array.isArray(object[key]) && typeof currentValue === "function") {
|
|
445
|
+
object[key] = currentValue(object[key]);
|
|
446
|
+
return true;
|
|
447
|
+
}
|
|
448
|
+
});
|
|
449
|
+
|
|
450
|
+
// src/monorepo/utils.ts
|
|
369
451
|
var import_pathe4 = __toESM(require("pathe"), 1);
|
|
370
|
-
async function getWorkspacePackages(cwd3) {
|
|
452
|
+
async function getWorkspacePackages(cwd3, options) {
|
|
453
|
+
const posixCwd = import_pathe4.default.normalize(cwd3);
|
|
454
|
+
const { ignoreRootPackage } = defu(options, {
|
|
455
|
+
ignoreRootPackage: true
|
|
456
|
+
});
|
|
371
457
|
const packages = await (0, import_workspace.findWorkspacePackages)(cwd3);
|
|
372
|
-
|
|
458
|
+
let pkgs = packages.map((project) => {
|
|
373
459
|
const pkgJsonPath = import_pathe4.default.resolve(project.rootDir, "package.json");
|
|
374
460
|
return {
|
|
375
461
|
...project,
|
|
376
462
|
pkgJsonPath
|
|
377
463
|
};
|
|
378
|
-
}))).filter((x) => {
|
|
379
|
-
return x.status === "fulfilled";
|
|
380
|
-
}).map((x) => {
|
|
381
|
-
return x.value;
|
|
382
464
|
});
|
|
465
|
+
if (ignoreRootPackage) {
|
|
466
|
+
pkgs = pkgs.filter((x) => {
|
|
467
|
+
return import_pathe4.default.normalize(
|
|
468
|
+
x.rootDir
|
|
469
|
+
) !== posixCwd;
|
|
470
|
+
});
|
|
471
|
+
}
|
|
472
|
+
return pkgs;
|
|
383
473
|
}
|
|
384
474
|
|
|
385
475
|
// src/monorepo/context.ts
|
package/dist/cli.js
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
name,
|
|
6
6
|
upgradeMonorepo,
|
|
7
7
|
version
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-36LZD73K.js";
|
|
9
9
|
|
|
10
10
|
// src/program.ts
|
|
11
11
|
import process from "node:process";
|
|
@@ -89,20 +89,98 @@ import path4 from "pathe";
|
|
|
89
89
|
|
|
90
90
|
// src/monorepo/utils.ts
|
|
91
91
|
import { findWorkspacePackages } from "@pnpm/workspace.find-packages";
|
|
92
|
+
|
|
93
|
+
// ../../node_modules/.pnpm/defu@6.1.4/node_modules/defu/dist/defu.mjs
|
|
94
|
+
function isPlainObject(value) {
|
|
95
|
+
if (value === null || typeof value !== "object") {
|
|
96
|
+
return false;
|
|
97
|
+
}
|
|
98
|
+
const prototype = Object.getPrototypeOf(value);
|
|
99
|
+
if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) {
|
|
100
|
+
return false;
|
|
101
|
+
}
|
|
102
|
+
if (Symbol.iterator in value) {
|
|
103
|
+
return false;
|
|
104
|
+
}
|
|
105
|
+
if (Symbol.toStringTag in value) {
|
|
106
|
+
return Object.prototype.toString.call(value) === "[object Module]";
|
|
107
|
+
}
|
|
108
|
+
return true;
|
|
109
|
+
}
|
|
110
|
+
function _defu(baseObject, defaults, namespace = ".", merger) {
|
|
111
|
+
if (!isPlainObject(defaults)) {
|
|
112
|
+
return _defu(baseObject, {}, namespace, merger);
|
|
113
|
+
}
|
|
114
|
+
const object = Object.assign({}, defaults);
|
|
115
|
+
for (const key in baseObject) {
|
|
116
|
+
if (key === "__proto__" || key === "constructor") {
|
|
117
|
+
continue;
|
|
118
|
+
}
|
|
119
|
+
const value = baseObject[key];
|
|
120
|
+
if (value === null || value === void 0) {
|
|
121
|
+
continue;
|
|
122
|
+
}
|
|
123
|
+
if (merger && merger(object, key, value, namespace)) {
|
|
124
|
+
continue;
|
|
125
|
+
}
|
|
126
|
+
if (Array.isArray(value) && Array.isArray(object[key])) {
|
|
127
|
+
object[key] = [...value, ...object[key]];
|
|
128
|
+
} else if (isPlainObject(value) && isPlainObject(object[key])) {
|
|
129
|
+
object[key] = _defu(
|
|
130
|
+
value,
|
|
131
|
+
object[key],
|
|
132
|
+
(namespace ? `${namespace}.` : "") + key.toString(),
|
|
133
|
+
merger
|
|
134
|
+
);
|
|
135
|
+
} else {
|
|
136
|
+
object[key] = value;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
return object;
|
|
140
|
+
}
|
|
141
|
+
function createDefu(merger) {
|
|
142
|
+
return (...arguments_) => (
|
|
143
|
+
// eslint-disable-next-line unicorn/no-array-reduce
|
|
144
|
+
arguments_.reduce((p, c) => _defu(p, c, "", merger), {})
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
var defu = createDefu();
|
|
148
|
+
var defuFn = createDefu((object, key, currentValue) => {
|
|
149
|
+
if (object[key] !== void 0 && typeof currentValue === "function") {
|
|
150
|
+
object[key] = currentValue(object[key]);
|
|
151
|
+
return true;
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
var defuArrayFn = createDefu((object, key, currentValue) => {
|
|
155
|
+
if (Array.isArray(object[key]) && typeof currentValue === "function") {
|
|
156
|
+
object[key] = currentValue(object[key]);
|
|
157
|
+
return true;
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
// src/monorepo/utils.ts
|
|
92
162
|
import path3 from "pathe";
|
|
93
|
-
async function getWorkspacePackages(cwd2) {
|
|
163
|
+
async function getWorkspacePackages(cwd2, options) {
|
|
164
|
+
const posixCwd = path3.normalize(cwd2);
|
|
165
|
+
const { ignoreRootPackage } = defu(options, {
|
|
166
|
+
ignoreRootPackage: true
|
|
167
|
+
});
|
|
94
168
|
const packages = await findWorkspacePackages(cwd2);
|
|
95
|
-
|
|
169
|
+
let pkgs = packages.map((project) => {
|
|
96
170
|
const pkgJsonPath = path3.resolve(project.rootDir, "package.json");
|
|
97
171
|
return {
|
|
98
172
|
...project,
|
|
99
173
|
pkgJsonPath
|
|
100
174
|
};
|
|
101
|
-
}))).filter((x) => {
|
|
102
|
-
return x.status === "fulfilled";
|
|
103
|
-
}).map((x) => {
|
|
104
|
-
return x.value;
|
|
105
175
|
});
|
|
176
|
+
if (ignoreRootPackage) {
|
|
177
|
+
pkgs = pkgs.filter((x) => {
|
|
178
|
+
return path3.normalize(
|
|
179
|
+
x.rootDir
|
|
180
|
+
) !== posixCwd;
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
return pkgs;
|
|
106
184
|
}
|
|
107
185
|
|
|
108
186
|
// src/monorepo/context.ts
|
package/dist/index.cjs
CHANGED
|
@@ -36,7 +36,7 @@ __export(src_exports, {
|
|
|
36
36
|
});
|
|
37
37
|
module.exports = __toCommonJS(src_exports);
|
|
38
38
|
|
|
39
|
-
// ../../node_modules/.pnpm/tsup@8.3.0_jiti@2.3.1_postcss@8.4.47_tsx@4.19.1_typescript@5.6.
|
|
39
|
+
// ../../node_modules/.pnpm/tsup@8.3.0_jiti@2.3.1_postcss@8.4.47_tsx@4.19.1_typescript@5.6.3_yaml@2.5.1/node_modules/tsup/assets/cjs_shims.js
|
|
40
40
|
var getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href;
|
|
41
41
|
var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
|
|
42
42
|
|
|
@@ -54,7 +54,8 @@ var import_picocolors = __toESM(require("picocolors"), 1);
|
|
|
54
54
|
var import_set_value = __toESM(require("set-value"), 1);
|
|
55
55
|
|
|
56
56
|
// package.json
|
|
57
|
-
var
|
|
57
|
+
var name = "@icebreakers/monorepo";
|
|
58
|
+
var version = "0.6.3";
|
|
58
59
|
|
|
59
60
|
// src/logger.ts
|
|
60
61
|
var import_consola = require("consola");
|
|
@@ -190,19 +191,31 @@ var __dirname = import_pathe.default.dirname(__filename2);
|
|
|
190
191
|
var assetsDir = import_pathe.default.join(__dirname, "../assets");
|
|
191
192
|
var templatesDir = import_pathe.default.join(__dirname, "../templates");
|
|
192
193
|
var cwd = import_node_process.default.cwd();
|
|
194
|
+
function isWorkspace(version2) {
|
|
195
|
+
if (typeof version2 === "string") {
|
|
196
|
+
return version2.startsWith("workspace:");
|
|
197
|
+
}
|
|
198
|
+
return false;
|
|
199
|
+
}
|
|
193
200
|
function setPkgJson(sourcePkgJson, targetPkgJson) {
|
|
194
201
|
const packageManager = (0, import_get_value2.default)(sourcePkgJson, "packageManager", { default: "" });
|
|
195
202
|
const deps = (0, import_get_value2.default)(sourcePkgJson, "dependencies", { default: {} });
|
|
196
203
|
const devDeps = (0, import_get_value2.default)(sourcePkgJson, "devDependencies", { default: {} });
|
|
204
|
+
const targetDeps = (0, import_get_value2.default)(targetPkgJson, "dependencies", { default: {} });
|
|
205
|
+
const targetDevDeps = (0, import_get_value2.default)(targetPkgJson, "devDependencies", { default: {} });
|
|
197
206
|
(0, import_set_value.default)(targetPkgJson, "packageManager", packageManager);
|
|
198
207
|
Object.entries(deps).forEach((x) => {
|
|
199
|
-
|
|
208
|
+
if (!isWorkspace(targetDeps[x[0]])) {
|
|
209
|
+
(0, import_set_value.default)(targetPkgJson, `dependencies.${x[0].replaceAll(".", "\\.")}`, x[1], { preservePaths: false });
|
|
210
|
+
}
|
|
200
211
|
});
|
|
201
212
|
Object.entries(devDeps).forEach((x) => {
|
|
202
|
-
if (x[0] ===
|
|
213
|
+
if (x[0] === name) {
|
|
203
214
|
(0, import_set_value.default)(targetPkgJson, `devDependencies.${x[0].replaceAll(".", "\\.")}`, `^${version}`, { preservePaths: false });
|
|
204
215
|
} else {
|
|
205
|
-
|
|
216
|
+
if (!isWorkspace(targetDevDeps[x[0]])) {
|
|
217
|
+
(0, import_set_value.default)(targetPkgJson, `devDependencies.${x[0].replaceAll(".", "\\.")}`, x[1], { preservePaths: false });
|
|
218
|
+
}
|
|
206
219
|
}
|
|
207
220
|
});
|
|
208
221
|
for (const [k, v] of scriptsEntries) {
|
package/dist/index.js
CHANGED