@icebreakers/monorepo 1.0.0 → 1.0.1

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/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.5.0_jiti@2.4.2_postcss@8.5.3_tsx@4.19.4_typescript@5.8.3_yaml@2.8.0/node_modules/tsup/assets/cjs_shims.js
36
+ // ../../node_modules/.pnpm/tsup@8.5.0_@microsoft+api-extractor@7.52.8_@types+node@22.15.23__jiti@2.4.2_postcss@8.5_b914d2c7671fefba2a17179d863c3344/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.5.0_jiti@2.4.2_postcss@8.5.3_tsx@4.19.4_typescript@5.8.3_yaml@2.8.0/node_modules/tsup/assets/cjs_shims.js"() {
39
+ "../../node_modules/.pnpm/tsup@8.5.0_@microsoft+api-extractor@7.52.8_@types+node@22.15.23__jiti@2.4.2_postcss@8.5_b914d2c7671fefba2a17179d863c3344/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();
@@ -190,9 +190,9 @@ var require_set_value = __commonJS({
190
190
  }
191
191
  return obj;
192
192
  };
193
- var setValue = (target, path9, value, options) => {
194
- if (!path9 || !isObject2(target)) return target;
195
- const keys = split2(path9, options);
193
+ var setValue = (target, path10, value, options) => {
194
+ if (!path10 || !isObject2(target)) return target;
195
+ const keys = split2(path10, options);
196
196
  let obj = target;
197
197
  for (let i = 0; i < keys.length; i++) {
198
198
  const key = keys[i];
@@ -309,15 +309,17 @@ init_cjs_shims();
309
309
  var import_fs_extra2 = __toESM(require("fs-extra"), 1);
310
310
  var import_pathe2 = __toESM(require("pathe"), 1);
311
311
  var import_set_value2 = __toESM(require_set_value(), 1);
312
- var dirs = [
312
+ var cleanDirs = [
313
313
  "packages/monorepo",
314
- "packages/foo",
314
+ "packages/bar",
315
+ "packages/ui",
316
+ // 'packages/foo',
315
317
  // 'apps/cli',
316
318
  // 'apps/website',
317
319
  "apps"
318
320
  ];
319
321
  async function cleanProjects(cwd) {
320
- for (const dir of dirs.map((x) => {
322
+ for (const dir of cleanDirs.map((x) => {
321
323
  return import_pathe2.default.resolve(cwd, x);
322
324
  })) {
323
325
  await import_fs_extra2.default.remove(dir);
@@ -344,11 +346,11 @@ var join = /* @__PURE__ */ __name((segs, joinChar, options) => {
344
346
  }
345
347
  return segs[0] + joinChar + segs[1];
346
348
  }, "join");
347
- var split = /* @__PURE__ */ __name((path9, splitChar, options) => {
349
+ var split = /* @__PURE__ */ __name((path10, splitChar, options) => {
348
350
  if (typeof options.split === "function") {
349
- return options.split(path9);
351
+ return options.split(path10);
350
352
  }
351
- return path9.split(splitChar);
353
+ return path10.split(splitChar);
352
354
  }, "split");
353
355
  var isValid = /* @__PURE__ */ __name((key, target = {}, options) => {
354
356
  if (typeof options?.isValid === "function") {
@@ -359,27 +361,27 @@ var isValid = /* @__PURE__ */ __name((key, target = {}, options) => {
359
361
  var isValidObject = /* @__PURE__ */ __name((v) => {
360
362
  return isObject(v) || typeof v === "function";
361
363
  }, "isValidObject");
362
- var getValue = /* @__PURE__ */ __name((target, path9, options = {}) => {
364
+ var getValue = /* @__PURE__ */ __name((target, path10, options = {}) => {
363
365
  if (!isObject(options)) {
364
366
  options = { default: options };
365
367
  }
366
368
  if (!isValidObject(target)) {
367
369
  return typeof options.default !== "undefined" ? options.default : target;
368
370
  }
369
- if (typeof path9 === "number") {
370
- path9 = String(path9);
371
+ if (typeof path10 === "number") {
372
+ path10 = String(path10);
371
373
  }
372
- const pathIsArray = Array.isArray(path9);
373
- const pathIsString = typeof path9 === "string";
374
+ const pathIsArray = Array.isArray(path10);
375
+ const pathIsString = typeof path10 === "string";
374
376
  const splitChar = options.separator || ".";
375
377
  const joinChar = options.joinChar || (typeof splitChar === "string" ? splitChar : ".");
376
378
  if (!pathIsString && !pathIsArray) {
377
379
  return target;
378
380
  }
379
- if (target[path9] !== void 0) {
380
- return isValid(path9, target, options) ? target[path9] : options.default;
381
+ if (target[path10] !== void 0) {
382
+ return isValid(path10, target, options) ? target[path10] : options.default;
381
383
  }
382
- const segs = pathIsArray ? path9 : split(path9, splitChar, options);
384
+ const segs = pathIsArray ? path10 : split(path10, splitChar, options);
383
385
  const len = segs.length;
384
386
  let idx = 0;
385
387
  do {
@@ -600,18 +602,39 @@ async function createContext(cwd) {
600
602
  };
601
603
  }
602
604
 
603
- // src/monorepo/setPkgJson.ts
605
+ // src/monorepo/setChangeset.ts
604
606
  init_cjs_shims();
605
607
  var import_fs_extra3 = __toESM(require("fs-extra"), 1);
606
608
  var import_pathe5 = __toESM(require("pathe"), 1);
607
609
  var import_set_value3 = __toESM(require_set_value(), 1);
610
+ async function setChangeset_default(ctx) {
611
+ const { gitUrl, workspaceFilepath } = ctx;
612
+ if (gitUrl && await import_fs_extra3.default.exists(workspaceFilepath)) {
613
+ const changesetConfigPath = import_pathe5.default.resolve(import_pathe5.default.dirname(workspaceFilepath), ".changeset/config.json");
614
+ if (await import_fs_extra3.default.exists(changesetConfigPath)) {
615
+ const changesetConfig = await import_fs_extra3.default.readJson(
616
+ changesetConfigPath
617
+ );
618
+ if (gitUrl.full_name) {
619
+ (0, import_set_value3.default)(changesetConfig, "changelog.1.repo", gitUrl.full_name);
620
+ await import_fs_extra3.default.outputJson(changesetConfigPath, changesetConfig, { spaces: 2 });
621
+ }
622
+ }
623
+ }
624
+ }
625
+
626
+ // src/monorepo/setPkgJson.ts
627
+ init_cjs_shims();
628
+ var import_fs_extra4 = __toESM(require("fs-extra"), 1);
629
+ var import_pathe6 = __toESM(require("pathe"), 1);
630
+ var import_set_value4 = __toESM(require_set_value(), 1);
608
631
  async function setPkgJson_default(ctx) {
609
632
  const { gitUrl, gitUser, projects, cwd, workspaceFilepath } = ctx;
610
- if (gitUrl && await import_fs_extra3.default.exists(workspaceFilepath)) {
633
+ if (gitUrl && await import_fs_extra4.default.exists(workspaceFilepath)) {
611
634
  for (const project of projects) {
612
635
  const pkgJson = project.manifest;
613
- const directory = import_pathe5.default.relative(cwd, project.rootDir);
614
- (0, import_set_value3.default)(pkgJson, "bugs.url", `https://github.com/${gitUrl.full_name}/issues`);
636
+ const directory = import_pathe6.default.relative(cwd, project.rootDir);
637
+ (0, import_set_value4.default)(pkgJson, "bugs.url", `https://github.com/${gitUrl.full_name}/issues`);
615
638
  const repository = {
616
639
  type: "git",
617
640
  url: `git+https://github.com/${gitUrl.full_name}.git`
@@ -619,11 +642,11 @@ async function setPkgJson_default(ctx) {
619
642
  if (directory) {
620
643
  repository.directory = directory;
621
644
  }
622
- (0, import_set_value3.default)(pkgJson, "repository", repository);
645
+ (0, import_set_value4.default)(pkgJson, "repository", repository);
623
646
  if (gitUser) {
624
- (0, import_set_value3.default)(pkgJson, "author", `${gitUser.name} <${gitUser.email}>`);
647
+ (0, import_set_value4.default)(pkgJson, "author", `${gitUser.name} <${gitUser.email}>`);
625
648
  }
626
- await import_fs_extra3.default.writeJSON(project.pkgJsonPath, pkgJson, {
649
+ await import_fs_extra4.default.writeJSON(project.pkgJsonPath, pkgJson, {
627
650
  spaces: 2
628
651
  });
629
652
  }
@@ -632,8 +655,8 @@ async function setPkgJson_default(ctx) {
632
655
 
633
656
  // src/monorepo/setReadme.ts
634
657
  init_cjs_shims();
635
- var import_fs_extra4 = __toESM(require("fs-extra"), 1);
636
- var import_pathe6 = __toESM(require("pathe"), 1);
658
+ var import_fs_extra5 = __toESM(require("fs-extra"), 1);
659
+ var import_pathe7 = __toESM(require("pathe"), 1);
637
660
  async function getRows(ctx) {
638
661
  const { projects, git, cwd } = ctx;
639
662
  const gitUrl = await git.getGitUrl();
@@ -645,7 +668,7 @@ async function getRows(ctx) {
645
668
  }
646
669
  rows.push("## Projects\n");
647
670
  for (const project of projects) {
648
- const p = import_pathe6.default.relative(cwd, project.rootDirRealPath);
671
+ const p = import_pathe7.default.relative(cwd, project.rootDirRealPath);
649
672
  if (p) {
650
673
  const description = project.manifest.description ? `- ${project.manifest.description}` : "";
651
674
  rows.push(`- [${project.manifest.name}](${p}) ${description}`);
@@ -673,13 +696,14 @@ async function getRows(ctx) {
673
696
  }
674
697
  async function setReadme_default(ctx) {
675
698
  const rows = await getRows(ctx);
676
- await import_fs_extra4.default.writeFile(import_pathe6.default.resolve(ctx.cwd, "README.md"), `${rows.join("\n")}
699
+ await import_fs_extra5.default.writeFile(import_pathe7.default.resolve(ctx.cwd, "README.md"), `${rows.join("\n")}
677
700
  `);
678
701
  }
679
702
 
680
703
  // src/monorepo/init.ts
681
704
  async function init(cwd) {
682
705
  const ctx = await createContext(cwd);
706
+ await setChangeset_default(ctx);
683
707
  await setPkgJson_default(ctx);
684
708
  await setReadme_default(ctx);
685
709
  }
@@ -689,7 +713,7 @@ init_cjs_shims();
689
713
  var import_node_os = __toESM(require("os"), 1);
690
714
  var import_execa = require("execa");
691
715
  var import_p_queue = __toESM(require("p-queue"), 1);
692
- var import_pathe7 = __toESM(require("pathe"), 1);
716
+ var import_pathe8 = __toESM(require("pathe"), 1);
693
717
  var import_picocolors = __toESM(require("picocolors"), 1);
694
718
 
695
719
  // src/logger.ts
@@ -701,15 +725,15 @@ var logger = (0, import_consola.createConsola)();
701
725
  async function syncNpmMirror(cwd, options) {
702
726
  const packages = await getWorkspacePackages(cwd, options);
703
727
  logger.info(`[\u5F53\u524D\u5DE5\u4F5C\u533ARepo]:
704
- ${packages.map((x) => `- ${import_picocolors.default.green(x.manifest.name)} : ${import_pathe7.default.relative(cwd, x.rootDir)}`).join("\n")}
728
+ ${packages.map((x) => `- ${import_picocolors.default.green(x.manifest.name)} : ${import_pathe8.default.relative(cwd, x.rootDir)}`).join("\n")}
705
729
  `);
706
- const set5 = new Set(packages.map((x) => x.manifest.name));
730
+ const set6 = new Set(packages.map((x) => x.manifest.name));
707
731
  logger.info(`[\u5373\u5C06\u540C\u6B65\u7684\u5305]:
708
- ${Array.from(set5).map((x) => `- ${import_picocolors.default.green(x)}`).join("\n")}
732
+ ${Array.from(set6).map((x) => `- ${import_picocolors.default.green(x)}`).join("\n")}
709
733
  `);
710
734
  const concurrency = Math.max(import_node_os.default.cpus().length, 1);
711
735
  const queue2 = new import_p_queue.default({ concurrency });
712
- for (const pkgName of set5) {
736
+ for (const pkgName of set6) {
713
737
  if (pkgName) {
714
738
  await queue2.add(async () => {
715
739
  return (0, import_execa.execa)({
@@ -726,19 +750,19 @@ var import_node_process = __toESM(require("process"), 1);
726
750
  var import_node_url = require("url");
727
751
  var import_checkbox = __toESM(require("@inquirer/checkbox"), 1);
728
752
  var import_confirm = __toESM(require("@inquirer/confirm"), 1);
729
- var import_fs_extra5 = __toESM(require("fs-extra"), 1);
753
+ var import_fs_extra6 = __toESM(require("fs-extra"), 1);
730
754
  var import_klaw = __toESM(require("klaw"), 1);
731
755
  var import_p_queue2 = __toESM(require("p-queue"), 1);
732
- var import_pathe8 = __toESM(require("pathe"), 1);
756
+ var import_pathe9 = __toESM(require("pathe"), 1);
733
757
  var import_picocolors2 = __toESM(require("picocolors"), 1);
734
- var import_set_value4 = __toESM(require_set_value(), 1);
758
+ var import_set_value5 = __toESM(require_set_value(), 1);
735
759
 
736
760
  // src/constants.ts
737
761
  init_cjs_shims();
738
762
 
739
763
  // package.json
740
764
  var name = "@icebreakers/monorepo";
741
- var version = "1.0.0";
765
+ var version = "1.0.1";
742
766
 
743
767
  // src/scripts.ts
744
768
  init_cjs_shims();
@@ -822,8 +846,8 @@ function isMatch(str, arr) {
822
846
  // src/upgrade.ts
823
847
  var queue = new import_p_queue2.default({ concurrency: 1 });
824
848
  var __filename2 = (0, import_node_url.fileURLToPath)(importMetaUrl);
825
- var __dirname = import_pathe8.default.dirname(__filename2);
826
- var assetsDir = import_pathe8.default.join(__dirname, "../assets");
849
+ var __dirname = import_pathe9.default.dirname(__filename2);
850
+ var assetsDir = import_pathe9.default.join(__dirname, "../assets");
827
851
  function isWorkspace(version2) {
828
852
  if (typeof version2 === "string") {
829
853
  return version2.startsWith("workspace:");
@@ -836,21 +860,21 @@ function setPkgJson(sourcePkgJson, targetPkgJson) {
836
860
  const devDeps = index_default(sourcePkgJson, "devDependencies", { default: {} });
837
861
  const targetDeps = index_default(targetPkgJson, "dependencies", { default: {} });
838
862
  const targetDevDeps = index_default(targetPkgJson, "devDependencies", { default: {} });
839
- (0, import_set_value4.default)(targetPkgJson, "packageManager", packageManager);
863
+ (0, import_set_value5.default)(targetPkgJson, "packageManager", packageManager);
840
864
  Object.entries(deps).forEach((x) => {
841
865
  if (!isWorkspace(targetDeps[x[0]])) {
842
- (0, import_set_value4.default)(targetPkgJson, `dependencies.${x[0].replaceAll(".", "\\.")}`, x[1], { preservePaths: false });
866
+ (0, import_set_value5.default)(targetPkgJson, `dependencies.${x[0].replaceAll(".", "\\.")}`, x[1], { preservePaths: false });
843
867
  }
844
868
  });
845
869
  Object.entries(devDeps).forEach((x) => {
846
870
  if (x[0] === name) {
847
- (0, import_set_value4.default)(targetPkgJson, `devDependencies.${x[0].replaceAll(".", "\\.")}`, `^${version}`, { preservePaths: false });
871
+ (0, import_set_value5.default)(targetPkgJson, `devDependencies.${x[0].replaceAll(".", "\\.")}`, `^${version}`, { preservePaths: false });
848
872
  } else if (!isWorkspace(targetDevDeps[x[0]])) {
849
- (0, import_set_value4.default)(targetPkgJson, `devDependencies.${x[0].replaceAll(".", "\\.")}`, x[1], { preservePaths: false });
873
+ (0, import_set_value5.default)(targetPkgJson, `devDependencies.${x[0].replaceAll(".", "\\.")}`, x[1], { preservePaths: false });
850
874
  }
851
875
  });
852
876
  for (const [k, v] of scriptsEntries) {
853
- (0, import_set_value4.default)(targetPkgJson, `scripts.${k}`, v);
877
+ (0, import_set_value5.default)(targetPkgJson, `scripts.${k}`, v);
854
878
  }
855
879
  }
856
880
  function confirmOverwrite(filename) {
@@ -861,7 +885,7 @@ async function upgradeMonorepo(opts) {
861
885
  cwd: import_node_process.default.cwd(),
862
886
  outDir: ""
863
887
  });
864
- const absOutDir = import_pathe8.default.isAbsolute(outDir) ? outDir : import_pathe8.default.join(cwd, outDir);
888
+ const absOutDir = import_pathe9.default.isAbsolute(outDir) ? outDir : import_pathe9.default.join(cwd, outDir);
865
889
  const gitClient = new GitClient({
866
890
  baseDir: cwd
867
891
  });
@@ -883,20 +907,20 @@ async function upgradeMonorepo(opts) {
883
907
  });
884
908
  for await (const file of (0, import_klaw.default)(assetsDir, {
885
909
  filter(p) {
886
- const str = import_pathe8.default.relative(assetsDir, p);
910
+ const str = import_pathe9.default.relative(assetsDir, p);
887
911
  return isMatch(str, regexpArr);
888
912
  }
889
913
  })) {
890
914
  await queue.add(async () => {
891
915
  if (file.stats.isFile()) {
892
- const relPath = import_pathe8.default.relative(assetsDir, file.path);
893
- const targetPath = import_pathe8.default.resolve(absOutDir, relPath);
894
- const targetIsExisted = await import_fs_extra5.default.exists(targetPath);
916
+ const relPath = import_pathe9.default.relative(assetsDir, file.path);
917
+ const targetPath = import_pathe9.default.resolve(absOutDir, relPath);
918
+ const targetIsExisted = await import_fs_extra6.default.exists(targetPath);
895
919
  async function overwriteOrCopy(target) {
896
920
  let isOverwrite = true;
897
921
  if (targetIsExisted) {
898
- const src = await import_fs_extra5.default.readFile(file.path);
899
- const dest = target ?? await import_fs_extra5.default.readFile(targetPath);
922
+ const src = await import_fs_extra6.default.readFile(file.path);
923
+ const dest = target ?? await import_fs_extra6.default.readFile(targetPath);
900
924
  if (await isFileChanged(src, dest)) {
901
925
  isOverwrite = await confirmOverwrite(relPath);
902
926
  }
@@ -906,25 +930,25 @@ async function upgradeMonorepo(opts) {
906
930
  if (relPath === "package.json") {
907
931
  const sourcePath = file.path;
908
932
  if (targetIsExisted) {
909
- const sourcePkgJson = await import_fs_extra5.default.readJson(sourcePath);
910
- const targetPkgJson = await import_fs_extra5.default.readJson(targetPath);
933
+ const sourcePkgJson = await import_fs_extra6.default.readJson(sourcePath);
934
+ const targetPkgJson = await import_fs_extra6.default.readJson(targetPath);
911
935
  setPkgJson(sourcePkgJson, targetPkgJson);
912
936
  const data = JSON.stringify(targetPkgJson, void 0, 2);
913
- await import_fs_extra5.default.outputFile(targetPath, `${data}
937
+ await import_fs_extra6.default.outputFile(targetPath, `${data}
914
938
  `, "utf8");
915
939
  logger.success(targetPath);
916
940
  }
917
941
  } else if (relPath === ".changeset/config.json" && repoName) {
918
- const changesetJson = await import_fs_extra5.default.readJson(file.path);
919
- (0, import_set_value4.default)(changesetJson, "changelog.1.repo", repoName);
942
+ const changesetJson = await import_fs_extra6.default.readJson(file.path);
943
+ (0, import_set_value5.default)(changesetJson, "changelog.1.repo", repoName);
920
944
  const data = JSON.stringify(changesetJson, void 0, 2);
921
945
  if (await overwriteOrCopy(data)) {
922
- await import_fs_extra5.default.outputFile(targetPath, `${data}
946
+ await import_fs_extra6.default.outputFile(targetPath, `${data}
923
947
  `, "utf8");
924
948
  logger.success(targetPath);
925
949
  }
926
950
  } else if (await overwriteOrCopy()) {
927
- await import_fs_extra5.default.copy(
951
+ await import_fs_extra6.default.copy(
928
952
  file.path,
929
953
  targetPath
930
954
  );
package/dist/index.js CHANGED
@@ -12,7 +12,7 @@ import {
12
12
  setVscodeBinaryMirror,
13
13
  syncNpmMirror,
14
14
  upgradeMonorepo
15
- } from "./chunk-VOROHSAI.js";
15
+ } from "./chunk-OIMX7CDP.js";
16
16
 
17
17
  // src/index.ts
18
18
  init_esm_shims();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@icebreakers/monorepo",
3
3
  "type": "module",
4
- "version": "1.0.0",
4
+ "version": "1.0.1",
5
5
  "description": "icebreaker's monorepo config generator",
6
6
  "author": "ice breaker <1324318532@qq.com>",
7
7
  "license": "MIT",
@@ -0,0 +1,9 @@
1
+ import { icebreaker } from '@icebreakers/eslint-config'
2
+
3
+ export default icebreaker(
4
+ {
5
+ vue: true,
6
+ typescript: true,
7
+ ignores: ['**/fixtures/**'],
8
+ },
9
+ )
@@ -0,0 +1,13 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <link rel="icon" type="image/svg+xml" href="/vite.svg" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <title>Vite + Vue + TS</title>
8
+ </head>
9
+ <body>
10
+ <div id="app"></div>
11
+ <script type="module" src="/src/main.ts"></script>
12
+ </body>
13
+ </html>
@@ -0,0 +1,19 @@
1
+ <script setup lang="ts">
2
+ withDefaults(defineProps<{
3
+ msg?: string
4
+ }>(), {
5
+ msg: 'Hello World',
6
+ })
7
+ </script>
8
+
9
+ <template>
10
+ <div>
11
+ {{ msg }}
12
+ </div>
13
+ </template>
14
+
15
+ <style scoped>
16
+ .a {
17
+ color: aliceblue;
18
+ }
19
+ </style>
@@ -0,0 +1,3 @@
1
+ import HelloWorld from './HelloWorld.vue'
2
+
3
+ export { HelloWorld }
@@ -0,0 +1,57 @@
1
+ {
2
+ "name": "@icebreakers/vue-ui",
3
+ "type": "module",
4
+ "version": "0.0.0",
5
+ "description": "vue ui vite lib mode 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
+ ".": "./lib/index.ts"
20
+ },
21
+ "files": [
22
+ "dist"
23
+ ],
24
+ "scripts": {
25
+ "dev": "vite",
26
+ "build": "vue-tsc -b && vite build",
27
+ "preview": "vite preview",
28
+ "test": "vitest run",
29
+ "test:dev": "vitest",
30
+ "release": "pnpm publish",
31
+ "lint": "eslint .",
32
+ "lint:fix": "eslint . --fix"
33
+ },
34
+ "publishConfig": {
35
+ "exports": {
36
+ ".": {
37
+ "types": "./dist/index.d.ts",
38
+ "import": "./dist/index.js",
39
+ "require": "./dist/index.umd.cjs"
40
+ },
41
+ "./style.css": "./dist/index.css"
42
+ },
43
+ "main": "./dist/index.umd.cjs",
44
+ "module": "./dist/index.js",
45
+ "types": "./dist/index.d.ts"
46
+ },
47
+ "devDependencies": {
48
+ "@vitejs/plugin-vue": "^5.2.4",
49
+ "@vue/test-utils": "^2.4.6",
50
+ "@vue/tsconfig": "^0.7.0",
51
+ "jsdom": "^26.1.0",
52
+ "vite": "^6.3.5",
53
+ "vite-plugin-dts": "^4.5.4",
54
+ "vue": "^3.5.15",
55
+ "vue-tsc": "^2.2.10"
56
+ }
57
+ }
@@ -0,0 +1,9 @@
1
+ <script setup lang="ts">
2
+ import HelloWorld from '../lib/HelloWorld.vue'
3
+ </script>
4
+
5
+ <template>
6
+ <HelloWorld msg="Vite + Vue" />
7
+ </template>
8
+
9
+ <style scoped></style>
@@ -0,0 +1,5 @@
1
+ import { createApp } from 'vue'
2
+ import App from './App.vue'
3
+ import './style.css'
4
+
5
+ createApp(App).mount('#app')
File without changes
@@ -0,0 +1 @@
1
+ /// <reference types="vite/client" />
@@ -0,0 +1,13 @@
1
+ import { mount } from '@vue/test-utils'
2
+ import HelloWorld from '../lib/HelloWorld.vue'
3
+
4
+ it('displays message', () => {
5
+ const wrapper = mount(HelloWorld, {
6
+ props: {
7
+ msg: 'Hello world',
8
+ },
9
+ })
10
+
11
+ // Assert the rendered text of the component
12
+ expect(wrapper.text()).toContain('Hello world')
13
+ })
@@ -0,0 +1,29 @@
1
+ {
2
+ "extends": "@vue/tsconfig/tsconfig.dom.json",
3
+ "compilerOptions": {
4
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
5
+ "paths": {
6
+ "@/*": [
7
+ "./src"
8
+ ],
9
+ "~/*": [
10
+ "./lib"
11
+ ]
12
+ },
13
+ /* Linting */
14
+ "strict": true,
15
+ "noFallthroughCasesInSwitch": true,
16
+ "noUnusedLocals": true,
17
+ "noUnusedParameters": true,
18
+ "erasableSyntaxOnly": true,
19
+ "noUncheckedSideEffectImports": true
20
+ },
21
+ "include": [
22
+ "lib/**/*.ts",
23
+ "lib/**/*.tsx",
24
+ "lib/**/*.vue",
25
+ "src/**/*.ts",
26
+ "src/**/*.tsx",
27
+ "src/**/*.vue"
28
+ ]
29
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "references": [
3
+ {
4
+ "path": "./tsconfig.app.json"
5
+ },
6
+ {
7
+ "path": "./tsconfig.node.json"
8
+ },
9
+ {
10
+ "path": "./tsconfig.test.json"
11
+ }
12
+ ],
13
+ "files": []
14
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ "compilerOptions": {
3
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
4
+ "target": "ES2023",
5
+ "lib": ["ES2023"],
6
+ "moduleDetection": "force",
7
+ "module": "ESNext",
8
+
9
+ /* Bundler mode */
10
+ "moduleResolution": "bundler",
11
+ "allowImportingTsExtensions": true,
12
+
13
+ /* Linting */
14
+ "strict": true,
15
+ "noFallthroughCasesInSwitch": true,
16
+ "noUnusedLocals": true,
17
+ "noUnusedParameters": true,
18
+ "noEmit": true,
19
+ "verbatimModuleSyntax": true,
20
+ "erasableSyntaxOnly": true,
21
+ "skipLibCheck": true,
22
+ "noUncheckedSideEffectImports": true
23
+ },
24
+ "include": ["vite.config.ts"]
25
+ }
@@ -0,0 +1,40 @@
1
+ {
2
+ "extends": "@vue/tsconfig/tsconfig.dom.json",
3
+ "compilerOptions": {
4
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
5
+ "target": "ES2023",
6
+ "lib": [
7
+ "ES2023"
8
+ ],
9
+ "moduleDetection": "force",
10
+ "baseUrl": ".",
11
+ "module": "ESNext",
12
+ /* Bundler mode */
13
+ "moduleResolution": "bundler",
14
+ "paths": {
15
+ "@/*": [
16
+ "./src"
17
+ ],
18
+ "~/*": [
19
+ "./lib"
20
+ ]
21
+ },
22
+ "types": [
23
+ "vitest/globals"
24
+ ],
25
+ "allowImportingTsExtensions": true,
26
+ /* Linting */
27
+ "strict": true,
28
+ "noFallthroughCasesInSwitch": true,
29
+ "noUnusedLocals": true,
30
+ "noUnusedParameters": true,
31
+ "noEmit": true,
32
+ "verbatimModuleSyntax": true,
33
+ "erasableSyntaxOnly": true,
34
+ "skipLibCheck": true,
35
+ "noUncheckedSideEffectImports": true
36
+ },
37
+ "include": [
38
+ "test/**/*.ts"
39
+ ]
40
+ }
@@ -0,0 +1,36 @@
1
+ import path from 'pathe'
2
+ import { mergeConfig } from 'vite'
3
+ import dts from 'vite-plugin-dts'
4
+ import { sharedConfig } from './vite.shared.config'
5
+
6
+ export default mergeConfig(sharedConfig, {
7
+ plugins: [
8
+ dts(
9
+ {
10
+ tsconfigPath: './tsconfig.app.json',
11
+ entryRoot: './lib',
12
+ },
13
+ ),
14
+ ],
15
+ // https://vite.dev/guide/build.html#library-mode
16
+ build: {
17
+ lib: {
18
+ entry: path.resolve(import.meta.dirname, 'lib/index'),
19
+ name: 'icebreaker',
20
+ // the proper extensions will be added
21
+ fileName: 'index',
22
+ },
23
+ rollupOptions: {
24
+ // make sure to externalize deps that shouldn't be bundled
25
+ // into your library
26
+ external: ['vue'],
27
+ output: {
28
+ // Provide global variables to use in the UMD build
29
+ // for externalized deps
30
+ globals: {
31
+ vue: 'Vue',
32
+ },
33
+ },
34
+ },
35
+ },
36
+ })