Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
hywax authored Mar 11, 2024
0 parents commit f1dabf6
Show file tree
Hide file tree
Showing 18 changed files with 4,948 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .commitlintrc.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default {
extends: ['@commitlint/config-conventional'],
}
15 changes: 15 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
root = true

[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
charset = utf-8

[*.ts]
indent_style = space
indent_size = 2

[{package.json,*.yml,*.cjson}]
indent_style = space
indent_size = 2
4 changes: 4 additions & 0 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": ["github>hywax/renovate-config"]
}
23 changes: 23 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Main

on: [push, pull_request]

jobs:
main:
name: ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- run: git config --global core.autocrlf false
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- uses: pnpm/action-setup@v2
with:
version: 8
run_install: true
- run: pnpm build
- run: pnpm test
24 changes: 24 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
coverage
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx --no -- commitlint --edit ${1}
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx lint-staged
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) Hywax

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
44 changes: 44 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Vite Vanilla Library Template

Template for creating a library with a fully customized environment.

## Features

* ✨ Fully customized [eslint](https://eslint.org/) configuration based on the config by [Antfu](https://github.com/antfu/eslint-config)
* 🧪 Write tests quickly and conveniently with [vitest](https://vitest.dev/)
* 🤝 Supports [conventional commits](https://www.conventionalcommits.org/)
* 💅 Generate beautiful changelogs with [changelogen](https://github.com/unjs/changelogen)
* ♾️ GitHub CI for your build
* 🤖 Ready configuration for [renovatebot](https://github.com/apps/renovate) with [renovate-config](https://github.com/hywax/renovate-config)
* 🚀 Library releases with just one command

## Get started

### GitHub Template

This is a template repo. Click the green [Use this template](https://github.com/hywax/vite-vanilla-library-template/generate) button to get started.

### Git Clone

```shell
git clone https://github.com/hywax/vite-vanilla-library-template.git
cd vite-vanilla-library-template
pnpm install
```

## Usage

The template contains the following scripts:

* `dev` - Start the development server
* `build` - Build for production
* `release` - Generate changelog and npm publish
* `lint` - Checks your code for any linting errors
* `test` - Run all tests
* `test:watch` - Run all tests with watch mode
* `test:coverage` - Run all tests with code coverage report
* `prepare` - Script for setting up husky hooks

## License

This template was created under the [MIT License](LICENSE).
15 changes: 15 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import antfu from '@antfu/eslint-config'

export default antfu({
typescript: true,
ignores: [
'dist',
'node_modules',
],
rules: {
'style/brace-style': ['error', '1tbs'],
'style/arrow-parens': ['error', 'always'],
'curly': ['error', 'all'],
'antfu/consistent-list-newline': 'off',
},
})
12 changes: 12 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite App</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/index.ts"></script>
</body>
</html>
45 changes: 45 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"name": "vite-vanilla-library",
"type": "module",
"version": "0.0.0",
"private": true,
"exports": {
".": {
"import": "./dist/vite-vanilla-library.js",
"require": "./dist/vite-vanilla-library.cjs"
}
},
"main": "./dist/vite-vanilla-library.cjs",
"module": "./dist/vite-vanilla-library.js",
"types": "./dist/vite-vanilla-library.d.ts",
"files": ["dist"],
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"release": "pnpm test && pnpm build && changelogen --release && pnpm publish && git push --follow-tags",
"lint": "eslint . --fix",
"test": "vitest --run",
"test:watch": "vitest",
"test:coverage": "vitest --coverage",
"prepare": "husky install"
},
"devDependencies": {
"@antfu/eslint-config": "^2.8.0",
"@commitlint/cli": "^19.0.3",
"@commitlint/config-conventional": "^19.0.3",
"@types/node": "^20.11.25",
"@vitest/coverage-v8": "^1.3.1",
"camelcase": "^8.0.0",
"changelogen": "^0.5.5",
"eslint": "^8.57.0",
"husky": "^9.0.11",
"lint-staged": "^15.2.2",
"typescript": "^5.4.2",
"vite": "^5.1.6",
"vite-plugin-dts": "^3.7.3",
"vitest": "^1.3.1"
},
"lint-staged": {
"*.ts": "pnpm run lint"
}
}
Loading

0 comments on commit f1dabf6

Please sign in to comment.