Skip to content

Commit

Permalink
Merge branch 'main' into cm-793-sanction-ui
Browse files Browse the repository at this point in the history
  • Loading branch information
jwhardwick authored Aug 1, 2024
2 parents 9aa107e + fdaa3cc commit 5488c08
Show file tree
Hide file tree
Showing 57 changed files with 1,362 additions and 403 deletions.
541 changes: 541 additions & 0 deletions .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
nodeLinker: node-modules
checksumBehavior: update

plugins:
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
spec: "@yarnpkg/plugin-workspace-tools"
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
spec: "@yarnpkg/plugin-interactive-tools"

yarnPath: .yarn/releases/yarn-3.6.1.cjs
84 changes: 80 additions & 4 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,51 @@

Important information on how to create examples, pull them through to the docs site and ensure they are covered by tests in the CI CD pipeline.

## Create a New Example

## Example Scope

When creating an example app it should contain only examples about one particular feature to prevent overloading the example. If there are multiple ways to use the feature then it is okay to include those in one sample app.

For example;

the app in `examples/passport/wallets-connect-with-nextjs` show how to connect passport in the nextjs framework. It contains a default route that has links to each of the examples. Inside there are three routes, one for each way to connect (EIP-1193, EtherJS and Wagmi). These are okay to be part of one sample app since they show how to use one feature but using 3 different libraries.

If you want to show a different feature e.g signing with passport, you should create a new example app. Even though it also requires passport to connect you should not add the signing example to the connect example app.

## Folder structure

Each product should have its own folder inside examples, and the examples for that product should be flatly arranged inside that folder, do not nest the examples deeper than this.

Each example app folder inside the product folder be named as `<feature>-with-<framework>`

Then if your example has multiple routes because there are multiple ways to use that feature e.g. you need to show how to use the feature using multiple libraries, then you should name your routes `<feature>-with<library>`.

eg.

```
examples
├── passport
│ ├── wallets-connect-with-nextjs
│ │ └── src
│ │ └── app
│ │ ├── page.tsx
│ │ ├── connect-with-eip1193
│ │ ├── connect-with-etherjs
│ │ └── connect-with-wagmi
│ └── wallets-signing-with-nextjs
│ │ └── src
│ │ └── app
│ │ ├── page.tsx
│ │ ├── sign-with-eip712
│ │ └── sign-with-erc191
│ └── ...
├── checkout
│ └── ...
```

If you need to create a new example follow the steps below;

## Creating a New Example

create the nextjs project

Expand Down Expand Up @@ -86,7 +130,7 @@ In your examples find the parts of the code you want to use as code snippets and

Labels only have to be unique in the file, but they should be verbose so it makes it easy to know what they are e.g.

e.g. `<product>-<feature>-<framework>-<example>-<library>-<tag>
e.g. `<product>-<feature>-<framework>-<example>-<library>-<tag>`

```
// #doc passport-wallets-nextjs-connect-eip1193-create
Expand All @@ -103,20 +147,52 @@ It's very simple, you just add a code block with the reference to the file you w
```
````

Or if you only want to display part of the file, add the `#` label of the snippt you want to display e.g.
Or if you only want to display part of the file, add the `#` label of the snippet you want to display e.g.

````
```js reference=examples/passport/wallets-connect-with-nextjs/src/app/connect-with-etherjs/page.tsx#passport-wallets-nextjs-connect-etherjs-create title="Connect Passport to Immutable zkEVM and create the Provider"
```
````


All snippets should have a title, usually this can just be the file name the snippet comes from. Don't be shy adding extra context before or after the snippet explaining any key points which are necessary.

## Development process

Since the docs site by default is pulling the code examples from the main branch of `ts-immutable-sdk` they will not be available until they are merged. To get around this and view the snippets in the docs site before you merge the example to main you can point the docs site to use the branch you are working on in the sdk repo while you work on them.

Create a branch for your example in `ts-immutable-sdk` repo and a branch for your code snippets in `docs` repo.

Create your example in your `ts-immutable-sdk` branch and push it up to GitHub.

