Skip to content
This repository was archived by the owner on Feb 11, 2023. It is now read-only.

Commit d4a6d61

Browse files
authored
Merge pull request #16 from Network-Goods/fix/package_release_bugs
Fix/package release bugs
2 parents 6946310 + 5ff1224 commit d4a6d61

30 files changed

Lines changed: 5024 additions & 1097 deletions

.github/workflows/main.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# This is a basic workflow to help you get started with Actions
2+
3+
name: CI - SDK
4+
5+
env:
6+
GRAPH_URL: ${{ secrets.GRAPH_URL }}
7+
NFT_STORAGE_TOKEN: ${{ secrets.NFT_STORAGE_TOKEN }}
8+
9+
# Controls when the workflow will run
10+
on:
11+
# Triggers the workflow on push or pull request events but only for the main branch
12+
pull_request:
13+
branches: [main]
14+
15+
# Allows you to run this workflow manually from the Actions tab
16+
workflow_dispatch:
17+
18+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
19+
jobs:
20+
# This workflow contains a single job called "build"
21+
build-and-test:
22+
environment: test
23+
# The type of runner that the job will run on
24+
name: Build and test SDK
25+
runs-on: ubuntu-latest
26+
27+
# Steps represent a sequence of tasks that will be executed as part of the job
28+
steps:
29+
- name: "Check out the repo"
30+
uses: "actions/checkout@v3"
31+
32+
- name: "Install Node.js"
33+
uses: "actions/setup-node@v3"
34+
with:
35+
cache: "yarn"
36+
node-version: "16"
37+
38+
- name: "Install the dependencies"
39+
run: "yarn install --immutable"
40+
41+
- name: "Run Jest"
42+
run: "yarn test"

docs/RELEASE.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,31 @@
11
# Release notes
22

3+
## 0.0.12
4+
5+
* JSON assertion
6+
7+
## 0.0.11
8+
9+
* Refactored to use ESM ("type": "module")
10+
* Refactered Mocha to Jest
11+
* Added basic assertions for the exported interface functions
12+
* Updated build scripts for stabler releasing
13+
* Enforce graphclient dependencies
14+
15+
... [Numbers got lost in testing releasing]
16+
## 0.0.6
17+
18+
* Added graphql deps to solve publishing blocker
19+
20+
## 0.0.5
21+
22+
* Added `storeData` to upload Blobs to IPFS for non-metadata data upload
23+
* Added `getData` to retrieve those blobs
24+
* Refactored GraphQL queries to use graphclient generated SDK for better typings
25+
* Updated Graph client and types
26+
* Export ESM module only
27+
* Add allowList property to `HypercertMetaData`
28+
329
## 0.0.4
430

531
* Added `ClaimById` query

jest.config.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/** @type {import('ts-jest').JestConfigWithTsJest} */
2+
export default {
3+
setupFiles: ["./test/setup-tests.ts"],
4+
preset: "ts-jest/presets/js-with-ts-esm", // or other ESM presets,
5+
rootDir: ".",
6+
moduleDirectories: ["node_modules", "src", ".graphclient"],
7+
verbose: false,
8+
resolver: "ts-jest-resolver",
9+
moduleNameMapper: {
10+
"^(\\.{1,2}/.*)\\.js$": "$1",
11+
// ".graphclient/(.*)": "<rootDir>/.graphclient/$1",
12+
// "resources/(.*)": "<rootDir>/resources/$1",
13+
// "types/(.*)": "<rootDir>/src/types/$1",
14+
},
15+
transform: {
16+
// '^.+\\.[tj]sx?$' to process js/ts with `ts-jest`
17+
// '^.+\\.m?[tj]sx?$' to process js/ts/mjs/mts with `ts-jest`
18+
"^.+\\.[tj]sx?$": [
19+
"ts-jest",
20+
{
21+
useESM: true,
22+
},
23+
],
24+
},
25+
};

package.json

