@skirtle/create-vue-lib 0.0.0 → 0.0.2

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 (39) hide show
  1. package/README.md +2 -0
  2. package/dist/index.cjs +337 -162
  3. package/dist/template/base/config/{.editorconfig → .editorconfig.ejs} +6 -0
  4. package/dist/template/base/config/.gitignore.ejs +33 -0
  5. package/dist/template/base/config/.vscode/extensions.json.ejs +10 -0
  6. package/dist/template/base/config/.vscode/settings.json.ejs +13 -0
  7. package/dist/template/base/config/LICENSE +0 -0
  8. package/dist/template/base/config/package.json.ejs +37 -5
  9. package/dist/template/base/config/packages/@projectName@/package.json +13 -16
  10. package/dist/template/base/config/packages/@projectName@/src/global.d.ts.ejs +4 -0
  11. package/dist/template/base/config/packages/@projectName@/{tsconfig.app.json → tsconfig.app.json.ejs} +3 -1
  12. package/dist/template/base/config/packages/@projectName@/tsconfig.node.json +1 -1
  13. package/dist/template/base/config/packages/@projectName@/tsconfig.vitest.json +1 -1
  14. package/dist/template/base/config/packages/@projectName@/{vite.config.mts → vite.config.mts.ejs} +26 -11
  15. package/dist/template/base/examples/packages/@projectName@/src/components/{Example.vue → ExampleComponent.vue.ejs} +4 -1
  16. package/dist/template/base/examples/packages/@projectName@/src/index.ts +1 -1
  17. package/dist/template/eslint/config/eslint.config.mts.ejs +33 -0
  18. package/dist/template/eslint/config/tsconfig.json +10 -0
  19. package/dist/template/gh-pages/config/.github/workflows/pages.yml +0 -2
  20. package/dist/template/playground/config/packages/playground/env.d.ts +2 -1
  21. package/dist/template/playground/config/packages/playground/package.json +6 -4
  22. package/dist/template/playground/config/packages/playground/tsconfig.app.json.ejs +13 -0
  23. package/dist/template/playground/config/packages/playground/tsconfig.node.json +1 -1
  24. package/dist/template/playground/config/packages/playground/vite.config.mts.ejs +45 -0
  25. package/dist/template/playground/examples/packages/playground/src/App.vue +1 -1
  26. package/dist/template/vitepress/config/packages/docs/.vitepress/config.mts.ejs +28 -3
  27. package/dist/template/vitepress/config/packages/docs/env.d.ts +2 -1
  28. package/dist/template/vitepress/config/packages/docs/package.json +7 -4
  29. package/dist/template/vitepress/config/packages/docs/tsconfig.app.json.ejs +22 -0
  30. package/dist/template/vitepress/config/packages/docs/tsconfig.node.json +1 -9
  31. package/dist/template/vitepress/examples/packages/docs/src/index.md +1 -1
  32. package/dist/template/vitepress/examples/packages/docs/src/introduction.md +1 -1
  33. package/package.json +8 -8
  34. package/dist/template/base/config/packages/@projectName@/README.md.ejs +0 -5
  35. package/dist/template/base/config/packages/@projectName@/src/global.d.ts +0 -1
  36. package/dist/template/base/config/tsconfig.json +0 -4
  37. package/dist/template/playground/config/packages/playground/tsconfig.app.json +0 -11
  38. package/dist/template/playground/config/packages/playground/vite.config.mts +0 -22
  39. package/dist/template/vitepress/config/packages/docs/tsconfig.app.json +0 -13
@@ -1,3 +1,5 @@
1
+ root = true
2
+
1
3
  [*]
2
4
  charset = utf-8
3
5
  indent_style = space
@@ -5,3 +7,7 @@ indent_size = 2
5
7
  end_of_line = lf
6
8
  insert_final_newline = true
7
9
  trim_trailing_whitespace = true
