Skip to content

Commit

Permalink
feat: v0.1.4
Browse files Browse the repository at this point in the history
  • Loading branch information
surmon-china committed Aug 14, 2024
1 parent ad40388 commit 0c83b2d
Show file tree
Hide file tree
Showing 25 changed files with 4,049 additions and 3,524 deletions.
12 changes: 0 additions & 12 deletions .eslintrc.js

This file was deleted.

2 changes: 0 additions & 2 deletions .github/FUNDING.yml

This file was deleted.

20 changes: 11 additions & 9 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,23 @@ jobs:
name: Test Coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
node-version: '14'
cache: 'yarn'
version: 9
- uses: actions/setup-node@v4
with:
node-version: 'lts/*'
cache: 'pnpm'

- name: Install dependencies
run: yarn install
run: pnpm install

- name: Test
run: yarn test
- name: Test coverage
run: pnpm run test:coverage

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
directory: ./coverage/
verbose: true
15 changes: 9 additions & 6 deletions .github/workflows/pr-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,17 @@ jobs:
name: PR Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
node-version: '14'
cache: 'yarn'
version: 9
- uses: actions/setup-node@v4
with:
node-version: 'lts/*'
cache: 'pnpm'

- name: Install dependencies
run: yarn install
run: pnpm install

- name: Lint/Test/Build
run: yarn rebirth
run: pnpm run ci
17 changes: 10 additions & 7 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,17 @@ jobs:
publish-npm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
node-version: '14'
cache: 'yarn'
registry-url: https://registry.npmjs.org/
- run: yarn install
- run: yarn rebirth
version: 9
- uses: actions/setup-node@v4
with:
node-version: 'lts/*'
cache: 'pnpm'

- run: pnpm install
- run: pnpm run ci
- run: npm publish --access=public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
10 changes: 4 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,14 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@master
uses: actions/checkout@v4

- name: Create Release
id: create_release
uses: actions/create-release@latest
uses: surmon-china/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
# body:
draft: false
prerelease: false
body: |
Please refer to [CHANGELOG.md](/CHANGELOG.md) for details.
6 changes: 2 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@ package-lock.json
npm-debug.log

