Skip to content

Sync build with @skirtle/create-vue-lib #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
indent_size = 4
32 changes: 32 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: CI

on:
push:
branches: ['main']
pull_request:
branches: ['main']

jobs:
ci:
if: github.repository == 'skirtles-code/vue-vnode-utils'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
- name: Lint
run: pnpm run lint
- name: Type check
run: pnpm run type-check
- name: Build
run: pnpm run build
- name: Test
run: pnpm run test:unit
2 changes: 0 additions & 2 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ jobs:
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- name: Set up Node
uses: actions/setup-node@v4
with:
Expand Down
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ dist-ssr
coverage
*.local
packages/docs/.vitepress/cache
packages/vue-vnode-utils/README.md

/cypress/videos/
/cypress/screenshots/

# Editor directories and files
.vscode/*
Expand All @@ -24,3 +28,5 @@ packages/docs/.vitepress/cache
*.njsproj
*.sln
*.sw?

*.tsbuildinfo
2 changes: 1 addition & 1 deletion packages/vue-vnode-utils/LICENSE → LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2022-2024, skirtle
Copyright (c) 2022-2025, skirtle

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,4 @@ Some browsers do not yet have full support for import maps.

MIT

Copyright © 2022-2024, skirtle
Copyright © 2022-2025, skirtle
43 changes: 43 additions & 0 deletions eslint.config.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import path from 'node:path'
import { fileURLToPath } from 'node:url'

import { includeIgnoreFile } from '@eslint/compat'
import pluginVue from 'eslint-plugin-vue'
import stylistic from '@stylistic/eslint-plugin'
import { defineConfigWithVueTs, vueTsConfigs } from '@vue/eslint-config-typescript'
import pluginVitest from '@vitest/eslint-plugin'

export default defineConfigWithVueTs(
{
name: 'app/files-to-lint',
files: ['**/*.{ts,mts,vue}']
},

includeIgnoreFile(path.resolve(path.dirname(fileURLToPath(import.meta.url)), '.gitignore')),

pluginVue.configs['flat/essential'],
vueTsConfigs.recommended,

stylistic.configs.customize({
braceStyle: '1tbs',
commaDangle: 'never',
quoteProps: 'as-needed'
}),

{
rules: {
'@stylistic/arrow-parens': 'off',
'@stylistic/spaced-comment': ['error', 'always', { exceptions: ['#__PURE__'] }],
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unused-expressions': ['error', { allowShortCircuit: true }],
'vue/block-lang': 'off',
'vue/require-v-for-key': 'off',
'vue/valid-v-for': 'off'
}
},