10
+
11
+ [*.md]
12
+ indent_size = 4
13
+ trim_trailing_whitespace = false
@@ -0,0 +1,33 @@
1
+ # Logs
2
+ logs
3
+ *.log
4
+ npm-debug.log*
5
+ yarn-debug.log*
6
+ yarn-error.log*
7
+ pnpm-debug.log*
8
+ lerna-debug.log*
9
+
10
+ node_modules
11
+ .DS_Store
12
+ dist
13
+ dist-ssr
14
+ coverage
15
+ *.local
16
+ packages/docs/.vitepress/cache
17
+ packages/<%- config.mainPackageDirName %>/LICENSE
18
+ packages/<%- config.mainPackageDirName %>/README.md
19
+
20
+ /cypress/videos/
21
+ /cypress/screenshots/
22
+
23
+ # Editor directories and files
24
+ .vscode/*
25
+ !.vscode/extensions.json
26
+ .idea
27
+ *.suo
28
+ *.ntvs*
29
+ *.njsproj
30
+ *.sln
31
+ *.sw?
32
+
33
+ *.tsbuildinfo
@@ -0,0 +1,10 @@
1
+ {
2
+ "recommendations": [
3
+ "Vue.volar",
4
+ "vitest.explorer",
5
+ <%_ if (config.includeEsLint) { _%>
6
+ "dbaeumer.vscode-eslint",
7
+ <%_ } _%>
8
+ "EditorConfig.EditorConfig"
9
+ ]
10
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "explorer.fileNesting.enabled": true,
3
+ "explorer.fileNesting.patterns": {
4
+ "tsconfig.json": "tsconfig.*.json, env.d.ts",
5
+ "vite.config.*": "jsconfig*, vitest.config.*, cypress.config.*, playwright.config.*",
6
+ "package.json": "package-lock.json, pnpm*, .yarnrc*, yarn*, .eslint*, eslint*, .prettier*, prettier*, .editorconfig"
7
+ },
8
+ <%_ if (config.includeEsLint) { _%>
9
+ "editor.codeActionsOnSave": {
10
+ "source.fixAll": "explicit"
11
+ }
12
+ <%_ } _%>
13
+ }
File without changes
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "private": true,
3
3
  "type": "module",
4
+ "packageManager": "pnpm@9.15.4",
5
+ "engines": {
6
+ "node": ">=v18.3.0"
7
+ },
4
8
  "scripts": {
5
9
  "clean": "pnpm run -r clean",
6
- "build": "pnpm run -r build",
7
- "type-check": "pnpm run -r type-check",
8
- "lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore",
9
10
  <%_ if (config.includePlayground) { _%>
10
11
  "dev": "pnpm run --filter ./packages/playground -r dev",
11
12
  <%_ } _%>
@@ -15,21 +16,52 @@
15
16
  <%_ } _%>
16
17
  "test:unit": "pnpm run --filter ./packages/<%- config.mainPackageDirName %> -r test:unit",
17
18
  "coverage": "pnpm run --filter ./packages/<%- config.mainPackageDirName %> -r coverage",
19
+ <%_ if (config.includeEsLint) { _%>
20
+ "type-check": "run-p type-check:*",
21
+ "type-check:packages": "pnpm run -r type-check",
22
+ "type-check:self": "tsc",
23
+ "lint": "eslint",
24
+ "lint:fix": "eslint --fix",
25
+ "lint:staged": "lint-staged",
26
+ <%_ } else { _%>
27
+ "type-check": "pnpm run -r type-check",
28
+ <%_ } _%>
29
+ "build": "pnpm run -r build",
18
30
  "preinstall": "node scripts/preinstall.js",
19
31
  "postinstall": "simple-git-hooks"
20
32
  },
33
+ <%_ if (config.includeEsLint) { _%>
21
34
  "simple-git-hooks": {
22
- "pre-commit": "pnpm run type-check && pnpm exec lint-staged"
35
+ "pre-commit": "pnpm exec run-s type-check lint:staged"
23
36
  },
24
37
  "lint-staged": {
25
38
  "*.{vue,js,jsx,cjs,mjs,ts,tsx,cts,mts}": "eslint --fix"
26
39
  },
40
+ <%_ } else { _%>
41
+ "simple-git-hooks": {
42
+ "pre-commit": "pnpm run type-check"
43
+ },
44
+ <%_ } _%>
27
45
  "devDependencies": {
46
+ <%_ if (config.includeEsLint) { _%>
47
+ "@eslint/compat": "^1.2.6",
48
+ <%_ if (config.includeEsLintStylistic) { _%>
49
+ "@stylistic/eslint-plugin": "^4.0.0",
50
+ <%_ } _%>
51
+ "@tsconfig/node22": "^22.0.0",
52
+ "@types/node": "^22.13.0",
28
53
  "@typescript-eslint/parser": "^8.23.0",
54
+ "@vitest/eslint-plugin": "1.1.25",
29
55
  "@vue/eslint-config-typescript": "^14.3.0",
30
56
  "eslint": "^9.18.0",
31
57
  "eslint-plugin-vue": "^9.32.0",
58
+ "jiti": "^2.4.2",
32
59
  "lint-staged": "^15.4.3",
33
- "simple-git-hooks": "^2.11.1"
60
+ "npm-run-all2": "^7.0.2",
61
+ <%_ } _%>
62
+ "simple-git-hooks": "^2.11.1",
63
+ <%_ if (config.includeEsLint) { _%>
64
+ "typescript": "^5.7.3"
65
+ <%_ } _%>
34
66
  }
35
67
  }
@@ -42,32 +42,29 @@
42
42
  "@vitest/coverage-v8": "^3.0.5",
43
43
  "@vue/test-utils": "^2.4.6",
44
44
  "@vue/tsconfig": "^0.7.0",
45
+ "copyfiles": "^2.4.1",
46
+ "cross-env": "^7.0.3",
45
47
  "jsdom": "^26.0.0",
48
+ "npm-run-all2": "^7.0.2",
46
49
  "rimraf": "^5.0.1",
47
50
  "typescript": "~5.7.3",
48
51
  "vite": "^6.0.11",
49
- "vite-plugin-dts": "^4.5.0",
52
+ "vite-plugin-dts": "4.5.0",
50
53
  "vitest": "^3.0.2",
51
54
  "vue": "^3.5.13",
52
- "vue-tsc": "^2.2.0",
53
-
54
- "@vitest/eslint-plugin": "1.1.25",
55
- "@vue/eslint-config-typescript": "^14.3.0",
56
- "eslint": "^9.18.0",
57
- "eslint-plugin-vue": "^9.32.0",
58
- "jiti": "^2.4.2",
59
- "npm-run-all2": "^7.0.2",
60
- "vite-plugin-vue-devtools": "^7.7.0"
55
+ "vue-tsc": "^2.2.0"
61
56
  },
62
57
  "scripts": {
63
- "clean": "rimraf dist && rimraf coverage",
58
+ "clean:dist": "rimraf dist",
59
+ "clean": "rimraf dist coverage LICENSE README.md",
64
60
  "test:unit": "vitest --environment jsdom",
65
61
  "coverage": "vitest run --coverage --environment jsdom",
66
- "build": "rimraf dist && pnpm build-dev && pnpm build-neutral && pnpm build-prod && pnpm type-check",
67
- "build-dev": "vite build --mode development",
68
- "build-neutral": "vite build --mode neutral",
69
- "build-prod": "vite build --mode production",
70
- "type-check": "vue-tsc --noEmit -p tsconfig.vitest.json --composite false",
62
+ "type-check": "vue-tsc --build",
63
+ "build:copy": "copyfiles -f ../../LICENSE ../../README.md .",
64
+ "build:dev": "cross-env NODE_ENV=development vite build --mode development",
65
+ "build:neutral": "vite build --mode neutral",
66
+ "build:prod": "vite build --mode production",
67
+ "build": "run-s clean:dist build:* type-check",
71
68
  "preinstall": "node ../../scripts/preinstall.js"
72
69
  }
73
70
  }
@@ -0,0 +1,4 @@
1
+ declare const __DEV__: boolean
2
+ <%_ if (config.includeTestVariable) { _%>
3
+ declare const __TEST__: boolean
4
+ <%_ } _%>
@@ -3,9 +3,11 @@
3
3
  "include": ["env.d.ts", "src/**/*", "src/**/*.vue"],
