Skip to content

Commit

Permalink
rewrite in typescript
Browse files Browse the repository at this point in the history
  • Loading branch information
silverwind committed May 22, 2024
1 parent e58b3a8 commit bff5af4
Show file tree
Hide file tree
Showing 13 changed files with 2,983 additions and 839 deletions.
4 changes: 3 additions & 1 deletion .eslintrc.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
root: true
extends: silverwind
extends:
- silverwind
- silverwind-typescript
5 changes: 2 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@ jobs:
strategy:
fail-fast: false
matrix:
node: [18, 20]

node: [18, 20, 22]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{matrix.node}}
- run: make test
- run: make lint test
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/.vscode
/dist
/node_modules
/npm-debug.log*
/yarn-error.log
/yarn.lock
34 changes: 24 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
SOURCE_FILES := index.ts
DIST_FILES := dist/index.js

node_modules: package-lock.json
npm install --no-save
@touch node_modules
Expand All @@ -7,16 +10,27 @@ deps: node_modules

.PHONY: lint
lint: node_modules
npx eslint --color .
npx eslint --ext js,jsx,ts,tsx --color .
npx tsc

.PHONY: lint-fix
lint-fix: node_modules
npx eslint --color . --fix
npx eslint --ext js,jsx,ts,tsx --color . --fix
npx tsc

.PHONY: test
test: node_modules lint
test: node_modules
npx vitest
npx tsd

.PHONY: test-update
test-update: node_modules
npx vitest -u

.PHONY: build
build: node_modules $(DIST_FILES)

$(DIST_FILES): $(SOURCE_FILES) package-lock.json vite.config.ts
npx vite build

.PHONY: publish
publish: node_modules
Expand All @@ -31,16 +45,16 @@ update: node_modules
@touch node_modules

.PHONY: path
patch: node_modules test
patch: node_modules lint test build
npx versions patch package.json package-lock.json
$(MAKE) --no-print-directory publish
@$(MAKE) --no-print-directory publish

.PHONY: minor
minor: node_modules test
minor: node_modules lint test build
npx versions minor package.json package-lock.json
$(MAKE) --no-print-directory publish
@$(MAKE) --no-print-directory publish

.PHONY: major
major: node_modules test
major: node_modules lint test build
npx versions major package.json package-lock.json
$(MAKE) --no-print-directory publish
@$(MAKE) --no-print-directory publish
39 changes: 0 additions & 39 deletions index.d.ts

This file was deleted.

21 changes: 0 additions & 21 deletions index.test-d.ts

This file was deleted.

5 changes: 1 addition & 4 deletions index.test.js → index.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import m, {
mergeCidr, excludeCidr, expandCidr, overlapCidr, normalizeCidr, containsCidr, parseCidr,
} from "./index.js";
import {inspect} from "node:util";

inspect.defaultOptions.depth = null;
} from "./index.ts";

test("exports", () => {
expect(m.mergeCidr).toEqual(mergeCidr);
Expand Down
Loading

0 comments on commit bff5af4

Please sign in to comment.