Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
EnergoStalin authored Jan 31, 2024
0 parents commit f02089a
Show file tree
Hide file tree
Showing 16 changed files with 4,642 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[*]
charset = utf-8
end_of_line = lf

indent_style = tab
indent_size = 3

insert_final_newline = true
trim_trailing_whitespace = true

[*.{yml,yaml}]
indent_style = space
indent_size = 2

[*.md]
trim_trailing_whitespace = false
indent_style = space
indent_size = 2

[package.json]
indent_style = space
indent_size = 2
12 changes: 12 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const { configure, presets } = require("eslint-kit")

module.exports = configure({
allowDebug: process.env.NODE_ENV !== "production",

presets: [
presets.imports(),
presets.node(),
presets.prettier(),
presets.typescript(),
],
})
26 changes: 26 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
on:
pull_request:
types: ["opened", "ready_for_review", "review_requested"]
branches: ["master"]
push:
branches: ["master"]

jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PNPM
uses: pnpm/action-setup@v2
with:
version: 8.15.1
- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
cache: pnpm
node-version: 20.x
- name: Install
run: pnpm i
- name: Lint
run: pnpm run lint
42 changes: 42 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
on:
push:
tags: ["v*"]

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PNPM
uses: pnpm/action-setup@v2
with:
version: 8.15.1
- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
cache: pnpm
node-version: 20.x
- name: Install
run: pnpm i
- name: Build
run: pnpm run build
env:
ENVIRONMENT: ci
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: userscript
path: dist/bundle.user.js

release:
needs: build
runs-on: ubuntu-latest
steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: userscript
- uses: ncipollo/release-action@v1
with:
artifacts: "bundle.user.js"
136 changes: 136 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)
web_modules/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional stylelint cache
.stylelintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# Next.js build output
.next
out

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# vuepress v2.x temp and cache directory
.temp
.cache

# Docusaurus cache and generated files
.docusaurus

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
.vscode-test

# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*

# VSCode workspace configuration
.vscode/settings.json

# Build output
build/
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
preid=dev
4 changes: 4 additions & 0 deletions .prettierrc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
editorconfig: true

semi: false
trailingComma: all
7 changes: 7 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"recommendations": [
"editorconfig.editorconfig",
"dbaeumer.vscode-eslint",
"usernamehw.errorlens"
]
}
37 changes: 37 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "dev",
"label": "npm: dev",
"detail": "rollup -c -w"
},
{
"type": "npm",
"script": "serve",
"label": "npm: serve",
"detail": "http-server build -c 1 -o"
},
{
"label": "npm: dev & serve",
"dependsOn": [
"npm: dev",
"npm: serve"
],
"dependsOrder": "parallel"
},
{
"type": "npm",
"script": "lint:fix",
"problemMatcher": [
"$eslint-stylish"
],
"label": "npm: lint:fix",
"detail": "eslint --fix src/**/*.ts src/*.ts"
}
],
"problemMatcher": [
"$tsc-watch"
],
}
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Tampermonkey ts rollup pnpm template

![release.yml](https://github.com/EnergoStalin/tampermonkey-template/actions/workflows/release.yaml/badge.svg)
![release.yml](https://github.com/EnergoStalin/tampermonkey-template/actions/workflows/lint.yaml/badge.svg)

## Setup
Just change package.json fields and optionally tweak metadata in `tsup.config.ts`
Empty file added globals.d.ts
Empty file.
37 changes: 37 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"name": "name",
"version": "v0.0.0",
"description": "description",
"homepage": "https://example.com",
"module": "esm",
"type": "module",
"engines": {
"node": ">=20"
},
"scripts": {
"dev": "ENVIRONMENT=development tsup --watch",
"build": "tsup",
"serve": "http-server build -c 1 -o",
"lint": "eslint src/**/*.ts src/*.ts",
"lint:fix": "eslint --fix src/**/*.ts src/*.ts",
"release": "npm version -m 'chore(release): %s' --"
},
"keywords": [],
"repository": {
"url": "https://github.com/EnergoStalin/tampermonkey-template"
},
"author": "EnergoStalin",
"license": "AGPL-3.0-only",
"devDependencies": {
"@swc/core": "^1.3.107",
"@types/node": "^20.11.13",
"@types/tampermonkey": "^4.20.4",
"esbuild-plugin-userscript": "^0.2.6",
"eslint": "^8.56.0",
"eslint-kit": "^10.10.0",
"http-server": "^14.1.1",
"prettier": "^3.2.4",
"tsup": "^8.0.1",
"typescript": "^5.3.3"
}
}
Loading

0 comments on commit f02089a

Please sign in to comment.