Skip to content

Commit e1b2934

Browse files
authored
feat: Use SWC (#515)
* feat: update yarn version * feat: rm build files * feat: update sdk-core * feat: udpate sdk package * feat: update * fix: strip leading paths * feat: complete swc build * feat: update lint configs * feat: fix lint * feat: use vitest for testing * feat: update pr-any workflow * feat: upgrade modules * feat: add publish
1 parent 2b8c248 commit e1b2934

File tree

155 files changed

+7183
-14118
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

155 files changed

+7183
-14118
lines changed

.123trigger

-8
This file was deleted.

.cjsswcrc

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"$schema": "https://json.schemastore.org/swcrc",
3+
"exclude": [".*\\.test.ts$", ".*\\.spec.ts$"],
4+
"jsc": {
5+
"parser": {
6+
"syntax": "typescript"
7+
},
8+
"target": "es2021"
9+
},
10+
"module": {
11+
"type": "commonjs"
12+
}
13+
}

.eslintignore

-6
This file was deleted.

.eslintrc.js

-23
This file was deleted.

.esmswcrc

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"$schema": "https://json.schemastore.org/swcrc",
3+
"exclude": [".*\\.test.ts$", ".*\\.spec.ts$"],
4+
"jsc": {
5+
"parser": {
6+
"syntax": "typescript"
7+
},
8+
"target": "esnext"
9+
},
10+
"module": {
11+
"type": "es6"
12+
}
13+
}

.github/workflows/codeql.yml

+52-30
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,74 @@
1-
name: "Code scanning - action"
1+
# For most projects, this workflow file will not need changing; you simply need
2+
# to commit it to your repository.
3+
#
4+
# You may wish to alter this file to override the set of languages analyzed,
5+
# or to provide custom queries or build logic.
6+
#
7+
# ******** NOTE ********
8+
# We have attempted to detect the languages in your repository. Please check
9+
# the `language` matrix defined below to confirm you have the correct set of
10+
# supported CodeQL languages.
11+
#
12+
name: "CodeQL"
213

314
on:
415
push:
16+
branches: [ "master" ]
517
pull_request:
18+
# The branches below must be a subset of the branches above
19+
branches: [ "master" ]
620
schedule:
7-
- cron: '0 19 * * 0'
21+
- cron: '32 2 * * 1'
822

923
jobs:
10-
CodeQL-Build:
11-
12-
# CodeQL runs on ubuntu-latest and windows-latest
24+
analyze:
25+
name: Analyze
1326
runs-on: ubuntu-latest
27+
permissions:
28+
actions: read
29+
contents: read
30+
security-events: write
31+
32+
strategy:
33+
fail-fast: false
34+
matrix:
35+
language: [ 'javascript' ]
36+
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
37+
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
1438

1539
steps:
1640
- name: Checkout repository
17-
uses: actions/checkout@v2
18-
with:
19-
# We must fetch at least the immediate parents so that if this is
20-
# a pull request then we can checkout the head.
21-
fetch-depth: 2
22-
23-
# If this run was triggered by a pull request event, then checkout
24-
# the head of the pull request instead of the merge commit.
25-
- run: git checkout HEAD^2
26-
if: ${{ github.event_name == 'pull_request' }}
27-
41+
uses: actions/checkout@v4
42+
2843
# Initializes the CodeQL tools for scanning.
2944
- name: Initialize CodeQL
30-
uses: github/codeql-action/init@v1
31-
# Override language selection by uncommenting this and choosing your languages
32-
# with:
33-
# languages: go, javascript, csharp, python, cpp, java
45+
uses: github/codeql-action/init@v2
46+
with:
47+
languages: ${{ matrix.language }}
48+
# If you wish to specify custom queries, you can do so here or in a config file.
49+
# By default, queries listed here will override any specified in a config file.
50+
# Prefix the list here with "+" to use these queries and those in the config file.
51+
52+
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
53+
# queries: security-extended,security-and-quality
3454

35-
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
55+
56+
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
3657
# If this step fails, then you should remove it and run the build manually (see below)
3758
- name: Autobuild
38-
uses: github/codeql-action/autobuild@v1
59+
uses: github/codeql-action/autobuild@v2
3960

4061
# ℹ️ Command-line programs to run using the OS shell.
41-
# 📚 https://git.io/JvXDl
62+
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
4263

43-
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
44-
# and modify them (or add more) to build your code if your project
45-
# uses a compiled language
64+
# If the Autobuild fails above, remove it and uncomment the following three lines.
65+
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
4666

47-
#- run: |
48-
# make bootstrap
49-
# make release
67+
# - run: |
68+
# echo "Run, Build Application using script"
69+
# ./location_of_script_within_repo/buildscript.sh
5070

5171
- name: Perform CodeQL Analysis
52-
uses: github/codeql-action/analyze@v1
72+
uses: github/codeql-action/analyze@v2
73+
with:
74+
category: "/language:${{matrix.language}}"

.github/workflows/pr-any.yml

+21-27
Original file line numberDiff line numberDiff line change
@@ -3,52 +3,46 @@ on: [pull_request]
33

