Skip to content

Commit be6e863

Browse files
authored
Merge branch 'main' into task/ability-to-override-network-map
2 parents 1743788 + bc01237 commit be6e863

103 files changed

Lines changed: 7867 additions & 4480 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@ package.json @immutable/passport
2222
/packages/minting-backend @shineli1984
2323
/packages/webhook @shineli1984
2424
/packages/game-bridge @immutable/gamesdk
25-
/examples @immutable/passport
25+
/examples @immutable/devgrowth
2626
**/package.json @immutable/passport

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ cache/
66
.DS_Store
77
.vscode
88
.parcel-cache
9+
.next/
910

1011
.env
1112
.env.local

examples/README.md

Lines changed: 95 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,17 @@
2121
- [Contribution guidelines](#contribution-guidelines)
2222
- [Adding examples](#adding-examples)
2323
- [End to end testing](#end-to-end-testing)
24+
- [Generating examples apps using Cursor](#generating-example-apps-using-cursor)
2425
- [Using code examples in the docs site](#using-code-examples-in-the-docs-site)
25-
- [Generating Tutorials and Metadata](#generating-tutorials-and-metadata)
26+
- [Generating Tutorials and Metadata with cursor](#generating-tutorials-and-metadata-with-cursor)
2627

2728
<hr />
2829

2930
# Introduction
3031

3132
The example apps in this examples directory are compiled and tested as part of our CI CD pipeline. The goal of this is to ensure the examples found here are always able to run against the latest version of the Immutable Typescript SDK.
3233

33-
Selected portions of code from these example apps are then displayed as code snippets in our docs site, which means our code snippets in the docs are inherently always accurate as well. How to include the code from here in the docs site is explained below.
34+
Selected portions of code from these example apps are then displayed as code snippets in our docs site, which means our code snippets in the docs are inherently always accurate as well. How to include the code from here in the docs site is explained below.
3435

3536
These example apps can also be used directly as a reference and run locally to test and develop with.
3637

@@ -325,6 +326,95 @@ Run your tests
325326
```bash
326327
pnpm test
327328
```
329+
330+
# Generating example apps using cursor
331+
332+
1) Open the product folder under /examples/{product}/_prompts
333+
334+
2) Under the {product}/_prompts directory, open the example-app-2-add-feature.txt file.
335+
336+
3) Copy all of the content in the example-app-2-add-feature.txt file.
337+
338+
4) Paste it on to Cursor. Make sure that you're using Agent mode and the model to be used is Claude 3.7 (Thinking)
339+
340+
5) After pasting the prompt, in the chat window you can type:
341+
app name: <app name(if exists)>
342+
feature name: <name of the feature>
343+
and cursor will generate the feature page in the given app.
344+
345+
6) To update an existing feature, the prompt will identify if the given <feature name> exists in the <app name> directory. If it does, it will check if
346+
the <feature name> has the manually-edited field value as true in the feature.json file.
347+
348+
7) If the flag above exists, it will ask for a confirmation, otherwise, it will use best practices to update the existing feature page.
349+
350+
8) Once the feature page is completed, under the same directory as example-app-2-add-feature.txt, open example-app-3-fix-ui.txt and copy all of its contents.
351+
352+
9) Paste it on to a new Cursor window and in the chat window you can type:
353+
354+
feature name: <name of the feature>
355+
356+
Here, cursor will check and fix pages with styling issues to ensure that it looks consistent with other example apps.
357+
358+
10) Once the styling changes have been made, under the same directory as example-app-2-add-feature.txt, open example-app-4-testing.txt and copy all of its contents.
359+
360+
11) Paste it on to a new Cursor window and in the chat window you can type:
361+
app name: <app name(if exists)>
362+
feature name: <name of the feature>
363+
364+
12) Cursor will then run tests and build until everything passes and renders properly.
365+
366+
13) When the prompt is done running, make sure to double check if the tests are comprehensive enough and also check if the feature page was built properly using best practices.
367+
368+
14) Run `pnpm dev` and check every page's styling. If something looks off, you can manually fix it.
369+
370+
## If an App Doesn't Exist Yet
371+
372+
You must create the app first by going to the example-app-1-create-app-template.txt file and paste it on to Cursor's chat window and use Agent Mode + Claude 3.7 Sonnet Thinking.
373+
374+
In the chat window, type in:
375+
feature name: <name>
376+
377+
Then Cursor will build out the example app's setup, etc.
378+
IF Cursor doesn't run build at the end, manually type on the chat window 'run build'.
379+
380+
IMPORTANT: For any prompts, if cursor is not done with its operations but it has reached 25 tool calls, you will need to manually type "continue" on the chat window for cursor to continue building.
381+
382+
## Understanding the Prompt Files
383+
384+
The example generation process uses three different prompt files, each with a specific purpose:
385+
386+
### example-app-1-create-app-template.txt
387+
- **Purpose**: Creates the initial app structure and boilerplate
388+
- **When to use**: Only when you need to create a completely new example app
389+
- **What it does**: Sets up the project structure, configuration files, basic components, and placeholder pages
390+
- **Output**: A functioning but minimal app with no implemented features
391+
392+
### example-app-2-add-feature.txt
393+
- **Purpose**: Implements or updates a specific feature within an existing app
394+
- **When to use**: After creating an app with example-app-1-create-app-template.txt, or when adding/updating features
395+
- **What it does**: Creates or modifies the feature implementation with proper error handling, UI states, and best practices
396+
- **Output**: A fully implemented feature page within the app structure
397+
398+
### example-app-3-fix-ui.txt
399+
- **Purpose**: Apply styling changes to the given example app if possible to ensure styling consistency with other example apps
400+
- **When to use**: After running example-app-2-add-feature.txt to implement a feature
401+
- **What it does**: Modifies the example app's UI/UX to ensure that the app looks consistent with other example apps
402+
- **Output**: A fully implemented feature page within the app structure with consistent UI/UX looks.
403+
404+
### example-app-4-testing.txt
405+
- **Purpose**: Tests, validates, and fixes issues in the implementation
406+
- **When to use**: After running example-app-2-add-feature.txt to implement a feature
407+
- **What it does**: Runs tests, checks coverage, builds the app, and fixes any detected issues
408+
- **Output**: A tested, validated feature ready for use
409+
410+
**Typical Workflow:**
411+
1. Use example-app-1-create-app-template.txt to create a new app (only once per app)
412+
2. Use example-app-2-add-feature.txt to implement each feature in the app
413+
3. Use example-app-3-fix-ui.txt to fix the app's UI/UX styling and make it look consistent to other example apps.
414+
4. Use example-app-4-testing.txt after each feature implementation to test and validate
415+
5. Once you've generated the example app or feature, you should manually review the implementation and the UI. It's likely you will need to make some manual adjustments to get the app to function and look like our other example apps because the cursor can not reliably get it 100% correct.
416+
6. Once you're happy with your example app or feature, you need to [re-run the tutorial generation prompt](#generating-tutorials-and-metadata-with-cursor) for your example app before creating your PR so the new example app or feature is piped into the docs site with it's corresponding tutorial.
417+
328418
# Using code examples in the docs site
329419

