@icebreakers/monorepo-templates 0.0.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.
Files changed (201) hide show
  1. package/README.md +9 -0
  2. package/assets/.changeset/config.json +16 -0
  3. package/assets/.changeset/create-icebreaker-interactive.md +5 -0
  4. package/assets/.changeset/monorepo-templates-package.md +5 -0
  5. package/assets/.changeset/skills-sync-resources.md +5 -0
  6. package/assets/.dockerignore +44 -0
  7. package/assets/.editorconfig +12 -0
  8. package/assets/.gitattributes +218 -0
  9. package/assets/.github/FUNDING.yml +4 -0
  10. package/assets/.github/ISSUE_TEMPLATE/bug_report.yml +71 -0
  11. package/assets/.github/ISSUE_TEMPLATE/config.yml +17 -0
  12. package/assets/.github/workflows/ci.yml +62 -0
  13. package/assets/.github/workflows/release.yml +57 -0
  14. package/assets/.husky/commit-msg +4 -0
  15. package/assets/.husky/pre-commit +4 -0
  16. package/assets/.vscode/extensions.json +6 -0
  17. package/assets/.vscode/settings.json +172 -0
  18. package/assets/CODE_OF_CONDUCT.md +128 -0
  19. package/assets/CONTRIBUTING.md +3 -0
  20. package/assets/Dockerfile +27 -0
  21. package/assets/LICENSE +21 -0
  22. package/assets/SECURITY.md +21 -0
  23. package/assets/commitlint.config.ts +3 -0
  24. package/assets/eslint.config.js +7 -0
  25. package/assets/gitignore +38 -0
  26. package/assets/lint-staged.config.js +11 -0
  27. package/assets/monorepo.config.ts +22 -0
  28. package/assets/netlify.toml +14 -0
  29. package/assets/package.json +88 -0
  30. package/assets/pnpm-workspace.yaml +11 -0
  31. package/assets/renovate.json +28 -0
  32. package/assets/stylelint.config.js +3 -0
  33. package/assets/tsconfig.json +51 -0
  34. package/assets/turbo.json +74 -0
  35. package/assets/vitest.config.ts +123 -0
  36. package/assets-data.mjs +45 -0
  37. package/dist/index.d.mts +37 -0
  38. package/dist/index.mjs +287 -0
  39. package/package.json +51 -0
  40. package/skeleton/.editorconfig +12 -0
  41. package/skeleton/LICENSE +21 -0
  42. package/skeleton/commitlint.config.ts +3 -0
  43. package/skeleton/eslint.config.js +7 -0
  44. package/skeleton/gitignore +38 -0
  45. package/skeleton/lint-staged.config.js +11 -0
  46. package/skeleton/package.json +88 -0
  47. package/skeleton/pnpm-workspace.yaml +11 -0
  48. package/skeleton/renovate.json +28 -0
  49. package/skeleton/stylelint.config.js +3 -0
  50. package/skeleton/tsconfig.json +51 -0
  51. package/skeleton/turbo.json +74 -0
  52. package/skeleton/vitest.config.ts +123 -0
  53. package/template-data.mjs +10 -0
  54. package/templates/cli/bin/index.js +2 -0
  55. package/templates/cli/dev/index.ts +2 -0
  56. package/templates/cli/gitignore +2 -0
  57. package/templates/cli/package.json +35 -0
  58. package/templates/cli/src/cli.ts +4 -0
  59. package/templates/cli/src/index.ts +15 -0
  60. package/templates/cli/tsconfig.json +7 -0
  61. package/templates/cli/tsup.config.ts +13 -0
  62. package/templates/client/eslint.config.js +12 -0
  63. package/templates/client/gitignore +28 -0
  64. package/templates/client/index.html +13 -0
  65. package/templates/client/package.json +52 -0
  66. package/templates/client/public/vite.svg +1 -0
  67. package/templates/client/src/App.vue +11 -0
  68. package/templates/client/src/main.ts +16 -0
  69. package/templates/client/src/pages/index.vue +357 -0
  70. package/templates/client/src/query-keys.ts +4 -0
  71. package/templates/client/src/router/index.ts +13 -0
  72. package/templates/client/src/stores/i18n.ts +24 -0
  73. package/templates/client/src/stores/index.ts +15 -0
  74. package/templates/client/src/style.css +1 -0
  75. package/templates/client/src/trpc/index.ts +10 -0
  76. package/templates/client/src/vite-env.d.ts +2 -0
  77. package/templates/client/tsconfig.app.json +28 -0
  78. package/templates/client/tsconfig.json +8 -0
  79. package/templates/client/tsconfig.node.json +25 -0
  80. package/templates/client/tsconfig.worker.json +11 -0
  81. package/templates/client/vite.config.ts +57 -0
  82. package/templates/client/worker/app.ts +24 -0
  83. package/templates/client/worker/config.ts +1 -0
  84. package/templates/client/worker/fetch-entry.ts +5 -0
  85. package/templates/client/worker/node-entry.ts +13 -0
  86. package/templates/client/worker/trpc-router.ts +24 -0
  87. package/templates/client/wrangler.jsonc +24 -0
  88. package/templates/server/gitignore +2 -0
  89. package/templates/server/package.json +60 -0
  90. package/templates/server/src/app.ts +191 -0
  91. package/templates/server/src/config.ts +1 -0
  92. package/templates/server/src/fetch-entry.ts +5 -0
  93. package/templates/server/src/node-entry.ts +13 -0
  94. package/templates/server/test/index.test.ts +14 -0
  95. package/templates/server/tsconfig.json +24 -0
  96. package/templates/server/tsup.config.ts +13 -0
  97. package/templates/server/vitest.config.ts +15 -0
  98. package/templates/server/wrangler.jsonc +18 -0
  99. package/templates/tsdown/package.json +47 -0
  100. package/templates/tsdown/src/index.ts +5 -0
  101. package/templates/tsdown/test/index.test.ts +11 -0
  102. package/templates/tsdown/tsconfig.json +15 -0
  103. package/templates/tsdown/tsdown.config.ts +9 -0
  104. package/templates/tsdown/vitest.config.ts +15 -0
  105. package/templates/tsup/build.config.ts +24 -0
  106. package/templates/tsup/package.json +48 -0
  107. package/templates/tsup/src/index.ts +12 -0
  108. package/templates/tsup/test/index.test.ts +18 -0
  109. package/templates/tsup/tsconfig.json +15 -0
  110. package/templates/tsup/tsup.config.ts +18 -0
  111. package/templates/tsup/vitest.config.ts +15 -0
  112. package/templates/unbuild/build.config.ts +24 -0
  113. package/templates/unbuild/package.json +48 -0
  114. package/templates/unbuild/src/index.ts +9 -0
  115. package/templates/unbuild/src/utils.ts +3 -0
  116. package/templates/unbuild/test/index.test.ts +18 -0
  117. package/templates/unbuild/tsconfig.json +15 -0
  118. package/templates/unbuild/vitest.config.ts +15 -0
  119. package/templates/vitepress/.vitepress/config.ts +93 -0
  120. package/templates/vitepress/.vitepress/theme/index.ts +4 -0
  121. package/templates/vitepress/.vitepress/theme/tailwind.css +1 -0
  122. package/templates/vitepress/gitignore +1 -0
  123. package/templates/vitepress/index.md +127 -0
  124. package/templates/vitepress/monorepo/index.md +46 -0
  125. package/templates/vitepress/monorepo/manage.md +129 -0
  126. package/templates/vitepress/monorepo/publish.md +142 -0
  127. package/templates/vitepress/package.json +39 -0
  128. package/templates/vitepress/public/logo.jpg +0 -0
  129. package/templates/vitepress/thinking.md +88 -0
  130. package/templates/vitepress/tools/changeset.md +87 -0
  131. package/templates/vitepress/tools/husky.md +108 -0
  132. package/templates/vitepress/tools/lint-staged.md +79 -0
  133. package/templates/vitepress/tools/pnpm.md +101 -0
  134. package/templates/vitepress/tools/renovate.md +91 -0
  135. package/templates/vitepress/tools/turborepo.md +149 -0
  136. package/templates/vitepress/why/assets/npm-dt.svg +15 -0
  137. package/templates/vitepress/why/assets/npm-ts.svg +19 -0
  138. package/templates/vitepress/why/examples/0.npm-basic-package/index.js +10 -0
  139. package/templates/vitepress/why/examples/0.npm-basic-package/package.json +11 -0
  140. package/templates/vitepress/why/examples/1.npm-basic-package/index.cjs +12 -0
  141. package/templates/vitepress/why/examples/1.npm-basic-package/index.d.ts +1 -0
  142. package/templates/vitepress/why/examples/1.npm-basic-package/index.js +8 -0
  143. package/templates/vitepress/why/examples/1.npm-basic-package/package.json +19 -0
  144. package/templates/vitepress/why/examples/2.npm-basic-package/README.md +1 -0
  145. package/templates/vitepress/why/examples/2.npm-basic-package/package-lock.json +30 -0
  146. package/templates/vitepress/why/examples/2.npm-basic-package/package.json +35 -0
  147. package/templates/vitepress/why/examples/2.npm-basic-package/rename-ext.js +24 -0
  148. package/templates/vitepress/why/examples/2.npm-basic-package/src/index.ts +8 -0
  149. package/templates/vitepress/why/examples/2.npm-basic-package/tsconfig.cjs.json +8 -0
  150. package/templates/vitepress/why/examples/2.npm-basic-package/tsconfig.esm.json +7 -0
  151. package/templates/vitepress/why/examples/2.npm-basic-package/tsconfig.json +18 -0
  152. package/templates/vitepress/why/examples/3.npm-basic-package/README.md +1 -0
  153. package/templates/vitepress/why/examples/3.npm-basic-package/build.config.ts +24 -0
  154. package/templates/vitepress/why/examples/3.npm-basic-package/package-lock.json +3661 -0
  155. package/templates/vitepress/why/examples/3.npm-basic-package/package.json +32 -0
  156. package/templates/vitepress/why/examples/3.npm-basic-package/src/index.ts +8 -0
  157. package/templates/vitepress/why/examples/3.npm-basic-package/tsconfig.json +16 -0
  158. package/templates/vitepress/why/examples/3.npm-basic-package/tsup.config.ts +16 -0
  159. package/templates/vitepress/why/examples/usage-cjs/cjs.cjs +4 -0
  160. package/templates/vitepress/why/examples/usage-cjs/esm.mjs +4 -0
  161. package/templates/vitepress/why/examples/usage-cjs/index.js +12 -0
  162. package/templates/vitepress/why/examples/usage-cjs/package-lock.json +42 -0
  163. package/templates/vitepress/why/examples/usage-cjs/package.json +20 -0
  164. package/templates/vitepress/why/examples/usage-esm/cjs.cjs +4 -0
  165. package/templates/vitepress/why/examples/usage-esm/createRequire.js +7 -0
  166. package/templates/vitepress/why/examples/usage-esm/esm.mjs +4 -0
  167. package/templates/vitepress/why/examples/usage-esm/index.js +8 -0
  168. package/templates/vitepress/why/examples/usage-esm/package-lock.json +42 -0
  169. package/templates/vitepress/why/examples/usage-esm/package.json +21 -0
  170. package/templates/vitepress/why/how-to-reuse-js-code.md +250 -0
  171. package/templates/vitepress/why/index.md +1 -0
  172. package/templates/vitepress/why/js-cjs-mjs.md +99 -0
  173. package/templates/vitepress/why/js-keywords.md +132 -0
  174. package/templates/vitepress/why/modern/bundlers.md +79 -0
  175. package/templates/vitepress/why/modern/dts.md +93 -0
  176. package/templates/vitepress/why/modern/esm-vs-cjs.md +84 -0
  177. package/templates/vitepress/why/modern/index.md +55 -0
  178. package/templates/vitepress/why/modern/package-entry-points.md +128 -0
  179. package/templates/vitepress/why/modern/typescript.md +155 -0
  180. package/templates/vitepress/why/publish-basic-npm-package.md +146 -0
  181. package/templates/vitepress/why/what-is-npm-package.md +162 -0
  182. package/templates/vue-lib/eslint.config.js +12 -0
  183. package/templates/vue-lib/gitignore +1 -0
  184. package/templates/vue-lib/index.html +13 -0
  185. package/templates/vue-lib/lib/HelloWorld.vue +21 -0
  186. package/templates/vue-lib/lib/index.ts +3 -0
  187. package/templates/vue-lib/package.json +61 -0
  188. package/templates/vue-lib/src/App.vue +9 -0
  189. package/templates/vue-lib/src/main.ts +8 -0
  190. package/templates/vue-lib/src/pages/index.vue +7 -0
  191. package/templates/vue-lib/src/router/index.ts +11 -0
  192. package/templates/vue-lib/src/style.css +1 -0
  193. package/templates/vue-lib/src/vite-env.d.ts +2 -0
  194. package/templates/vue-lib/test/index.test.ts +13 -0
  195. package/templates/vue-lib/tsconfig.app.json +30 -0
  196. package/templates/vue-lib/tsconfig.json +14 -0
  197. package/templates/vue-lib/tsconfig.node.json +25 -0
  198. package/templates/vue-lib/tsconfig.test.json +40 -0
  199. package/templates/vue-lib/vite.config.ts +54 -0
  200. package/templates/vue-lib/vite.shared.config.ts +13 -0
  201. package/templates/vue-lib/vitest.config.ts +13 -0
