Skip to content

Commit

Permalink
chore: upgrade dev deps and fix eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
qq15725 committed Nov 6, 2024
1 parent 868758a commit adb4560
Show file tree
Hide file tree
Showing 70 changed files with 7,757 additions and 4,877 deletions.
3 changes: 0 additions & 3 deletions .eslintrc.json

This file was deleted.

2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

### Before submitting the PR, please make sure you do the following

- [ ] Read the [Pull Request Guidelines](https://github.com/qq15725/modern-screenshot/blob/master/.github/pull-request-guidelines.md) and follow the [PR Title Convention](https://github.com/qq15725/modern-screenshot/blob/master/.github/commit-convention.md).
- [ ] Read the [Pull Request Guidelines](https://github.com/qq15725/modern-screenshot/blob/main/.github/pull-request-guidelines.md) and follow the [PR Title Convention](https://github.com/qq15725/modern-screenshot/blob/main/.github/commit-convention.md).
- [ ] Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
- [ ] Provide a description in this PR that addresses **what** the PR is solving, or reference the issue that it solves (e.g. `fixes #123`).
- [ ] Ideally, include relevant tests that fail without this PR but pass with it.
45 changes: 18 additions & 27 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,72 +26,63 @@ jobs:
test:
timeout-minutes: 10
runs-on: ubuntu-latest
name: "Build&Test: node-16.x, ubuntu-latest"
name: 'Build&Test: node-lts, ubuntu-latest'
steps:
- name: ⤵️ Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
# Assume PRs are less than 50 commits
fetch-depth: 50

fetch-depth: 0
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@57d9664f8e2aa45f26bcb59095f99aa47ae8e90d # v35.4.4
with:
files: |
docs/**
.github/**
.vscode/**
!.github/workflows/ci.yml
**.md
- name: 🎉 Install pnpm
if: steps.changed-files.outputs.only_changed != 'true'
uses: pnpm/[email protected]

- name: 🎉 Set node version to 16.x
uses: pnpm/action-setup@v4
- name: 🎉 Set node version to lts
if: steps.changed-files.outputs.only_changed != 'true'
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 16.x

node-version: lts/*
registry-url: https://registry.npmjs.org/
cache: pnpm
- name: 🚧 Install deps
if: steps.changed-files.outputs.only_changed != 'true'
run: pnpm install

- name: 📦 Build
if: steps.changed-files.outputs.only_changed != 'true'
run: pnpm run build

- name: 🔀 Test unit
if: steps.changed-files.outputs.only_changed != 'true'
run: pnpm run test

lint:
timeout-minutes: 10
runs-on: ubuntu-latest
name: "Lint: node-16, ubuntu-latest"
name: 'Lint: node-lts, ubuntu-latest'
steps:
- name: ⤵️ Checkout
uses: actions/checkout@v3

uses: actions/checkout@v4
- name: 🎉 Install pnpm
uses: pnpm/[email protected]

- name: 🎉 Set node version to 16.x
uses: actions/setup-node@v3
uses: pnpm/action-setup@v4
- name: 🎉 Set node version to lts
uses: actions/setup-node@v4
with:
node-version: 16.x
cache: "pnpm"

node-version: lts/*
registry-url: https://registry.npmjs.org/
cache: pnpm
- name: 🚧 Install deps
run: pnpm install

- name: 📦 Build
run: pnpm run build

- name: 🔀 Lint
run: pnpm run lint

# From https://github.com/rhysd/actionlint/blob/main/docs/usage.md#use-actionlint-on-github-actions
- name: 🔀 Check workflow files
run: |
Expand Down
21 changes: 9 additions & 12 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,29 @@ name: 🚀 Publish Package
on:
push:
tags:
- "v*" # Push events to matching v*, i.e. v1.0, v20.15.10
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10

jobs:
publish:
runs-on: ubuntu-latest
environment: Release
steps:
- name: ⤵️ Checkout
uses: actions/checkout@v3

uses: actions/checkout@v4
with:
fetch-depth: 0
- name: 🎉 Install pnpm
uses: pnpm/[email protected]

- name: 🎉 Set node version to 16.x
uses: actions/setup-node@v3
uses: pnpm/action-setup@v4
- name: 🎉 Set node version to lts
uses: actions/setup-node@v4
with:
node-version: 16.x
node-version: lts/*
registry-url: https://registry.npmjs.org/
cache: "pnpm"

cache: pnpm
- name: 🚧 Install deps
run: pnpm install

- name: 📦 Build
run: pnpm run build

- name: 🔀 Publish package
run: npm publish --access public
env:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ name: 🚀 Add GitHub Release Tag
on:
push:
tags:
- "v*" # Push events to matching v*, i.e. v1.0, v20.15.10
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10

# $GITHUB_REF_NAME - https://docs.github.com/en/actions/learn-github-actions/environment-variables#default-environment-variables

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: 🔀 Create Release for Tag
id: release_tag
uses: actions/create-release@v1
Expand Down
21 changes: 21 additions & 0 deletions build.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { defineBuildConfig } from 'unbuild'

export default defineBuildConfig({
entries: [
'src/index',
'src/worker',
],
declaration: true,
clean: false,
failOnWarn: false,
rollup: {
emitCJS: true,
esbuild: {
tsconfigRaw: {
compilerOptions: {
experimentalDecorators: true,
},
},
},
},
})
12 changes: 12 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// @ts-check
import antfu from '@antfu/eslint-config'

export default antfu(
{ type: 'lib' },
{
rules: {
'antfu/consistent-list-newline': ['off'],
'eslint-comments/no-unlimited-disable': ['off'],
},
},
)
74 changes: 42 additions & 32 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "modern-screenshot",
"type": "module",
"version": "4.4.39",
"packageManager": "pnpm@8.7.6",
"packageManager": "pnpm@9.12.3",
"description": "Quickly generate image from DOM node using HTML5 canvas and SVG",
"author": "wxm",
"license": "MIT",
Expand All @@ -28,58 +28,68 @@
"sideEffects": false,
"exports": {
".": {
"types": "./types/index.d.ts",
"require": "./dist/index.cjs",
"import": "./dist/index.mjs"
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs",
"require": "./dist/index.cjs"
},
"./worker": {
"types": "./types/worker.d.ts",
"require": "./dist/worker.js",
"import": "./dist/worker.js"
"types": "./dist/worker.d.ts",
"require": "./dist/worker.mjs",
"import": "./dist/worker.cjs"
},
"./*": "./*"
},
"main": "dist/index.mjs",
"module": "dist/index.mjs",
"types": "types/index.d.ts",
"browser": "dist/index.js",
"main": "./dist/index.mjs",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"browser": "./dist/index.js",
"typesVersions": {
"*": {
"*": [
"./types/*",
"./types/index.d.ts"
"./dist/*",
"./dist/index.d.ts"
]
}
},
"files": [
"dist",
"types"
"dist"
],
"scripts": {
"dev": "vite",
"lint": "eslint src",
"lint:fix": "eslint src --fix",
"test": "vitest --no-threads --no-isolate",
"test": "vitest --no-isolate",
"coverage": "vitest run --coverage",
"build:worker": "vite build --config vite.worker.config.ts",
"build": "vite build && pnpm build:worker && tsc --project tsconfig.build.json",
"build": "vite build && unbuild && pnpm build:worker",
"version": "conventional-changelog -p angular -i CHANGELOG.md -s && git add CHANGELOG.md",
"release": "bumpp package.json --commit \"release: v%s\" --push --all --tag"
"release": "bumpp package.json --commit \"release: v%s\" --push --all --tag",
"typecheck": "tsc --noEmit",
"prepare": "simple-git-hooks"
},
"devDependencies": {
"@qq15725/eslint-config": "^1.1.0",
"@types/glob": "^8.0.1",
"@types/jest-image-snapshot": "^6.1.0",
"@vitest/ui": "^0.28.5",
"bumpp": "^8.2.1",
"conventional-changelog-cli": "^2.2.2",
"eslint": "^8.34.0",
"glob": "^8.1.0",
"happy-dom": "^8.6.0",
"jest-image-snapshot": "^6.1.0",
"puppeteer": "^19.7.1",
"typescript": "^4.9.5",
"vite": "^4.1.3",
"vitest": "^0.28.5"
"@antfu/eslint-config": "^3.8.0",
"@types/glob": "^8.1.0",
"@types/jest-image-snapshot": "^6.4.0",
"@vitest/ui": "^2.1.4",
"bumpp": "^9.8.1",
"conventional-changelog-cli": "^5.0.0",
"eslint": "^9.14.0",
"glob": "^11.0.0",
"happy-dom": "^15.10.1",
"jest-image-snapshot": "^6.4.0",
"lint-staged": "^15.2.10",
"puppeteer": "^23.7.0",
"simple-git-hooks": "^2.11.1",
"typescript": "^5.6.3",
"unbuild": "^2.0.0",
"vite": "^5.4.10",
"vitest": "^2.1.4"
},
"simple-git-hooks": {
"pre-commit": "pnpm lint-staged"
},
"lint-staged": {
"*": "eslint src --fix"
}
}
Loading

0 comments on commit adb4560

Please sign in to comment.