Skip to content

Commit 0352b37

Browse files
Sync build with @skirtle/create-vue-lib (#10)
1 parent 4934959 commit 0352b37

33 files changed

+3426
-806
lines changed

Diff for: .editorconfig

+5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
1+
root = true
2+
13
[*]
24
charset = utf-8
35
indent_style = space
46
indent_size = 2
57
end_of_line = lf
68
insert_final_newline = true
79
trim_trailing_whitespace = true
10+
11+
[*.md]
12+
indent_size = 4

Diff for: .github/workflows/ci.yml

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: ['main']
6+
pull_request:
7+
branches: ['main']
8+
9+
jobs:
10+
ci:
11+
if: github.repository == 'skirtles-code/vue-vnode-utils'
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
- name: Install pnpm
17+
uses: pnpm/action-setup@v4
18+
- name: Set up Node
19+
uses: actions/setup-node@v4
20+
with:
21+
node-version: 20
22+
cache: 'pnpm'
23+
- name: Install dependencies
24+
run: pnpm install
25+
- name: Lint
26+
run: pnpm run lint
27+
- name: Type check
28+
run: pnpm run type-check
29+
- name: Build
30+
run: pnpm run build
31+
- name: Test
32+
run: pnpm run test:unit

Diff for: .github/workflows/pages.yml

-2
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ jobs:
3232
uses: actions/checkout@v4
3333
- name: Install pnpm
3434
uses: pnpm/action-setup@v4
35-
with:
36-
version: 9
3735
- name: Set up Node
3836
uses: actions/setup-node@v4
3937
with:

Diff for: .gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ dist-ssr
1414
coverage
1515
*.local
1616
packages/docs/.vitepress/cache
17+
packages/vue-vnode-utils/README.md
18+
19+
/cypress/videos/
20+
/cypress/screenshots/
1721

1822
# Editor directories and files
1923
.vscode/*
@@ -24,3 +28,5 @@ packages/docs/.vitepress/cache
2428
*.njsproj
2529
*.sln
2630
*.sw?
31+
32+
*.tsbuildinfo

Diff for: packages/vue-vnode-utils/LICENSE renamed to LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2022-2024, skirtle
3+
Copyright (c) 2022-2025, skirtle
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

Diff for: README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,4 @@ Some browsers do not yet have full support for import maps.
6565

6666
MIT
6767

68-
Copyright © 2022-2024, skirtle
68+
Copyright © 2022-2025, skirtle

Diff for: eslint.config.mts

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
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+
import stylistic from '@stylistic/eslint-plugin'
7+
import { defineConfigWithVueTs, vueTsConfigs } from '@vue/eslint-config-typescript'
8+
import pluginVitest from '@vitest/eslint-plugin'
9+
10+
export default defineConfigWithVueTs(
11+
{
12+
name: 'app/files-to-lint',
13+
files: ['**/*.{ts,mts,vue}']
14+
},
15+
16+
includeIgnoreFile(path.resolve(path.dirname(fileURLToPath(import.meta.url)), '.gitignore')),
17+
18+
pluginVue.configs['flat/essential'],
19+
vueTsConfigs.recommended,
20+
21+
stylistic.configs.customize({
22+
braceStyle: '1tbs',
23+
commaDangle: 'never',
24+
quoteProps: 'as-needed'
25+
}),
26+
27+
{
28+
rules: {
29+
'@stylistic/arrow-parens': 'off',
30+
'@stylistic/spaced-comment': ['error', 'always', { exceptions: ['#__PURE__'] }],
31+
'@typescript-eslint/no-explicit-any': 'off',
32+
'@typescript-eslint/no-unused-expressions': ['error', { allowShortCircuit: true }],
33+
'vue/block-lang': 'off',
34+
'vue/require-v-for-key': 'off',
35+
'vue/valid-v-for': 'off'
36+
}
37+
},
38+
39+
{
40+
...pluginVitest.configs.recommended,
41+
files: ['src/**/__tests__/*']
42+
}
43+
)

Diff for: package.json

