Skip to content

Commit 8faad07

Browse files
authored
Merge pull request #5 from MeshJS/cip-113-contract
chore: git workflow and bump version
2 parents cde3c9c + b5a7e27 commit 8faad07

File tree

5 files changed

+65
-12
lines changed

5 files changed

+65
-12
lines changed

.eslintrc.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"parser": "@typescript-eslint/parser",
3+
"plugins": ["@typescript-eslint"],
4+
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
5+
"env": {
6+
"node": true,
7+
"jest": true
8+
},
9+
"rules": {
10+
"@typescript-eslint/no-explicit-any": "off",
11+
"@typescript-eslint/no-unused-vars": ["warn", { "argsIgnorePattern": "^_" }],
12+
"@typescript-eslint/no-var-requires": "off",
13+
"no-constant-condition": "warn"
14+
}
15+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Lint, Test, and Build
2+
3+
on:
4+
release:
5+
types: [created]
6+
pull_request:
7+
branches:
8+
- main
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
node-version: [20]
16+
steps:
17+
- uses: actions/checkout@v4
18+
- name: Use Node.js ${{ matrix.node-version }}
19+
uses: actions/setup-node@v4
20+
with:
21+
node-version: ${{ matrix.node-version }}
22+
- name: Install dependencies
23+
run: npm install
24+
- name: Lint
25+
run: npm run lint
26+
- name: Test
27+
run: npm run test
28+
- name: Build
29+
run: npm run build

.github/workflows/publish.yml

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
2-
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
3-
4-
name: Publish Mesh SDK Contract
1+
name: Publish Package
52

63
on:
74
pull_request:
@@ -13,13 +10,16 @@ on:
1310
jobs:
1411
build:
1512
runs-on: ubuntu-latest
13+
if: github.event.pull_request.merged == true
1614
strategy:
1715
matrix:
1816
node-version: [20]
1917
steps:
2018
- uses: actions/checkout@v4
2119
- name: Use Node.js ${{ matrix.node-version }}
2220
uses: actions/setup-node@v4
21+
with:
22+
node-version: ${{ matrix.node-version }}
2323
- name: Install dependencies
2424
run: npm install
2525
- name: Lint
@@ -29,6 +29,7 @@ jobs:
2929

3030
check-version:
3131
runs-on: ubuntu-latest
32+
needs: [build]
3233
if: github.event.pull_request.merged == true
3334
outputs:
3435
version-updated: ${{ steps.compare-versions.outputs.version-updated }}
@@ -38,7 +39,7 @@ jobs:
3839
with:
3940
ref: ${{ github.event.pull_request.base.sha }}
4041

41-
- name: Get package version from main branch before merge
42+
- name: Get version before merge
4243
id: pre-merge-version
4344
run: |
4445
PRE_MERGE_VERSION=$(node -p "require('./package.json').version")
@@ -47,9 +48,9 @@ jobs:
4748
- name: Checkout main branch at commit after merge
4849
uses: actions/checkout@v4
4950
with:
50-
ref: "main"
51+
ref: main
5152

52-
- name: Get package version from main branch after merge
53+
- name: Get version after merge
5354
id: post-merge-version
5455
run: |
5556
POST_MERGE_VERSION=$(node -p "require('./package.json').version")
@@ -64,7 +65,7 @@ jobs:
6465
echo "version-updated=false" >> "$GITHUB_OUTPUT"
6566
fi
6667
67-
publish-meshsdk-contract:
68+
publish:
6869
needs: [build, check-version]
6970
if: needs.check-version.outputs.version-updated == 'true'
7071
runs-on: ubuntu-latest
@@ -74,7 +75,8 @@ jobs:
7475
with:
7576
node-version: 20
7677
registry-url: https://registry.npmjs.org/
77-
- run: npm install && npm run build
78+
- run: npm install
79+
- run: npm run build
7880
- run: npm publish --access public
7981
env:
80-
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
82+
NODE_AUTH_TOKEN: ${{ secrets.npm_token }}

jest.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const jestConfig: Config = {
44
clearMocks: true,
55
maxWorkers: 1,
66
testEnvironment: "node",
7-
testMatch: ["**/packages/**/*.test.ts"],
7+
testMatch: ["**/src/**/*.test.ts"],
88
setupFiles: ["dotenv/config"],
99
preset: "ts-jest",
1010
moduleNameMapper: {

package.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@meshsdk/contract",
3-
"version": "1.9.0-beta.87",
3+
"version": "1.9.0-beta.103",
44
"description": "List of open-source smart contracts, complete with documentation, live demos, and end-to-end source code. https://meshjs.dev/smart-contracts",
55
"main": "./dist/index.cjs",
66
"browser": "./dist/index.js",
@@ -28,7 +28,14 @@
2828
"test": "jest"
2929
},
3030
"devDependencies": {
31+
"@types/jest": "^29.5.12",
32+
"@typescript-eslint/eslint-plugin": "^7.1.0",
33+
"@typescript-eslint/parser": "^7.1.0",
34+
"dotenv": "^16.4.5",
3135
"eslint": "^8.57.0",
36+
"jest": "^29.7.0",
37+
"ts-jest": "^29.1.2",
38+
"ts-node": "^10.9.2",
3239
"tsup": "^8.0.2",
3340
"typescript": "^5.3.3"
3441
},

0 commit comments

Comments
 (0)