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

feat(pie-monorepo): DSW-2056 pie webc integration next13 #1613

Merged
merged 6 commits into from
Jul 22, 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
5 changes: 5 additions & 0 deletions .changeset/blue-yaks-mix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"wc-next13": minor
---

[Added] - pie-webc integration to next13 example apps
21 changes: 21 additions & 0 deletions apps/examples/wc-next13/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
module.exports = {
root: true,
env: { browser: true, es2020: true },
extends: [
'eslint:recommended',
'plugin:react/recommended',
'plugin:react/jsx-runtime',
'plugin:react-hooks/recommended',
],
ignorePatterns: ['dist', '.eslintrc.cjs'],
parserOptions: { ecmaVersion: 'latest', sourceType: 'module' },
settings: { react: { version: '18.2' } },
plugins: ['react-refresh'],
rules: {
'react/jsx-no-target-blank': 'off',
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
],
},
}
61 changes: 21 additions & 40 deletions apps/examples/wc-next13/.gitignore
Original file line number Diff line number Diff line change
@@ -1,43 +1,24 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*

# local env files
.env*.local

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
11 changes: 9 additions & 2 deletions apps/examples/wc-next13/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
## How to use Next.js App
# React + Vite

This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.

Currently, two official plugins are available:

- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh

### `yarn dev`

Expand Down Expand Up @@ -39,4 +46,4 @@ React 18 and previous versions don't handle web components and custom elements o

Therefore, in order to import the web component into your React application, please use:

import { PieButton } from '@justeattakeaway/pie-button/dist/react';
import { PieButton } from '@justeattakeaway/pie-webc/react/button.js';
13 changes: 13 additions & 0 deletions apps/examples/wc-next13/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + React</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.jsx"></script>
</body>
</html>
25 changes: 14 additions & 11 deletions apps/examples/wc-next13/package.json
Original file line number Diff line number Diff line change
@@ -1,29 +1,32 @@
{
"name": "wc-next13",
"version": "0.3.43",
"private": true,
"version": "0.3.43",
"type": "module",
"scripts": {
"dev": "NODE_OPTIONS=--conditions=development next dev",
"build:examples": "yarn build-static",
"build-static": "next build && next export -o build",
"start": "next start",
"lint:examples": "next lint"
"dev": "vite",
"build": "vite build",
"lint": "eslint . --ext js,jsx --report-unused-disable-directives --max-warnings 0",
kevinrodrigues marked this conversation as resolved.
Show resolved Hide resolved
"preview": "vite preview"
},
"dependencies": {
"@justeattakeaway/pie-button": "0.47.8",
"@justeattakeaway/pie-css": "0.12.1",
"@justeattakeaway/pie-webc": "0.5.13",
"@lit-labs/nextjs": "0.2.0",
"@lit/react": "1.0.5",
"next": "13.5.5",
"react": "18.3.1",
"react-dom": "18.3.1"
},
"devDependencies": {
"@types/node": "20.9.3",
"@types/react": "18.3.3",
"@types/react-dom": "18.3.0",
"eslint": "8.37.0",
"eslint-config-next": "13.5.5",
"typescript": "5.4.5"
"@vitejs/plugin-react": "4.3.1",
"eslint": "8.57.0",
"eslint-plugin-react": "7.34.3",
"eslint-plugin-react-hooks": "4.6.2",
"eslint-plugin-react-refresh": "0.4.7",
"vite": "5.3.4"
},
"volta": {
"extends": "../../../package.json"
Expand Down
6 changes: 0 additions & 6 deletions apps/examples/wc-next13/pages/_app.tsx

This file was deleted.

15 changes: 0 additions & 15 deletions apps/examples/wc-next13/pages/_document.tsx

This file was deleted.

69 changes: 0 additions & 69 deletions apps/examples/wc-next13/pages/index.tsx

This file was deleted.

Binary file removed apps/examples/wc-next13/public/favicon.ico
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,3 @@
* {
font-family: JETSansDigital, Arial, sans-serif;
}

.flex-wrapper {
display: flex;
justify-content: flex-start;
align-items: center;
}

.padding {
padding: 1rem;
}
17 changes: 17 additions & 0 deletions apps/examples/wc-next13/src/App.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import './App.css'
import { PieButton } from "@justeattakeaway/pie-webc/react/button.js";
import '@justeattakeaway/pie-css';

function App() {
return (
<>
<div className="App">
<PieButton size='large'>WC Button in NextJS!</PieButton>
<PieButton variant='secondary'>WC Button in NextJS!</PieButton>
<PieButton disabled>WC Button in NextJS!</PieButton>
</div>
</>
)
}

export default App
9 changes: 9 additions & 0 deletions apps/examples/wc-next13/src/main.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import React from 'react'
import ReactDOM from 'react-dom/client'
import App from './App.jsx'

ReactDOM.createRoot(document.getElementById('root')).render(
<React.StrictMode>
<App />
</React.StrictMode>,
)
23 changes: 0 additions & 23 deletions apps/examples/wc-next13/tsconfig.json

This file was deleted.

9 changes: 9 additions & 0 deletions apps/examples/wc-next13/vite.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';

export default defineConfig({
plugins: [react()],
resolve: {
alias: {},
},
});
Loading
Loading