Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

switch from webpack to swc #2

Merged
merged 7 commits into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 0 additions & 32 deletions .github/workflows/node.js.yml

This file was deleted.

49 changes: 49 additions & 0 deletions .github/workflows/pnpm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs

name: Node.js CI

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

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [lts/*, latest]

steps:
- uses: actions/checkout@v3

- uses: pnpm/action-setup@v2
name: Install pnpm
with:
version: 8
run_install: false

- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV

- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-

- name: Install dependencies
run: pnpm install

- run: pnpm run build

- run: pnpm test

9 changes: 9 additions & 0 deletions .swcrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"$schema": "http://json.schemastore.org/swcrc",
"jsc": {
"parser": {
"syntax": "typescript",
"tsx": true
}
}
}
22 changes: 22 additions & 0 deletions .swcrc-cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"$schema": "https://json.schemastore.org/swcrc",
"module": {
"type": "commonjs",
"strict": false,
"strictMode": true,
"lazy": false,
"noInterop": false
},
"jsc": {
"transform": {
"legacyDecorator": true,
"decoratorMetadata": true
},
"target": "es5",
"minify": {
"compress": true,
"mangle": true
}
},
"sourceMaps": true
}
13 changes: 13 additions & 0 deletions .swcrc-esm
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"$schema": "http://json.schemastore.org/swcrc",
"module": {
"type": "es6"
},
"jsc": {
"parser": {
"syntax": "typescript",
"tsx": true
}
},
"isModule": true
}
22 changes: 22 additions & 0 deletions .swcrc-umd
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"$schema": "https://json.schemastore.org/swcrc",
"module": {
"type": "umd",
"globals": {
"default": "isoToLanguage"
},
"strict": false,
"strictMode": true,
"lazy": false,
"noInterop": false
},
"jsc": {
"target": "es5",
"loose": false,
"minify": {
"compress": true,
"mangle": true
}
},
"minify": true
}
6 changes: 0 additions & 6 deletions babel.config.js

This file was deleted.

10 changes: 10 additions & 0 deletions bin/clean.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
//!/usr/bin/env node
import fs from 'fs'

//check if the directory exists
if (!fs.existsSync("./lib")) {
console.log("Directory not found... skipping");
process.exit(0);
}

fs.rmdirSync("./lib", {recursive: true});
13 changes: 13 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module.exports = {
extensionsToTreatAsEsm: ['.ts', '.tsx'],
transform: {
'^.+\\.(t|j)sx?$': [
'@swc/jest', {
jsc: {
'parser': { 'syntax': 'typescript' }
}
}
],
},
collectCoverage: true
}
Loading