Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelYuhe committed Dec 9, 2023
0 parents commit 8a28662
Show file tree
Hide file tree
Showing 21 changed files with 1,917 additions and 0 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Build

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout Repo
uses: actions/checkout@v4

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

- name: Set node
uses: actions/setup-node@v3
with:
node-version: lts/*

- name: Setup
run: npm i -g @antfu/ni

- name: Install
run: nci

- name: Lint
run: nr style

- name: Build
run: nr build
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
npm-debug.log
node_modules/
dist/
tmp/
.DS_Store
dist.zip
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
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Chrome Extension Starter

Chrome extension starter template with React, TypeScript, Vite and Tailwind

## Development

```bash
# Install dependencies
pnpm install

# Development
pnpm dev

# Build
pnpm build
```
24 changes: 24 additions & 0 deletions lint-staged.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/**
* https://github.com/vercel/next.js/blob/canary/lint-staged.config.js
*/

const { quote } = require("shell-quote");

const isWin = process.platform === "win32";

module.exports = {
"**/*.{js,jsx,cjs,mjs,ts,tsx,mts,cts,md,json}": (filenames) => {
const escapedFileNames = filenames
.map((filename) => `"${isWin ? filename : escape([filename])}"`)
.join(" ");
return [
`prettier --write ${escapedFileNames}`,
`git add ${escapedFileNames}`,
];
},
};

function escape(str) {
const escaped = quote(str);
return escaped.replace(/\\@/g, "@");
}
11 changes: 11 additions & 0 deletions options.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>Options</title>
</head>

<body>
<div id="root"></div>
<script type="module" src="./src/options.tsx"></script>
</body>
</html>
39 changes: 39 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"name": "chrome-extension-starter",
"private": true,
"type": "module",
"packageManager": "[email protected]",
"scripts": {
"prepare": "husky install",
"dev": "vite build --watch",
"build": "vite build",
"style": "prettier --check \"src/**/*.{ts,tsx}\"",
"style:fix": "prettier --write \"src/**/*.{ts,tsx}\""
},
"author": "MichaelYuhe",
"license": "MIT",
"dependencies": {
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"prettier": {
"tabWidth": 2
},
"devDependencies": {
"@tailwindcss/forms": "^0.5.7",
"@types/chrome": "0.0.158",
"@types/node": "^20.10.4",
"@types/react": "^18.0.29",
"@types/react-dom": "^18.0.11",
"@vitejs/plugin-react-swc": "^3.5.0",
"autoprefixer": "^10.4.16",
"husky": "^8.0.3",
"lint-staged": "^15.2.0",
"postcss": "^8.4.32",
"prettier": "^2.2.1",
"shell-quote": "^1.8.1",
"tailwindcss": "^3.3.6",
"typescript": "^5.0.4",
"vite": "^5.0.7"
}
}
Loading

0 comments on commit 8a28662

Please sign in to comment.