Skip to content

Commit

Permalink
feat!: upgrade to ESM
Browse files Browse the repository at this point in the history
Also migrated to oxlint and vitest
  • Loading branch information
jlopezcur committed Nov 6, 2024
1 parent 4b14288 commit 131b171
Show file tree
Hide file tree
Showing 17 changed files with 5,670 additions and 9,635 deletions.
15 changes: 0 additions & 15 deletions .eslintrc.json

This file was deleted.

70 changes: 12 additions & 58 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,92 +1,46 @@
name: ci

permissions:
contents: read
id-token: write

on:
push:
branches: ['master']
pull_request:
branches: ['master']

# Allows to run this workflow manually from the Actions tab
workflow_dispatch:

env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout repo
- name: Checkout 🛎️
uses: actions/checkout@v4

- name: Cache node modules
id: cache-npm
uses: actions/cache@v4
env:
cache-name: cache-node-modules
with:
path: |
node_modules
~/.npm
key: ${{ runner.os }}-prepare-${{ env.cache-name }}-${{ github.sha }}
- name: Setup Node.js ⚙️ - Cache dependencies ⚡ - Install dependencies 🔧
uses: ./.github/workflows/setup-node

- name: Set Node v20
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
registry-url: https://registry.npmjs.org/

- name: Install dependencies
run: npm ci
- name: Generate dist
run: npm run build

test:
needs: [build]

runs-on: ubuntu-latest

steps:
- name: Checkout repo
- name: Checkout 🛎️
uses: actions/checkout@v4

- name: Use node modules cache
id: cache-npm
uses: actions/cache@v4
env:
cache-name: cache-node-modules
with:
path: |
node_modules
~/.npm
key: ${{ runner.os }}-prepare-${{ env.cache-name }}-${{ github.sha }}
- name: Setup Node.js ⚙️ - Cache dependencies ⚡ - Install dependencies 🔧
uses: ./.github/workflows/setup-node

- name: Run tests
run: npm t
run: npm run test -- --coverage

lint:
needs: [build]

runs-on: ubuntu-latest

steps:
- name: Checkout repo
- name: Checkout 🛎️
uses: actions/checkout@v4

- name: Use node modules cache
id: cache-npm
uses: actions/cache@v4
env:
cache-name: cache-node-modules
with:
path: |
node_modules
~/.npm
key: ${{ runner.os }}-prepare-${{ env.cache-name }}-${{ github.sha }}
- name: Setup Node.js ⚙️ - Cache dependencies ⚡ - Install dependencies 🔧
uses: ./.github/workflows/setup-node

- name: Run linter
run: npm run lint
78 changes: 14 additions & 64 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
name: release

on:
workflow_dispatch:
inputs:
Expand Down Expand Up @@ -28,72 +27,38 @@ env:
jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout repo
- name: Checkout 🛎️
uses: actions/checkout@v4

- name: Cache node modules
id: cache-npm
uses: actions/cache@v4
env:
cache-name: cache-node-modules
with:
path: |
node_modules
~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.sha }}

- name: Set Node v20
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
registry-url: https://registry.npmjs.org/
- name: Setup Node.js ⚙️ - Cache dependencies ⚡ - Install dependencies 🔧
uses: ./.github/workflows/setup-node

- name: Install dependencies
run: npm ci
- name: Generate dist
run: npm run build

test:
needs: [build]
runs-on: ubuntu-latest

steps:
- name: Checkout repo
- name: Checkout 🛎️
uses: actions/checkout@v4

- name: Use node modules cache
id: cache-npm
uses: actions/cache@v4
env:
cache-name: cache-node-modules
with:
path: |
node_modules
~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.sha }}
- name: Setup Node.js ⚙️ - Cache dependencies ⚡ - Install dependencies 🔧
uses: ./.github/workflows/setup-node

- name: Run tests
run: npm t

lint:
needs: [build]
runs-on: ubuntu-latest

steps:
- name: Checkout repo
- name: Checkout 🛎️
uses: actions/checkout@v4

- name: Use node modules cache
id: cache-npm
uses: actions/cache@v4
env:
cache-name: cache-node-modules
with:
path: |
node_modules
~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.sha }}
- name: Setup Node.js ⚙️ - Cache dependencies ⚡ - Install dependencies 🔧
uses: ./.github/workflows/setup-node

- name: Run linter
run: npm run lint
Expand All @@ -102,28 +67,13 @@ jobs:
needs: [lint, test]
runs-on: ubuntu-latest
steps:
- name: Checkout repo
- name: Checkout 🛎️
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set node v18
uses: actions/setup-node@v4
with:
node-version: 18
cache: 'npm'
registry-url: https://registry.npmjs.org/

- name: Use node modules cache
id: cache-npm
uses: actions/cache@v4
env:
cache-name: cache-node-modules
with:
path: |
node_modules
~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.sha }}
- name: Setup Node.js ⚙️ - Cache dependencies ⚡ - Install dependencies 🔧
uses: ./.github/workflows/setup-node

- name: Setup Git config
run: |
Expand Down
21 changes: 21 additions & 0 deletions .github/workflows/setup-node/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: setup-node
description: 'Setup Node.js ⚙️ - Cache dependencies ⚡ - Install dependencies 🔧'
runs:
using: 'composite'
steps:
- name: Setup Node.js ⚙️
uses: actions/setup-node@v4
with:
node-version: 22

- name: Cache dependencies ⚡
id: cache_dependencies
uses: actions/cache@v4
with:
path: node_modules
key: node-modules-${{ hashFiles('package-lock.json') }}

- name: Install dependencies 🔧
shell: bash
if: steps.cache_dependencies.outputs.cache-hit != 'true'
run: npm ci
3 changes: 3 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"singleQuote": true
}
14 changes: 0 additions & 14 deletions jest.config.ts

This file was deleted.

10 changes: 10 additions & 0 deletions oxlintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"env": {
"browser": true
},
"rules": {
"no-inner-declaration": "error",
"no-console": "error",
"no-cycle": "error"
}
}
Loading

0 comments on commit 131b171

Please sign in to comment.