Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release/2.3.2 #974

Merged
merged 11 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .changeset/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
"access": "public",
"baseBranch": "develop",
"updateInternalDependencies": "patch",
"ignore": ["example-*", "lens-next-app"]
"ignore": ["example-*", "lens-next-app", "lens-next-privy-app"]
}
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"eslint.workingDirectories": [
"examples/lens-next-app",
"examples/lens-next-privy-app",
"examples/node",
"examples/react-native",
"examples/shared",
Expand Down
1 change: 1 addition & 0 deletions examples/lens-next-privy-app/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
NEXT_PUBLIC_PRIVY_APP_ID=
3 changes: 3 additions & 0 deletions examples/lens-next-privy-app/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "next/core-web-vitals"
}
41 changes: 41 additions & 0 deletions examples/lens-next-privy-app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js
.yarn/install-state.gz

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env*.local

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts

# playwright
/test-results/
/playwright-report/
/playwright/.cache/
25 changes: 25 additions & 0 deletions examples/lens-next-privy-app/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).

## Getting Started

Start by renaming the `.env.example` file to `.env` and then populate it with the necessary values:

- `NEXT_PUBLIC_PRIVY_APP_ID` - This is the App ID for Privy. You can create a free App ID at [Privy](https://privy.io).

After setting up the environment variables, launch the development server:

```bash
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev
```

Once the server is running, open http://localhost:3000 in your browser to view the result.

You can begin editing the page by modifying `app/page.tsx`. The page will automatically update as you make changes to the file.

Happy coding!
13 changes: 13 additions & 0 deletions examples/lens-next-privy-app/e2e/desktop.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { devices, test, expect } from "@playwright/test";

test.use(devices["Desktop Chrome"]);

test.describe("Given a desktop browser", async () => {
test.describe("When opening the default page", async () => {
test("Then the welcome text should appear", async ({ page }) => {
await page.goto("/");

await expect(page.getByRole("heading", { name: "Welcome to Lens" })).toBeVisible();
});
});
});
13 changes: 13 additions & 0 deletions examples/lens-next-privy-app/e2e/mobile.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { devices, test, expect } from "@playwright/test";

test.use(devices["iPhone 13"]);

test.describe("Given a mobile browser", async () => {
test.describe("When opening the default page", async () => {
test("Then the welcome text should appear", async ({ page }) => {
await page.goto("/");

await expect(page.getByRole("heading", { name: "Welcome to Lens" })).toBeVisible();
});
});
});
19 changes: 19 additions & 0 deletions examples/lens-next-privy-app/next.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
// Until the @apollo-client fixes the ESM modules support (https://github.com/apollographql/apollo-feature-requests/issues/287)
// it's required to either transpile the `@lens-protocol` packages or make sure they won't get `imported` during SSR.
transpilePackages: ["@lens-protocol"],

webpack: (config) => {
// Ignore warnings from the 3rd party packages
config.ignoreWarnings = [
{ module: /pino/ },
{ module: /node-gyp-build/ },
{ module: /@metamask/ },
];

return config;
},
};

export default nextConfig;
38 changes: 38 additions & 0 deletions examples/lens-next-privy-app/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"name": "lens-next-privy-app",
"description": "Lens SDK Next.js Starter App with Privy SDK",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint",
"test:e2e": "playwright test"
},
"dependencies": {
"@lens-protocol/react-web": "latest",
"@lens-protocol/wagmi": "latest",
"@privy-io/react-auth": "^1.74.1",
"@privy-io/wagmi": "^0.2.10",
"@tanstack/react-query": "^5.29.2",
"next": "^14.2.2",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"viem": "^2.9.16",
"wagmi": "^2.5.19"
},
"devDependencies": {
"@playwright/test": "^1.43.1",
"@types/node": "^20.12.7",
"@types/react": "^18.2.79",
"@types/react-dom": "^18.2.25",
"autoprefixer": "^10.4.19",
"dotenv": "^16.4.5",
"eslint": "^8.57.0",
"eslint-config-next": "14.1.1",
"postcss": "^8.4.38",
"tailwindcss": "^3.4.3",
"typescript": "^5.4.5"
}
}
38 changes: 38 additions & 0 deletions examples/lens-next-privy-app/playwright.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { defineConfig } from "@playwright/test";
import dotenv from "dotenv";

/**
* Read environment variables from file.
* https://github.com/motdotla/dotenv
*/
dotenv.config();

/**
* See https://playwright.dev/docs/test-configuration.
*/
export default defineConfig({
testDir: "./e2e",
/* Run tests in files in parallel */
fullyParallel: true,
/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: !!process.env.CI,
/* Retry on CI only */
retries: process.env.CI ? 2 : 0,
/* Opt out of parallel tests on CI. */
workers: process.env.CI ? 1 : undefined,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: "html",
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
/* Base URL to use in actions like `await page.goto('/')`. */
baseURL: "http://localhost:3000",
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: "on-first-retry",
},
/* Run your local dev server before starting the tests */
webServer: {
command: "npm run dev",
url: "http://localhost:3000",
reuseExistingServer: !process.env.CI,
},
});
6 changes: 6 additions & 0 deletions examples/lens-next-privy-app/postcss.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
};
Binary file added examples/lens-next-privy-app/public/lens.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 33 additions & 0 deletions examples/lens-next-privy-app/src/app/globals.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
@tailwind base;
@tailwind components;
@tailwind utilities;

