@icebreakers/monorepo 0.0.8 → 0.1.0
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/assets → assets}/package.json +2 -0
- package/dist/chunk-J3MNI6VD.js +520 -0
- package/dist/cli.cjs +149 -26
- package/dist/cli.js +4 -355
- package/dist/index.cjs +526 -0
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +5 -5
- package/package.json +8 -2
- package/dist/chunk-22Y5C5SV.js +0 -41
- /package/{dist/assets → assets}/.changeset/config.json +0 -0
- /package/{dist/assets → assets}/.dockerignore +0 -0
- /package/{dist/assets → assets}/.editorconfig +0 -0
- /package/{dist/assets → assets}/.gitattributes +0 -0
- /package/{dist/assets → assets}/.github/FUNDING.yml +0 -0
- /package/{dist/assets → assets}/.github/ISSUE_TEMPLATE/bug_report.yml +0 -0
- /package/{dist/assets → assets}/.github/ISSUE_TEMPLATE/config.yml +0 -0
- /package/{dist/assets → assets}/.github/workflows/ci.yml +0 -0
- /package/{dist/assets → assets}/.github/workflows/release.yml +0 -0
- /package/{dist/assets → assets}/.husky/commit-msg +0 -0
- /package/{dist/assets → assets}/.husky/pre-commit +0 -0
- /package/{dist/assets → assets}/.vscode/settings.json +0 -0
- /package/{dist/assets → assets}/CODE_OF_CONDUCT.md +0 -0
- /package/{dist/assets → assets}/CONTRIBUTING.md +0 -0
- /package/{dist/assets → assets}/Dockerfile +0 -0
- /package/{dist/assets → assets}/LICENSE +0 -0
- /package/{dist/assets → assets}/SECURITY.md +0 -0
- /package/{dist/assets → assets}/commitlint.config.ts +0 -0
- /package/{dist/assets → assets}/eslint.config.js +0 -0
- /package/{dist/assets → assets}/lint-staged.config.js +0 -0
- /package/{dist/assets → assets}/pnpm-workspace.yaml +0 -0
- /package/{dist/assets → assets}/renovate.json +0 -0
- /package/{dist/assets → assets}/tsconfig.json +0 -0
- /package/{dist/assets → assets}/turbo.json +0 -0
- /package/{dist/assets → assets}/vitest.workspace.ts +0 -0
package/dist/cli.cjs
CHANGED
|
@@ -307,49 +307,172 @@ var require_set_value = __commonJS({
|
|
|
307
307
|
}
|
|
308
308
|
});
|
|
309
309
|
|
|
310
|
+
// ../../node_modules/.pnpm/klaw@4.1.0/node_modules/klaw/src/index.js
|
|
311
|
+
var require_src = __commonJS({
|
|
312
|
+
"../../node_modules/.pnpm/klaw@4.1.0/node_modules/klaw/src/index.js"(exports2, module2) {
|
|
313
|
+
"use strict";
|
|
314
|
+
init_cjs_shims();
|
|
315
|
+
var { strictEqual } = require("assert");
|
|
316
|
+
var path2 = require("path");
|
|
317
|
+
var fs2 = require("fs");
|
|
318
|
+
var { Readable } = require("stream");
|
|
319
|
+
var { fileURLToPath: fileURLToPath2 } = require("url");
|
|
320
|
+
var Walker = class extends Readable {
|
|
321
|
+
/**
|
|
322
|
+
* @param {string} dir
|
|
323
|
+
* @param {Object} options
|
|
324
|
+
*/
|
|
325
|
+
constructor(dir, options) {
|
|
326
|
+
if (dir instanceof URL) {
|
|
327
|
+
dir = fileURLToPath2(dir);
|
|
328
|
+
}
|
|
329
|
+
strictEqual(typeof dir, "string", "`dir` parameter should be of type string or file URL. Got type: " + typeof dir);
|
|
330
|
+
options = {
|
|
331
|
+
queueMethod: "shift",
|
|
332
|
+
pathSorter: void 0,
|
|
333
|
+
filter: void 0,
|
|
334
|
+
depthLimit: void 0,
|
|
335
|
+
preserveSymlinks: false,
|
|
336
|
+
...options,
|
|
337
|
+
objectMode: true
|
|
338
|
+
};
|
|
339
|
+
super(options);
|
|
340
|
+
this.root = path2.resolve(dir);
|
|
341
|
+
this.paths = [this.root];
|
|
342
|
+
this.options = options;
|
|
343
|
+
if (options.depthLimit > -1) {
|
|
344
|
+
this.rootDepth = this.root.split(path2.sep).length + 1;
|
|
345
|
+
}
|
|
346
|
+
this.fs = options.fs || fs2;
|
|
347
|
+
}
|
|
348
|
+
_read() {
|
|
349
|
+
if (this.paths.length === 0) {
|
|
350
|
+
return this.push(null);
|
|
351
|
+
}
|
|
352
|
+
const pathItem = this.paths[this.options.queueMethod]();
|
|
353
|
+
const statFunction = this.options.preserveSymlinks ? this.fs.lstat : this.fs.stat;
|
|
354
|
+
statFunction(pathItem, (err, stats) => {
|
|
355
|
+
const item = { path: pathItem, stats };
|
|
356
|
+
if (err) {
|
|
357
|
+
return this.emit("error", err, item);
|
|
358
|
+
}
|
|
359
|
+
if (!stats.isDirectory() || this.rootDepth && pathItem.split(path2.sep).length - this.rootDepth >= this.options.depthLimit) {
|
|
360
|
+
return this.push(item);
|
|
361
|
+
}
|
|
362
|
+
this.fs.readdir(pathItem, (err2, pathItems) => {
|
|
363
|
+
if (err2) {
|
|
364
|
+
this.push(item);
|
|
365
|
+
return this.emit("error", err2, item);
|
|
366
|
+
}
|
|
367
|
+
pathItems = pathItems.map(function(part) {
|
|
368
|
+
return path2.join(pathItem, part);
|
|
369
|
+
});
|
|
370
|
+
if (this.options.filter) {
|
|
371
|
+
pathItems = pathItems.filter(this.options.filter);
|
|
372
|
+
}
|
|
373
|
+
if (this.options.pathSorter) {
|
|
374
|
+
pathItems.sort(this.options.pathSorter);
|
|
375
|
+
}
|
|
376
|
+
this.paths.push.apply(this.paths, pathItems);
|
|
377
|
+
this.push(item);
|
|
378
|
+
});
|
|
379
|
+
});
|
|
380
|
+
}
|
|
381
|
+
};
|
|
382
|
+
function walk(root, options) {
|
|
383
|
+
return new Walker(root, options);
|
|
384
|
+
}
|
|
385
|
+
module2.exports = walk;
|
|
386
|
+
}
|
|
387
|
+
});
|
|
388
|
+
|
|
310
389
|
// src/cli.ts
|
|
311
390
|
init_cjs_shims();
|
|
391
|
+
|
|
392
|
+
// src/lib.ts
|
|
393
|
+
init_cjs_shims();
|
|
312
394
|
var import_node_url = require("url");
|
|
313
395
|
var import_node_process = __toESM(require("process"), 1);
|
|
314
396
|
var import_pathe = __toESM(require("pathe"), 1);
|
|
315
397
|
var import_fs_extra = __toESM(require("fs-extra"), 1);
|
|
316
|
-
var
|
|
398
|
+
var import_get_value2 = __toESM(require_get_value(), 1);
|
|
317
399
|
var import_set_value = __toESM(require_set_value(), 1);
|
|
400
|
+
var import_klaw = __toESM(require_src(), 1);
|
|
401
|
+
|
|
402
|
+
// src/git.ts
|
|
403
|
+
init_cjs_shims();
|
|
404
|
+
var import_simple_git = require("simple-git");
|
|
405
|
+
var import_git_url_parse = __toESM(require("git-url-parse"), 1);
|
|
406
|
+
var import_get_value = __toESM(require_get_value(), 1);
|
|
407
|
+
var GitClient = class {
|
|
408
|
+
client;
|
|
409
|
+
constructor(options) {
|
|
410
|
+
this.client = (0, import_simple_git.simpleGit)(options);
|
|
411
|
+
}
|
|
412
|
+
listConfig() {
|
|
413
|
+
return this.client.listConfig();
|
|
414
|
+
}
|
|
415
|
+
async getRepoName() {
|
|
416
|
+
const listConfig = await this.listConfig();
|
|
417
|
+
const x = (0, import_get_value.default)(listConfig.all, "remote.origin.url");
|
|
418
|
+
if (x) {
|
|
419
|
+
const url = (0, import_git_url_parse.default)(x);
|
|
420
|
+
return `${url.owner}/${url.name}`;
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
};
|
|
424
|
+
|
|
425
|
+
// src/lib.ts
|
|
318
426
|
var __filename2 = (0, import_node_url.fileURLToPath)(importMetaUrl);
|
|
319
427
|
var __dirname = import_pathe.default.dirname(__filename2);
|
|
320
|
-
var assetsDir = import_pathe.default.join(__dirname, "
|
|
428
|
+
var assetsDir = import_pathe.default.join(__dirname, "../assets");
|
|
321
429
|
var cwd = import_node_process.default.cwd();
|
|
322
|
-
async function main() {
|
|
323
|
-
const
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
(0,
|
|
338
|
-
|
|
339
|
-
|
|
430
|
+
async function main(outdir = "") {
|
|
431
|
+
const absOutDir = import_pathe.default.isAbsolute(outdir) ? outdir : import_pathe.default.join(cwd, outdir);
|
|
432
|
+
const gitClient = new GitClient({
|
|
433
|
+
baseDir: cwd
|
|
434
|
+
});
|
|
435
|
+
const repoName = await gitClient.getRepoName();
|
|
436
|
+
for await (const file of (0, import_klaw.default)(assetsDir)) {
|
|
437
|
+
if (file.stats.isFile()) {
|
|
438
|
+
const relPath = import_pathe.default.relative(assetsDir, file.path);
|
|
439
|
+
const targetPath = import_pathe.default.resolve(absOutDir, relPath);
|
|
440
|
+
if (relPath === "package.json") {
|
|
441
|
+
const sourcePath = file.path;
|
|
442
|
+
if (await import_fs_extra.default.exists(targetPath) && await import_fs_extra.default.exists(sourcePath)) {
|
|
443
|
+
const sourcePkgJson = await import_fs_extra.default.readJson(sourcePath);
|
|
444
|
+
const targetPkgJson = await import_fs_extra.default.readJson(targetPath);
|
|
445
|
+
const deps = (0, import_get_value2.default)(sourcePkgJson, "dependencies", { default: {} });
|
|
446
|
+
const devDeps = (0, import_get_value2.default)(sourcePkgJson, "devDependencies", { default: {} });
|
|
447
|
+
Object.entries(deps).forEach((x) => {
|
|
448
|
+
(0, import_set_value.default)(targetPkgJson, `dependencies.${x[0]}`, x[1], { preservePaths: false });
|
|
449
|
+
});
|
|
450
|
+
Object.entries(devDeps).forEach((x) => {
|
|
451
|
+
(0, import_set_value.default)(targetPkgJson, `devDependencies.${x[0]}`, x[1], { preservePaths: false });
|
|
452
|
+
});
|
|
453
|
+
await import_fs_extra.default.writeJson(targetPath, targetPkgJson, {
|
|
454
|
+
spaces: 2
|
|
455
|
+
});
|
|
456
|
+
}
|
|
457
|
+
} else if (relPath === ".changeset/config.json" && repoName && await import_fs_extra.default.exists(file.path)) {
|
|
458
|
+
const changesetJson = await import_fs_extra.default.readJson(file.path);
|
|
459
|
+
(0, import_set_value.default)(changesetJson, "changelog.1.repo", repoName);
|
|
460
|
+
await import_fs_extra.default.writeJson(targetPath, changesetJson, {
|
|
340
461
|
spaces: 2
|
|
341
462
|
});
|
|
463
|
+
} else {
|
|
464
|
+
await import_fs_extra.default.copy(
|
|
465
|
+
file.path,
|
|
466
|
+
import_pathe.default.resolve(absOutDir, relPath)
|
|
467
|
+
);
|
|
342
468
|
}
|
|
343
|
-
} else {
|
|
344
|
-
await import_fs_extra.default.copy(
|
|
345
|
-
import_pathe.default.resolve(assetsDir, item),
|
|
346
|
-
import_pathe.default.resolve(cwd, item)
|
|
347
|
-
);
|
|
348
469
|
}
|
|
349
470
|
}
|
|
350
471
|
}
|
|
472
|
+
|
|
473
|
+
// src/cli.ts
|
|
351
474
|
main().then(() => {
|
|
352
|
-
console.log("@icebreakers/monorepo ok!");
|
|
475
|
+
console.log("upgrade @icebreakers/monorepo ok!");
|
|
353
476
|
});
|
|
354
477
|
/*! Bundled license information:
|
|
355
478
|
|
package/dist/cli.js
CHANGED
|
@@ -1,361 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
} from "./chunk-22Y5C5SV.js";
|
|
6
|
-
|
|
7
|
-
// ../../node_modules/.pnpm/isobject@3.0.1/node_modules/isobject/index.js
|
|
8
|
-
var require_isobject = __commonJS({
|
|
9
|
-
"../../node_modules/.pnpm/isobject@3.0.1/node_modules/isobject/index.js"(exports, module) {
|
|
10
|
-
"use strict";
|
|
11
|
-
init_esm_shims();
|
|
12
|
-
module.exports = function isObject(val) {
|
|
13
|
-
return val != null && typeof val === "object" && Array.isArray(val) === false;
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
// ../../node_modules/.pnpm/get-value@3.0.1/node_modules/get-value/index.js
|
|
19
|
-
var require_get_value = __commonJS({
|
|
20
|
-
"../../node_modules/.pnpm/get-value@3.0.1/node_modules/get-value/index.js"(exports, module) {
|
|
21
|
-
"use strict";
|
|
22
|
-
init_esm_shims();
|
|
23
|
-
var isObject = require_isobject();
|
|
24
|
-
module.exports = function(target, path2, options) {
|
|
25
|
-
if (!isObject(options)) {
|
|
26
|
-
options = { default: options };
|
|
27
|
-
}
|
|
28
|
-
if (!isValidObject(target)) {
|
|
29
|
-
return typeof options.default !== "undefined" ? options.default : target;
|
|
30
|
-
}
|
|
31
|
-
if (typeof path2 === "number") {
|
|
32
|
-
path2 = String(path2);
|
|
33
|
-
}
|
|
34
|
-
const isArray = Array.isArray(path2);
|
|
35
|
-
const isString = typeof path2 === "string";
|
|
36
|
-
const splitChar = options.separator || ".";
|
|
37
|
-
const joinChar = options.joinChar || (typeof splitChar === "string" ? splitChar : ".");
|
|
38
|
-
if (!isString && !isArray) {
|
|
39
|
-
return target;
|
|
40
|
-
}
|
|
41
|
-
if (isString && path2 in target) {
|
|
42
|
-
return isValid(path2, target, options) ? target[path2] : options.default;
|
|
43
|
-
}
|
|
44
|
-
let segs = isArray ? path2 : split(path2, splitChar, options);
|
|
45
|
-
let len = segs.length;
|
|
46
|
-
let idx = 0;
|
|
47
|
-
do {
|
|
48
|
-
let prop = segs[idx];
|
|
49
|
-
if (typeof prop === "number") {
|
|
50
|
-
prop = String(prop);
|
|
51
|
-
}
|
|
52
|
-
while (prop && prop.slice(-1) === "\\") {
|
|
53
|
-
prop = join([prop.slice(0, -1), segs[++idx] || ""], joinChar, options);
|
|
54
|
-
}
|
|
55
|
-
if (prop in target) {
|
|
56
|
-
if (!isValid(prop, target, options)) {
|
|
57
|
-
return options.default;
|
|
58
|
-
}
|
|
59
|
-
target = target[prop];
|
|
60
|
-
} else {
|
|
61
|
-
let hasProp = false;
|
|
62
|
-
let n = idx + 1;
|
|
63
|
-
while (n < len) {
|
|
64
|
-
prop = join([prop, segs[n++]], joinChar, options);
|
|
65
|
-
if (hasProp = prop in target) {
|
|
66
|
-
if (!isValid(prop, target, options)) {
|
|
67
|
-
return options.default;
|
|
68
|
-
}
|
|
69
|
-
target = target[prop];
|
|
70
|
-
idx = n - 1;
|
|
71
|
-
break;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
if (!hasProp) {
|
|
75
|
-
return options.default;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
} while (++idx < len && isValidObject(target));
|
|
79
|
-
if (idx === len) {
|
|
80
|
-
return target;
|
|
81
|
-
}
|
|
82
|
-
return options.default;
|
|
83
|
-
};
|
|
84
|
-
function join(segs, joinChar, options) {
|
|
85
|
-
if (typeof options.join === "function") {
|
|
86
|
-
return options.join(segs);
|
|
87
|
-
}
|
|
88
|
-
return segs[0] + joinChar + segs[1];
|
|
89
|
-
}
|
|
90
|
-
function split(path2, splitChar, options) {
|
|
91
|
-
if (typeof options.split === "function") {
|
|
92
|
-
return options.split(path2);
|
|
93
|
-
}
|
|
94
|
-
return path2.split(splitChar);
|
|
95
|
-
}
|
|
96
|
-
function isValid(key, target, options) {
|
|
97
|
-
if (typeof options.isValid === "function") {
|
|
98
|
-
return options.isValid(key, target);
|
|
99
|
-
}
|
|
100
|
-
return true;
|
|
101
|
-
}
|
|
102
|
-
function isValidObject(val) {
|
|
103
|
-
return isObject(val) || Array.isArray(val) || typeof val === "function";
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
// ../../node_modules/.pnpm/is-primitive@3.0.1/node_modules/is-primitive/index.js
|
|
109
|
-
var require_is_primitive = __commonJS({
|
|
110
|
-
"../../node_modules/.pnpm/is-primitive@3.0.1/node_modules/is-primitive/index.js"(exports, module) {
|
|
111
|
-
"use strict";
|
|
112
|
-
init_esm_shims();
|
|
113
|
-
module.exports = function isPrimitive(val) {
|
|
114
|
-
if (typeof val === "object") {
|
|
115
|
-
return val === null;
|
|
116
|
-
}
|
|
117
|
-
return typeof val !== "function";
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
// ../../node_modules/.pnpm/is-plain-object@2.0.4/node_modules/is-plain-object/index.js
|
|
123
|
-
var require_is_plain_object = __commonJS({
|
|
124
|
-
"../../node_modules/.pnpm/is-plain-object@2.0.4/node_modules/is-plain-object/index.js"(exports, module) {
|
|
125
|
-
"use strict";
|
|
126
|
-
init_esm_shims();
|
|
127
|
-
var isObject = require_isobject();
|
|
128
|
-
function isObjectObject(o) {
|
|
129
|
-
return isObject(o) === true && Object.prototype.toString.call(o) === "[object Object]";
|
|
130
|
-
}
|
|
131
|
-
module.exports = function isPlainObject(o) {
|
|
132
|
-
var ctor, prot;
|
|
133
|
-
if (isObjectObject(o) === false) return false;
|
|
134
|
-
ctor = o.constructor;
|
|
135
|
-
if (typeof ctor !== "function") return false;
|
|
136
|
-
prot = ctor.prototype;
|
|
137
|
-
if (isObjectObject(prot) === false) return false;
|
|
138
|
-
if (prot.hasOwnProperty("isPrototypeOf") === false) {
|
|
139
|
-
return false;
|
|
140
|
-
}
|
|
141
|
-
return true;
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
// ../../node_modules/.pnpm/set-value@4.1.0/node_modules/set-value/index.js
|
|
147
|
-
var require_set_value = __commonJS({
|
|
148
|
-
"../../node_modules/.pnpm/set-value@4.1.0/node_modules/set-value/index.js"(exports, module) {
|
|
149
|
-
"use strict";
|
|
150
|
-
init_esm_shims();
|
|
151
|
-
var { deleteProperty } = Reflect;
|
|
152
|
-
var isPrimitive = require_is_primitive();
|
|
153
|
-
var isPlainObject = require_is_plain_object();
|
|
154
|
-
var isObject = (value) => {
|
|
155
|
-
return typeof value === "object" && value !== null || typeof value === "function";
|
|
156
|
-
};
|
|
157
|
-
var isUnsafeKey = (key) => {
|
|
158
|
-
return key === "__proto__" || key === "constructor" || key === "prototype";
|
|
159
|
-
};
|
|
160
|
-
var validateKey = (key) => {
|
|
161
|
-
if (!isPrimitive(key)) {
|
|
162
|
-
throw new TypeError("Object keys must be strings or symbols");
|
|
163
|
-
}
|
|
164
|
-
if (isUnsafeKey(key)) {
|
|
165
|
-
throw new Error(`Cannot set unsafe key: "${key}"`);
|
|
166
|
-
}
|
|
167
|
-
};
|
|
168
|
-
var toStringKey = (input) => {
|
|
169
|
-
return Array.isArray(input) ? input.flat().map(String).join(",") : input;
|
|
170
|
-
};
|
|
171
|
-
var createMemoKey = (input, options) => {
|
|
172
|
-
if (typeof input !== "string" || !options) return input;
|
|
173
|
-
let key = input + ";";
|
|
174
|
-
if (options.arrays !== void 0) key += `arrays=${options.arrays};`;
|
|
175
|
-
if (options.separator !== void 0) key += `separator=${options.separator};`;
|
|
176
|
-
if (options.split !== void 0) key += `split=${options.split};`;
|
|
177
|
-
if (options.merge !== void 0) key += `merge=${options.merge};`;
|
|
178
|
-
if (options.preservePaths !== void 0) key += `preservePaths=${options.preservePaths};`;
|
|
179
|
-
return key;
|
|
180
|
-
};
|
|
181
|
-
var memoize = (input, options, fn) => {
|
|
182
|
-
const key = toStringKey(options ? createMemoKey(input, options) : input);
|
|
183
|
-
validateKey(key);
|
|
184
|
-
const value = setValue.cache.get(key) || fn();
|
|
185
|
-
setValue.cache.set(key, value);
|
|
186
|
-
return value;
|
|
187
|
-
};
|
|
188
|
-
var splitString = (input, options = {}) => {
|
|
189
|
-
const sep = options.separator || ".";
|
|
190
|
-
const preserve = sep === "/" ? false : options.preservePaths;
|
|
191
|
-
if (typeof input === "string" && preserve !== false && /\//.test(input)) {
|
|
192
|
-
return [input];
|
|
193
|
-
}
|
|
194
|
-
const parts = [];
|
|
195
|
-
let part = "";
|
|
196
|
-
const push = (part2) => {
|
|
197
|
-
let number;
|
|
198
|
-
if (part2.trim() !== "" && Number.isInteger(number = Number(part2))) {
|
|
199
|
-
parts.push(number);
|
|
200
|
-
} else {
|
|
201
|
-
parts.push(part2);
|
|
202
|
-
}
|
|
203
|
-
};
|
|
204
|
-
for (let i = 0; i < input.length; i++) {
|
|
205
|
-
const value = input[i];
|
|
206
|
-
if (value === "\\") {
|
|
207
|
-
part += input[++i];
|
|
208
|
-
continue;
|
|
209
|
-
}
|
|
210
|
-
if (value === sep) {
|
|
211
|
-
push(part);
|
|
212
|
-
part = "";
|
|
213
|
-
continue;
|
|
214
|
-
}
|
|
215
|
-
part += value;
|
|
216
|
-
}
|
|
217
|
-
if (part) {
|
|
218
|
-
push(part);
|
|
219
|
-
}
|
|
220
|
-
return parts;
|
|
221
|
-
};
|
|
222
|
-
var split = (input, options) => {
|
|
223
|
-
if (options && typeof options.split === "function") return options.split(input);
|
|
224
|
-
if (typeof input === "symbol") return [input];
|
|
225
|
-
if (Array.isArray(input)) return input;
|
|
226
|
-
return memoize(input, options, () => splitString(input, options));
|
|
227
|
-
};
|
|
228
|
-
var assignProp = (obj, prop, value, options) => {
|
|
229
|
-
validateKey(prop);
|
|
230
|
-
if (value === void 0) {
|
|
231
|
-
deleteProperty(obj, prop);
|
|
232
|
-
} else if (options && options.merge) {
|
|
233
|
-
const merge = options.merge === "function" ? options.merge : Object.assign;
|
|
234
|
-
if (merge && isPlainObject(obj[prop]) && isPlainObject(value)) {
|
|
235
|
-
obj[prop] = merge(obj[prop], value);
|
|
236
|
-
} else {
|
|
237
|
-
obj[prop] = value;
|
|
238
|
-
}
|
|
239
|
-
} else {
|
|
240
|
-
obj[prop] = value;
|
|
241
|
-
}
|
|
242
|
-
return obj;
|
|
243
|
-
};
|
|
244
|
-
var setValue = (target, path2, value, options) => {
|
|
245
|
-
if (!path2 || !isObject(target)) return target;
|
|
246
|
-
const keys = split(path2, options);
|
|
247
|
-
let obj = target;
|
|
248
|
-
for (let i = 0; i < keys.length; i++) {
|
|
249
|
-
const key = keys[i];
|
|
250
|
-
const next = keys[i + 1];
|
|
251
|
-
validateKey(key);
|
|
252
|
-
if (next === void 0) {
|
|
253
|
-
assignProp(obj, key, value, options);
|
|
254
|
-
break;
|
|
255
|
-
}
|
|
256
|
-
if (typeof next === "number" && !Array.isArray(obj[key])) {
|
|
257
|
-
obj = obj[key] = [];
|
|
258
|
-
continue;
|
|
259
|
-
}
|
|
260
|
-
if (!isObject(obj[key])) {
|
|
261
|
-
obj[key] = {};
|
|
262
|
-
}
|
|
263
|
-
obj = obj[key];
|
|
264
|
-
}
|
|
265
|
-
return target;
|
|
266
|
-
};
|
|
267
|
-
setValue.split = split;
|
|
268
|
-
setValue.cache = /* @__PURE__ */ new Map();
|
|
269
|
-
setValue.clear = () => {
|
|
270
|
-
setValue.cache = /* @__PURE__ */ new Map();
|
|
271
|
-
};
|
|
272
|
-
module.exports = setValue;
|
|
273
|
-
}
|
|
274
|
-
});
|
|
2
|
+
init_esm_shims,
|
|
3
|
+
main
|
|
4
|
+
} from "./chunk-J3MNI6VD.js";
|
|
275
5
|
|
|
276
6
|
// src/cli.ts
|
|
277
7
|
init_esm_shims();
|
|
278
|
-
var import_get_value = __toESM(require_get_value(), 1);
|
|
279
|
-
var import_set_value = __toESM(require_set_value(), 1);
|
|
280
|
-
import { fileURLToPath } from "node:url";
|
|
281
|
-
import process from "node:process";
|
|
282
|
-
import path from "pathe";
|
|
283
|
-
import fs from "fs-extra";
|
|
284
|
-
var __filename = fileURLToPath(import.meta.url);
|
|
285
|
-
var __dirname = path.dirname(__filename);
|
|
286
|
-
var assetsDir = path.join(__dirname, "./assets");
|
|
287
|
-
var cwd = process.cwd();
|
|
288
|
-
async function main() {
|
|
289
|
-
const list = await fs.readdir(assetsDir);
|
|
290
|
-
for (const item of list) {
|
|
291
|
-
if (item === "package.json") {
|
|
292
|
-
const sourcePath = path.resolve(assetsDir, item);
|
|
293
|
-
const targetPath = path.resolve(cwd, item);
|
|
294
|
-
if (await fs.exists(targetPath) && await fs.exists(sourcePath)) {
|
|
295
|
-
const sourcePkgJson = await fs.readJson(sourcePath);
|
|
296
|
-
const targetPkgJson = await fs.readJson(targetPath);
|
|
297
|
-
const deps = (0, import_get_value.default)(sourcePkgJson, "dependencies", { default: {} });
|
|
298
|
-
const devDeps = (0, import_get_value.default)(sourcePkgJson, "devDependencies", { default: {} });
|
|
299
|
-
Object.entries(deps).forEach((x) => {
|
|
300
|
-
(0, import_set_value.default)(targetPkgJson, `dependencies.${x[0]}`, x[1], { preservePaths: false });
|
|
301
|
-
});
|
|
302
|
-
Object.entries(devDeps).forEach((x) => {
|
|
303
|
-
(0, import_set_value.default)(targetPkgJson, `devDependencies.${x[0]}`, x[1], { preservePaths: false });
|
|
304
|
-
});
|
|
305
|
-
await fs.writeJson(targetPath, targetPkgJson, {
|
|
306
|
-
spaces: 2
|
|
307
|
-
});
|
|
308
|
-
}
|
|
309
|
-
} else {
|
|
310
|
-
await fs.copy(
|
|
311
|
-
path.resolve(assetsDir, item),
|
|
312
|
-
path.resolve(cwd, item)
|
|
313
|
-
);
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
8
|
main().then(() => {
|
|
318
|
-
console.log("@icebreakers/monorepo ok!");
|
|
9
|
+
console.log("upgrade @icebreakers/monorepo ok!");
|
|
319
10
|
});
|
|
320
|
-
/*! Bundled license information:
|
|
321
|
-
|
|
322
|
-
isobject/index.js:
|
|
323
|
-
(*!
|
|
324
|
-
* isobject <https://github.com/jonschlinkert/isobject>
|
|
325
|
-
*
|
|
326
|
-
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
327
|
-
* Released under the MIT License.
|
|
328
|
-
*)
|
|
329
|
-
|
|
330
|
-
get-value/index.js:
|
|
331
|
-
(*!
|
|
332
|
-
* get-value <https://github.com/jonschlinkert/get-value>
|
|
333
|
-
*
|
|
334
|
-
* Copyright (c) 2014-2018, Jon Schlinkert.
|
|
335
|
-
* Released under the MIT License.
|
|
336
|
-
*)
|
|
337
|
-
|
|
338
|
-
is-primitive/index.js:
|
|
339
|
-
(*!
|
|
340
|
-
* is-primitive <https://github.com/jonschlinkert/is-primitive>
|
|
341
|
-
*
|
|
342
|
-
* Copyright (c) 2014-present, Jon Schlinkert.
|
|
343
|
-
* Released under the MIT License.
|
|
344
|
-
*)
|
|
345
|
-
|
|
346
|
-
is-plain-object/index.js:
|
|
347
|
-
(*!
|
|
348
|
-
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
|
|
349
|
-
*
|
|
350
|
-
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
351
|
-
* Released under the MIT License.
|
|
352
|
-
*)
|
|
353
|
-
|
|
354
|
-
set-value/index.js:
|
|
355
|
-
(*!
|
|
356
|
-
* set-value <https://github.com/jonschlinkert/set-value>
|
|
357
|
-
*
|
|
358
|
-
* Copyright (c) Jon Schlinkert (https://github.com/jonschlinkert).
|
|
359
|
-
* Released under the MIT License.
|
|
360
|
-
*)
|
|
361
|
-
*/
|