Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
zyyv authored Nov 7, 2024
0 parents commit 597fd2e
Show file tree
Hide file tree
Showing 23 changed files with 7,242 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/autofix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: autofix.ci

on:
push:
branches:
- main

pull_request:
branches:
- main

jobs:
autofix:
runs-on: ubuntu-latest
timeout-minutes: 10

steps:
- name: Checkout 🛎️
uses: actions/checkout@v4

- name: Install pnpm
uses: pnpm/action-setup@v4

- name: Set node LTS ✨
uses: actions/setup-node@v4
with:
node-version: lts/*

- name: Install Dependencies 📦️
run: pnpm i

- name: Lint
run: pnpm lint:fix

- uses: autofix-ci/action@v1
66 changes: 66 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: CI

on:
push:
branches:
- main

pull_request:
branches:
- main

jobs:
typecheck:
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v4

- name: Install pnpm
uses: pnpm/action-setup@v4

- name: Set node LTS ✨
uses: actions/setup-node@v4
with:
node-version: lts/*
cache: pnpm

- name: Install Dependencies 📦️
run: pnpm i

- name: Build
run: pnpm build

- name: Typecheck
run: pnpm typecheck

test:
runs-on: ${{ matrix.os }}

strategy:
matrix:
node: [lts/*]
os: [ubuntu-latest, windows-latest, macos-latest]
fail-fast: false

steps:
- name: Checkout 🛎️
uses: actions/checkout@v4

- name: Install pnpm
uses: pnpm/action-setup@v4

- name: Set node ${{ matrix.node }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: pnpm

- name: Install Dependencies 📦️
run: pnpm i

- name: Build
run: pnpm build

- name: Test
run: pnpm test
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
dist
*.log
2 changes: 2 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ignore-workspace-root-check=true
shamefully-hoist=true
6 changes: 6 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
},
"editor.formatOnSave": false
}
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) 2023 zyyv

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.
41 changes: 41 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<p align="center">
<img src="logo" alt='logo' style="width:100px;" />
</p>

<h1 align="center">unocss-transformer-starter</h1>

<p align="center">A Unocss transformer starter template.</p>

<p align="center">
<a>
<img src="https://img.shields.io/npm/v/unocss-transformer-starter?style=flat&colorA=080f12&colorB=1fa669" alt="npm version" />
</a>
<a>
<img src="https://img.shields.io/npm/dm/unocss-transformer-starter?style=flat&colorA=080f12&colorB=1fa669" alt="npm downloads" />
</a>
<a>
<img src="https://img.shields.io/github/license/unpreset/unocss-transformer-starter.svg?style=flat&colorA=080f12&colorB=1fa669" alt="License" />
</a>
</p>

## Install
```shell
pnpm i -D unocss-transformer-starter
```

```ts
// uno.config.ts
import { defineConfig } from 'unocss'
import transformerAlias from 'unocss-transformer-starter'

export default defineConfig({
// ...
transformers: [
transformerAlias(),
],
})
```

## License

MIT License &copy; 2023-PRESENT [Chris](https://github.com/zyyv)
16 changes: 16 additions & 0 deletions build.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { defineBuildConfig } from 'unbuild'

export default defineBuildConfig({
entries: [
'src/index',
],
declaration: true,
clean: true,
rollup: {
emitCJS: true,
},
externals: [
'magic-string',
'unocss',
],
})
5 changes: 5 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import antfu from '@antfu/eslint-config'

export default antfu({
ignores: ['README.md', 'dist', 'node_modules'],
})
69 changes: 69 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{
"name": "unocss-transformer-starter",
"type": "module",
"version": "0.0.0",
"packageManager": "[email protected]",
"description": "A Unocss transformer starter template.",
"license": "MIT",
"homepage": "https://github.com/unpreset/unocss-transformer-starter#readme",
"repository": {
"type": "git",
"url": "git+https://github.com/unpreset/unocss-transformer-starter.git"
},
"bugs": {
"url": "https://github.com/unpreset/unocss-transformer-starter/issues"
},
"keywords": [
"unpreset",
"unocss",
"unocss transformer"
],
"sideEffects": false,
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs",
"require": "./dist/index.cjs"
}
},
"main": "./dist/index.cjs",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"typesVersions": {
"*": {
"*": [
"./dist/*",
"./dist/index.d.ts"
]
}
},
"files": [
"dist"
],
"scripts": {
"build": "unbuild",
"dev": "unbuild --stub",
"prepublishOnly": "pnpm run build",
"release": "bumpp --commit --push --tag && pnpm publish",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"test": "vitest",
"test:update": "vitest -u",
"typecheck": "tsc --noEmit",
"play": "npm -C playground run dev"
},
"devDependencies": {
"@antfu/eslint-config": "^3.8.0",
"@babel/types": "^7.26.0",
"@types/node": "^22.9.0",
"bumpp": "^9.8.1",
"eslint": "^9.14.0",
"esno": "^4.8.0",
"magic-string": "^0.30.12",
"typescript": "^5.6.3",
"unbuild": "^2.0.0",
"unocss": "^0.64.0",
"vite": "^5.4.10",
"vitest": "^2.1.4"
}
}
13 changes: 13 additions & 0 deletions playground/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + Vue + TS</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
22 changes: 22 additions & 0 deletions playground/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "playground",
"type": "module",
"version": "0.0.0",
"private": true,
"scripts": {
"dev": "vite",
"build": "vue-tsc && vite build",
"preview": "vite preview"
},
"dependencies": {
"vue": "^3.5.12"
},
"devDependencies": {
"@vitejs/plugin-vue": "^5.1.4",
"typescript": "^5.6.3",
"unocss": "^0.64.0",
"unocss-transformer-starter": "workspace:*",
"vite": "^5.4.10",
"vue-tsc": "^2.1.10"
}
}
6 changes: 6 additions & 0 deletions playground/src/App.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<template>
<div>
<h1>Playground</h1>
<p>hello UnoCSS</p>
</div>
</template>
6 changes: 6 additions & 0 deletions playground/src/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { createApp } from 'vue'
// @ts-expect-error anyway
import App from './App.vue'
import 'uno.css'

createApp(App).mount('#app')
16 changes: 16 additions & 0 deletions playground/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"compilerOptions": {
"target": "ESNext",
"jsx": "preserve",
"lib": ["ESNext", "DOM"],
"useDefineForClassFields": true,
"module": "ESNext",
"moduleResolution": "Node",
"resolveJsonModule": true,
"strict": true,
"sourceMap": true,
"esModuleInterop": true,
"isolatedModules": true,
"skipLibCheck": true
}
}
14 changes: 14 additions & 0 deletions playground/uno.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import {
defineConfig,
presetUno,
} from 'unocss'
import transformerStarter from 'unocss-transformer-starter'

export default defineConfig({
presets: [
presetUno(),
],
transformers: [
transformerStarter(),
],
})
8 changes: 8 additions & 0 deletions playground/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import vue from '@vitejs/plugin-vue'
import UnoCSS from 'unocss/vite'
import { defineConfig } from 'vite'

// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue(), UnoCSS()],
})
Loading

0 comments on commit 597fd2e

Please sign in to comment.