@icebreakers/monorepo 0.6.21 → 0.6.24
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/.github/workflows/ci.yml +3 -0
- package/assets/package.json +20 -32
- package/assets/vitest.config.ts +19 -0
- package/dist/{chunk-54PKU7G6.js → chunk-YMAPO4ZI.js} +115 -116
- package/dist/cli.cjs +136 -130
- package/dist/cli.js +18 -11
- package/dist/index.cjs +117 -118
- package/dist/index.js +1 -1
- package/package.json +20 -10
- package/templates/foo/build.config.ts +25 -0
- package/templates/foo/package.json +45 -0
- package/templates/foo/src/index.ts +7 -0
- package/templates/foo/test/index.test.ts +7 -0
- package/templates/foo/tsconfig.json +15 -0
- package/templates/foo/vitest.config.ts +15 -0
- package/assets/vitest.workspace.ts +0 -8
package/dist/index.cjs
CHANGED
|
@@ -33,10 +33,10 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
33
33
|
));
|
|
34
34
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
35
35
|
|
|
36
|
-
// ../../node_modules/.pnpm/tsup@8.3.
|
|
36
|
+
// ../../node_modules/.pnpm/tsup@8.3.6_jiti@2.4.2_postcss@8.5.0_tsx@4.19.2_typescript@5.7.3_yaml@2.7.0/node_modules/tsup/assets/cjs_shims.js
|
|
37
37
|
var getImportMetaUrl, importMetaUrl;
|
|
38
38
|
var init_cjs_shims = __esm({
|
|
39
|
-
"../../node_modules/.pnpm/tsup@8.3.
|
|
39
|
+
"../../node_modules/.pnpm/tsup@8.3.6_jiti@2.4.2_postcss@8.5.0_tsx@4.19.2_typescript@5.7.3_yaml@2.7.0/node_modules/tsup/assets/cjs_shims.js"() {
|
|
40
40
|
"use strict";
|
|
41
41
|
getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href;
|
|
42
42
|
importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
|
|
@@ -62,7 +62,7 @@ var require_isobject = __commonJS({
|
|
|
62
62
|
"../../node_modules/.pnpm/isobject@3.0.1/node_modules/isobject/index.js"(exports2, module2) {
|
|
63
63
|
"use strict";
|
|
64
64
|
init_cjs_shims();
|
|
65
|
-
module2.exports = function
|
|
65
|
+
module2.exports = function isObject2(val) {
|
|
66
66
|
return val != null && typeof val === "object" && Array.isArray(val) === false;
|
|
67
67
|
};
|
|
68
68
|
}
|
|
@@ -73,9 +73,9 @@ var require_is_plain_object = __commonJS({
|
|
|
73
73
|
"../../node_modules/.pnpm/is-plain-object@2.0.4/node_modules/is-plain-object/index.js"(exports2, module2) {
|
|
74
74
|
"use strict";
|
|
75
75
|
init_cjs_shims();
|
|
76
|
-
var
|
|
76
|
+
var isObject2 = require_isobject();
|
|
77
77
|
function isObjectObject(o) {
|
|
78
|
-
return
|
|
78
|
+
return isObject2(o) === true && Object.prototype.toString.call(o) === "[object Object]";
|
|
79
79
|
}
|
|
80
80
|
module2.exports = function isPlainObject2(o) {
|
|
81
81
|
var ctor, prot;
|
|
@@ -100,7 +100,7 @@ var require_set_value = __commonJS({
|
|
|
100
100
|
var { deleteProperty } = Reflect;
|
|
101
101
|
var isPrimitive = require_is_primitive();
|
|
102
102
|
var isPlainObject2 = require_is_plain_object();
|
|
103
|
-
var
|
|
103
|
+
var isObject2 = (value) => {
|
|
104
104
|
return typeof value === "object" && value !== null || typeof value === "function";
|
|
105
105
|
};
|
|
106
106
|
var isUnsafeKey = (key) => {
|
|
@@ -168,7 +168,7 @@ var require_set_value = __commonJS({
|
|
|
168
168
|
}
|
|
169
169
|
return parts;
|
|
170
170
|
};
|
|
171
|
-
var
|
|
171
|
+
var split2 = (input, options) => {
|
|
172
172
|
if (options && typeof options.split === "function") return options.split(input);
|
|
173
173
|
if (typeof input === "symbol") return [input];
|
|
174
174
|
if (Array.isArray(input)) return input;
|
|
@@ -191,8 +191,8 @@ var require_set_value = __commonJS({
|
|
|
191
191
|
return obj;
|
|
192
192
|
};
|
|
193
193
|
var setValue = (target, path9, value, options) => {
|
|
194
|
-
if (!path9 || !
|
|
195
|
-
const keys =
|
|
194
|
+
if (!path9 || !isObject2(target)) return target;
|
|
195
|
+
const keys = split2(path9, options);
|
|
196
196
|
let obj = target;
|
|
197
197
|
for (let i = 0; i < keys.length; i++) {
|
|
198
198
|
const key = keys[i];
|
|
@@ -206,14 +206,14 @@ var require_set_value = __commonJS({
|
|
|
206
206
|
obj = obj[key] = [];
|
|
207
207
|
continue;
|
|
208
208
|
}
|
|
209
|
-
if (!
|
|
209
|
+
if (!isObject2(obj[key])) {
|
|
210
210
|
obj[key] = {};
|
|
211
211
|
}
|
|
212
212
|
obj = obj[key];
|
|
213
213
|
}
|
|
214
214
|
return target;
|
|
215
215
|
};
|
|
216
|
-
setValue.split =
|
|
216
|
+
setValue.split = split2;
|
|
217
217
|
setValue.cache = /* @__PURE__ */ new Map();
|
|
218
218
|
setValue.clear = () => {
|
|
219
219
|
setValue.cache = /* @__PURE__ */ new Map();
|
|
@@ -222,99 +222,9 @@ var require_set_value = __commonJS({
|
|
|
222
222
|
}
|
|
223
223
|
});
|
|
224
224
|
|
|
225
|
-
// ../../node_modules/.pnpm/get-value@3.0.1/node_modules/get-value/index.js
|
|
226
|
-
var require_get_value = __commonJS({
|
|
227
|
-
"../../node_modules/.pnpm/get-value@3.0.1/node_modules/get-value/index.js"(exports2, module2) {
|
|
228
|
-
"use strict";
|
|
229
|
-
init_cjs_shims();
|
|
230
|
-
var isObject = require_isobject();
|
|
231
|
-
module2.exports = function(target, path9, options) {
|
|
232
|
-
if (!isObject(options)) {
|
|
233
|
-
options = { default: options };
|
|
234
|
-
}
|
|
235
|
-
if (!isValidObject(target)) {
|
|
236
|
-
return typeof options.default !== "undefined" ? options.default : target;
|
|
237
|
-
}
|
|
238
|
-
if (typeof path9 === "number") {
|
|
239
|
-
path9 = String(path9);
|
|
240
|
-
}
|
|
241
|
-
const isArray = Array.isArray(path9);
|
|
242
|
-
const isString = typeof path9 === "string";
|
|
243
|
-
const splitChar = options.separator || ".";
|
|
244
|
-
const joinChar = options.joinChar || (typeof splitChar === "string" ? splitChar : ".");
|
|
245
|
-
if (!isString && !isArray) {
|
|
246
|
-
return target;
|
|
247
|
-
}
|
|
248
|
-
if (isString && path9 in target) {
|
|
249
|
-
return isValid(path9, target, options) ? target[path9] : options.default;
|
|
250
|
-
}
|
|
251
|
-
let segs = isArray ? path9 : split(path9, splitChar, options);
|
|
252
|
-
let len = segs.length;
|
|
253
|
-
let idx = 0;
|
|
254
|
-
do {
|
|
255
|
-
let prop = segs[idx];
|
|
256
|
-
if (typeof prop === "number") {
|
|
257
|
-
prop = String(prop);
|
|
258
|
-
}
|
|
259
|
-
while (prop && prop.slice(-1) === "\\") {
|
|
260
|
-
prop = join([prop.slice(0, -1), segs[++idx] || ""], joinChar, options);
|
|
261
|
-
}
|
|
262
|
-
if (prop in target) {
|
|
263
|
-
if (!isValid(prop, target, options)) {
|
|
264
|
-
return options.default;
|
|
265
|
-
}
|
|
266
|
-
target = target[prop];
|
|
267
|
-
} else {
|
|
268
|
-
let hasProp = false;
|
|
269
|
-
let n = idx + 1;
|
|
270
|
-
while (n < len) {
|
|
271
|
-
prop = join([prop, segs[n++]], joinChar, options);
|
|
272
|
-
if (hasProp = prop in target) {
|
|
273
|
-
if (!isValid(prop, target, options)) {
|
|
274
|
-
return options.default;
|
|
275
|
-
}
|
|
276
|
-
target = target[prop];
|
|
277
|
-
idx = n - 1;
|
|
278
|
-
break;
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
if (!hasProp) {
|
|
282
|
-
return options.default;
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
} while (++idx < len && isValidObject(target));
|
|
286
|
-
if (idx === len) {
|
|
287
|
-
return target;
|
|
288
|
-
}
|
|
289
|
-
return options.default;
|
|
290
|
-
};
|
|
291
|
-
function join(segs, joinChar, options) {
|
|
292
|
-
if (typeof options.join === "function") {
|
|
293
|
-
return options.join(segs);
|
|
294
|
-
}
|
|
295
|
-
return segs[0] + joinChar + segs[1];
|
|
296
|
-
}
|
|
297
|
-
function split(path9, splitChar, options) {
|
|
298
|
-
if (typeof options.split === "function") {
|
|
299
|
-
return options.split(path9);
|
|
300
|
-
}
|
|
301
|
-
return path9.split(splitChar);
|
|
302
|
-
}
|
|
303
|
-
function isValid(key, target, options) {
|
|
304
|
-
if (typeof options.isValid === "function") {
|
|
305
|
-
return options.isValid(key, target);
|
|
306
|
-
}
|
|
307
|
-
return true;
|
|
308
|
-
}
|
|
309
|
-
function isValidObject(val) {
|
|
310
|
-
return isObject(val) || Array.isArray(val) || typeof val === "function";
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
});
|
|
314
|
-
|
|
315
225
|
// src/index.ts
|
|
316
|
-
var
|
|
317
|
-
__export(
|
|
226
|
+
var index_exports = {};
|
|
227
|
+
__export(index_exports, {
|
|
318
228
|
GitClient: () => GitClient,
|
|
319
229
|
cleanProjects: () => cleanProjects,
|
|
320
230
|
escapeStringRegexp: () => escapeStringRegexp,
|
|
@@ -328,7 +238,7 @@ __export(src_exports, {
|
|
|
328
238
|
syncNpmMirror: () => syncNpmMirror,
|
|
329
239
|
upgradeMonorepo: () => upgradeMonorepo
|
|
330
240
|
});
|
|
331
|
-
module.exports = __toCommonJS(
|
|
241
|
+
module.exports = __toCommonJS(index_exports);
|
|
332
242
|
init_cjs_shims();
|
|
333
243
|
|
|
334
244
|
// src/monorepo/index.ts
|
|
@@ -422,7 +332,96 @@ async function cleanProjects(cwd) {
|
|
|
422
332
|
|
|
423
333
|
// src/monorepo/git.ts
|
|
424
334
|
init_cjs_shims();
|
|
425
|
-
|
|
335
|
+
|
|
336
|
+
// ../../node_modules/.pnpm/get-value@4.0.1/node_modules/get-value/dist/index.mjs
|
|
337
|
+
init_cjs_shims();
|
|
338
|
+
var __defProp2 = Object.defineProperty;
|
|
339
|
+
var __name = (target, value) => __defProp2(target, "name", { value, configurable: true });
|
|
340
|
+
var isObject = /* @__PURE__ */ __name((v) => v !== null && typeof v === "object", "isObject");
|
|
341
|
+
var join = /* @__PURE__ */ __name((segs, joinChar, options) => {
|
|
342
|
+
if (typeof options.join === "function") {
|
|
343
|
+
return options.join(segs);
|
|
344
|
+
}
|
|
345
|
+
return segs[0] + joinChar + segs[1];
|
|
346
|
+
}, "join");
|
|
347
|
+
var split = /* @__PURE__ */ __name((path9, splitChar, options) => {
|
|
348
|
+
if (typeof options.split === "function") {
|
|
349
|
+
return options.split(path9);
|
|
350
|
+
}
|
|
351
|
+
return path9.split(splitChar);
|
|
352
|
+
}, "split");
|
|
353
|
+
var isValid = /* @__PURE__ */ __name((key, target = {}, options) => {
|
|
354
|
+
if (typeof options?.isValid === "function") {
|
|
355
|
+
return options.isValid(key, target);
|
|
356
|
+
}
|
|
357
|
+
return true;
|
|
358
|
+
}, "isValid");
|
|
359
|
+
var isValidObject = /* @__PURE__ */ __name((v) => {
|
|
360
|
+
return isObject(v) || typeof v === "function";
|
|
361
|
+
}, "isValidObject");
|
|
362
|
+
var getValue = /* @__PURE__ */ __name((target, path9, options = {}) => {
|
|
363
|
+
if (!isObject(options)) {
|
|
364
|
+
options = { default: options };
|
|
365
|
+
}
|
|
366
|
+
if (!isValidObject(target)) {
|
|
367
|
+
return typeof options.default !== "undefined" ? options.default : target;
|
|
368
|
+
}
|
|
369
|
+
if (typeof path9 === "number") {
|
|
370
|
+
path9 = String(path9);
|
|
371
|
+
}
|
|
372
|
+
const pathIsArray = Array.isArray(path9);
|
|
373
|
+
const pathIsString = typeof path9 === "string";
|
|
374
|
+
const splitChar = options.separator || ".";
|
|
375
|
+
const joinChar = options.joinChar || (typeof splitChar === "string" ? splitChar : ".");
|
|
376
|
+
if (!pathIsString && !pathIsArray) {
|
|
377
|
+
return target;
|
|
378
|
+
}
|
|
379
|
+
if (target[path9] !== void 0) {
|
|
380
|
+
return isValid(path9, target, options) ? target[path9] : options.default;
|
|
381
|
+
}
|
|
382
|
+
const segs = pathIsArray ? path9 : split(path9, splitChar, options);
|
|
383
|
+
const len = segs.length;
|
|
384
|
+
let idx = 0;
|
|
385
|
+
do {
|
|
386
|
+
let prop = segs[idx];
|
|
387
|
+
if (typeof prop !== "string") {
|
|
388
|
+
prop = String(prop);
|
|
389
|
+
}
|
|
390
|
+
while (prop && prop.slice(-1) === "\\") {
|
|
391
|
+
prop = join([prop.slice(0, -1), segs[++idx] || ""], joinChar, options);
|
|
392
|
+
}
|
|
393
|
+
if (target[prop] !== void 0) {
|
|
394
|
+
if (!isValid(prop, target, options)) {
|
|
395
|
+
return options.default;
|
|
396
|
+
}
|
|
397
|
+
target = target[prop];
|
|
398
|
+
} else {
|
|
399
|
+
let hasProp = false;
|
|
400
|
+
let n = idx + 1;
|
|
401
|
+
while (n < len) {
|
|
402
|
+
prop = join([prop, segs[n++]], joinChar, options);
|
|
403
|
+
if (hasProp = target[prop] !== void 0) {
|
|
404
|
+
if (!isValid(prop, target, options)) {
|
|
405
|
+
return options.default;
|
|
406
|
+
}
|
|
407
|
+
target = target[prop];
|
|
408
|
+
idx = n - 1;
|
|
409
|
+
break;
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
if (!hasProp) {
|
|
413
|
+
return options.default;
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
} while (++idx < len && isValidObject(target));
|
|
417
|
+
if (idx === len) {
|
|
418
|
+
return target;
|
|
419
|
+
}
|
|
420
|
+
return options.default;
|
|
421
|
+
}, "getValue");
|
|
422
|
+
var index_default = getValue;
|
|
423
|
+
|
|
424
|
+
// src/monorepo/git.ts
|
|
426
425
|
var import_git_url_parse = __toESM(require("git-url-parse"), 1);
|
|
427
426
|
var import_simple_git = require("simple-git");
|
|
428
427
|
var GitClient = class {
|
|
@@ -448,7 +447,7 @@ var GitClient = class {
|
|
|
448
447
|
}
|
|
449
448
|
async getGitUrl() {
|
|
450
449
|
const config = await this.getConfig();
|
|
451
|
-
const x = (
|
|
450
|
+
const x = index_default(config, "remote.origin.url");
|
|
452
451
|
if (x) {
|
|
453
452
|
return (0, import_git_url_parse.default)(x);
|
|
454
453
|
}
|
|
@@ -461,8 +460,8 @@ var GitClient = class {
|
|
|
461
460
|
}
|
|
462
461
|
async getUser() {
|
|
463
462
|
const config = await this.getConfig();
|
|
464
|
-
const name2 = (
|
|
465
|
-
const email = (
|
|
463
|
+
const name2 = index_default(config, "user.name");
|
|
464
|
+
const email = index_default(config, "user.email");
|
|
466
465
|
return {
|
|
467
466
|
name: name2,
|
|
468
467
|
email
|
|
@@ -726,7 +725,6 @@ var import_node_url = require("url");
|
|
|
726
725
|
var import_checkbox = __toESM(require("@inquirer/checkbox"), 1);
|
|
727
726
|
var import_confirm = __toESM(require("@inquirer/confirm"), 1);
|
|
728
727
|
var import_fs_extra5 = __toESM(require("fs-extra"), 1);
|
|
729
|
-
var import_get_value2 = __toESM(require_get_value(), 1);
|
|
730
728
|
var import_klaw = __toESM(require("klaw"), 1);
|
|
731
729
|
var import_p_queue2 = __toESM(require("p-queue"), 1);
|
|
732
730
|
var import_pathe8 = __toESM(require("pathe"), 1);
|
|
@@ -738,7 +736,7 @@ init_cjs_shims();
|
|
|
738
736
|
|
|
739
737
|
// package.json
|
|
740
738
|
var name = "@icebreakers/monorepo";
|
|
741
|
-
var version = "0.6.
|
|
739
|
+
var version = "0.6.24";
|
|
742
740
|
|
|
743
741
|
// src/scripts.ts
|
|
744
742
|
init_cjs_shims();
|
|
@@ -773,7 +771,8 @@ function getAssetTargets(raw) {
|
|
|
773
771
|
// turbo
|
|
774
772
|
"turbo.json",
|
|
775
773
|
// vitest
|
|
776
|
-
"vitest.
|
|
774
|
+
"vitest.config.ts",
|
|
775
|
+
// 'vitest.workspace.ts',
|
|
777
776
|
// #region docker
|
|
778
777
|
"Dockerfile",
|
|
779
778
|
".dockerignore"
|
|
@@ -830,11 +829,11 @@ function isWorkspace(version2) {
|
|
|
830
829
|
return false;
|
|
831
830
|
}
|
|
832
831
|
function setPkgJson(sourcePkgJson, targetPkgJson) {
|
|
833
|
-
const packageManager = (
|
|
834
|
-
const deps = (
|
|
835
|
-
const devDeps = (
|
|
836
|
-
const targetDeps = (
|
|
837
|
-
const targetDevDeps = (
|
|
832
|
+
const packageManager = index_default(sourcePkgJson, "packageManager", { default: "" });
|
|
833
|
+
const deps = index_default(sourcePkgJson, "dependencies", { default: {} });
|
|
834
|
+
const devDeps = index_default(sourcePkgJson, "devDependencies", { default: {} });
|
|
835
|
+
const targetDeps = index_default(targetPkgJson, "dependencies", { default: {} });
|
|
836
|
+
const targetDevDeps = index_default(targetPkgJson, "devDependencies", { default: {} });
|
|
838
837
|
(0, import_set_value4.default)(targetPkgJson, "packageManager", packageManager);
|
|
839
838
|
Object.entries(deps).forEach((x) => {
|
|
840
839
|
if (!isWorkspace(targetDeps[x[0]])) {
|
|
@@ -983,11 +982,11 @@ set-value/index.js:
|
|
|
983
982
|
* Released under the MIT License.
|
|
984
983
|
*)
|
|
985
984
|
|
|
986
|
-
get-value/index.
|
|
985
|
+
get-value/dist/index.mjs:
|
|
987
986
|
(*!
|
|
988
987
|
* get-value <https://github.com/jonschlinkert/get-value>
|
|
989
988
|
*
|
|
990
|
-
* Copyright (c) 2014-
|
|
989
|
+
* Copyright (c) 2014-present, Jon Schlinkert.
|
|
991
990
|
* Released under the MIT License.
|
|
992
991
|
*)
|
|
993
992
|
*/
|
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.24",
|
|
5
5
|
"description": "icebreaker's monorepo config generator",
|
|
6
6
|
"author": "ice breaker <1324318532@qq.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -34,23 +34,33 @@
|
|
|
34
34
|
"templates"
|
|
35
35
|
],
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@inquirer/checkbox": "^4.
|
|
38
|
-
"@inquirer/confirm": "^5.1.
|
|
37
|
+
"@inquirer/checkbox": "^4.1.1",
|
|
38
|
+
"@inquirer/confirm": "^5.1.5",
|
|
39
39
|
"@pnpm/logger": "^1000.0.0",
|
|
40
|
-
"@pnpm/types": "^1000.
|
|
41
|
-
"@pnpm/workspace.find-packages": "^1000.0.
|
|
42
|
-
"commander": "^13.
|
|
40
|
+
"@pnpm/types": "^1000.1.1",
|
|
41
|
+
"@pnpm/workspace.find-packages": "^1000.0.7",
|
|
42
|
+
"commander": "^13.1.0",
|
|
43
43
|
"comment-json": "^4.2.5",
|
|
44
|
-
"consola": "^3.
|
|
44
|
+
"consola": "^3.4.0",
|
|
45
45
|
"execa": "^9.5.2",
|
|
46
|
-
"fs-extra": "^11.
|
|
46
|
+
"fs-extra": "^11.3.0",
|
|
47
47
|
"git-url-parse": "^16.0.0",
|
|
48
48
|
"klaw": "^4.1.0",
|
|
49
|
-
"p-queue": "^8.0
|
|
50
|
-
"pathe": "^2.0.
|
|
49
|
+
"p-queue": "^8.1.0",
|
|
50
|
+
"pathe": "^2.0.2",
|
|
51
51
|
"picocolors": "^1.1.1",
|
|
52
52
|
"simple-git": "^3.27.0"
|
|
53
53
|
},
|
|
54
|
+
"devDependencies": {
|
|
55
|
+
"@types/get-value": "^3.0.5",
|
|
56
|
+
"@types/git-url-parse": "^9.0.3",
|
|
57
|
+
"@types/klaw": "^3.0.6",
|
|
58
|
+
"@types/micromatch": "^4.0.9",
|
|
59
|
+
"@types/set-value": "^4.0.3",
|
|
60
|
+
"get-value": "^4.0.1",
|
|
61
|
+
"micromatch": "^4.0.8",
|
|
62
|
+
"set-value": "^4.1.0"
|
|
63
|
+
},
|
|
54
64
|
"scripts": {
|
|
55
65
|
"dev": "tsup --watch --sourcemap",
|
|
56
66
|
"build": "tsup",
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import path from 'node:path'
|
|
2
|
+
import { defineBuildConfig } from 'unbuild'
|
|
3
|
+
|
|
4
|
+
export default defineBuildConfig({
|
|
5
|
+
// entries: ['./src/index', './src/cli'],
|
|
6
|
+
entries: ['./src/index'],
|
|
7
|
+
rollup: {
|
|
8
|
+
// 内联,相当于 nodeResolve
|
|
9
|
+
inlineDependencies: true,
|
|
10
|
+
// cjs
|
|
11
|
+
emitCJS: true,
|
|
12
|
+
// 添加 cjs 注入
|
|
13
|
+
cjsBridge: true,
|
|
14
|
+
dts: {
|
|
15
|
+
// https://github.com/unjs/unbuild/issues/135
|
|
16
|
+
respectExternal: false,
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
alias: {
|
|
20
|
+
// 别名
|
|
21
|
+
'@': path.resolve(__dirname, './src'),
|
|
22
|
+
},
|
|
23
|
+
// dts
|
|
24
|
+
declaration: true,
|
|
25
|
+
})
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@icebreakers/foo",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "0.1.2",
|
|
5
|
+
"description": "esbuild(rollup) build package template",
|
|
6
|
+
"author": "ice breaker <1324318532@qq.com>",
|
|
7
|
+
"license": "ISC",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/sonofmagic/monorepo-template.git",
|
|
11
|
+
"directory": "packages/foo"
|
|
12
|
+
},
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/sonofmagic/monorepo-template/issues"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [],
|
|
17
|
+
"sideEffects": false,
|
|
18
|
+
"exports": {
|
|
19
|
+
".": "./src/index.ts"
|
|
20
|
+
},
|
|
21
|
+
"files": [
|
|
22
|
+
"dist"
|
|
23
|
+
],
|
|
24
|
+
"scripts": {
|
|
25
|
+
"dev": "unbuild --watch --sourcemap",
|
|
26
|
+
"build": "unbuild",
|
|
27
|
+
"test": "vitest run",
|
|
28
|
+
"test:dev": "vitest",
|
|
29
|
+
"release": "pnpm publish",
|
|
30
|
+
"lint": "eslint .",
|
|
31
|
+
"lint:fix": "eslint . --fix"
|
|
32
|
+
},
|
|
33
|
+
"publishConfig": {
|
|
34
|
+
"exports": {
|
|
35
|
+
".": {
|
|
36
|
+
"types": "./dist/index.d.ts",
|
|
37
|
+
"import": "./dist/index.mjs",
|
|
38
|
+
"require": "./dist/index.cjs"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"main": "./dist/index.cjs",
|
|
42
|
+
"module": "./dist/index.mjs",
|
|
43
|
+
"types": "./dist/index.d.ts"
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import path from 'node:path'
|
|
2
|
+
import { defineProject } from 'vitest/config'
|
|
3
|
+
|
|
4
|
+
export default defineProject({
|
|
5
|
+
test: {
|
|
6
|
+
alias: [
|
|
7
|
+
{
|
|
8
|
+
find: '@',
|
|
9
|
+
replacement: path.resolve(__dirname, './src'),
|
|
10
|
+
},
|
|
11
|
+
],
|
|
12
|
+
globals: true,
|
|
13
|
+
testTimeout: 60_000,
|
|
14
|
+
},
|
|
15
|
+
})
|