Skip to content

Commit 1a3263d

Browse files
authored
feat(passport): nextjs packages (#2768)
1 parent 9b16625 commit 1a3263d

File tree

117 files changed

+8004
-2117
lines changed

Some content is hidden

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

117 files changed

+8004
-2117
lines changed

.cursorrules

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,17 @@ Always use conventional commit format for all commits and PR titles:
5353
- Use the body to explain what and why vs. how
5454
- Wrap the body at 72 characters
5555

56-
When creating PRs, always follow this conventional commit style for both the commit messages and PR titles.
56+
When creating PRs, always follow this conventional commit style for both the commit messages and PR titles.
57+
58+
## Principles
59+
The following list of principles should be honoured when introducing changes:
60+
- always check what's the best practice in the industry
61+
- raise with the user if there is a package out there that is a 80-90% fit instead of writing from scratch
62+
- always clean up after changes
63+
- focus on root cause instead of fixing symptoms
64+
- trace changes applied locally and in-branch against main when debugging issues locally to first understand if it's a pre-existing bug
65+
- do not come up with new requirements or alter requirements by yourself. Propose alternatives first.
66+
- follow the same architecture pattern in the repo. If there is significant benefit to do things differently, raise it first.
67+
- when refactoring, check if any existing functionality has been changed/broken or new functionality has been added. if inevertible, call it out.
68+
- always check or ask if a problem/bug exists after certain changes. trace back and find all the changes applied in between and use that as scope for debugging.
69+
- when coming up with a fix, keep going after the first layer of root cause until you can reason about the entire data flow/userflow is sound.

.github/actions/setup/action.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ runs:
1919

2020
- name: install dependencies
2121
shell: bash
22-
run: pnpm install --frozen-lockfile
22+
run: pnpm install --frozen-lockfile

.github/workflows/pr.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: PR
33
on:
44
pull_request:
55
branches:
6-
- '**'
6+
- "**"
77
merge_group:
88
branches:
99
- main
@@ -42,7 +42,7 @@ jobs:
4242
uses: ./.github/actions/setup
4343

4444
- name: Build, Lint & Test
45-
run: pnpm --if-present nx affected -t build,lint,test
45+
run: pnpm --if-present nx affected -t build,lint,test
4646

4747
build-lint-test-examples:
4848
name: Build, Lint & Test Examples
@@ -64,7 +64,7 @@ jobs:
6464

6565
- name: Prepare SDK
6666
run: pnpm prepare:sdk
67-
67+
6868
- name: Prepare examples
6969
run: pnpm prepare:examples
7070

@@ -118,7 +118,7 @@ jobs:
118118
with:
119119
ref: ${{ github.event.pull_request.head.ref }}
120120
fetch-depth: 0
121-
121+
122122
- name: setup
123123
uses: ./.github/actions/setup
124124

@@ -130,7 +130,7 @@ jobs:
130130

131131
- name: Prepare tests
132132
run: pnpm prepare:tests
133-
133+
134134
- name: Update modules
135135
run: pnpm install --frozen-lockfile=false
136136

.github/workflows/publish.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,17 +69,17 @@ jobs:
6969
echo "Check user permissions for triggering actor - ${{ github.triggering_actor }}"
7070
echo "user-permission = ${{ steps.check_user_permission.outputs.user-permission }}"
7171
echo "require-result = ${{ steps.check_user_permission.outputs.require-result }}"
72-
72+
7373
- name: Admin Permission Check
7474
if: ${{ steps.check_user_permission.outputs.require-result != 'true' && env.RELEASE_TYPE == 'major' }}
7575
run: exit 1
76-
76+
7777
- name: Allowed Actors Check
7878
id: allowed_actors_check
7979
# only allow certain SDK team members to run this workflow
8080
if: ${{ contains(fromJson(env.SDK_PUBLISH_MAJOR_VERSION_ACTORS), github.triggering_actor) && env.RELEASE_TYPE == 'major' }}
8181
run: echo "ALLOWED_ACTOR=true" >> $GITHUB_OUTPUT
82-
82+
8383
- name: Allowed Actors Filter
8484
if: ${{ steps.allowed_actors_check.outputs.ALLOWED_ACTOR != 'true' && env.RELEASE_TYPE == 'major' }}
8585
run: exit 1
@@ -97,7 +97,7 @@ jobs:
9797
run: |
9898
git config user.name "platform-sa"
9999
git config user.email "platform-sa@users.noreply.github.com"
100-
100+
101101
- name: Initialize current versions
102102
run: pnpm --filter @imtbl/sdk... --filter @imtbl/checkout-widgets... exec sh -c "jq --arg version \"$(npm view @imtbl/metrics versions --json | jq -r '.[-1]')\" '.version = \$version' package.json > package.tmp.json && mv package.tmp.json package.json"
103103

@@ -106,7 +106,7 @@ jobs:
106106

107107
- name: Build SDK & Checkout Widgets
108108
run: pnpm build
109-
109+
110110
- name: Pack SDK & Checkout Widgets packages and dependencies
111111
run: pnpm pack-npm-packages
112112

@@ -118,7 +118,7 @@ jobs:
118118

119119
- name: Publish Github Release
120120
if: ${{ !startsWith(env.RELEASE_TYPE, 'pre') }}
121-
run: pnpm nx release changelog $(jq -r '.version' ./sdk/package.json) $( ${{ env.DRY_RUN }} && echo "--dry-run" || echo "")
121+
run: pnpm nx release changelog $(jq -r '.version' ./sdk/package.json) $( ${{ env.DRY_RUN }} && echo "--dry-run" || echo "")
122122

123123
- name: Tag Git Pre-Release
124124
if: ${{ startsWith(env.RELEASE_TYPE, 'pre') }}
@@ -163,7 +163,7 @@ jobs:
163163
uses: ./.github/actions/notify-slack-publish-status
164164
with:
165165
message: "❌ Failed to publish SDK version ${{steps.release.outputs.RELEASE_NAME}} to NPM. ${{ github.triggering_actor }} please check the logs for more details."
166-
166+
167167
- name: Wait for NPM @latest Update
168168
id: wait_for_npm_update
169169
if: ${{ !startsWith(env.RELEASE_TYPE, 'pre') && github.event_name != 'push' }} && env.DRY_RUN == 'false'

.husky/pre-commit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
. "$(dirname -- "$0")/_/husky.sh"
33

44
# prevent heap limit allocation errors - increased to 8GB
5-
export NODE_OPTIONS="--max-old-space-size=8192"
5+
export NODE_OPTIONS="--max-old-space-size=10240"
66

77
pnpm lint-staged

.npmrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,7 @@ public-hoist-pattern[]=@imtbl/*
77
public-hoist-pattern[]=*openzeppelin*
88
public-hoist-pattern[]=*solidity*
99
public-hoist-pattern[]=eslint-*
10+
11+
# Serialize git-hosted package preparation to prevent parallel yarn installs
12+
# from corrupting each other (seaport packages use yarn install as prepare script)
13+
network-concurrency=1

.syncpackrc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@
66
"dependencies": ["$LOCAL"],
77
"dependencyTypes": ["prod", "dev"],
88
"pinVersion": "workspace:*"
9+
},
10+
{
11+
"label": "Allow flexible peer dependency ranges for auth-next packages and sdk",
12+
"dependencies": ["next", "next-auth", "react"],
13+
"dependencyTypes": ["peer"],
14+
"packages": ["@imtbl/auth-next-server", "@imtbl/auth-next-client", "@imtbl/sdk"],
15+
"isIgnored": true
916
}
1017
]
1118
}

examples/orderbook/create-bid-with-nextjs/tests/base.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ test.describe("home page", () => {
1616
test.describe("create bid with ERC721", () => {
1717
test("loads creation screen", async ({ page }) => {
1818
await page.getByTestId("create-bid-with-erc721").click();
19-
await expect(page.getByRole("heading", { level: 1 })).toBeVisible();
19+
await expect(page.getByRole("heading", { name: /Create.*ERC721.*bid/i })).toBeVisible();
2020
});
2121
});
2222

2323
test.describe("create bid with ERC1155", () => {
2424
test("loads creation screen", async ({ page }) => {
2525
await page.getByTestId("create-bid-with-erc1155").click();
26-
await expect(page.getByRole("heading", { level: 1 })).toBeVisible();
26+
await expect(page.getByRole("heading", { name: /Create.*ERC1155.*bid/i })).toBeVisible();
2727
});
2828
});

examples/orderbook/create-collection-bid-with-nextjs/tests/base.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ test.describe("home page", () => {
1616
test.describe("create collection bid with ERC721", () => {
1717
test("loads creation screen", async ({ page }) => {
1818
await page.getByTestId("create-collection-bid-with-erc721").click();
19-
await expect(page.getByRole("heading", { level: 1 })).toBeVisible();
19+
await expect(page.getByRole("heading", { name: /Create ERC721 collection bid/i })).toBeVisible();
2020
});
2121
});
2222

2323
test.describe("create collection bid with ERC1155", () => {
2424
test("loads creation screen", async ({ page }) => {
2525
await page.getByTestId("create-collection-bid-with-erc1155").click();
26-
await expect(page.getByRole("heading", { level: 1 })).toBeVisible();
26+
await expect(page.getByRole("heading", { name: /Create ERC1155 collection bid/i })).toBeVisible();
2727
});
2828
});

examples/orderbook/create-listing-with-nextjs/tests/base.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ test.describe("home page", () => {
1616
test.describe("create listing with ERC721", () => {
1717
test("loads creation screen", async ({ page }) => {
1818
await page.getByTestId("create-listing-with-erc721").click();
19-
await expect(page.getByRole("heading", { level: 1 })).toBeVisible();
19+
await expect(page.getByRole("heading", { name: /Create ERC721 listing/i })).toBeVisible();
2020
});
2121
});
2222

2323
test.describe("create listing with ERC1155", () => {
2424
test("loads creation screen", async ({ page }) => {
2525
await page.getByTestId("create-listing-with-erc1155").click();
26-
await expect(page.getByRole("heading", { level: 1 })).toBeVisible();
26+
await expect(page.getByRole("heading", { name: /Create ERC1155 listing/i })).toBeVisible();
2727
});
2828
});

0 commit comments

Comments
 (0)