@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.
- package/README.md +9 -0
- package/assets/.changeset/config.json +16 -0
- package/assets/.changeset/create-icebreaker-interactive.md +5 -0
- package/assets/.changeset/monorepo-templates-package.md +5 -0
- package/assets/.changeset/skills-sync-resources.md +5 -0
- package/assets/.dockerignore +44 -0
- package/assets/.editorconfig +12 -0
- package/assets/.gitattributes +218 -0
- package/assets/.github/FUNDING.yml +4 -0
- package/assets/.github/ISSUE_TEMPLATE/bug_report.yml +71 -0
- package/assets/.github/ISSUE_TEMPLATE/config.yml +17 -0
- package/assets/.github/workflows/ci.yml +62 -0
- package/assets/.github/workflows/release.yml +57 -0
- package/assets/.husky/commit-msg +4 -0
- package/assets/.husky/pre-commit +4 -0
- package/assets/.vscode/extensions.json +6 -0
- package/assets/.vscode/settings.json +172 -0
- package/assets/CODE_OF_CONDUCT.md +128 -0
- package/assets/CONTRIBUTING.md +3 -0
- package/assets/Dockerfile +27 -0
- package/assets/LICENSE +21 -0
- package/assets/SECURITY.md +21 -0
- package/assets/commitlint.config.ts +3 -0
- package/assets/eslint.config.js +7 -0
- package/assets/gitignore +38 -0
- package/assets/lint-staged.config.js +11 -0
- package/assets/monorepo.config.ts +22 -0
- package/assets/netlify.toml +14 -0
- package/assets/package.json +88 -0
- package/assets/pnpm-workspace.yaml +11 -0
- package/assets/renovate.json +28 -0
- package/assets/stylelint.config.js +3 -0
- package/assets/tsconfig.json +51 -0
- package/assets/turbo.json +74 -0
- package/assets/vitest.config.ts +123 -0
- package/assets-data.mjs +45 -0
- package/dist/index.d.mts +37 -0
- package/dist/index.mjs +287 -0
- package/package.json +51 -0
- package/skeleton/.editorconfig +12 -0
- package/skeleton/LICENSE +21 -0
- package/skeleton/commitlint.config.ts +3 -0
- package/skeleton/eslint.config.js +7 -0
- package/skeleton/gitignore +38 -0
- package/skeleton/lint-staged.config.js +11 -0
- package/skeleton/package.json +88 -0
- package/skeleton/pnpm-workspace.yaml +11 -0
- package/skeleton/renovate.json +28 -0
- package/skeleton/stylelint.config.js +3 -0
- package/skeleton/tsconfig.json +51 -0
- package/skeleton/turbo.json +74 -0
- package/skeleton/vitest.config.ts +123 -0
- package/template-data.mjs +10 -0
- package/templates/cli/bin/index.js +2 -0
- package/templates/cli/dev/index.ts +2 -0
- package/templates/cli/gitignore +2 -0
- package/templates/cli/package.json +35 -0
- package/templates/cli/src/cli.ts +4 -0
- package/templates/cli/src/index.ts +15 -0
- package/templates/cli/tsconfig.json +7 -0
- package/templates/cli/tsup.config.ts +13 -0
- package/templates/client/eslint.config.js +12 -0
- package/templates/client/gitignore +28 -0
- package/templates/client/index.html +13 -0
- package/templates/client/package.json +52 -0
- package/templates/client/public/vite.svg +1 -0
- package/templates/client/src/App.vue +11 -0
- package/templates/client/src/main.ts +16 -0
- package/templates/client/src/pages/index.vue +357 -0
- package/templates/client/src/query-keys.ts +4 -0
- package/templates/client/src/router/index.ts +13 -0
- package/templates/client/src/stores/i18n.ts +24 -0
- package/templates/client/src/stores/index.ts +15 -0
- package/templates/client/src/style.css +1 -0
- package/templates/client/src/trpc/index.ts +10 -0
- package/templates/client/src/vite-env.d.ts +2 -0
- package/templates/client/tsconfig.app.json +28 -0
- package/templates/client/tsconfig.json +8 -0
- package/templates/client/tsconfig.node.json +25 -0
- package/templates/client/tsconfig.worker.json +11 -0
- package/templates/client/vite.config.ts +57 -0
- package/templates/client/worker/app.ts +24 -0
- package/templates/client/worker/config.ts +1 -0
- package/templates/client/worker/fetch-entry.ts +5 -0
- package/templates/client/worker/node-entry.ts +13 -0
- package/templates/client/worker/trpc-router.ts +24 -0
- package/templates/client/wrangler.jsonc +24 -0
- package/templates/server/gitignore +2 -0
- package/templates/server/package.json +60 -0
- package/templates/server/src/app.ts +191 -0
- package/templates/server/src/config.ts +1 -0
- package/templates/server/src/fetch-entry.ts +5 -0
- package/templates/server/src/node-entry.ts +13 -0
- package/templates/server/test/index.test.ts +14 -0
- package/templates/server/tsconfig.json +24 -0
- package/templates/server/tsup.config.ts +13 -0
- package/templates/server/vitest.config.ts +15 -0
- package/templates/server/wrangler.jsonc +18 -0
- package/templates/tsdown/package.json +47 -0
- package/templates/tsdown/src/index.ts +5 -0
- package/templates/tsdown/test/index.test.ts +11 -0
- package/templates/tsdown/tsconfig.json +15 -0
- package/templates/tsdown/tsdown.config.ts +9 -0
- package/templates/tsdown/vitest.config.ts +15 -0
- package/templates/tsup/build.config.ts +24 -0
- package/templates/tsup/package.json +48 -0
- package/templates/tsup/src/index.ts +12 -0
- package/templates/tsup/test/index.test.ts +18 -0
- package/templates/tsup/tsconfig.json +15 -0
- package/templates/tsup/tsup.config.ts +18 -0
- package/templates/tsup/vitest.config.ts +15 -0
- package/templates/unbuild/build.config.ts +24 -0
- package/templates/unbuild/package.json +48 -0
- package/templates/unbuild/src/index.ts +9 -0
- package/templates/unbuild/src/utils.ts +3 -0
- package/templates/unbuild/test/index.test.ts +18 -0
- package/templates/unbuild/tsconfig.json +15 -0
- package/templates/unbuild/vitest.config.ts +15 -0
- package/templates/vitepress/.vitepress/config.ts +93 -0
- package/templates/vitepress/.vitepress/theme/index.ts +4 -0
- package/templates/vitepress/.vitepress/theme/tailwind.css +1 -0
- package/templates/vitepress/gitignore +1 -0
- package/templates/vitepress/index.md +127 -0
- package/templates/vitepress/monorepo/index.md +46 -0
- package/templates/vitepress/monorepo/manage.md +129 -0
- package/templates/vitepress/monorepo/publish.md +142 -0
- package/templates/vitepress/package.json +39 -0
- package/templates/vitepress/public/logo.jpg +0 -0
- package/templates/vitepress/thinking.md +88 -0
- package/templates/vitepress/tools/changeset.md +87 -0
- package/templates/vitepress/tools/husky.md +108 -0
- package/templates/vitepress/tools/lint-staged.md +79 -0
- package/templates/vitepress/tools/pnpm.md +101 -0
- package/templates/vitepress/tools/renovate.md +91 -0
- package/templates/vitepress/tools/turborepo.md +149 -0
- package/templates/vitepress/why/assets/npm-dt.svg +15 -0
- package/templates/vitepress/why/assets/npm-ts.svg +19 -0
- package/templates/vitepress/why/examples/0.npm-basic-package/index.js +10 -0
- package/templates/vitepress/why/examples/0.npm-basic-package/package.json +11 -0
- package/templates/vitepress/why/examples/1.npm-basic-package/index.cjs +12 -0
- package/templates/vitepress/why/examples/1.npm-basic-package/index.d.ts +1 -0
- package/templates/vitepress/why/examples/1.npm-basic-package/index.js +8 -0
- package/templates/vitepress/why/examples/1.npm-basic-package/package.json +19 -0
- package/templates/vitepress/why/examples/2.npm-basic-package/README.md +1 -0
- package/templates/vitepress/why/examples/2.npm-basic-package/package-lock.json +30 -0
- package/templates/vitepress/why/examples/2.npm-basic-package/package.json +35 -0
- package/templates/vitepress/why/examples/2.npm-basic-package/rename-ext.js +24 -0
- package/templates/vitepress/why/examples/2.npm-basic-package/src/index.ts +8 -0
- package/templates/vitepress/why/examples/2.npm-basic-package/tsconfig.cjs.json +8 -0
- package/templates/vitepress/why/examples/2.npm-basic-package/tsconfig.esm.json +7 -0
- package/templates/vitepress/why/examples/2.npm-basic-package/tsconfig.json +18 -0
- package/templates/vitepress/why/examples/3.npm-basic-package/README.md +1 -0
- package/templates/vitepress/why/examples/3.npm-basic-package/build.config.ts +24 -0
- package/templates/vitepress/why/examples/3.npm-basic-package/package-lock.json +3661 -0
- package/templates/vitepress/why/examples/3.npm-basic-package/package.json +32 -0
- package/templates/vitepress/why/examples/3.npm-basic-package/src/index.ts +8 -0
- package/templates/vitepress/why/examples/3.npm-basic-package/tsconfig.json +16 -0
- package/templates/vitepress/why/examples/3.npm-basic-package/tsup.config.ts +16 -0
- package/templates/vitepress/why/examples/usage-cjs/cjs.cjs +4 -0
- package/templates/vitepress/why/examples/usage-cjs/esm.mjs +4 -0
- package/templates/vitepress/why/examples/usage-cjs/index.js +12 -0
- package/templates/vitepress/why/examples/usage-cjs/package-lock.json +42 -0
- package/templates/vitepress/why/examples/usage-cjs/package.json +20 -0
- package/templates/vitepress/why/examples/usage-esm/cjs.cjs +4 -0
- package/templates/vitepress/why/examples/usage-esm/createRequire.js +7 -0
- package/templates/vitepress/why/examples/usage-esm/esm.mjs +4 -0
- package/templates/vitepress/why/examples/usage-esm/index.js +8 -0
- package/templates/vitepress/why/examples/usage-esm/package-lock.json +42 -0
- package/templates/vitepress/why/examples/usage-esm/package.json +21 -0
- package/templates/vitepress/why/how-to-reuse-js-code.md +250 -0
- package/templates/vitepress/why/index.md +1 -0
- package/templates/vitepress/why/js-cjs-mjs.md +99 -0
- package/templates/vitepress/why/js-keywords.md +132 -0
- package/templates/vitepress/why/modern/bundlers.md +79 -0
- package/templates/vitepress/why/modern/dts.md +93 -0
- package/templates/vitepress/why/modern/esm-vs-cjs.md +84 -0
- package/templates/vitepress/why/modern/index.md +55 -0
- package/templates/vitepress/why/modern/package-entry-points.md +128 -0
- package/templates/vitepress/why/modern/typescript.md +155 -0
- package/templates/vitepress/why/publish-basic-npm-package.md +146 -0
- package/templates/vitepress/why/what-is-npm-package.md +162 -0
- package/templates/vue-lib/eslint.config.js +12 -0
- package/templates/vue-lib/gitignore +1 -0
- package/templates/vue-lib/index.html +13 -0
- package/templates/vue-lib/lib/HelloWorld.vue +21 -0
- package/templates/vue-lib/lib/index.ts +3 -0
- package/templates/vue-lib/package.json +61 -0
- package/templates/vue-lib/src/App.vue +9 -0
- package/templates/vue-lib/src/main.ts +8 -0
- package/templates/vue-lib/src/pages/index.vue +7 -0
- package/templates/vue-lib/src/router/index.ts +11 -0
- package/templates/vue-lib/src/style.css +1 -0
- package/templates/vue-lib/src/vite-env.d.ts +2 -0
- package/templates/vue-lib/test/index.test.ts +13 -0
- package/templates/vue-lib/tsconfig.app.json +30 -0
- package/templates/vue-lib/tsconfig.json +14 -0
- package/templates/vue-lib/tsconfig.node.json +25 -0
- package/templates/vue-lib/tsconfig.test.json +40 -0
- package/templates/vue-lib/vite.config.ts +54 -0
- package/templates/vue-lib/vite.shared.config.ts +13 -0
- package/templates/vue-lib/vitest.config.ts +13 -0
|
@@ -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)
|