diff --git a/.github/workflows/deploy-package.yml b/.github/workflows/deploy-package.yml new file mode 100644 index 00000000..3b00fa26 --- /dev/null +++ b/.github/workflows/deploy-package.yml @@ -0,0 +1,46 @@ +name: Deploy NPM Package + +on: + workflow_dispatch: + inputs: + version: + description: "Version to publish (e.g., 1.0.0)" + default: "1.0.0" + required: true + +jobs: + publish: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Setup pnpm + uses: pnpm/action-setup@v4 + with: + version: 9.11.0 + + - name: Use Node.js + uses: actions/setup-node@v4 + with: + node-version: lts/Iron + cache: 'pnpm' + + - name: Install dependencies + run: pnpm install -r --frozen-lockfile + + - name: Build the package + run: pnpm nx build sdk + + - name: Prepare package.json + working-directory: packages/sdk + run: node prepare-package.mjs + env: + INPUT_VERSION: ${{ github.event.inputs.version }} + + - name: Create .npmrc + run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPMJS_NPM_MATTERLABS_AUTOMATION_TOKEN }}" > ~/.npmrc + + - name: Publish to NPM + working-directory: packages/sdk + run: npm publish --access public \ No newline at end of file diff --git a/.verdaccio/config.yml b/.verdaccio/config.yml deleted file mode 100644 index 591a20dd..00000000 --- a/.verdaccio/config.yml +++ /dev/null @@ -1,28 +0,0 @@ -# path to a directory with all packages -storage: ../tmp/local-registry/storage - -# a list of other known repositories we can talk to -uplinks: - npmjs: - url: https://registry.npmjs.org - maxage: 60m - -packages: - "**": - # give all users (including non-authenticated users) full access - # because it is a local registry - access: $all - publish: $all - unpublish: $all - - # if package is not available locally, proxy requests to npm registry - proxy: npmjs - -# log settings -logs: - type: stdout - format: pretty - level: warn - -publish: - allow_offline: true # set offline to true to allow publish offline diff --git a/README.md b/README.md index 5c704373..e9a1d5c2 100644 --- a/README.md +++ b/README.md @@ -37,9 +37,9 @@ Add ZKsync SSO connector to your app (using `wagmi`): ```ts import { zksyncSepoliaTestnet } from "viem/chains"; import { createConfig, connect } from "@wagmi/core"; -import { zksyncAccountConnector } from "zksync-sso/connector"; +import { zksyncSsoConnector } from "zksync-sso/connector"; -const ssoConnector = zksyncAccountConnector({ +const ssoConnector = zksyncSsoConnector({ // Optional session configuration, if omitted user will have to sign every transaction via Auth Server session: { // Allow up to 0.1 ETH to be spend in gas fees @@ -117,34 +117,9 @@ This monorepo is comprised of the following packages, products, and examples: pnpm install ``` -You have two options for using the SDK in the monorepo workspaces, via PNPM -workspace protocol or using Verdaccio. The project is currently configured to -use the SDK package via PNPM. If you want to use the SDK outside of the monorepo -in another local project, setup the Verdaccio option to easily use the SDK -package. - -### Using the SDK package via PNPM - -PNPM provides a way to "link" workspaces together via `package.json` -dependencies using the -[Workspace protocol](https://pnpm.io/workspaces#workspace-protocol-workspace). - -### Using the SDK package locally via Verdaccio - -2. Start up the Verdaccio proxy registry. - - ```bash - pnpm run registry - ``` - -3. Publish the SDK package to your proxy registry. - - ```bash - pnpm nx publish:local sdk - ``` - -4. Edit the respective `package.json` dependency for the SDK to use the version - that is published to Verdaccio. +2. If creating new packages: use pnpm and + [workspace protocol](https://pnpm.io/workspaces#workspace-protocol-workspace) + to link SDK in the new folder. ## Running commands diff --git a/cspell-config/cspell-misc.txt b/cspell-config/cspell-misc.txt index c6a7ce73..4890947e 100644 --- a/cspell-config/cspell-misc.txt +++ b/cspell-config/cspell-misc.txt @@ -8,7 +8,6 @@ nuxt Nuxt nuxtjs testid -verdaccio vueuse // examples/bank-demo diff --git a/docs/sdk/client-auth-server/README.md b/docs/sdk/client-auth-server/README.md index 6dcdfff3..1dcbf2fe 100644 --- a/docs/sdk/client-auth-server/README.md +++ b/docs/sdk/client-auth-server/README.md @@ -9,9 +9,9 @@ your application. It's built on top of [client SDK](../client/README.md) and ```ts import { zksync } from "viem/chains"; import { createConfig, connect } from "@wagmi/core"; -import { zksyncAccountConnector } from "zksync-sso/connector"; +import { zksyncSsoConnector } from "zksync-sso/connector"; -const ssoConnector = zksyncAccountConnector({ +const ssoConnector = zksyncSsoConnector({ // Optional session configuration session: { feeLimit: parseEther("0.1"), diff --git a/docs/verdaccio.md b/docs/verdaccio.md deleted file mode 100644 index 73a7e745..00000000 --- a/docs/verdaccio.md +++ /dev/null @@ -1,51 +0,0 @@ -# Verdaccio - -[Verdaccio](https://verdaccio.org/) - -Verdaccio is a local proxy registry that helps with publishing npm packages to a -non production or private environment. - -## Run Verdaccio via the monorepo - -Verdaccio is installed in this project from an NX plugin `@nx/js`, you do not -need to install the package globally. Open up a terminal within the monorepo -directory and run the following command. - -```bash -pnpm run registry -``` - -## How it works - -Verdaccio is a proxy that will intercept npm registry calls and determine if it -has a cached version of the package you're downloading or if it should allow it -through to the official registry. On the first download from the official -registry, it will take that package and cache it locally. - -All NPM/PNPM/Yarn commands will work as normal but calls through to a registry -will be managed via Verdaccio. - -When publishing a package, Verdaccio will instead take that package and set it -up locally within its own registry. You can access the dashboard for Verdaccio -and view packages at [http://localhost:4873/](http://localhost:4873/). - -## Troubleshooting - -### Keep Verdaccio running - -With the way Verdaccio is setup and how it proxies the NPM registry, it's -probably best practice to always keep Verdaccio running on your machine. How you -do that is up to you. - -The quickest and simplest way to run Verdaccio on your machine is open up a -separate terminal and run `pnpm verdaccio`. - -### Unable to access NPM registry when installing packages - -Check your Verdaccio and make sure it's running. Some configuration somewhere, -either in your global configuration for NPM registry URL, a project's `.npmrc` -or a `package.json` `publishConfig` might be pointing to the Verdaccio URL. -Without Verdaccio running it will not proxy to the official NPM registry. - -This monorepo project is setup with Verdaccio through NX. It has its own -configuration defined within `.verdaccio/config.yml`. diff --git a/examples/demo-app/pages/index.vue b/examples/demo-app/pages/index.vue index fd58fb7e..7a16c725 100644 --- a/examples/demo-app/pages/index.vue +++ b/examples/demo-app/pages/index.vue @@ -41,13 +41,13 @@