@@ -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,54 @@
1
+ import type { PluginOption, UserConfig } from 'vite'
2
+ import Tailwindcss from '@tailwindcss/vite'
3
+ import Vue from '@vitejs/plugin-vue'
4
+ import path from 'pathe'
5
+ import VueRouter from 'unplugin-vue-router/vite'
6
+ import { mergeConfig } from 'vite'
7
+ import DTS from 'vite-plugin-dts'
8
+ import { sharedConfig } from './vite.shared.config'
9
+
10
+ // 某些插件仍引用旧版 Vite 类型,这里统一断言到当前工程使用的 PluginOption,避免类型不兼容。
11
+ const ensureVitePlugin = <T>(plugin: T) => plugin as unknown as PluginOption
12
+
13
+ export default mergeConfig(sharedConfig, {
14
+ plugins: [
15
+ ensureVitePlugin(
16
+ VueRouter(
17
+ {
18
+ dts: path.relative(import.meta.dirname, './types/typed-router.d.ts'),
19
+ },
20
+ ),
21
+ ),
22
+ ensureVitePlugin(Vue()),
23
+ ensureVitePlugin(
24
+ DTS(
25
+ {
26
+ tsconfigPath: './tsconfig.app.json',
27
+ entryRoot: './lib',
28
+ },
29
+ ),
30
+ ),
31
+ ensureVitePlugin(Tailwindcss()),
32
+ ],
33
+ // https://vite.dev/guide/build.html#library-mode
34
+ build: {
35
+ lib: {
36
+ entry: path.resolve(import.meta.dirname, 'lib/index'),
37
+ name: 'icebreaker',
38
+ // the proper extensions will be added
39
+ fileName: 'index',
40
+ },
41
+ rollupOptions: {
42
+ // make sure to externalize deps that shouldn't be bundled
43
+ // into your library
44
+ external: ['vue'],
45
+ output: {
46
+ // Provide global variables to use in the UMD build
47
+ // for externalized deps
48
+ globals: {
49
+ vue: 'Vue',
50
+ },
51
+ },
52
+ },
53
+ },
54
+ } satisfies UserConfig)
@@ -0,0 +1,13 @@
1
+ import path from 'pathe'
2
+
3
+ // https://vite.dev/guide/build.html#library-mode
4
+ import { defineConfig } from 'vite'
5
+
6
+ export const sharedConfig = defineConfig({
7
+ resolve: {
8
+ alias: {
9
+ '@': path.resolve(import.meta.dirname, 'src'),
10
+ '~': path.resolve(import.meta.dirname, 'lib'),
11
+ },
12
+ },
13
+ })
@@ -0,0 +1,13 @@
1
+ import type { UserConfig } from 'vite'
2
+ import Vue from '@vitejs/plugin-vue'
3
+ import { mergeConfig } from 'vitest/config'
4
+ import { sharedConfig } from './vite.shared.config'
5
+
6
+ export default mergeConfig(sharedConfig, {
7
+ test: {
8
+ globals: true,
9
+ testTimeout: 60_000,
10
+ environment: 'jsdom',
11
+ },
12
+ plugins: [Vue()],
13
+ } satisfies UserConfig)