Skip to content

Commit

Permalink
refactor: typescript (#112)
Browse files Browse the repository at this point in the history
* refactor: typescript

* test fixes etc

- Refactored to use TypeScript and modern ES/Node.js features.
- Minimum Node.js version is now v16.
- Ships ESM and CJS versions.
- Upgraded package dependencies, in particular using Glob v8.
- Switched to Vite, Vitest, and pnpm.
- API is the same, but some internals changed.
  • Loading branch information
smonn authored Feb 18, 2023
1 parent b3a44f9 commit ab4b7b3
Show file tree
Hide file tree
Showing 42 changed files with 3,893 additions and 8,967 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
coverage
dist
node_modules
.eslintrc.cjs
9 changes: 0 additions & 9 deletions .eslintrc

This file was deleted.

16 changes: 16 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module.exports = {
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
'plugin:@typescript-eslint/strict',
'plugin:prettier/recommended'
],
parser: '@typescript-eslint/parser',
parserOptions: {
project: ['./tsconfig.json'],
tsconfigRootDir: __dirname
},
plugins: ['@typescript-eslint'],
root: true
}
12 changes: 6 additions & 6 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
version: 2
updates:
- package-ecosystem: 'npm'
directory: '/'
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: 'weekly'
interval: "weekly"
open-pull-requests-limit: 20

- package-ecosystem: 'github-actions'
directory: '/'
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: 'weekly'
interval: "weekly"
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
name: Continuous Deployment
name: cd

on:
release:
types:
- published
on: workflow_dispatch

jobs:
build:
Expand All @@ -15,29 +12,32 @@ jobs:
with:
ref: ${{ github.event.release.target_commitish }}

- name: Setup Node.js LTS
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: latest

- name: Setup Node.js 16
uses: actions/setup-node@v3
with:
node-version: 'lts/*'
node-version: 16
cache: 'pnpm'

- name: Install dependencies
uses: bahmutov/npm-install@v1
run: pnpm install --frozen-lockfile

- name: Configure git
run: |
git config --global user.name "GitHub CD bot"
git config --global user.email "[email protected]"
git config --global user.name "${{ secrets.GIT_NAME }}"
git config --global user.email "${{ secrets.GIT_EMAIL }}"
- name: Update version in package.json
run: npm version ${{ github.event.release.tag_name }} --allow-same-version
run: pnpm version ${{ github.event.release.tag_name }} --allow-same-version

- name: Configure npm client for publish
run: npm config set '//registry.npmjs.org/:_authToken' "${{ secrets.NPM_TOKEN }}"

- name: Build
run: npm run build
run: pnpm config set '//registry.npmjs.org/:_authToken' "${{ secrets.NPM_TOKEN }}"

- name: Publish package to npmjs.com
run: npm publish
run: pnpm publish --no-git-checks
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

Expand Down
36 changes: 36 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: ci

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build:
name: Run CI checks

runs-on: ubuntu-latest

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

- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: latest

- name: Use Node 18
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'pnpm'

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Run CI suite
run: pnpm ci
36 changes: 0 additions & 36 deletions .github/workflows/continuous-integration.yml

This file was deleted.

4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

pnpm lint-staged
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"testing.automaticallyOpenPeekView": "never",
"typescript.tsdk": "node_modules/typescript/lib"
}
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog

## 3.0.0

- Refactored to use TypeScript and modern ES/Node.js features.
- Minimum Node.js version is now v16.
- Ships ESM and CJS versions.
- Upgraded package dependencies, in particular using Glob v8.
- Switched to Vite, Vitest, and pnpm.
- API is the same, but some internals changed.

## 2.0.0

- Updated package dependencies.
Expand Down
13 changes: 0 additions & 13 deletions babel.config.json

This file was deleted.

Loading

0 comments on commit ab4b7b3

Please sign in to comment.