Skip to content

Commit

Permalink
Updated package release instructions in README
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisli30 committed Feb 5, 2025
1 parent f416ee7 commit 988d971
Show file tree
Hide file tree
Showing 7 changed files with 394 additions and 410 deletions.
41 changes: 19 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,22 @@ To ensure the SDK is functioning correctly, we have a comprehensive test suite.
## Release Process
This repository uses a two-step workflow process for creating new releases:
### Releasing a new version for development
Once a package is ready for a new version, we first publish a dev version and test it in local environment.
1. Run `npm version prerelease --preid=dev` under either `packages/sdk-js` or `packages/types` to update the version in `package.json`.
2. Run `npm publish --tag dev` under either `packages/sdk-js` or `packages/types` to publish the new dev version to NPM. Most importantly, this **bumps up version number** in `package.json` of `packages/types`.
3. If the `types` package has a new version, since it is depended on by `sdk-js`, we need to make sure `sdk-js` can build with the new version.
1. `yarn run clean` **at the root folder** to remove existing node_modules folder and yarn.lock file.
2. Run `yarn install` under the root folder to re-install the dependencies. You should see a prompt asking the version of `@avaprotocol/types` to install. Choose the new version you just created in step 1.
3. Run `yarn build` under the root folder to build all packages.
4. Run `yarn run test` under the root folder to run all tests.
### Publishing to NPM
Once the dev version is tested and ready to be published to NPM, `changeset` can be used to create a new release for NPM.
1. **Record changeset workflow**
Expand All @@ -117,30 +132,12 @@ This repository uses a two-step workflow process for creating new releases:
- Examine the Pull Request created by the workflow, and merge it if everything looks correct. This will record any commits before it as a major, minor, or patch.
2. **Create release workflow**
- Go to the "Actions" tab in GitHub and run the "Create Release" workflow. This will run `npx changeset version` to bump up version in `package.json` based on the recorded changeset files. It will also create a new GitHub Release if the new version is higher than the current version in `package.json`.
There are two ways to create a release:
- Manually create a release in the GitHub UI. This will run `npx changeset version` to bump up version in `package.json` based on the recorded changeset files. It will also create a new GitHub Release if the new version is higher than the current version in `package.json`.
- Automatically create a release when a PR is merged. This will run `npx changeset version` to bump up version in `package.json` based on the recorded changeset files. It will also create a new GitHub Release if the new version is higher than the current version in `package.json`.
3. **Publish to NPM**
- After the last step, the version number in `package.json` is updated and a git tag with the new version number is created. Now you can publish the production version to NPM using `npm publish`.
### NPM Publishing Dev Versions
The NPM publishing of dev versions can be handled manually, since the test cases reference the dist folder and don’t require a new version on NPM. NPM publish on dev tag is only required for testing the new version in a web app.
1. Publish a dev version and test it in your local environment. The `npm publish` will use the version number in `package.json`, so run `npm version prerelease --preid=dev` first if you need a new version number.
```bash
# Optionally, update version with dev tag in package.json
yarn workspace @avaprotocol/sdk-js version --prerelease --preid=dev
# Publish to npm with dev tag
npm publish --tag dev
```
2. Once tested, and a release is created using GitHub Actions, publish the production version to NPM:
```bash
# Publish to npm with latest tag
npm publish
```
### Utility Scripts
To generate the key request message for signing, you can run the following command:
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
"proto-download": "curl -s https://raw.githubusercontent.com/AvaProtocol/EigenLayer-AVS/main/protobuf/avs.proto > grpc_codegen/avs.proto",
"gen-protoc": "grpc_tools_node_protoc --js_out=import_style=commonjs,binary:./grpc_codegen/ --grpc_out=grpc_js:./grpc_codegen/ --plugin=protoc-gen-ts=./node_modules/.bin/protoc-gen-ts --ts_out=grpc_js:./grpc_codegen --proto_path=./grpc_codegen grpc_codegen/avs.proto",
"gen-apikey": "sh -c 'API_KEY=$(docker compose exec aggregator /ava create-api-key --role=admin --subject=apikey) && echo \"Generated API key for tests: $API_KEY\" && echo \"Writing to .env.test to replace the TEST_API_KEY env variable\" && sed -i \"\" -e \"s/^TEST_API_KEY=.*/TEST_API_KEY=$API_KEY/\" .env.test && echo \"Done.\"'",
"build": "yarn workspace @avaprotocol/types run build && yarn workspace @avaprotocol/sdk-js run build",
"clean": "yarn workspaces run clean",
"build": "yarn workspaces run build",
"clean": "rm -rf node_modules yarn.lock && yarn workspaces run clean",
"test": "jest --config jest.config.cjs",
"test:select": "npm run test -- --testNamePattern"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk-js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
},
"scripts": {
"build": "tsup src/index.ts --format cjs,esm --dts",
"clean": "rm -rf dist tsconfig.tsbuildinfo"
"clean": "rm -rf node_modules dist tsconfig.tsbuildinfo"
},
"dependencies": {
"@avaprotocol/types": "workspace:*",
Expand Down
11 changes: 11 additions & 0 deletions packages/sdk-js/src/auth.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export const getKeyRequestMessage = (chainId: number, address: string, issuedAt: Date, expiredAt: Date): string => {
return `Please sign the below text for ownership verification.
URI: https://app.avaprotocol.org
Chain ID: ${chainId}
Version: 1
Issued At: ${issuedAt.toISOString()}
Expire At: ${expiredAt.toISOString()}
Wallet: ${address}`;

}
4 changes: 2 additions & 2 deletions packages/sdk-js/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ import Execution from "./models/execution";
import NodeFactory from "./models/node/factory";
import TriggerFactory from "./models/trigger/factory";
import Secret from "./models/secret";
import {
import type {
GetKeyRequestApiKey,
GetKeyRequestSignature,
GetKeyResponse,
} from "@/types/dist";
} from "@avaprotocol/types";

import {
AUTH_KEY_HEADER,
Expand Down
2 changes: 1 addition & 1 deletion packages/types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
},
"scripts": {
"build": "tsup src/index.ts --dts",
"clean": "rm -rf dist tsconfig.tsbuildinfo"
"clean": "rm -rf node_modules dist tsconfig.tsbuildinfo"
},
"dependencies": {
"typescript": "^5.4.2"
Expand Down
Loading

0 comments on commit 988d971

Please sign in to comment.