# output
es
es/*
lib
lib/*
dist
dist/*

# Test Relative Folders
coverage
7 changes: 0 additions & 7 deletions .prettierrc

This file was deleted.

2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"editor.formatOnSave": true,
"editor.formatOnType": true,
"editor.codeActionsOnSave": {
"source.fixAll": true
"source.fixAll": "explicit"
},
"typescript.tsdk": "node_modules/typescript/lib"
}
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@

All notable changes to this project will be documented in this file.

### v0.1.4 (2024-08-15)

#### Changed

- Replaced `yarn` with `pnpm`.
- Upgraded `React` and `react-dom` peerDependencies versions.
- Upgraded ESLint to v9.
- Updated unit test scripts.

#### Removed

- Removed `CommonJS` module.

### v0.1.2 (2021-07-27)

- fix tsconfig (remove helper).
Expand Down
29 changes: 14 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,44 +12,43 @@

[Veact](https://github.com/veactjs/veact) hooks.

---

### Installation
## Installation

```bash
# using npm
npm install veact veact-use --save
```

or

```bash
# using yarn
yarn add veact veact-use

# using pnpm
pnpm add veact veact-use
```

### APIs
## APIs

- [`useWindowScroll`](/src/useWindowScroll.ts) — tracks `Window` scroll position.
- [`useWindowSize`](/src/useWindowSize.ts) — tracks `Window` dimensions.
- [`useLoading`](/src/useLoading.ts) — loading.
- [`useLoadings`](/src/useLoadings.ts) — loadings.
- ...

### Development
## Development

```bash
yarn
pnpm install

yarn lint
pnpm run lint

yarn test
pnpm run test

yarn build
pnpm run build
```

### Changelog
## Changelog

Detailed changes for each release are documented in the [release notes](/CHANGELOG.md).

### License
## License

[MIT](/LICENSE)
27 changes: 27 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import globals from 'globals'
import js from '@eslint/js'
import ts from 'typescript-eslint'
import prettier from 'eslint-plugin-prettier/recommended'

const globalsConfig = {
...globals.node,
...globals.browser,
}

const rules = {
'prettier/prettier': 'error',
'prefer-const': 0,
'@typescript-eslint/explicit-module-boundary-types': 0,
'@typescript-eslint/no-explicit-any': 0,
'@typescript-eslint/no-empty-function': 0,
'@typescript-eslint/ban-types': 0,
}

export default [
{ languageOptions: { globals: globalsConfig } },
js.configs.recommended,
...ts.configs.recommended,
prettier,
{ rules },
{ ignores: ['node_modules', 'dist'] },
]
4 changes: 1 addition & 3 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
/** @type {import('@ts-jest/dist/types').InitialOptionsTsJest} */
module.exports = {
export default {
preset: 'ts-jest',
testEnvironment: 'jsdom',
collectCoverage: true,
coverageDirectory: 'coverage',
}
76 changes: 37 additions & 39 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,63 +1,61 @@
{
"name": "veact-use",
"version": "0.1.3",
"version": "0.1.4",
"description": "Collection of Veact Hooks",
"keywords": [
"React mutable state lib",
"React vue state",
"React composition API",
"Veact Hooks"
],
"license": "MIT",
"author": "Surmon",
"repository": {
"type": "git",
"url": "https://github.com/veactjs/veact-use.git"
},
"license": "MIT",
"homepage": "https://github.com/veactjs/veact-use",
"funding": "https://github.com/veactjs/veact-use?sponsor=1",
"repository": "github:veactjs/veact-use",
"files": [
"CHANGELOG.md",
"lib/",
"es/"
"dist/"
],
"sideEffects": false,
"main": "lib/index.js",
"module": "es/index.js",
"browser": "lib/index.js",
"types": "lib/index.d.ts",
"typings": "lib/index.d.ts",
"type": "module",
"main": "./dist/index.js",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"scripts": {
"lint": "eslint --ext .ts src",
"lint": "eslint src",
"format": "npm run lint --fix",
"test": "jest",
"build:lib": "rimraf lib && tsc",
"build:es": "rimraf es && tsc -m esNext --outDir es",
"build": "npm run build:lib && npm run build:es",
"rebirth": "npm run lint && npm run test && npm run build",
"test:watch": "jest --watch",
"test:coverage": "jest --collectCoverage",
"build": "rimraf dist && tsc",
"ci": "npm run lint && npm run test && npm run build",
"release": ". ./scripts/release.sh"
},
"peerDependencies": {
"react": "^16.8.0 || ^17.0.0",
"react-dom": "^16.8.0 || ^17.0.0",
"veact": "^0.1"
"react": "^16.8.0 || ^17 || ^18 || ^19",
"react-dom": "^16.8.0 || ^17 || ^18 || ^19",
"veact": "*"
},
"devDependencies": {
"@testing-library/react": "^12.0.0",
"@testing-library/react-hooks": "^7.0.1",
"@types/jest": "^26.0.24",
"@types/react": "^17.0.15",
"@types/react-dom": "^17.0.9",
"@typescript-eslint/eslint-plugin": "^4.28.4",
"@typescript-eslint/parser": "^4.28.4",
"eslint": "^7.31.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^3.4.0",
"jest": "^27.0.6",
"prettier": "^2.3.2",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"rimraf": "^3.0.2",
"ts-jest": "^27.0.4",
"typescript": "^4.3.5",
"veact": "^0.1.2"
"@eslint/js": "^9.x",
"@testing-library/react": "^16.x",
"@types/eslint": "^9.x",
"@types/jest": "^29.x",
"@types/react": "^18.x",
"@types/react-dom": "^18.x",
"eslint": "^9.x",
"eslint-config-prettier": "^9.x",
"eslint-plugin-prettier": "^5.x",
"globals": "^15.9.0",
"jest": "^29.x",
"prettier": "^3.x",
"react": "^18.x",
"react-dom": "^18.x",
"rimraf": "^6.x",
"ts-jest": "^29.x",
"typescript": "^5.5.4",
"typescript-eslint": "^8.x",
"veact": "latest"
}
}
Loading

0 comments on commit 0c83b2d

Please sign in to comment.