+30-6
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,45 @@
11
{
22
"private": true,
33
"type": "module",
4+
"packageManager": "[email protected]",
5+
"engines": {
6+
"node": ">=v18.3.0"
7+
},
8+
"devDependencies": {
9+
"@eslint/compat": "^1.2.7",
10+
"@stylistic/eslint-plugin": "^4.2.0",
11+
"@tsconfig/node22": "^22.0.0",
12+
"@types/node": "^22.13.9",
13+
"@vitest/eslint-plugin": "^1.1.36",
14+
"@vue/eslint-config-typescript": "^14.5.0",
15+
"eslint": "^9.21.0",
16+
"eslint-plugin-vue": "~10.0.0",
17+
"jiti": "^2.4.2",
18+
"lint-staged": "^15.4.3",
19+
"npm-run-all2": "^7.0.2",
20+
"simple-git-hooks": "^2.11.1",
21+
"typescript": "~5.8.0"
22+
},
423
"scripts": {
524
"clean": "pnpm run -r clean",
6-
"build": "pnpm run -r build",
7-
"type-check": "pnpm run -r type-check",
825
"docs:dev": "pnpm run --filter ./packages/docs -r dev",
926
"docs:build": "pnpm run --filter ./packages/docs -r build",
1027
"test:unit": "pnpm run --filter ./packages/vue-vnode-utils -r test:unit",
1128
"coverage": "pnpm run --filter ./packages/vue-vnode-utils -r coverage",
12-
"preinstall": "npx only-allow pnpm",
29+
"type-check": "run-p type-check:*",
30+
"type-check:packages": "pnpm run -r type-check",
31+
"type-check:self": "tsc",
32+
"lint": "eslint",
33+
"lint:fix": "eslint --fix",
34+
"lint:staged": "lint-staged",
35+
"build": "pnpm run -r build",
36+
"preinstall": "node scripts/preinstall.js",
1337
"postinstall": "simple-git-hooks"
1438
},
1539
"simple-git-hooks": {
16-
"pre-commit": "pnpm run type-check"
40+
"pre-commit": "pnpm exec run-s type-check lint:staged"
1741
},
18-
"devDependencies": {
19-
"simple-git-hooks": "^2.11.1"
42+
"lint-staged": {
43+
"*.{vue,js,jsx,cjs,mjs,ts,tsx,cts,mts}": "eslint --fix"
2044
}
2145
}

Diff for: packages/docs/.vitepress/config.mts

+19-4
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,38 @@
1+
import { fileURLToPath, URL } from 'node:url'
2+
13
import { defineConfigWithTheme } from 'vitepress'
2-
import { resolve } from 'node:path'
34

45
export default ({ mode }: { mode: string }) => defineConfigWithTheme({
56
srcDir: './src',
67
outDir: './dist',
7-
base: '/vue-vnode-utils',
8+
base: '/vue-vnode-utils/',
89
title: '@skirtle/vue-vnode-utils',
910
lang: 'en-US',
1011
description: 'VNode utilities for Vue',
1112

13+
sitemap: {
14+
hostname: 'https://skirtles-code.github.io/vue-vnode-utils/'
15+
},
16+
17+
transformHead({ page }) {
18+
if (page !== '404.md') {
19+
const canonicalUrl = `https://skirtles-code.github.io/vue-vnode-utils/${page}`
20+
.replace(/index\.md$/, '')
21+
.replace(/\.md$/, '.html')
22+
23+
return [['link', { rel: 'canonical', href: canonicalUrl }]]
24+
}
25+
},
26+
1227
vite: {
1328
resolve: {
1429
alias: {
15-
'@skirtle/vue-vnode-utils': resolve(__dirname, '../../vue-vnode-utils/src/index.ts')
30+
'@skirtle/vue-vnode-utils': fileURLToPath(new URL('../../vue-vnode-utils/src/', import.meta.url))
1631
}
1732
},
1833

1934
define: {
20-
__DEV__: JSON.stringify(mode !== 'production')
35+
__DEV__: mode !== 'production'
2136
}
2237
},
2338

Diff for: packages/docs/.vitepress/theme/components/live-example.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
</fieldset>
66
</template>
77

8-
<script>
8+
<script lang="ts">
99
export default {
1010
name: 'live-example'
1111
}

Diff for: packages/docs/env.d.ts

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/// <reference types="vite/client" />
2+
3+
import '../vue-vnode-utils/env.d.ts'

Diff for: packages/docs/package.json

+19-10
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,27 @@
11
{
22
"private": true,
3-
"scripts": {
4-
"clean": "rimraf dist && rimraf .vitepress/cache",
5-
"dev": "vitepress dev .",
6-
"build": "vitepress build .",
7-
"preview": "vitepress preview .",
8-
"preinstall": "npx only-allow pnpm"
9-
},
3+
"type": "module",
104
"dependencies": {
11-
"vue": "^3.5.11"
5+
"vue": "^3.5.13"
126
},
137
"devDependencies": {
14-
"@types/node": "^22.7.4",
8+
"@tsconfig/node22": "^22.0.0",
9+
"@types/node": "^22.13.9",
10+
"@vue/tsconfig": "^0.7.0",
11+
"npm-run-all2": "^7.0.2",
1512
"rimraf": "^6.0.1",
16-
"vitepress": "^1.3.4"
13+
"typescript": "~5.8.0",
14+
"vitepress": "^1.6.3",
15+
"vue-tsc": "^2.2.8"
16+
},
17+
"scripts": {
18+
"clean": "rimraf dist .vitepress/cache",
19+
"dev": "vitepress dev .",
20+
"type-check:code": "vue-tsc --noEmit -p tsconfig.app.json --composite false",
21+
"type-check:config": "vue-tsc --noEmit -p tsconfig.node.json --composite false",
22+
"type-check": "run-p -c type-check:*",
23+
"build:only": "vitepress build .",
24+
"build": "run-p -c type-check \"build:only {@}\" --",
25+
"preview": "vitepress preview ."
1726
}
1827
}

Diff for: packages/docs/src/examples/add-ref.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export default {
1313

1414
return [
1515
clone,
16-
h('pre', `outerHTML: ${ rootRef.value?.outerHTML }`)
16+
h('pre', `outerHTML: ${rootRef.value?.outerHTML}`)
1717
]
1818
}
1919
}

Diff for: packages/docs/src/examples/basic-accordion.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export default {
2626
}
2727
})
2828
29-
return h('div', { class : 'accordion' }, children)
29+
return h('div', { class: 'accordion' }, children)
3030
}
3131
}
3232
}

