Skip to content

Commit 7a1ad61

Browse files
committed
chore: update oclif lib and add tests
1 parent 3b91104 commit 7a1ad61

38 files changed

+10653
-23200
lines changed

.eslintrc.js

Lines changed: 0 additions & 12 deletions
This file was deleted.

.github/CODEOWNERS

Lines changed: 0 additions & 6 deletions
This file was deleted.

.github/workflows/main.yml

Lines changed: 0 additions & 34 deletions
This file was deleted.

.github/workflows/onPushToMain.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: version, tag and github release
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
jobs:
8+
release:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
- uses: actions/setup-node@v4
13+
- name: Check if version already exists
14+
id: version-check
15+
run: |
16+
package_version=$(node -p "require('./package.json').version")
17+
exists=$(gh api repos/${{ github.repository }}/releases/tags/v$package_version >/dev/null 2>&1 && echo "true" || echo "")
18+
19+
if [ -n "$exists" ];
20+
then
21+
echo "Version v$package_version already exists"
22+
echo "::warning file=package.json,line=1::Version v$package_version already exists - no release will be created. If you want to create a new release, please update the version in package.json and push again."
23+
echo "skipped=true" >> $GITHUB_OUTPUT
24+
else
25+
echo "Version v$package_version does not exist. Creating release..."
26+
echo "skipped=false" >> $GITHUB_OUTPUT
27+
echo "tag=v$package_version" >> $GITHUB_OUTPUT
28+
fi
29+
env:
30+
GH_TOKEN: ${{ secrets.GH_TOKEN }}
31+
- name: Setup git
32+
if: ${{ steps.version-check.outputs.skipped == 'false' }}
33+
run: |
34+
git config --global user.email ${{ secrets.GH_EMAIL }}
35+
git config --global user.name ${{ secrets.GH_USERNAME }}
36+
- name: Generate oclif README
37+
if: ${{ steps.version-check.outputs.skipped == 'false' }}
38+
id: oclif-readme
39+
run: |
40+
npm install
41+
npm exec oclif readme
42+
if [ -n "$(git status --porcelain)" ]; then
43+
git add .
44+
git commit -am "chore: update README.md"
45+
git push -u origin ${{ github.ref_name }}
46+
fi
47+
- name: Create Github Release
48+
uses: ncipollo/release-action@2c591bcc8ecdcd2db72b97d6147f871fcd833ba5
49+
if: ${{ steps.version-check.outputs.skipped == 'false' }}
50+
with:
51+
name: ${{ steps.version-check.outputs.tag }}
52+
tag: ${{ steps.version-check.outputs.tag }}
53+
commit: ${{ github.ref_name }}
54+
token: ${{ secrets.GH_TOKEN }}
55+
skipIfReleaseExists: true

.github/workflows/onRelease.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: publish
2+
3+
on:
4+
release:
5+
types: [released]
6+
7+
jobs:
8+
publish:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
- uses: actions/setup-node@v4
13+
with:
14+
node-version: latest
15+
- run: npm install
16+
- run: npm run build
17+
- run: npm run prepack
18+
- uses: JS-DevTools/npm-publish@19c28f1ef146469e409470805ea4279d47c3d35c
19+
with:
20+
token: ${{ secrets.NPM_TOKEN }}
21+
- run: npm run postpack

.github/workflows/test.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: tests
2+
on:
3+
push:
4+
branches-ignore: [main]
5+
pull_request:
6+
branches:
7+
- '**'
8+
workflow_dispatch:
9+
10+
jobs:
11+
unit-tests:
12+
strategy:
13+
matrix:
14+
os: ['ubuntu-latest', 'windows-latest']
15+
node_version: [lts/-1, lts/*, latest]
16+
fail-fast: false
17+
runs-on: ${{ matrix.os }}
18+
steps:
19+
- uses: actions/checkout@v4
20+
- uses: actions/setup-node@v4
21+
with:
22+
node-version: ${{ matrix.node_version }}
23+
cache: npm
24+
- run: npm install
25+
- run: npm run lint
26+
- run: npm run build
27+
- run: npm run test

.gitignore

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
1-
*.log
2-
.DS_Store
3-
node_modules
4-
dist
5-
lib
1+
*-debug.log
2+
*-error.log
3+
**/.DS_Store
4+
/.idea
5+
/dist
6+
/tmp
7+
/node_modules
8+
oclif.manifest.json
9+
10+
11+
12+
yarn.lock
13+
pnpm-lock.yaml
14+

.mocharc.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"require": [
3+
"ts-node/register"
4+
],
5+
"watch-extensions": [
6+
"ts"
7+
],
8+
"recursive": true,
9+
"reporter": "spec",
10+
"timeout": 60000
11+
}

