Skip to content
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
15 changes: 15 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint"],
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
"env": {
"node": true,
"jest": true
},
"rules": {
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-unused-vars": ["warn", { "argsIgnorePattern": "^_" }],
"@typescript-eslint/no-var-requires": "off",
"no-constant-condition": "warn"
}
}
29 changes: 29 additions & 0 deletions .github/workflows/lint-test-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Lint, Test, and Build

on:
release:
types: [created]
pull_request:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20]
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: npm install
- name: Lint
run: npm run lint
- name: Test
run: npm run test
- name: Build
run: npm run build
22 changes: 12 additions & 10 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages

name: Publish Mesh SDK Contract
name: Publish Package

on:
pull_request:
Expand All @@ -13,13 +10,16 @@ on:
jobs:
build:
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true
strategy:
matrix:
node-version: [20]
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: npm install
- name: Lint
Expand All @@ -29,6 +29,7 @@ jobs:

check-version:
runs-on: ubuntu-latest
needs: [build]
if: github.event.pull_request.merged == true
outputs:
version-updated: ${{ steps.compare-versions.outputs.version-updated }}
Expand All @@ -38,7 +39,7 @@ jobs:
with:
ref: ${{ github.event.pull_request.base.sha }}

- name: Get package version from main branch before merge
- name: Get version before merge
id: pre-merge-version
run: |
PRE_MERGE_VERSION=$(node -p "require('./package.json').version")
Expand All @@ -47,9 +48,9 @@ jobs:
- name: Checkout main branch at commit after merge
uses: actions/checkout@v4
with:
ref: "main"
ref: main

- name: Get package version from main branch after merge
- name: Get version after merge
id: post-merge-version
run: |
POST_MERGE_VERSION=$(node -p "require('./package.json').version")
Expand All @@ -64,7 +65,7 @@ jobs:
echo "version-updated=false" >> "$GITHUB_OUTPUT"
fi

publish-meshsdk-contract:
publish:
needs: [build, check-version]
if: needs.check-version.outputs.version-updated == 'true'
runs-on: ubuntu-latest
Expand All @@ -74,7 +75,8 @@ jobs:
with:
node-version: 20
registry-url: https://registry.npmjs.org/
- run: npm install && npm run build
- run: npm install
- run: npm run build
- run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
NODE_AUTH_TOKEN: ${{ secrets.npm_token }}
2 changes: 1 addition & 1 deletion jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const jestConfig: Config = {
clearMocks: true,
maxWorkers: 1,
testEnvironment: "node",
testMatch: ["**/packages/**/*.test.ts"],
testMatch: ["**/src/**/*.test.ts"],
setupFiles: ["dotenv/config"],
preset: "ts-jest",
moduleNameMapper: {
Expand Down
9 changes: 8 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@meshsdk/contract",
"version": "1.9.0-beta.87",
"version": "1.9.0-beta.103",
"description": "List of open-source smart contracts, complete with documentation, live demos, and end-to-end source code. https://meshjs.dev/smart-contracts",
"main": "./dist/index.cjs",
"browser": "./dist/index.js",
Expand Down Expand Up @@ -28,7 +28,14 @@
"test": "jest"
},
"devDependencies": {
"@types/jest": "^29.5.12",
"@typescript-eslint/eslint-plugin": "^7.1.0",
"@typescript-eslint/parser": "^7.1.0",
"dotenv": "^16.4.5",
"eslint": "^8.57.0",
"jest": "^29.7.0",
"ts-jest": "^29.1.2",
"ts-node": "^10.9.2",
"tsup": "^8.0.2",
"typescript": "^5.3.3"
},
Expand Down
Loading