4
4
  "exclude": ["src/**/__tests__/*"],
5
5
  "compilerOptions": {
6
- "tsBuildInfoFile": "../../node_modules/.tmp/tsconfig.app.tsbuildinfo",
6
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
7
+ <%_ if (config.includeAtAliases) { _%>
7
8
  "paths": {
8
9
  "@/*": ["./src/*"]
9
10
  }
11
+ <%_ } _%>
10
12
  }
11
13
  }
@@ -10,7 +10,7 @@
10
10
  ],
11
11
  "compilerOptions": {
12
12
  "noEmit": true,
13
- "tsBuildInfoFile": "../../node_modules/.tmp/tsconfig.node.tsbuildinfo",
13
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
14
14
  "module": "ESNext",
15
15
  "moduleResolution": "Bundler",
16
16
  "types": ["node"]
@@ -3,7 +3,7 @@
3
3
  "include": ["src/**/__tests__/*", "env.d.ts"],
4
4
  "exclude": [],
5
5
  "compilerOptions": {
6
- "tsBuildInfoFile": "../../node_modules/.tmp/tsconfig.vitest.tsbuildinfo",
6
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.vitest.tsbuildinfo",
7
7
  "lib": [],
8
8
  "types": ["node", "jsdom"]
9
9
  }
@@ -1,20 +1,24 @@
1
1
  import { resolve } from 'node:path'
2
+ <%_ if (config.includeAtAliases) { _%>
2
3
  import { fileURLToPath, URL } from 'node:url'
4
+ <%_ } _%>
3
5
 
4
- import { defineConfig } from 'vite'
6
+ import { defineConfig, type UserConfig } from 'vite'
5
7
  import replace from '@rollup/plugin-replace'
6
8
  import vue from '@vitejs/plugin-vue'
7
9
  import dts from 'vite-plugin-dts'
8
10
 
9
- export default defineConfig(({ mode }) => {
11
+ export default defineConfig(({ mode }): UserConfig => {
10
12
  if (mode !== 'production' && mode !== 'development' && mode !== 'neutral' && mode !== 'test') {
11
13
  throw new Error(`Unknown mode: ${mode}`)
12
14
  }
13
15
 
14
- const dtsPlugin = mode === 'neutral' ? dts({
15
- rollupTypes: true,
16
- tsconfigPath: './tsconfig.app.json'
17
- }) : null
16
+ const dtsPlugin = mode === 'neutral'
17
+ ? dts({
18
+ rollupTypes: true,
19
+ tsconfigPath: './tsconfig.app.json'
20
+ })
21
+ : null
18
22
 
19
23
  return {
20
24
  plugins: [
@@ -27,35 +31,46 @@ export default defineConfig(({ mode }) => {
27
31
  vue(),
28
32
  dtsPlugin
29
33
  ],
34
+ <%_ if (config.includeAtAliases) { _%>
30
35
  resolve: {
31
36
  alias: {
32
37
  '@': fileURLToPath(new URL('./src', import.meta.url))
33
38
  }
34
39
  },
40
+ <%_ } _%>
41
+ <%_ if (config.includeTestVariable) { _%>
42
+ define: {
43
+ __TEST__: mode === 'test'
44
+ },
45
+ <%_ } _%>
35
46
  build: {
36
47
  target: 'es2019',
37
48
  emptyOutDir: false,
38
49
  minify: mode === 'production',
39
50
  lib: {
40
51
  entry: resolve(__dirname, 'src/index.ts'),
41
- name: '@globalVariableName@',
52
+ name: '<%- config.globalVariableName %>',
42
53
  formats: mode === 'neutral' ? ['cjs', 'es'] : ['es', 'iife'],
54
+ cssFileName: mode === 'production' ? '<%- config.unscopedPackageName %>.prod' : '<%- config.unscopedPackageName %>',
43
55
 
44
56
  fileName(format) {
45
- let name = '@unscopedPackageName@'
57
+ let name = '<%- config.unscopedPackageName %>'
46
58
  let extension = 'js'
47
59
 
48
60
  if (format === 'iife') {
49
61
  name += '.global'
50
- } else if (format === 'es') {
62
+ }
63
+ else if (format === 'es') {
51
64
  name += '.esm-' + (mode === 'neutral' ? 'bundler' : 'browser')
52
65
  }
53
66
 
54
67
  if (mode === 'production') {
55
68
  name += '.prod'
56
- } else if (mode === 'development') {
69
+ }
70
+ else if (mode === 'development') {
57
71
  name += '.dev'
58
- } else if (mode === 'neutral') {
72
+ }
73
+ else if (mode === 'neutral') {
59
74
  extension = format === 'cjs' ? 'cjs' : 'mjs'
60
75
  }
61
76
 
@@ -2,7 +2,10 @@
2
2
  import { ref } from 'vue'
3
3
 
4
4
  if (__DEV__) {
5
- console.log('dev: creating Example component')
5
+ console.log('dev: creating ExampleComponent')
6
+ <%_ if (config.includeTestVariable) { _%>
7
+ console.log(`__TEST__: ${__TEST__}`)
8
+ <%_ } _%>
6
9
  }
7
10
 
8
11
  const msg = ref('Hello world!')
@@ -1,3 +1,3 @@
1
- export { default as Example } from './components/Example.vue'
1
+ export { default as ExampleComponent } from './components/ExampleComponent.vue'
2
2
  export { default as MyPanel } from './components/MyPanel.vue'
3
3
  export { default as MyPanelSection } from './components/MyPanelSection.vue'
@@ -0,0 +1,33 @@
1
+ import path from 'node:path'
2
+ import { fileURLToPath } from 'node:url'
3
+
4
+ import { includeIgnoreFile } from '@eslint/compat'
5
+ import pluginVue from 'eslint-plugin-vue'
6
+ <%_ if (config.includeEsLintStylistic) { _%>
7
+ import stylistic from '@stylistic/eslint-plugin'
8
+ <%_ } _%>
9
+ import { defineConfigWithVueTs, vueTsConfigs } from '@vue/eslint-config-typescript'
10
+ import pluginVitest from '@vitest/eslint-plugin'
11
+
12
+ export default defineConfigWithVueTs(
13
+ {
14
+ name: 'app/files-to-lint',
15
+ files: ['**/*.{ts,mts,vue}']
16
+ },
17
+
18
+ includeIgnoreFile(path.resolve(path.dirname(fileURLToPath(import.meta.url)), '.gitignore')),
19
+
20
+ pluginVue.configs['flat/essential'],
21
+ vueTsConfigs.recommended,
22
+
23
+ <%_ if (config.includeEsLintStylistic) { _%>
24
+ stylistic.configs.customize({
25
+ commaDangle: 'never'
26
+ }),
27
+ <%_ } _%>
28
+
29
+ {
30
+ ...pluginVitest.configs.recommended,
31
+ files: ['src/**/__tests__/*']
32
+ }
33
+ )
@@ -0,0 +1,10 @@
1
+ {
2
+ "extends": "@tsconfig/node22/tsconfig.json",
3
+ "include": ["eslint.config.*"],
4
+ "compilerOptions": {
5
+ "noEmit": true,
6
+ "module": "ESNext",
7
+ "moduleResolution": "Bundler",
8
+ "types": ["node"]
9
+ }
10
+ }
@@ -32,8 +32,6 @@ jobs:
32
32
  uses: actions/checkout@v4
33
33
  - name: Install pnpm
34
34
  uses: pnpm/action-setup@v4
35
- with:
36
- version: 9
37
35
  - name: Set up Node
38
36
  uses: actions/setup-node@v4
39
37
  with:
@@ -1,2 +1,3 @@
1
1
  /// <reference types="vite/client" />
2
- /// <reference path="../@projectName@/src/global.d.ts" />
2
+
3
+ import '../@projectName@/src/global.d.ts'
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "private": true,
3
3
  "scripts": {
4
+ "clean": "rimraf dist",
4
5
  "dev": "vite --port 5051",
5
- "type-check": "vue-tsc --noEmit -p tsconfig.app.json --composite false",
6
- "build-only": "vite build",
7
- "build": "pnpm run type-check && pnpm run build-only",
6
+ "type-check": "vue-tsc --build",
7
+ "build:only": "vite build",
8
+ "build": "run-p -c type-check \"build:only {@}\" --",
8
9
  "preview": "vite preview --port 4051",
9
- "clean": "rimraf dist"
10
+ "preinstall": "node ../../scripts/preinstall.js"
10
11
  },
11
12
  "dependencies": {
12
13
  "vue": "^3.5.13"
@@ -16,6 +17,7 @@
16
17
  "@types/node": "^22.10.7",
17
18
  "@vitejs/plugin-vue": "^5.2.1",
18
19
  "@vue/tsconfig": "^0.7.0",
20
+ "npm-run-all2": "^7.0.2",
19
21
  "rimraf": "^5.0.1",
20
22
  "typescript": "~5.7.3",
21
23
  "vite": "^6.0.11",
@@ -0,0 +1,13 @@
1
+ {
2
+ "extends": "@vue/tsconfig/tsconfig.dom.json",
3
+ "include": ["env.d.ts", "src/**/*", "src/**/*.vue"],
4
+ "compilerOptions": {
5
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
6
+ "paths": {
7
+ <%_ if (config.includeAtAliases) { _%>
8
+ "@/*": ["./src/*"],
9
+ <%_ } _%>
10
+ "<%- config.scopedPackageName %>": ["../<%- config.mainPackageDirName %>/src/index.ts"]
11
+ }
12
+ }
13
+ }
@@ -10,7 +10,7 @@
10
10
  ],
11
11
  "compilerOptions": {
12
12
  "noEmit": true,
13
- "tsBuildInfoFile": "../../node_modules/.tmp/tsconfig.playground.node.tsbuildinfo",
13
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
14
14
  "module": "ESNext",
15
15
  "moduleResolution": "Bundler",
16
16
  "types": ["node"]
@@ -0,0 +1,45 @@
1
+ import { fileURLToPath, URL } from 'node:url'
2
+
3
+ import { defineConfig, type UserConfig } from 'vite'
4
+ import vue from '@vitejs/plugin-vue'
5
+ import vueDevTools from 'vite-plugin-vue-devtools'
6
+
7
+ <%_ if (config.includeAtAliases) { _%>
8
+ const librarySrc = fileURLToPath(new URL('../<%- config.mainPackageDirName %>/src/', import.meta.url))
9
+ const playgroundSrc = fileURLToPath(new URL('./src/', import.meta.url))
10
+
11
+ <%_ } _%>
12
+ export default defineConfig(({ mode }): UserConfig => ({
13
+ plugins: [
14
+ vue(),
15
+ vueDevTools()
16
+ ],
17
+ resolve: {
18
+ <%_ if (config.includeAtAliases) { _%>
19
+ alias: [
20
+ {
21
+ find: '@',
22
+ replacement: '@',
23
+ customResolver(source, importer) {
24
+ return source.replace(
25
+ /^@\//,
26
+ importer?.startsWith(librarySrc) ? librarySrc : playgroundSrc
27
+ )
28
+ }
29
+ }, {
30
+ find: '<%- config.scopedPackageName %>',
31
+ replacement: librarySrc
32
+ }
33
+ ]
34
+ <%_ } else { _%>
35
+ alias: {
36
+ '<%- config.scopedPackageName %>': fileURLToPath(new URL('../<%- config.mainPackageDirName %>/src/', import.meta.url))
37
+ }
38
+ <%_ } _%>
39
+ },
40
+ define: {
41
+ __DEV__: mode !== 'production'<%_ if (config.includeTestVariable) { _%>,
42
+ __TEST__: false
43
+ <%_ } %>
44
+ }
45
+ }))
@@ -1,5 +1,5 @@
1
1
  <script setup lang="ts">
2
- import { Example as ExampleComponent, MyPanel } from '@scopedPackageName@'
2
+ import { ExampleComponent, MyPanel } from '@scopedPackageName@'
3
3
  </script>
4
4
 
5
5
  <template>
@@ -1,7 +1,12 @@
1
- import { resolve } from 'node:path'
1
+ import { fileURLToPath, URL } from 'node:url'
2
2
 
3
3
  import { defineConfigWithTheme } from 'vitepress'
4
4
 
5
+ <%_ if (config.includeAtAliases) { _%>
6
+ const librarySrc = fileURLToPath(new URL('../../<%- config.mainPackageDirName %>/src/', import.meta.url))
7
+ const playgroundSrc = fileURLToPath(new URL('../src/', import.meta.url))
8
+
9
+ <%_ } _%>
5
10
  export default ({ mode }: { mode: string }) => defineConfigWithTheme({
6
11
  srcDir: './src',
7
12
  outDir: './dist',
@@ -30,13 +35,33 @@ export default ({ mode }: { mode: string }) => defineConfigWithTheme({
30
35
  <%_ } _%>
31
36
  vite: {
32
37
  resolve: {
38
+ <%_ if (config.includeAtAliases) { _%>
39
+ alias: [
40
+ {
41
+ find: '@',
42
+ replacement: '@',
43
+ customResolver(source, importer) {
44
+ return source.replace(
45
+ /^@\//,
46
+ importer?.startsWith(librarySrc) ? librarySrc : playgroundSrc
47
+ )
48
+ }
49
+ }, {
50
+ find: '<%- config.scopedPackageName %>',
51
+ replacement: librarySrc
52
+ }
53
+ ]
54
+ <%_ } else { _%>
33
55
  alias: {
34
- '<%- config.scopedPackageName %>': resolve(__dirname, '../../<%- config.mainPackageDirName %>/src/index.ts')
56
+ '<%- config.scopedPackageName %>': fileURLToPath(new URL('../../<%- config.mainPackageDirName %>/src/', import.meta.url))
35
57
  }
58
+ <%_ } _%>
36
59
  },
37
60
 
38
61
  define: {
39
- __DEV__: JSON.stringify(mode !== 'production')
62
+ __DEV__: mode !== 'production'<%_ if (config.includeTestVariable) { _%>,
63
+ __TEST__: false
64
+ <%_ } %>
40
65
  }
41
66
  },
42
67
 
@@ -1,2 +1,3 @@
1
1
  /// <reference types="vite/client" />
2
- /// <reference path="../@projectName@/src/global.d.ts" />
2
+
3
+ import '../@projectName@/src/global.d.ts'
@@ -1,11 +1,13 @@
1
1
  {
2
2
  "private": true,
3
3
  "scripts": {
4
- "clean": "rimraf dist && rimraf .vitepress/cache",
4
+ "clean": "rimraf dist .vitepress/cache",
5
5
  "dev": "vitepress dev .",
6
- "type-check": "vue-tsc --noEmit -p tsconfig.app.json --composite false",
7
- "build-only": "vitepress build .",
8
- "build": "pnpm run type-check && pnpm run build-only",
6
+ "type-check:code": "vue-tsc --noEmit -p tsconfig.app.json --composite false",
7
+ "type-check:config": "vue-tsc --noEmit -p tsconfig.node.json --composite false",
8
+ "type-check": "run-p -c type-check:*",
9
+ "build:only": "vitepress build .",
10
+ "build": "run-p -c type-check \"build:only {@}\" --",
9
11
  "preview": "vitepress preview .",
10
12
  "preinstall": "node ../../scripts/preinstall.js"
11
13
  },
@@ -16,6 +18,7 @@
16
18
  "@tsconfig/node22": "^22.0.0",
17
19
  "@types/node": "^22.13.0",
18
20
  "@vue/tsconfig": "^0.7.0",
21
+ "npm-run-all2": "^7.0.2",
19
22
  "rimraf": "^6.0.1",
20
23
  "typescript": "~5.7.3",
21
24
  "vitepress": "^1.6.3",
@@ -0,0 +1,22 @@
1
+ {
2
+ "extends": "@vue/tsconfig/tsconfig.dom.json",
3
+ "include": [
4
+ "env.d.ts",
5
+ "src/**/*",
6
+ "src/**/*.vue",
7
+ ".vitepress/theme/**/*",
8
+ ".vitepress/theme/**/*.vue",
9
+ "src/**/*.md"
10
+ ],
11
+ "compilerOptions": {
12
+ "paths": {
13
+ <%_ if (config.includeAtAliases) { _%>
14
+ "@/*": ["./src/*"],
15
+ <%_ } _%>
16
+ "<%- config.scopedPackageName %>": ["../<%- config.mainPackageDirName %>/src/index.ts"]
17
+ }
18
+ },
19
+ "vueCompilerOptions": {
20
+ "vitePressExtensions": [".md"],
21
+ }
22
+ }
@@ -1,16 +1,8 @@
1
1
  {
2
2
  "extends": "@tsconfig/node22/tsconfig.json",
3
- "include": [
4
- "vite.config.*",
5
- "vitest.config.*",
6
- "cypress.config.*",
7
- "nightwatch.conf.*",
8
- "playwright.config.*",
9
- "eslint.config.*"
10
- ],
3
+ "include": [".vitepress/config.*"],
11
4
  "compilerOptions": {
12
5
  "noEmit": true,
13
- "tsBuildInfoFile": "../../node_modules/.tmp/tsconfig.docs.node.tsbuildinfo",
14
6
  "module": "ESNext",
15
7
  "moduleResolution": "Bundler",
16
8
  "types": ["node"]
@@ -14,7 +14,7 @@ hero:
14
14
  link: /introduction
15
15
  - theme: alt
16
16
  text: View on GitHub
17
- link: https://github.com/???/???
17
+ link: https://github.com/@githubPath@
18
18
  - theme: alt
19
19
  text: See a demo
20
20
  link: https://play.vuejs.org/
@@ -1,5 +1,5 @@
1
1
  <script setup lang="ts">
2
- import { Example as ExampleComponent, MyPanel } from '@scopedPackageName@'
2
+ import { ExampleComponent, MyPanel } from '@scopedPackageName@'
3
3
  </script>
4
4
 
5
5
  <style scoped>