{
...pluginVitest.configs.recommended,
files: ['src/**/__tests__/*']
}
)
36 changes: 30 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,45 @@
{
"private": true,
"type": "module",
"packageManager": "[email protected]",
"engines": {
"node": ">=v18.3.0"
},
"devDependencies": {
"@eslint/compat": "^1.2.7",
"@stylistic/eslint-plugin": "^4.2.0",
"@tsconfig/node22": "^22.0.0",
"@types/node": "^22.13.9",
"@vitest/eslint-plugin": "^1.1.36",
"@vue/eslint-config-typescript": "^14.5.0",
"eslint": "^9.21.0",
"eslint-plugin-vue": "~10.0.0",
"jiti": "^2.4.2",
"lint-staged": "^15.4.3",
"npm-run-all2": "^7.0.2",
"simple-git-hooks": "^2.11.1",
"typescript": "~5.8.0"
},
"scripts": {
"clean": "pnpm run -r clean",
"build": "pnpm run -r build",
"type-check": "pnpm run -r type-check",
"docs:dev": "pnpm run --filter ./packages/docs -r dev",
"docs:build": "pnpm run --filter ./packages/docs -r build",
"test:unit": "pnpm run --filter ./packages/vue-vnode-utils -r test:unit",
"coverage": "pnpm run --filter ./packages/vue-vnode-utils -r coverage",
"preinstall": "npx only-allow pnpm",
"type-check": "run-p type-check:*",
"type-check:packages": "pnpm run -r type-check",
"type-check:self": "tsc",
"lint": "eslint",
"lint:fix": "eslint --fix",
"lint:staged": "lint-staged",
"build": "pnpm run -r build",
"preinstall": "node scripts/preinstall.js",
"postinstall": "simple-git-hooks"
},
"simple-git-hooks": {
"pre-commit": "pnpm run type-check"
"pre-commit": "pnpm exec run-s type-check lint:staged"
},
"devDependencies": {
"simple-git-hooks": "^2.11.1"
"lint-staged": {
"*.{vue,js,jsx,cjs,mjs,ts,tsx,cts,mts}": "eslint --fix"
}
}
23 changes: 19 additions & 4 deletions packages/docs/.vitepress/config.mts
Original file line number Diff line number Diff line change
@@ -1,23 +1,38 @@
import { fileURLToPath, URL } from 'node:url'

import { defineConfigWithTheme } from 'vitepress'
import { resolve } from 'node:path'

export default ({ mode }: { mode: string }) => defineConfigWithTheme({
srcDir: './src',
outDir: './dist',
base: '/vue-vnode-utils',
base: '/vue-vnode-utils/',
title: '@skirtle/vue-vnode-utils',
lang: 'en-US',
description: 'VNode utilities for Vue',

sitemap: {
hostname: 'https://skirtles-code.github.io/vue-vnode-utils/'
},

transformHead({ page }) {
if (page !== '404.md') {
const canonicalUrl = `https://skirtles-code.github.io/vue-vnode-utils/${page}`
.replace(/index\.md$/, '')
.replace(/\.md$/, '.html')

return [['link', { rel: 'canonical', href: canonicalUrl }]]
}
},

vite: {
resolve: {
alias: {
'@skirtle/vue-vnode-utils': resolve(__dirname, '../../vue-vnode-utils/src/index.ts')
'@skirtle/vue-vnode-utils': fileURLToPath(new URL('../../vue-vnode-utils/src/', import.meta.url))
}
},

define: {
__DEV__: JSON.stringify(mode !== 'production')
__DEV__: mode !== 'production'
}
},

Expand Down
2 changes: 1 addition & 1 deletion packages/docs/.vitepress/theme/components/live-example.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</fieldset>
</template>

<script>
<script lang="ts">
export default {
name: 'live-example'
}
Expand Down
3 changes: 3 additions & 0 deletions packages/docs/env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/// <reference types="vite/client" />

import '../vue-vnode-utils/env.d.ts'
29 changes: 19 additions & 10 deletions packages/docs/package.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,27 @@
{
"private": true,
"scripts": {
"clean": "rimraf dist && rimraf .vitepress/cache",
"dev": "vitepress dev .",
"build": "vitepress build .",
"preview": "vitepress preview .",
"preinstall": "npx only-allow pnpm"
},
"type": "module",
"dependencies": {
"vue": "^3.5.11"
"vue": "^3.5.13"
},
"devDependencies": {
"@types/node": "^22.7.4",
"@tsconfig/node22": "^22.0.0",
"@types/node": "^22.13.9",
"@vue/tsconfig": "^0.7.0",
"npm-run-all2": "^7.0.2",
"rimraf": "^6.0.1",
"vitepress": "^1.3.4"
"typescript": "~5.8.0",
"vitepress": "^1.6.3",
"vue-tsc": "^2.2.8"
},
"scripts": {
"clean": "rimraf dist .vitepress/cache",
"dev": "vitepress dev .",
"type-check:code": "vue-tsc --noEmit -p tsconfig.app.json --composite false",
"type-check:config": "vue-tsc --noEmit -p tsconfig.node.json --composite false",
"type-check": "run-p -c type-check:*",
"build:only": "vitepress build .",
"build": "run-p -c type-check \"build:only {@}\" --",
"preview": "vitepress preview ."
}
}
2 changes: 1 addition & 1 deletion packages/docs/src/examples/add-ref.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default {

return [
clone,
h('pre', `outerHTML: ${ rootRef.value?.outerHTML }`)
h('pre', `outerHTML: ${rootRef.value?.outerHTML}`)
]
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/docs/src/examples/basic-accordion.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default {
}
})

return h('div', { class : 'accordion' }, children)
return h('div', { class: 'accordion' }, children)
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions packages/docs/src/examples/radio-button.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ const props = defineProps({
const emit = defineEmits(['update:modelValue'])

const radioModel = computed({
get () {
get() {
return props.modelValue
},
set (newChecked) {
set(newChecked) {
emit('update:modelValue', newChecked)
}
})
Expand Down
2 changes: 1 addition & 1 deletion packages/docs/src/examples/wrapping-list.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { h } from 'vue'
import { replaceChildren } from '@skirtle/vue-vnode-utils'

export default {
render () {
render() {
const newChildren = replaceChildren(this.$slots.default(), (vnode) => {
return h('div', { class: 'wrapper' }, [vnode])
})
Expand Down
19 changes: 19 additions & 0 deletions packages/docs/tsconfig.app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"extends": "@vue/tsconfig/tsconfig.dom.json",
"include": [
"env.d.ts",
"src/**/*",
"src/**/*.vue",
".vitepress/theme/**/*",
".vitepress/theme/**/*.vue",
"src/**/*.md"
],
"compilerOptions": {
"paths": {
"@skirtle/vue-vnode-utils": ["../vue-vnode-utils/src/index.ts"]
}
},
"vueCompilerOptions": {
"vitePressExtensions": [".md"]
}
}
11 changes: 11 additions & 0 deletions packages/docs/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"files": [],
"references": [
{
"path": "./tsconfig.node.json"
},
{
"path": "./tsconfig.app.json"
}
]
}
10 changes: 10 additions & 0 deletions packages/docs/tsconfig.node.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "@tsconfig/node22/tsconfig.json",
"include": [".vitepress/config.*"],
"compilerOptions": {
"noEmit": true,
"module": "ESNext",
"moduleResolution": "Bundler",
"types": ["node"]
}
}
Loading