Skip to content

Commit dbba320

Browse files
authored
refactor: upgrade project setup (#646)
1 parent 687be8a commit dbba320

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+6864
-12400
lines changed

.circleci/config.yml

-30
This file was deleted.

.eslintignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
dist
1+
dist
2+
coverage
3+
node_modules

.eslintrc.js

+48-22
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,60 @@
1+
const { builtinModules } = require('node:module');
2+
13
module.exports = {
24
root: true,
3-
parserOptions: {
4-
ecmaVersion: 2020,
5-
ecmaFeatures: {
6-
jsx: true,
7-
},
8-
project: './tsconfig.json',
9-
},
105
env: {
116
browser: true,
127
node: true,
13-
jest: true,
148
es6: true,
159
},
16-
parser: '@typescript-eslint/parser',
17-
plugins: ['@typescript-eslint', 'import'],
10+
1811
extends: [
19-
'airbnb-typescript/base',
12+
'eslint:recommended',
13+
'plugin:@typescript-eslint/recommended',
14+
'prettier',
2015
],
16+
plugins: ['import'],
17+
parser: '@typescript-eslint/parser',
18+
parserOptions: {
19+
sourceType: 'module',
20+
ecmaFeatures: {
21+
jsx: true,
22+
},
23+
},
2124
rules: {
22-
'no-nested-ternary': [0],
23-
'no-param-reassign': [0],
24-
'no-use-before-define': [0],
25-
'no-restricted-syntax': [0],
26-
'no-plusplus': [0],
27-
'import/no-extraneous-dependencies': [0],
28-
'consistent-return': [0],
29-
'no-bitwise': [0],
30-
'@typescript-eslint/no-use-before-define': [0],
31-
'prefer-destructuring': [2, { array: false }],
32-
'max-len': [0],
25+
eqeqeq: ['warn', 'always', { null: 'never' }],
26+
'no-debugger': ['error'],
27+
'no-empty': ['warn', { allowEmptyCatch: true }],
28+
'prefer-const': [
29+
'warn',
30+
{
31+
destructuring: 'all',
32+
},
33+
],
34+
'@typescript-eslint/ban-ts-comment': 'off',
35+
'@typescript-eslint/no-var-requires': 'off',
36+
'@typescript-eslint/no-non-null-assertion': 'off',
37+
'@typescript-eslint/no-explicit-any': 'off',
38+
'@typescript-eslint/consistent-type-imports': [
39+
'error',
40+
{ prefer: 'type-imports', fixStyle: 'inline-type-imports' },
41+
],
42+
43+
'import/no-nodejs-modules': [
44+
'error',
45+
{ allow: builtinModules.map((mod) => `node:${mod}`) },
46+
],
47+
'import/no-duplicates': 'error',
48+
'import/order': 'error',
49+
'sort-imports': [
50+
'error',
51+
{
52+
ignoreCase: false,
53+
ignoreDeclarationSort: true,
54+
ignoreMemberSort: false,
55+
memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'],
56+
allowSeparatedGroups: false,
57+
},
58+
],
3359
},
3460
};

.github/ISSUE_TEMPLATE/bug_report.md

-3
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,13 @@ assignees:
88

99
### 🐛 Bug description
1010

11-
1211
<!-- Please describe the bug in detail above so that everyone can understand. -->
1312

1413
### 🏞 Desired result
1514

16-
1715
<!-- Please describe above what you expected to see. -->
1816

1917
### 🚑 Other information
2018

21-
2219
<!-- Please enter other information such as screenshots above. -->
2320
<!-- From: https://github.com/one-template/issue-template -->

.github/ISSUE_TEMPLATE/question.md

-3
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,13 @@ assignees: ''
88

99
### 🧐 Problem Description
1010

11-
1211
<!-- Describe the problem in detail so that everyone can understand. -->
1312

1413
### 💻 Sample code
1514

16-
1715
<!-- If you have a solution, state it clearly here. -->
1816

1917
### 🚑 Other information
2018

21-
2219
<!-- Other information such as screenshots can be posted here. -->
2320
<!-- From: https://github.com/one-template/issue-template -->

.github/renovate.json5

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
$schema: 'https://docs.renovatebot.com/renovate-schema.json',
3+
extends: [
4+
'config:base',
5+
'schedule:weekly',
6+
'group:allNonMajor',
7+
':semanticCommitTypeAll(chore)',
8+
],
9+
labels: ['dependencies'],
10+
pin: false,
11+
rangeStrategy: 'bump',
12+
node: false,
13+
packageRules: [
14+
{
15+
depTypeList: ['peerDependencies'],
16+
enabled: false,
17+
},
18+
],
19+
ignoreDeps: [
20+
'typescript',
21+
22+
// Pure ESM
23+
'camelcase',
24+
],
25+
}