.prettierrc.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"@oclif/prettier-config"

.vscode/launch.json

Lines changed: 70 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,85 @@
22
"version": "0.2.0",
33
"configurations": [
44
{
5+
"name": "Test",
56
"type": "node",
67
"request": "launch",
7-
"name": "Deploy send-many-memo contract",
8-
"preLaunchTask": "npm: build",
8+
"runtimeArgs": [
9+
"${workspaceRoot}/node_modules/.bin/mocha",
10+
"--forbid-only",
11+
"test/**/*.test.ts",
12+
// "--grep", "runs send-many mainnet"
13+
],
14+
},
15+
{
16+
"type": "node",
17+
"request": "launch",
18+
"name": "deploy-contract send-many-memo testnet",
19+
"skipFiles": ["<node_internals>/**"],
20+
"program": "${workspaceFolder}/bin/dev.js",
21+
"args": [
22+
"deploy-contract",
23+
"send-many-memo",
24+
"-n=testnet",
25+
"-k=00000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF",
26+
],
27+
},
28+
{
29+
"type": "node",
30+
"request": "launch",
31+
"name": "deploy-contract send-many-memo mainnet",
32+
"skipFiles": ["<node_internals>/**"],
33+
"program": "${workspaceFolder}/bin/dev.js",
34+
"args": [
35+
"deploy-contract",
36+
"send-many-memo",
37+
"-n=mainnet",
38+
"-k=00000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF",
39+
],
40+
},
41+
{
42+
"type": "node",
43+
"request": "launch",
44+
"name": "send-many-memo testnet",
45+
"skipFiles": ["<node_internals>/**"],
46+
"program": "${workspaceFolder}/bin/dev.js",
47+
"args": [
48+
"send-many-memo",
49+
"STADMRP577SC3MCNP7T3PRSTZBJ75FJ59JGABZTW,1,hello",
50+
"ST2WPFYAW85A0YK9ACJR8JGWPM19VWYF90J8P5ZTH,5,memo2",
51+
"--jsonOutput",
52+
"-n=testnet",
53+
"-k=00000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF",
54+
],
55+
},
56+
{
57+
"type": "node",
58+
"request": "launch",
59+
"name": "send-many-memo mainnet",
60+
"skipFiles": ["<node_internals>/**"],
61+
"program": "${workspaceFolder}/bin/dev.js",
962
"args": [
10-
"${workspaceFolder}/src/start.ts",
11-
"deploy-contract", "send-many-memo",
12-
"-n=testnet",
13-
"--broadcast",
14-
"-k=<YOUR_PRIVATE_KEY>",
63+
"send-many-memo",
64+
"SP16MQDBJB2BF21PJGX72R5XA1C32MY747ZSAR1QY,1,hello",
65+
"SP2TA4FGB43WVAS8MVS6YCWTSN2BZNQ1ASGEAKSDD,5,memo2",
66+
"--jsonOutput",
67+
"-n=mainnet",
68+
"-k=00000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF",
1569
],
16-
"outputCapture": "std",
1770
},
1871
{
1972
"type": "node",
2073
"request": "launch",
21-
"name": "Perform send-many-memo contract-call",
22-
"preLaunchTask": "npm: build",
74+
"name": "send-many-memo-safe testnet",
75+
"skipFiles": ["<node_internals>/**"],
76+
"program": "${workspaceFolder}/bin/dev.js",
2377
"args": [
24-
"${workspaceFolder}/bin/run",
25-
"send-many-memo", "STADMRP577SC3MCNP7T3PRSTZBJ75FJ59JGABZTW,1,hello", "ST2WPFYAW85A0YK9ACJR8JGWPM19VWYF90J8P5ZTH,5,memo2",
26-
"-n=testnet",
27-
"--broadcast",
28-
"-k=<YOUR_PRIVATE_KEY>",
78+
"send-many-memo-safe",
79+
"ST3F1X4QGV2SM8XD96X45M6RTQXKA1PZJZZCQAB4B,1",
80+
"--jsonOutput",
81+
"-n=testnet",
82+
"-k=00000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF",
2983
],
30-
"outputCapture": "std"
31-
}
84+
},
3285
]
3386
}

0 commit comments

Comments
 (0)