44
jobs:
55
lint:
6-
name: Linting
6+
name: linting
77
runs-on: ubuntu-latest
8-
strategy:
9-
matrix:
10-
node-version: [16.x]
118
steps:
12-
- uses: actions/checkout@v1
13-
- name: Use Node.js ${{ matrix.node-version }}
14-
uses: actions/setup-node@v1
9+
- uses: actions/checkout@v4
10+
- name: Use Node.js
11+
uses: actions/setup-node@v4
1512
with:
16-
node-version: ${{ matrix.node-version }}
13+
node-version: 18.x
14+
cache: 'yarn'
1715
- name: lint
1816
run: |
19-
yarn install --immutable | grep -v 'YN0013'
17+
yarn --immutable
2018
yarn lint
2119
2220
test:
23-
name: Testing
21+
name: testing
2422
runs-on: ubuntu-latest
25-
strategy:
26-
matrix:
27-
node-version: [16.x]
2823
steps:
29-
- uses: actions/checkout@v1
30-
- name: Use Node.js ${{ matrix.node-version }}
31-
uses: actions/setup-node@v1
24+
- uses: actions/checkout@v4
25+
- name: Use Node.js
26+
uses: actions/setup-node@v4
3227
with:
33-
node-version: ${{ matrix.node-version }}
28+
node-version: 18.x
29+
cache: 'yarn'
3430
- name: test
3531
run: |
36-
yarn install --immutable | grep -v 'YN0013'
32+
yarn --immutable
3733
yarn test
3834
3935
build_code:
40-
name: Build Code
36+
name: build Code
4137
runs-on: ubuntu-latest
42-
strategy:
43-
matrix:
44-
node-version: [16.x]
4538
steps:
46-
- uses: actions/checkout@v1
47-
- name: Use Node.js ${{ matrix.node-version }}
48-
uses: actions/setup-node@v1
39+
- uses: actions/checkout@v4
40+
- name: Use Node.js
41+
uses: actions/setup-node@v4
4942
with:
50-
node-version: ${{ matrix.node-version }}
43+
node-version: 18.x
44+
calche: 'yarn'
5145
- name: build
5246
run: |
53-
yarn install --immutable | grep -v 'YN0013'
47+
yarn --immutable
5448
yarn build

.github/workflows/publish.yml

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Publish
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
8+
jobs:
9+
publish:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
with:
14+
submodules: recursive
15+
- name: Use Node.js
16+
uses: actions/setup-node@v4
17+
with:
18+
node-version: 18.x
19+
cache: 'yarn'
20+
registry-url: https://registry.npmjs.org/
21+
- run: yarn --immutable
22+
- run: yarn build
23+
24+
# version containing a hyphen, publish as beta, i.e: 1.0.0-1
25+
- run: |
26+
if npm pkg get version --workspace @acala-network/sdk-core | jq '."@acala-network/sdk-core "' | grep '-'; then TAG='--tag beta'; fi
27+
echo "NPM_TAG=$TAG" >> $GITHUB_ENV
28+
29+
# Writes token to .yarnrc.yml. If written directly in .yarnrc.yml, it will cause an error
30+
- run: |
31+
echo npmAuthToken: "\${NPM_AUTH_TOKEN}" >> ./.yarnrc.yml
32+
33+
- name: Publish @acala-network/sdk-core
34+
run: yarn workspace @acala-network/sdk-core npm publish --tolerate-republish --access public ${{ env.NPM_TAG }}
35+
env:
36+
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
37+
38+
- name: Publish @acala-network/sdk
39+
run: yarn workspace @acala-network/sdk npm publish --tolerate-republish --access public ${{ env.NPM_TAG }}
40+
env:
41+
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
42+
43+
- name: Publish @acala-network/sdk-homa
44+
run: yarn workspace @acala-network/sdk-homa npm publish --tolerate-republish --access public ${{ env.NPM_TAG }}
45+
env:
46+
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
47+
48+
- name: Publish @acala-network/sdk-loan
49+
run: yarn workspace @acala-network/sdk-loan npm publish --tolerate-republish --access public ${{ env.NPM_TAG }}
50+
env:
51+
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
52+
53+
- name: Publish @acala-network/sdk-payment
54+
run: yarn workspace @acala-network/chopsticks-testing npm publish --tolerate-republish --access public ${{ env.NPM_TAG }}
55+
env:
56+
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
57+
58+
- name: Publish @acala-network/sdk-swap
59+
run: yarn workspace @acala-network/sdk-swap npm publish --tolerate-republish --access public ${{ env.NPM_TAG }}
60+
env:
61+
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
62+
63+
- name: Publish @acala-network/wormhole-protal
64+
run: yarn workspace @acala-network/wormhole-protal npm publish --tolerate-republish --access public ${{ env.NPM_TAG }}
65+
env:
66+
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
67+
68+
- run: |
69+
git checkout ./.yarnrc.yml

.github/workflows/push-master.yml

-34
This file was deleted.

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ typings/
6363
.npmrc
6464

6565
build/
66+
dist/
6667

6768
/.yarn/cache
6869
/.yarn/versions

0 commit comments

Comments
 (0)