Skip to content

Commit

Permalink
Various infrastructural improvements
Browse files Browse the repository at this point in the history
* Switched to pnpm
* Implemented eslint and prettier
* Improved docs
  • Loading branch information
kael-shipman committed Dec 30, 2023
1 parent b24c00e commit 356d644
Show file tree
Hide file tree
Showing 16 changed files with 3,234 additions and 7,134 deletions.
34 changes: 34 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
module.exports = {
"env": {
"browser": true,
"es2021": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"prettier"
],
"overrides": [
{
"env": {
"node": true
},
"files": [
".eslintrc.{js,cjs}"
],
"parserOptions": {
"sourceType": "script"
}
}
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": [
"@typescript-eslint"
],
"rules": {
}
}
30 changes: 30 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: CI

on: [push, workflow_dispatch]

concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true

jobs:
lint-and-test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x, 18.x, 20.x]
steps:
- uses: actions/checkout@v4
name: Checkout

- uses: pnpm/action-setup@v2
with:
version: 8

- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: pnpm
cache-dependency-path: ./pnpm-lock.yaml

- run: pnpm i && pnpm t
name: Lint and Test
15 changes: 13 additions & 2 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
#!/bin/sh
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx pretty-quick --staged
set -e

if [ -z "$SKIP_LINTING" ]; then
pnpm typecheck
pnpm prettier
pnpm lint
fi

if [ -z "$SKIP_TESTS" ]; then
pnpm test:jest
fi
3 changes: 3 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
.eslint*
.prettier*
.github
*.sw[op]
.node-xml*
tests
Expand Down
2 changes: 1 addition & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
@wymp:registry=https://npm.pkg.github.com/wymp
publish-branch=current
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
*.md
docs
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ across various disparate execution calls.

This was built specifically to address React component mount/unmount chaos, in which a "normal"
debounce function wouldn't work because it is being instantiated as a new instance every execution.
See examples of the primary use case below in `Usage`.
See examples of the primary use case below in [Usage](#usage).

Note: Detailed library API docs are available in this repo at `/docs/index.html`.
Note: Detailed library API docs are available in this repo at `./docs/index.html`.


## Usage
Expand Down Expand Up @@ -107,8 +107,9 @@ debouncer.bounce("non-existent", () => ({ status: "ready" }));
## Development
1. run `npm install`
1. run `pnpm i`
2. Make code changes
3. run `npx tsc`
3. run `pnpm t`
4. Make logical, specific commits
5. Publish using `pnpm publish --access public`
Loading

0 comments on commit 356d644

Please sign in to comment.