:root {
--foreground-rgb: 0, 0, 0;
--background-start-rgb: 214, 219, 220;
--background-end-rgb: 255, 255, 255;
}

@media (prefers-color-scheme: dark) {
:root {
--foreground-rgb: 255, 255, 255;
--background-start-rgb: 0, 0, 0;
--background-end-rgb: 0, 0, 0;
}
}

body {
color: rgb(var(--foreground-rgb));
background: linear-gradient(
to bottom,
transparent,
rgb(var(--background-end-rgb))
)
rgb(var(--background-start-rgb));
}

@layer utilities {
.text-balance {
text-wrap: balance;
}
}
20 changes: 20 additions & 0 deletions examples/lens-next-privy-app/src/app/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions examples/lens-next-privy-app/src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import type { Metadata } from "next";
import { Inter } from "next/font/google";
import { Web3Provider } from "@/components/Web3Provider";
import "./globals.css";

const inter = Inter({ subsets: ["latin"] });

export const metadata: Metadata = {
title: "Lens SDK + Privy + Next.js App",
description: "Generated by create next app",
};

export default function RootLayout({
children,
}: Readonly<{
children: React.ReactNode;
}>) {
return (
<html lang="en">
<body className={inter.className}>
<Web3Provider>{children}</Web3Provider>
</body>
</html>
);
}
76 changes: 76 additions & 0 deletions examples/lens-next-privy-app/src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
"use client";

import { WelcomeToLens } from "@/components/WelcomeToLens";
import Image from "next/image";

export default function Home() {
return (
<main className="flex min-h-screen flex-col items-center justify-between p-8 lg:p-16">
<div className="z-10 max-w-5xl w-full items-center justify-between font-mono text-sm lg:flex">
<p className="fixed left-0 top-0 flex w-full justify-center border-b border-gray-300 bg-gradient-to-b from-zinc-200 pb-6 pt-8 backdrop-blur-2xl dark:border-neutral-800 dark:bg-zinc-800/30 dark:from-inherit lg:static lg:w-auto lg:rounded-xl lg:border lg:bg-gray-200 lg:p-4 lg:dark:bg-zinc-800/30">
Get started by editing&nbsp;
<code className="font-mono font-bold">src/app/page.tsx</code>
</p>
<div className="fixed bottom-0 left-0 flex h-48 w-full items-end justify-center bg-gradient-to-t from-white via-white dark:from-black dark:via-black lg:static lg:h-auto lg:w-auto lg:bg-none">
<a
className="pointer-events-none flex place-items-center gap-2 p-8 lg:pointer-events-auto lg:p-0"
href="https://lens.xyz/"
target="_blank"
rel="noopener noreferrer"
>
By{" "}
<Image
src="/lens.png"
alt="Lens Logo"
className="dark:invert"
width={324}
height={60}
priority
/>
</a>
</div>
</div>

<div className="flex place-items-center flex-col max-w-lg my-16">
<h1 className="mb-3 text-3xl font-semibold">Welcome to Lens</h1>
<WelcomeToLens />
</div>

<div className="mb-32 grid text-center lg:max-w-5xl lg:w-full lg:mb-0 lg:grid-cols-2 lg:text-left">
<a
href="https://docs.lens.xyz/"
className="group rounded-lg border border-transparent px-5 py-4 transition-colors hover:border-gray-300 hover:bg-gray-100 hover:dark:border-neutral-700 hover:dark:bg-neutral-800/30"
target="_blank"
rel="noopener noreferrer"
>
<h2 className="mb-3 text-2xl font-semibold">
Lens Docs{" "}
<span className="inline-block transition-transform group-hover:translate-x-1 motion-reduce:transform-none">
-&gt;
</span>
</h2>
<p className="m-0 max-w-[30ch] text-sm opacity-50">
Find in-depth information about Lens Protocol.
</p>
</a>

<a
href="https://docs.lens.xyz/"
className="group rounded-lg border border-transparent px-5 py-4 transition-colors hover:border-gray-300 hover:bg-gray-100 hover:dark:border-neutral-700 hover:dark:bg-neutral-800/30"
target="_blank"
rel="noopener noreferrer"
>
<h2 className="mb-3 text-2xl font-semibold">
Follow Lens{" "}
<span className="inline-block transition-transform group-hover:translate-x-1 motion-reduce:transform-none">
-&gt;
</span>
</h2>
<p className="m-0 max-w-[30ch] text-sm opacity-50">
Join our social channels for developers.
</p>
</a>
</div>
</main>
);
}
Loading
Loading