Skip to content

Commit 4deb324

Browse files
authored
Merge pull request #196 from dashed/claude/vite-typescript-migration-JvyL1
Convert project to Vite and TypeScript
2 parents f2a35c3 + 1c1ed94 commit 4deb324

23 files changed

Lines changed: 3589 additions & 5951 deletions

.flowconfig

Lines changed: 0 additions & 16 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [master, main]
6+
pull_request:
7+
branches: [master, main]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
13+
strategy:
14+
matrix:
15+
node-version: [18, 20, 22]
16+
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v4
20+
21+
- name: Install pnpm
22+
uses: pnpm/action-setup@v4
23+
24+
- name: Setup Node.js ${{ matrix.node-version }}
25+
uses: actions/setup-node@v4
26+
with:
27+
node-version: ${{ matrix.node-version }}
28+
cache: pnpm
29+
30+
- name: Run CI
31+
run: make ci

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
node_modules
2+
dist
23
.DS_Store
3-
modules
44
*.log
5+
*.tsbuildinfo

.npmignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

.travis.yml

Lines changed: 0 additions & 9 deletions
This file was deleted.

Makefile

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
.PHONY: install build test test-watch lint typecheck clean all ci
2+
3+
# Default target
4+
all: install lint typecheck test build
5+
6+
# Install dependencies
7+
install:
8+
pnpm install
9+
10+
# Build the project
11+
build:
12+
pnpm build
13+
14+
# Run tests
15+
test:
16+
pnpm test
17+
18+
# Run tests in watch mode
19+
test-watch:
20+
pnpm test:watch
21+
22+
# Run linter
23+
lint:
24+
pnpm lint
25+
26+
# Run type checking
27+
typecheck:
28+
pnpm typecheck
29+
30+
# Clean build artifacts
31+
clean:
32+
rm -rf dist node_modules
33+
34+
# CI target - runs all checks
35+
ci: install lint typecheck test build

README.md

Lines changed: 56 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# shallowequal [![Build Status](https://travis-ci.org/dashed/shallowequal.svg)](https://travis-ci.org/dashed/shallowequal) [![Downloads](https://img.shields.io/npm/dm/shallowequal.svg)](https://npmjs.com/shallowequal) [![npm version](https://img.shields.io/npm/v/shallowequal.svg?style=flat)](https://www.npmjs.com/package/shallowequal)
1+
# shallowequal [![CI](https://github.com/dashed/shallowequal/actions/workflows/ci.yml/badge.svg)](https://github.com/dashed/shallowequal/actions/workflows/ci.yml) [![Downloads](https://img.shields.io/npm/dm/shallowequal.svg)](https://npmjs.com/shallowequal) [![npm version](https://img.shields.io/npm/v/shallowequal.svg?style=flat)](https://www.npmjs.com/package/shallowequal)
22

33
> `shallowequal` is like lodash's [`isEqual`](https://lodash.com/docs/3.10.1#isEqual) (v3.10.1) but for shallow (strict) equal.
44
@@ -20,17 +20,17 @@ The `customizer` is bound to `thisArg` and invoked with three arguments: `(value
2020
## Install
2121

2222
```sh
23-
$ yarn add shallowequal
24-
# npm v5+
25-
$ npm install shallowequal
26-
# before npm v5
27-
$ npm install --save shallowequal
23+
pnpm add shallowequal
24+
# or
25+
npm install shallowequal
26+
# or
27+
yarn add shallowequal
2828
```
2929

3030
## Usage
3131

3232
```js
33-
const shallowequal = require("shallowequal");
33+
import shallowequal from "shallowequal";
3434

3535
const object = { user: "fred" };
3636
const other = { user: "fred" };
@@ -42,22 +42,63 @@ shallowequal(object, other);
4242
// → true
4343
```
4444

45+
### TypeScript
46+
47+
This package includes TypeScript type definitions:
48+
49+
```ts
50+
import shallowequal, { Comparator } from "shallowequal";
51+
52+
const customCompare: Comparator = (a, b, key) => {
53+
// Custom comparison logic
54+
return undefined; // Fall back to default comparison
55+
};
56+
57+
shallowequal({ a: 1 }, { a: 1 }, customCompare);
58+
// → true
59+
```
60+
4561
## Credit
4662

4763
Code for `shallowEqual` originated from https://github.com/gaearon/react-pure-render/ and has since been refactored to have the exact same API as `lodash.isEqualWith` (as of `v4.17.4`).
4864

4965
## Development
5066

51-
- `node.js` and `npm`. See: https://github.com/creationix/nvm#installation
52-
- `yarn`. See: https://yarnpkg.com/en/docs/install
53-
- `npm` dependencies. Run: `yarn install`
67+
Prerequisites:
68+
- [Node.js](https://nodejs.org/) (v18+)
69+
- [pnpm](https://pnpm.io/)
70+
71+
### Setup
72+
73+
```sh
74+
pnpm install
75+
```
76+
77+
### Commands
5478

55-
### Chores
79+
Using Make:
5680

57-
- Lint: `yarn lint`
58-
- Test: `yarn test`
59-
- Pretty: `yarn pretty`
60-
- Prepare: `yarn prepare`
81+
```sh
82+
make install # Install dependencies
83+
make build # Build the project
84+
make test # Run tests
85+
make test-watch # Run tests in watch mode
86+
make lint # Run linter
87+
make typecheck # Run type checking
88+
make clean # Clean build artifacts
89+
make ci # Run full CI pipeline
90+
```
91+
92+
Or using pnpm directly:
93+
94+
```sh
95+
pnpm install # Install dependencies
96+
pnpm build # Build the project
97+
pnpm test # Run tests
98+
pnpm test:watch # Run tests in watch mode
99+
pnpm lint # Run linter
100+
pnpm typecheck # Run type checking
101+
```
61102

62103
## License
63104

babel.config.js

Lines changed: 0 additions & 12 deletions
This file was deleted.

eslint.config.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import eslint from "@eslint/js";
2+
import tseslint from "typescript-eslint";
3+
4+
export default tseslint.config(
5+
eslint.configs.recommended,
6+
...tseslint.configs.recommended,
7+
{
8+
ignores: ["dist/**", "node_modules/**"],
9+
},
10+
{
11+
files: ["**/*.ts"],
12+
rules: {
13+
"@typescript-eslint/no-explicit-any": "warn",
14+
"@typescript-eslint/no-unused-vars": [
15+
"error",
16+
{ argsIgnorePattern: "^_" },
17+
],
18+
},
19+
}
20+
);

index.js

Lines changed: 0 additions & 46 deletions
This file was deleted.

0 commit comments

Comments
 (0)