In your `docs` branch modify the file `/src/remark/import-code.mjs`

Update the `BRANCH` constant from `main` to your branch name e.g.

```
const BRANCH = 'DVR-193-passport-signing-example';
```

Now your docs branch will be pulling the code examples from your branch in `ts-immutable-sdk` and you can use them locally in your `docs` branch to make sure they make sense in the page.

Once you're happy with your examples, make the PR for your `ts-immutable-sdk` and get it merged into main.

Then change the `BRANCH` constant back to `main` in the `/src/remark/import-code.mjs` file.

Now your examples are merged they will appear locally in your `docs` branch from main on `ts-immutable-sdk` and you can make any other updates you need to give the code examples context in the docs site.

Create your PR for your `docs` branch and get it merged into main.

### WARNING

Do **NOT** merge your `docs` branch to main without pointing the code import back to the main branch on `ts-immutable-sdk` or it will break things when the branch is deleted and new code examples merged to main will not show in the docs site.


## Comments

All examples should be heavily commented and the comments should make sense in the context the snippet is appearing in the docs site.

## Tests

All examples should be covered by e2e tests to ensure they successfully do the action the code sample is showing in the docs site.

More info on e2e tests coming soon.
2 changes: 1 addition & 1 deletion examples/passport/identity-with-nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"eslint-config-next": "14.2.5",
"postcss": "^8.4.39",
"tailwindcss": "^3.4.6",
"typescript": "^5"
"typescript": "^5.5.4"
},
"private": true,
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion examples/passport/next-connect-kit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"@types/react-dom": "^18.0.11",
"eslint": "^8",
"eslint-config-next": "14.2.3",
"typescript": "^5"
"typescript": "^5.5.4"
},
"private": true,
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion examples/passport/next-rainbow-kit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"@types/react-dom": "^18.0.11",
"eslint": "^8",
"eslint-config-next": "14.2.3",
"typescript": "^5"
"typescript": "^5.5.4"
},
"private": true,
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion examples/passport/next-wagmi/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"@types/react-dom": "^18.0.11",
"eslint": "^8",
"eslint-config-next": "14.2.3",
"typescript": "^5"
"typescript": "^5.5.4"
},
"private": true,
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion examples/passport/next-web3-modal/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"@types/react-dom": "^18.0.11",
"eslint": "^8",
"eslint-config-next": "14.2.3",
"typescript": "^5"
"typescript": "^5.5.4"
},
"private": true,
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion examples/passport/vite-connect-kit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"@types/react": "^18.0.28",
"@types/react-dom": "^18.0.11",
"@vitejs/plugin-react": "^4.3.1",
"typescript": "^5.0.2",
"typescript": "^5.5.4",
"vite": "^5.3.5",
"vite-plugin-node-polyfills": "^0.22.0"
},
Expand Down
2 changes: 1 addition & 1 deletion examples/passport/vite-rainbow-kit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"@types/react": "^18.0.28",
"@types/react-dom": "^18.0.11",
"@vitejs/plugin-react": "^4.3.1",
"typescript": "^5.0.2",
"typescript": "^5.5.4",
"vite": "^5.3.5",
"vite-plugin-node-polyfills": "^0.22.0"
},
Expand Down
2 changes: 1 addition & 1 deletion examples/passport/vite-wagmi/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"@types/react": "^18.0.28",
"@types/react-dom": "^18.0.11",
"@vitejs/plugin-react": "^4.3.1",
"typescript": "^5.0.2",
"typescript": "^5.5.4",
"vite": "^5.3.5",
"vite-plugin-node-polyfills": "^0.22.0"
},
Expand Down
2 changes: 1 addition & 1 deletion examples/passport/vite-web3-modal/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"@types/react": "^18.0.28",
"@types/react-dom": "^18.0.11",
"@vitejs/plugin-react": "^4.3.1",
"typescript": "^5.0.2",
"typescript": "^5.5.4",
"vite": "^5.3.5",
"vite-plugin-node-polyfills": "^0.22.0"
},
Expand Down
2 changes: 2 additions & 0 deletions examples/passport/wallets-connect-with-nextjs/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
NEXT_PUBLIC_PUBLISHABLE_KEY="pk_imapik-test-5ss4GpFy-n@$$Ye3LSox"
NEXT_PUBLIC_CLIENT_ID="K846H940Uxokhz1aDb034QwBclYnAH24"
2 changes: 1 addition & 1 deletion examples/passport/wallets-connect-with-nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"eslint-config-next": "14.2.5",
"postcss": "^8",
"tailwindcss": "^3.4.1",
"typescript": "^5"
"typescript": "^5.5.4"
},
"private": true,
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion examples/passport/wallets-signing-with-nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"eslint-config-next": "14.2.5",
"postcss": "^8",
"tailwindcss": "^3.4.1",
"typescript": "^5"
"typescript": "^5.5.4"
},
"private": true,
"scripts": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"eslint-config-next": "14.2.5",
"postcss": "^8.4.39",
"tailwindcss": "^3.4.6",
"typescript": "^5"
"typescript": "^5.5.4"
},
"private": true,
"scripts": {
Expand Down
6 changes: 3 additions & 3 deletions packages/blockchain-data/sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"ethers": "^5.7.2"
},
"devDependencies": {
"@rollup/plugin-typescript": "^11.0.0",
"@rollup/plugin-typescript": "^11.1.6",
"@swc/core": "^1.3.36",
"@swc/jest": "^0.2.24",
"@typechain/ethers-v5": "^10.2.0",
Expand All @@ -22,10 +22,10 @@
"eslint": "^8.40.0",
"jest": "^29.4.3",
"jest-environment-jsdom": "^29.4.3",
"rollup": "^3.17.2",
"rollup": "^4.19.1",
"ts-mockito": "^2.6.1",
"typechain": "^8.1.1",
"typescript": "^4.9.5"
"typescript": "^5.5.4"
},
"homepage": "https://github.com/immutable/ts-immutable-sdk#readme",
"license": "Apache-2.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/checkout/sdk-sample-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"react-app-rewired": "^2.2.1",
"react-scripts": "5.0.1",
"stream-browserify": "^3.0.0",
"typescript": "^4.9.5",
"typescript": "^5.5.4",
"web-vitals": "^2.1.4"
},
"private": true,
Expand Down
20 changes: 10 additions & 10 deletions packages/checkout/sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,24 @@
"@babel/preset-env": "^7.20.2",
"@parcel/packager-ts": "^2.8.3",
"@parcel/transformer-typescript-types": "^2.8.3",
"@rollup/plugin-commonjs": "^24.0.1",
"@rollup/plugin-json": "^6.0.0",
"@rollup/plugin-node-resolve": "^15.0.2",
"@rollup/plugin-replace": "^5.0.2",
"@rollup/plugin-terser": "^0.4.3",
"@rollup/plugin-typescript": "^11.0.0",
"@rollup/plugin-commonjs": "^26.0.1",
"@rollup/plugin-json": "^6.1.0",
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-replace": "^5.0.7",
"@rollup/plugin-terser": "^0.4.4",
"@rollup/plugin-typescript": "^11.1.6",
"@types/uuid": "^8.3.4",
"babel-jest": "^29.5.0",
"eslint": "^8.40.0",
"jest": "^29.4.3",
"parcel": "^2.8.3",
"rollup": "^3.17.2",
"rollup-plugin-dts": "^5.3.0",
"rollup-plugin-polyfill-node": "^0.12.0",
"rollup": "^4.19.1",
"rollup-plugin-dts": "^6.1.1",
"rollup-plugin-polyfill-node": "^0.13.0",
"text-encoding": "^0.7.0",
"typedoc": "^0.24.8",
"typedoc-plugin-markdown": "^3.15.2",
"typescript": "^4.9.5"
"typescript": "^5.5.4"
},
"homepage": "https://github.com/immutable/ts-immutable-sdk",
"keywords": [
Expand Down
Loading

0 comments on commit 5488c08

Please sign in to comment.