330420
Creating and using code snippets is relatively straight forward. You can pull in a whole file or by adding some comments you can pull in just a particular few lines of a file as necessary.
@@ -369,7 +459,6 @@ It's very simple to use the code snippet in the docs site, you just add a code b
369459
````md
370460
```tsx reference=examples/checkout/sdk-connect-with-nextjs/src/app/connect-with-metamask/page.tsx#get-wallet-allow-list title="Get the wallet allow list"
371461
```
372-
```
373462
````
374463
Or if you want to display the whole file just don't include a `#` label at the end of the file reference e.g.
375464

@@ -416,9 +505,9 @@ Once your `docs` PR is merged, Netlify should automatically build and deploy the
416505

417506
If this happens you will need to log into the Netlify site, check the error and retry the build. Usually this will fix the deployment issue, otherwise follow up on the error message shown by Netlify.
418507

419-
# Generating Tutorials and Metadata
508+
# Generating tutorials and metadata with cursor
420509

421-
Whenever you add a new example app, or update an existing example app, you can use the prompts in the `prompt.txt` files in each `examples/product` folder to generate the tutorials and metadata for the example apps using Cursor AI.
510+
Whenever you add a new example app, or update an existing example app, you can use the prompts in the `tutorial-generation-generic.txt` OR `tutorial-generation-{product}.txt` files in each `examples/product/_prompts` folder to generate the tutorials and metadata for the example apps using Cursor AI.
422511

