Skip to content

Commit

Permalink
feat!: upgrade to typescript 5 (#524)
Browse files Browse the repository at this point in the history
  • Loading branch information
homura authored Jul 21, 2023
1 parent 28756be commit 3af1f4c
Show file tree
Hide file tree
Showing 139 changed files with 28,475 additions and 32,460 deletions.
68 changes: 29 additions & 39 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,24 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- uses: actions/cache@v1
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
- uses: pnpm/action-setup@v2
with:
version: 8.6.1
- uses: actions/setup-node@v3
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
cache: "pnpm"

- name: Install project dependencies and build
run: |
yarn --ignore-engines --frozen-lockfile
yarn build
pnpm install --frozen-lockfile
pnpm run build
git diff --exit-code
- name: Prettier check
run: yarn lint
run: pnpm run lint

- name: Run test with coverage
run: yarn test-coverage
run: pnpm run test-coverage

- uses: codecov/codecov-action@v3
with:
Expand All @@ -40,44 +35,39 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v1
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
- uses: pnpm/action-setup@v2
with:
version: 8.6.1
- uses: actions/setup-node@v3
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
cache: "pnpm"

- name: Install project dependencies and build
run: |
yarn --ignore-engines --frozen-lockfile
yarn build
docker-compose -f ./packages/e2e-test/docker/docker-compose.yml build
pnpm install --frozen-lockfile
pnpm run build
# TODO uncomment me
# docker-compose -f ./packages/e2e-test/docker/docker-compose.yml build
- name: e2e test
run: yarn e2e-test
run: pnpm run e2e-test

lint-staged:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v1
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
- uses: pnpm/action-setup@v2
with:
version: 8.6.1
- uses: actions/setup-node@v3
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
cache: "pnpm"

- name: Install project dependencies and build
run: |
yarn --ignore-engines --frozen-lockfile
yarn build
pnpm install --frozen-lockfile
pnpm run build
- name: Get changed files
uses: tj-actions/[email protected]
id: changed-files
Expand All @@ -91,4 +81,4 @@ jobs:
- name: Run lint for changed files
if: ${{ steps.changed-files.outputs.all_changed_files != '' }}
run: |
yarn eslint -c .eslintrc.next.js ${{ steps.changed-files.outputs.all_changed_files }}
npx eslint -c .eslintrc.next.js ${{ steps.changed-files.outputs.all_changed_files }}
79 changes: 35 additions & 44 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,77 +15,65 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- uses: actions/cache@v1
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
- uses: pnpm/action-setup@v2
with:
version: 8.6.1
- uses: actions/setup-node@v3
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
cache: 'pnpm'

- name: Install project dependencies and build
run: |
yarn --ignore-engines --frozen-lockfile
yarn build
pnpm install --frozen-lockfile
pnpm run build
git diff --exit-code
- name: Prettier check
run: yarn lint
run: pnpm run lint

- name: Run test with coverage
run: yarn test-coverage
run: pnpm run test-coverage

- uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
files: ./coverage/cobertura-coverage.xml
verbose: true # optional (default = false)

test-e2e:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v1
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
- uses: pnpm/action-setup@v2
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
version: 8.6.1
- uses: actions/setup-node@v3
with:
cache: 'pnpm'

- name: Install project dependencies and build
run: |
yarn --ignore-engines --frozen-lockfile
yarn build
pnpm install --frozen-lockfile
pnpm run build
- name: e2e test
run: yarn e2e-test
run: pnpm run e2e-test

lint-staged:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v1
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
- uses: pnpm/action-setup@v2
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
version: 8.6.1
- uses: actions/setup-node@v3
with:
cache: 'pnpm'

- name: Install project dependencies and build
run: |
yarn --ignore-engines --frozen-lockfile
yarn build
pnpm install --frozen-lockfile
pnpm run build
- name: Get changed files
uses: tj-actions/[email protected]
id: changed-files
Expand All @@ -99,18 +87,22 @@ jobs:
- name: Run lint for changed files
if: ${{ steps.changed-files.outputs.all_changed_files != '' }}
run: |
yarn eslint -c .eslintrc.next.js ${{ steps.changed-files.outputs.all_changed_files }}
npx eslint -c .eslintrc.next.js ${{ steps.changed-files.outputs.all_changed_files }}
publish:
needs: [test-unit, test-e2e, lint-staged]
name: Publish
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- uses: pnpm/action-setup@v2
with:
version: 8.6.1
- name: Setup Node ${{ matrix.node_version }}
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: 16
cache: 'pnpm'
registry-url: "https://registry.npmjs.org"
- name: Git Identity
run: |
Expand All @@ -120,7 +112,7 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install
run: yarn --frozen-lockfile --frozen-lockfile
run: pnpm install --frozen-lockfile
# Define ${CURRENT_VERSION}
- name: Set Current Version
run: |
Expand Down Expand Up @@ -185,9 +177,8 @@ jobs:
- name: Publish
if: steps.tag_check.outputs.exists_tag == 'false'
run: |
yarn run build
yarn run build-release
yarn lerna publish from-package --yes --dist-tag $([ $PRERELEASE == 'true' ] && echo 'next' || echo 'latest')
pnpm run build
npx lerna publish from-package --yes --dist-tag $([ $PRERELEASE == 'true' ] && echo 'next' || echo 'latest')
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -125,4 +125,4 @@ experiment/*/lib
# IDE or environment specific files
.idea
.parcel-cache
.DS_Store
.DS_Store
2 changes: 1 addition & 1 deletion .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn commitlint --edit $1
npx commitlint --edit $1
npx lint-staged
2 changes: 1 addition & 1 deletion .husky/pre-push
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn run lint
npm run lint
2 changes: 1 addition & 1 deletion DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## Publish

1. [Local] Checkout release branch: `git checkout v<version>` or `git checkout next/v<version>`
2. [Local] Run `yarn run versionup` or `yarn run versionup:prerelease`
2. [Local] Run `npm run versionup` or `npm run versionup:prerelease`
- Update CHANGELOG.md and `package.json`'s `version`, and `lerna.json`'s `version`
- It does not git tag
3. [Local] Submit to Release Pull Request
Expand Down
16 changes: 7 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,42 +34,40 @@ we have provided some use cases for Lumos, such as interactions with MetaMask, t
### Requirements

- [Node.js](https://nodejs.org)
- [Yarn](https://yarnpkg.com/)
- [node-gyp](https://github.com/nodejs/node-gyp)
- [pnpm](https://pnpm.io)

```bash
sudo apt-get update
sudo apt install nodejs
npm install --global yarn
sudo apt install build-essential
npm install -g pnpm
```

### Build

```bash
yarn run build
pnpm run build
```

### Test (ava)

```bash
yarn run test
pnpm run test
```

### Test Coverage (c8)

```bash
yarn run test-coverage
pnpm run test-coverage
```

### Format & Lint

```bash
yarn run lint
pnpm run lint
```

### Clean

```bash
yarn run clean
pnpm run clean
```
1 change: 1 addition & 0 deletions assets/readme-typedoc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Here is the API documentation of Lumos. It is generated by [TypeDoc](https://typedoc.org/).
3 changes: 3 additions & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ const scopeEnumValues = [
"website",
"codec",
"debugger",
"utils",
"runner",
"e2e-test",
];
const Configuration = {
extends: ["@commitlint/config-conventional"],
Expand Down
9 changes: 4 additions & 5 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,14 @@
```sh
git clone https://github.com/ckb-js/lumos.git
cd lumos
yarn
yarn build
yarn build-release
pnpm install
pnpm run build
```

### Check if the build is working

```
yarn ts-node examples/config-manager.ts
```sh
npx ts-node misc/config-manager.ts
```

## Online Preview
Expand Down
4 changes: 2 additions & 2 deletions examples/cardano-lock-namiwallet/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"private": true,
"name": "@lumos-examples/cardano-lock-namiwallet",
"version": "0.20.0-alpha.0",
"version": "0.20.0",
"description": "",
"main": "index.js",
"scripts": {
Expand All @@ -12,7 +12,7 @@
"author": "",
"license": "MIT",
"dependencies": {
"@ckb-lumos/lumos": "0.20.0-alpha.1",
"@ckb-lumos/lumos": "0.20.0",
"@emurgo/cardano-message-signing-asmjs": "^1.0.1",
"@emurgo/cardano-serialization-lib-asmjs": "^10.0.4",
"@types/react": "^18.0.25",
Expand Down
Loading

1 comment on commit 3af1f4c

@vercel
Copy link

@vercel vercel bot commented on 3af1f4c Jul 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.