Diff for: packages/docs/src/examples/radio-button.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ const props = defineProps({
1616
const emit = defineEmits(['update:modelValue'])
1717
1818
const radioModel = computed({
19-
get () {
19+
get() {
2020
return props.modelValue
2121
},
22-
set (newChecked) {
22+
set(newChecked) {
2323
emit('update:modelValue', newChecked)
2424
}
2525
})

Diff for: packages/docs/src/examples/wrapping-list.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { h } from 'vue'
33
import { replaceChildren } from '@skirtle/vue-vnode-utils'
44
55
export default {
6-
render () {
6+
render() {
77
const newChildren = replaceChildren(this.$slots.default(), (vnode) => {
88
return h('div', { class: 'wrapper' }, [vnode])
99
})

Diff for: packages/docs/tsconfig.app.json

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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+
"@skirtle/vue-vnode-utils": ["../vue-vnode-utils/src/index.ts"]
14+
}
15+
},
16+
"vueCompilerOptions": {
17+
"vitePressExtensions": [".md"]
18+
}
19+
}

Diff for: packages/docs/tsconfig.json

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"files": [],
3+
"references": [
4+
{
5+
"path": "./tsconfig.node.json"
6+
},
7+
{
8+
"path": "./tsconfig.app.json"
9+
}
10+
]
11+
}

Diff for: packages/docs/tsconfig.node.json

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"extends": "@tsconfig/node22/tsconfig.json",
3+
"include": [".vitepress/config.*"],
4+
"compilerOptions": {
5+
"noEmit": true,
6+
"module": "ESNext",
7+
"moduleResolution": "Bundler",
8+
"types": ["node"]
9+
}
10+
}

0 commit comments

Comments
 (0)