Lines changed: 42 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,72 +1,85 @@
11
{
22
"name": "@network-goods/hypercerts-sdk",
3-
"version": "0.0.4",
3+
"version": "0.0.12",
44
"description": "SDK for hypercerts protocol",
55
"repository": "git@github.com:Network-Goods/hypercerts-sdk.git",
66
"author": "Network Goods",
77
"license": "MIT",
8+
"source": "src/index.ts",
89
"typedocMain": "src/index.ts",
9-
"main": "./lib/cjs/src/index.js",
10+
"main": "./lib/index.js",
11+
"types": "./lib/index.d.ts",
1012
"files": [
11-
"lib/**/*"
13+
"lib",
14+
"README.md",
15+
"package.json"
1216
],
1317
"dependencies": {
18+
"@graphprotocol/client-add-source-name": "latest",
19+
"@graphprotocol/client-auto-pagination": "latest",
20+
"@graphprotocol/client-auto-type-merging": "latest",
21+
"@graphql-mesh/cache-localforage": "latest",
22+
"@graphql-mesh/cross-helpers": "latest",
23+
"@graphql-mesh/graphql": "latest",
24+
"@graphql-mesh/http": "latest",
25+
"@graphql-mesh/json-schema": "latest",
26+
"@graphql-mesh/merger-bare": "latest",
27+
"@graphql-mesh/merger-stitching": "latest",
28+
"@graphql-mesh/plugin-mock": "latest",
29+
"@graphql-mesh/runtime": "latest",
30+
"@graphql-mesh/store": "latest",
31+
"@graphql-mesh/transform-filter-schema": "latest",
32+
"@graphql-mesh/transform-prefix": "latest",
33+
"@graphql-mesh/transform-prune": "latest",
34+
"@graphql-mesh/transform-rename": "latest",
35+
"@graphql-mesh/transform-type-merging": "latest",
36+
"@graphql-mesh/utils": "latest",
37+
"@graphql-tools/merge": "latest",
1438
"@network-goods/hypercerts-protocol": "0.0.6",
39+
"@types/jest": "^29.2.5",
1540
"ajv": "^8.11.2",
1641
"axios": "^1.2.2",
1742
"ethers": "^5.7.2",
1843
"graphql": "^16.6.0",
1944
"ipfs-core": "^0.17.0",
45+
"jest": "^29.3.1",
2046
"loglevel": "^1.8.1",
2147
"mime": "^3.0.0",
2248
"nft.storage": "^7.0.0",
49+
"ts-jest": "^29.0.3",
2350
"ts-mocha": "^10.0.0"
2451
},
2552
"devDependencies": {
2653
"@graphprotocol/client-cli": "^2.2.15",
2754
"@types/chai": "^4.3.4",
28-
"@types/mocha": "^10.0.1",
2955
"@types/node": "^18.11.17",
3056
"chai": "^4.3.7",
3157
"it-all": "^2.0.0",
3258
"json-schema-to-typescript": "^11.0.2",
33-
"mocha": "^10.1.0",
3459
"mockipfs": "^0.3.0",
3560
"mockttp": "^3.6.1",
3661
"nyc": "^15.1.0",
3762
"shx": "^0.3.4",
38-
"ts-mocha": "^10.0.0",
63+
"ts-jest-resolver": "^2.0.0",
3964
"ts-node": "^10.9.1",
40-
"typescript": "^4.9.3"
65+
"typescript": "^4.9.0"
4166
},
4267
"resolutions": {
4368
"graphql": "^16.6.0"
4469
},
4570
"scripts": {
46-
"graph:build": "yarn graph:build:client && tsc",
47-
"graph:build:client": "graphclient build",
71+
"graph:build": "rm -rf ./src/.graphclient && NODE_OPTIONS='--loader ts-node/esm' graphclient build --throwOnInvalidConfig && mv .graphclient ./src/.graphclient",
4872
"graph:compile": "graphql-codegen",
4973
"graph:serve": "graphclient serve-dev",
50-
"graph:tsc": "tsc",
51-
"graph:test": "echo \"Error: No tests\" && exit 1",
5274
"graph:watch": "graphql-codegen -w",
53-
"clean": "rm -rf ./lib",
54-
"build": "npm run clean && npm run graph:build &&npm run build:esm && npm run build:cjs",
55-
"build:esm": "tsc -p ./tsconfig.esm.json && mv ./lib/esm/src/index.js ./lib/esm/src/index.mjs",
56-
"build:cjs": "tsc -p ./tsconfig.cjs.json",
57-
"prepack": "npm run build",
58-
"test": "ts-mocha -r dotenv/config test/*.ts"
75+
"graph:build:esm": "rm -rf ./src/.graphclient && NODE_OPTIONS='--loader ts-node/esm' graphclient build --filetype js --throwOnInvalidConfig && mv .graphclient ./src/.graphclient",
76+
"clean": "rm -rf ./lib && rm -rf ./src/types",
77+
"build": "yarn clean && yarn types:json && yarn graph:build:esm && yarn build:esm",
78+
"build:esm": "tsc",
79+
"prebuild": "yarn clean",
80+
"prepack": "yarn build",
81+
"test": "NODE_OPTIONS=\"--experimental-vm-modules\" jest",
82+
"types:json": "yarn run json2ts -i './src/resources/schema/' -o 'src/types' --cwd './src/resources/schema' --no-declareExternallyReferenced"
5983
},
60-
"exports": {
61-
".": {
62-
"import": {
63-
"types": "./lib/esm/types/src/index.d.ts",
64-
"default": "./lib/esm/src/index.mjs"
65-
},
66-
"require": {
67-
"types": "./lib/cjs/types/src/index.d.ts",
68-
"default": "./lib/cjs/src/index.js"
69-
}
70-
}
71-
}
84+
"type": "module"
7285
}

0 commit comments

Comments
 (0)