.github/workflows/ci.yml

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: CI
2+
3+
permissions: {}
4+
5+
on:
6+
push:
7+
branches:
8+
- main
9+
pull_request:
10+
workflow_dispatch:
11+
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.event.number || github.sha }}
14+
cancel-in-progress: true
15+
16+
jobs:
17+
test:
18+
timeout-minutes: 20
19+
runs-on: ubuntu-latest
20+
name: Unit Test
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v3
24+
25+
- name: Install pnpm
26+
uses: pnpm/action-setup@v2
27+
28+
- name: Setup node
29+
uses: actions/setup-node@v3
30+
with:
31+
node-version: lts/*
32+
cache: pnpm
33+
34+
- name: Install deps
35+
run: pnpm install
36+
37+
- name: Test unit
38+
run: pnpm run test
39+
40+
lint:
41+
timeout-minutes: 10
42+
runs-on: ubuntu-latest
43+
name: Lint
44+
steps:
45+
- name: Checkout
46+
uses: actions/checkout@v3
47+
48+
- name: Install pnpm
49+
uses: pnpm/action-setup@v2
50+
51+
- name: Setup node
52+
uses: actions/setup-node@v3
53+
with:
54+
node-version: lts/*
55+
cache: pnpm
56+
57+
- name: Install deps
58+
run: pnpm install
59+
60+
- name: Lint
61+
run: pnpm run lint
62+
63+
- name: Check formatting
64+
run: pnpm prettier --check .
65+
66+
- name: Typecheck
67+
run: pnpm run typecheck

.github/workflows/issue-reply.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
steps:
1111
- name: help wanted
1212
if: github.event.label.name == 'help wanted'
13-
uses: actions-cool/issues-helper@v2.5.0
13+
uses: actions-cool/issues-helper@v3
1414
with:
1515
actions: 'create-comment'
1616
issue-number: ${{ github.event.issue.number }}
@@ -19,7 +19,7 @@ jobs:
1919
2020
- name: need reproduction
2121
if: github.event.label.name == 'need reproduction'
22-
uses: actions-cool/issues-helper@v2.5.0
22+
uses: actions-cool/issues-helper@v3
2323
with:
2424
actions: 'create-comment'
2525
issue-number: ${{ github.event.issue.number }}

.github/workflows/release.yml

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v3
13+
with:
14+
fetch-depth: 0
15+
16+
- name: Install pnpm
17+
uses: pnpm/action-setup@v2
18+
19+
- name: Set node
20+
uses: actions/setup-node@v3
21+
with:
22+
node-version: lts/*
23+
cache: pnpm
24+
registry-url: 'https://registry.npmjs.org'
25+
26+
- run: npx changelogithub
27+
continue-on-error: true
28+
env:
29+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
30+
31+
- name: Install Dependencies
32+
run: pnpm i
33+
34+
- name: PNPM build
35+
run: pnpm run build
36+
37+
- name: Publish to NPM
38+
run: pnpm -r publish --access public --no-git-checks
39+
env:
40+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

.gitignore

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
# Logs
22
logs
33
*.log
4-
npm-debug.log*
5-
yarn-debug.log*
6-
yarn-error.log*
7-
lerna-debug.log*
4+
pnpm-debug.log*
85

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

.prettierignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
node_modules
2+
dist
3+
coverage
4+
pnpm-lock.yaml
5+
CHANGELOG.md

.prettierrc

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"singleQuote": true
3+
}

global.d.ts

-3
This file was deleted.

lerna.json

-8
This file was deleted.

netlify.toml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[build.environment]
2+
NODE_VERSION = "18"
3+
4+
[build]
5+
command = "pnpm run build"
6+
publish = "packages/jsx-explorer/dist"

package.json

+22-16
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,34 @@
11
{
22
"private": true,
3-
"workspaces": [
4-
"packages/*"
5-
],
3+
"packageManager": "[email protected]",
64
"scripts": {
7-
"publish": "lerna publish",
8-
"test": "lerna run test",
9-
"lint": "lerna run lint",
10-
"dev": "node scripts/dev.js",
11-
"site": "node scripts/site.js"
5+
"build": "pnpm run -r build",
6+
"test": "vitest",
7+
"lint": "eslint --cache .",
8+
"format": "prettier --write .",
9+
"typecheck": "tsc --noEmit",
10+
"release": "bumpp -r"
1211
},
1312
"license": "MIT",
1413
"keywords": [
1514
"vue",
1615
"jsx"
1716
],
1817
"devDependencies": {
19-
"@typescript-eslint/eslint-plugin": "^4.33.0",
20-
"eslint": "^7.32.0",
21-
"eslint-config-airbnb-typescript": "^12.3.1",
22-
"eslint-plugin-import": "^2.26.0",
23-
"lerna": "^3.22.1"
24-
},
25-
"resolutions": {
26-
"@types/node": "18.8.0"
18+
"@rollup/plugin-babel": "^6.0.3",
19+
"@types/babel__core": "^7.20.1",
20+
"@types/node": "^20.3.1",
21+
"@typescript-eslint/eslint-plugin": "^5.59.11",
22+
"@vitest/coverage-v8": "^0.32.2",
23+
"bumpp": "^9.1.1",
24+
"eslint": "^8.43.0",
25+
"eslint-config-prettier": "^8.8.0",
26+
"eslint-plugin-import": "^2.27.5",
27+
"jsdom": "^22.1.0",
28+
"prettier": "^2.8.8",
29+
"tsup": "^7.0.0",
30+
"typescript": "^5.1.3",
31+
"vite": "^4.3.9",
32+
"vitest": "^0.32.2"
2733
}
2834
}

0 commit comments

Comments
 (0)