423512
These AI generated tutorials and metadata files are then piped through to the docs site in the CI/CD pipeline, where they are used to display the example apps and their code walkthroughs. If you don't follow these steps, your example app will not be displayed on the docs site.
424513

@@ -431,7 +520,7 @@ Follow these steps to generate the tutorials and metadata for the example apps:
431520
1. Delete the existing tutorial.md and metadata.json files in the example app you are wanting to generate the tutorials and metadata for.
432521
2. Open the Composer window in Cursor IDE (Claude 3.7-sonnet-thinking).
433522
3. Press the `+` button clear the context of the composer window.
434-
4. Open the `prompt.txt` file in the examples/product folder you are wanting to generate the tutorials and metadata for e.g. `examples/passport/prompt.txt`.
523+
4. Open the `tutorial-generation-generic.txt` OR `tutorial-generation-{product}.txt` file in the examples/product/_prompts folder you are wanting to generate the tutorials and metadata for e.g. `examples/passport/_prompts/tutorial-generation-generic.txt`.
435524
5. Copy and pate the prompt into the composer window, or attach it as a file.
436525
6. After adding the prompt, in the composer window, type `app name: <name of the example app>` e.g. `app name: login-with-nextjs` where the app name is the folder name of the example app in the examples/product folder you are wanting to generate the tutorials and metadata for.
437526
7. Press enter and let the AI generate the tutorials and metadata.

examples/_parsed/passport-examples.json

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
],
2121
"product": "Passport",
2222
"programming_language": "TypeScript",
23-
"sidebar_order": 2
23+
"sidebar_order": 3
2424
}
2525
},
2626
"login-with-nextjs": {
@@ -46,6 +46,33 @@
4646
],
4747
"product": "Passport",
4848
"programming_language": "TypeScript",
49+
"sidebar_order": 2
50+
}
51+
},
52+
"setup-with-nextjs": {
53+
"tutorial": "setup-with-nextjs.md",
54+
"metadata": {
55+
"title": "Setup",
56+
"description": "Demonstrates various Passport SDK initialization patterns and configurations",
57+
"keywords": [
58+
"Immutable",
59+
"SDK",
60+
"Passport",
61+
"Setup",
62+
"Configuration",
63+
"Authentication",
64+
"Next.js",
65+
"Overlays",
66+
"Scopes",
67+
"Silent Logout"
68+
],
69+
"tech_stack": [
70+
"Next.js",
71+
"TypeScript",
72+
"Biom3"
73+
],
74+
"product": "Passport",
75+
"programming_language": "TypeScript",
4976
"sidebar_order": 1
5077
}
5178
},
@@ -71,7 +98,7 @@
7198
],
7299
"product": "Passport",
73100
"programming_language": "TypeScript",
74-
"sidebar_order": 6
101+
"sidebar_order": 7
75102
}
76103
},
77104
"wallets-connect-with-nextjs": {
@@ -99,7 +126,7 @@
99126
],
100127
"product": "Passport",
101128
"programming_language": "TypeScript",
102-
"sidebar_order": 3
129+
"sidebar_order": 4
103130
}
104131
},
105132
"wallets-signing-with-nextjs": {
@@ -123,7 +150,7 @@
123150
],
124151
"product": "Passport",
125152
"programming_language": "TypeScript",
126-
"sidebar_order": 5
153+
"sidebar_order": 6
127154
}
128155
},
129156
"wallets-transactions-with-nextjs": {
@@ -146,7 +173,7 @@
146173
],
147174
"product": "Passport",
148175
"programming_language": "TypeScript",
149-
"sidebar_order": 4
176+
"sidebar_order": 5
150177
}
151178
}
152179
}

0 commit comments

Comments
 (0)