Skip to content

Commit

Permalink
feat: support calc enum
Browse files Browse the repository at this point in the history
  • Loading branch information
baozouai committed Apr 21, 2023
1 parent 5d11038 commit f47c376
Show file tree
Hide file tree
Showing 17 changed files with 2,149 additions and 2,222 deletions.
8 changes: 8 additions & 0 deletions .codecov.yml
@@ -0,0 +1,8 @@
coverage:
status:
project:
default:
target: 95%
patch:
default:
target: 95%
97 changes: 97 additions & 0 deletions .github/workflows/ci.yml
@@ -0,0 +1,97 @@
name: CI

on:
push:
branches:
- master

pull_request:
branches:
- master

jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

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

- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 16.x
cache: pnpm

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

- name: Install
run: nci

- name: Lint
run: nr lint

typecheck:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

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

- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 18.x
cache: pnpm

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

- name: Install
run: nci

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

strategy:
matrix:
node: [16.x, 18.x]
os: [ubuntu-latest, windows-latest, macos-latest]
fail-fast: false

steps:
- name: Checkout
uses: actions/checkout@v3

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

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

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

- name: Install
run: nci

- name: Test
run: nr test --run --coverage

- name: Build
run: nr build

- name: Upload coverage report to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage/lcov.info
fail_ci_if_error: true
42 changes: 42 additions & 0 deletions .github/workflows/release.yml
@@ -0,0 +1,42 @@
name: Release

permissions:
contents: write

on:
push:
tags:
- 'v*'

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

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

- name: Set node
uses: actions/setup-node@v3
with:
node-version: 16.x
registry-url: 'https://registry.npmjs.org'

- name: ChangeLog
run: npx changelogithub
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

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

- name: Install
run: nci

- name: Release
run: ni release
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -7,3 +7,4 @@ yarn-error.log
.eslintcache
node_modules
dist
coverage/
3 changes: 2 additions & 1 deletion .npmrc
@@ -1 +1,2 @@
registry = http://registry.npmjs.org
registry = http://registry.npmjs.org
auto-install-peers=false
1 change: 1 addition & 0 deletions .nvmrc
@@ -0,0 +1 @@
16.14
11 changes: 9 additions & 2 deletions README-zh_CN.md
Expand Up @@ -5,15 +5,22 @@

<div align="center">

[![NPM version][npm-image]][npm-url] ![NPM downloads][download-image]

![Test][test-badge] ![codecov][codecov-badge]

[![NPM version][npm-image]][npm-url] ![NPM downloads][download-image]

[npm-image]: https://img.shields.io/npm/v/babel-plugin-enum-to-object.svg?style=flat-square
[npm-url]: http://npmjs.org/package/babel-plugin-enum-to-object


[download-image]: https://img.shields.io/npm/dm/babel-plugin-enum-to-object.svg?style=flat-square
[download-url]: https://npmjs.org/package/babel-plugin-enum-to-object



[test-badge]: https://github.com/baozouai/babel-plugin-enum-to-object/actions/workflows/test.yml/badge.svg

[codecov-badge]: https://codecov.io/github/baozouai/babel-plugin-enum-to-object/branch/master/graph/badge.svg


</div>
Expand Down
9 changes: 8 additions & 1 deletion README.md
Expand Up @@ -8,14 +8,21 @@

[![NPM version][npm-image]][npm-url] ![NPM downloads][download-image]

![Test][test-badge] ![codecov][codecov-badge]


[npm-image]: https://img.shields.io/npm/v/babel-plugin-enum-to-object.svg?style=flat-square
[npm-url]: http://npmjs.org/package/babel-plugin-enum-to-object


[download-image]: https://img.shields.io/npm/dm/babel-plugin-enum-to-object.svg?style=flat-square
[download-url]: https://npmjs.org/package/babel-plugin-enum-to-object



[test-badge]: https://github.com/baozouai/babel-plugin-enum-to-object/actions/workflows/ci.yml/badge.svg

[codecov-badge]: https://codecov.io/github/baozouai/babel-plugin-enum-to-object/branch/master/graph/badge.svg

</div>

English | [中文](./README-zh_CN.md)
Expand Down
63 changes: 0 additions & 63 deletions __tests__/test.js

This file was deleted.

72 changes: 40 additions & 32 deletions package.json
@@ -1,14 +1,18 @@
{
"name": "babel-plugin-enum-to-object",
"version": "0.1.0",
"author": "baozouai <baozouai@gmail.com>",
"version": "0.2.0",
"packageManager": "pnpm@8.3.1",
"description": "transform enum to object for better tree shaking",
"author": "baozouai <baozouai@gmail.com>",
"license": "MIT",
"homepage": "https://github.com/baozouai/babel-plugin-enum-to-object",
"main": "dist/babel-plugin-enum-to-object.js",
"types": "dist/babel-plugin-enum-to-object.d.ts",
"files": [
"dist/"
],
"repository": {
"type": "git",
"url": "https://github.com/baozouai/babel-plugin-enum-to-object.git"
},
"bugs": {
"url": "https://github.com/baozouai/babel-plugin-enum-to-object/issues"
},
"keywords": [
"webpack",
"plugin",
Expand All @@ -17,33 +21,26 @@
"node",
"reduce enum"
],
"main": "dist/babel-plugin-enum-to-object.js",
"types": "dist/babel-plugin-enum-to-object.d.ts",
"files": [
"dist/"
],
"engines": {
"node": ">=16.14.0"
},
"scripts": {
"clean": "rm -rf dist",
"lint": "eslint --cache --fix",
"build": "tsc",
"test": "jest",
"test": "vitest",
"release": "npm run clean && npm run build && npm publish",
"prepare": "husky install"
},
"husky": {
"hooks": {
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS",
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"./src/**/*.{ts,js}": [
"yarn lint"
]
},
"repository": {
"type": "git",
"url": "https://github.com/baozouai/babel-plugin-enum-to-object.git"
},
"bugs": {
"url": "https://github.com/baozouai/babel-plugin-enum-to-object/issues"
"dependencies": {
"@babel/helper-plugin-utils": "^7.20.2",
"@babel/plugin-syntax-typescript": "^7.21.4"
},
"license": "MIT",
"devDependencies": {
"@antfu/eslint-config": "^0.36.0",
"@babel/core": "^7.21.4",
Expand All @@ -53,13 +50,22 @@
"@commitlint/config-conventional": "^17.4.4",
"@types/babel__core": "^7.20.0",
"@types/babel__helper-plugin-utils": "^7.10.0",
"babel-jest": "^29.5.0",
"@types/node": "^18.15.13",
"@vitest/coverage-c8": "^0.30.1",
"cz-conventional-changelog": "^3.3.0",
"eslint": "^8.35.0",
"husky": "^8.0.3",
"jest": "^29.5.0",
"lint-staged": "^13.1.2",
"typescript": "^4.9.5"
"pnpm": "^8.3.1",
"simple-git-hooks": "^2.8.1",
"typescript": "^4.9.5",
"vitest": "^0.30.1"
},
"husky": {
"hooks": {
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS",
"pre-commit": "lint-staged"
}
},
"publishConfig": {
"registry": "https://registry.npmjs.org",
Expand All @@ -70,8 +76,10 @@
"path": "node_modules/cz-conventional-changelog"
}
},
"dependencies": {
"@babel/helper-plugin-utils": "^7.20.2",
"@babel/plugin-syntax-typescript": "^7.21.4"
"simple-git-hooks": {
"pre-commit": "pnpm lint-staged"
},
"lint-staged": {
"*": "eslint --fix"
}
}

0 comments on commit f47c376

Please sign in to comment.