Skip to content

Commit

Permalink
Move to NPM (#46)
Browse files Browse the repository at this point in the history
* [move-to-npm] new publish script

* [move-to-npm] add GitHub forks
  • Loading branch information
Cast0001 authored Dec 11, 2023
1 parent 5a05b47 commit a54b5f2
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 12 deletions.
13 changes: 4 additions & 9 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,8 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '18'
registry-url: 'https://npm.pkg.github.com'

- name: Setup git user
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
node-version: '18.16.1'
registry-url: 'https://registry.npmjs.org/'

- name: Update package.json version
run: npm version --tag=latest ${{ github.event.release.tag_name }}
Expand All @@ -32,6 +27,6 @@ jobs:
run: npm run build

- name: Publish to GitHub Packages
run: npm publish
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.GH_PACKAGES_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.idea
.turbo
.vscode
.rollup.cache
tsconfig.tsbuildinfo
Expand Down
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@

The official SDK designed for effortless data retrieval from the StakeWise platform. This SDK provides a streamlined interface over GraphQL requests and contract interactions.

![Version](https://img.shields.io/badge/version-1.5.1-blue)
![Version](https://img.shields.io/npm/v/@stakewise/v3-sdk)
![Unit Tests](https://github.com/stakewise/v3-sdk/actions/workflows/unit-tests.yml/badge.svg)
![GitHub issues](https://img.shields.io/github/issues-raw/stakewise/v3-sdk)
![GitHub pull requests](https://img.shields.io/github/issues-pr-raw/stakewise/v3-sdk)
![GitHub forks](https://img.shields.io/github/forks/stakewise/v3-sdk)
![Ethers version](https://img.shields.io/badge/ethers-6.7.1-purple)

## Table of Contents
Expand Down Expand Up @@ -48,6 +49,19 @@ You can do something similar for other builders as well
npm i @stakewise/v3-sdk
```

If your builder doesn't support `.graphql` files, then you need to add a plugin. For example, for webpack this would be graphql-tag.
If you are using another builder, you can easily find GQL support plugins

```ts
webpackConfig.module.rules.push(
{
test: /\.(graphql|gql)$/,
loader: 'graphql-tag/loader',
exclude: /node_modules/,
}
)
```

Create SDK instance

```typescript
Expand Down
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.2.2",
"version": "1.0.1",
"sideEffects": false,
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand All @@ -8,7 +8,7 @@
"typings": "dist/index.d.ts",
"module": "dist/index.esm.js",
"description": "StakeWise v3 SDK",
"homepage": "https://app.stakewise.io",
"homepage": "https://github.com/stakewise/v3-sdk",
"scripts": {
"test": "jest --clearCache && jest --onlyChanged",
"prepare": "npm run typechain && npm run graphql && husky install",
Expand All @@ -17,6 +17,9 @@
"graphql": "graphql-codegen && ts-node -O '{\"module\": \"commonjs\"}' ./scripts/generateGraphqlExports",
"rollup": "rollup --config rollup.config.js --bundleConfigAsCjs"
},
"files": [
"dist/"
],
"exports": {
".": "./dist/index.js"
},
Expand Down

0 comments on commit a54b5f2

Please sign in to comment.