Skip to content

Commit

Permalink
Add SSR testing playground setup
Browse files Browse the repository at this point in the history
  • Loading branch information
benoitgrelard committed Feb 12, 2021
1 parent 627cbf6 commit ae0512c
Show file tree
Hide file tree
Showing 15 changed files with 1,316 additions and 213 deletions.
55 changes: 55 additions & 0 deletions .yarn/releases/yarn-2.4.0.cjs

Large diffs are not rendered by default.

86 changes: 0 additions & 86 deletions .yarn/releases/yarn-berry.js

This file was deleted.

12 changes: 6 additions & 6 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ changesetBaseRefs:
- upstream/main

changesetIgnorePatterns:
- '**/*.test.{ts,tsx}'
- '**/*.stories.{ts,tsx}'
- "**/*.test.{ts,tsx}"
- "**/*.stories.{ts,tsx}"

nodeLinker: node-modules

plugins:
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
spec: '@yarnpkg/plugin-workspace-tools'
spec: "@yarnpkg/plugin-workspace-tools"
- path: .yarn/plugins/@yarnpkg/plugin-typescript.cjs
spec: '@yarnpkg/plugin-typescript'
spec: "@yarnpkg/plugin-typescript"
- path: .yarn/plugins/@yarnpkg/plugin-version.cjs
spec: '@yarnpkg/plugin-version'
spec: "@yarnpkg/plugin-version"

yarnPath: .yarn/releases/yarn-berry.js
yarnPath: .yarn/releases/yarn-2.4.0.cjs
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"version": "0.0.0",
"license": "MIT",
"workspaces": [
"ssr-testing",
"packages/*/*"
],
"scripts": {
Expand All @@ -19,8 +20,8 @@
"build:config": "mv tsconfig.json tsconfig.tmp.json && mv tsconfig.production.json tsconfig.json",
"build:packages": "parcel build 'packages/*/*/' --no-cache",
"build:cleanup": "mv tsconfig.json tsconfig.production.json && mv tsconfig.tmp.json tsconfig.json",
"publish": "yarn bump && yarn build && yarn workspaces foreach -pv --exclude primitives npm publish --tolerate-republish --access public",
"clean": "yarn workspaces foreach -pv --exclude primitives run clean",
"publish": "yarn bump && yarn build && yarn workspaces foreach -pv --exclude primitives --exclude ssr-testing npm publish --tolerate-republish --access public",
"clean": "yarn workspaces foreach -pv --exclude primitives --exclude ssr-testing run clean",
"reset": "yarn clean && rm -rf node_modules .yarn/cache .parcel-cache",
"bump": "yarn version apply --all",
"bump:check": "yarn version check"
Expand Down
34 changes: 34 additions & 0 deletions ssr-testing/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# 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
.env.development.local
.env.test.local
.env.production.local

# vercel
.vercel
13 changes: 13 additions & 0 deletions ssr-testing/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# ssr-testing

This is a testing playground for SSR support in our primitives using a [Next.js](https://nextjs.org/) project.

## Getting Started

First, run the development server:

```bash
npm run dev
# or
yarn dev
```
2 changes: 2 additions & 0 deletions ssr-testing/next-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/// <reference types="next" />
/// <reference types="next/types/global" />
19 changes: 19 additions & 0 deletions ssr-testing/next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
const path = require('path');
const withTM = require('next-transpile-modules')([]);

module.exports = withTM({
webpack(config) {
// https://github.com/josephluck/next-typescript-monorepo/blob/master/blog/next.config.js
const babelRule = config.module.rules.find((rule) =>
rule.use && Array.isArray(rule.use)
? rule.use.find((u) => u.loader === 'next-babel-loader')
: rule.use.loader === 'next-babel-loader'
);

if (babelRule) {
babelRule.include.push(path.resolve('../'));
}

return config;
},
});
20 changes: 20 additions & 0 deletions ssr-testing/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "ssr-testing",
"version": "0.0.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start"
},
"dependencies": {
"next": "10.0.6",
"next-transpile-modules": "^6.3.0",
"react": "17.0.1",
"react-dom": "17.0.1"
},
"devDependencies": {
"@types/react": "^17",
"@types/react-dom": "^17"
}
}
5 changes: 5 additions & 0 deletions ssr-testing/pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import * as React from 'react';

export default function App({ Component, pageProps }) {
return <Component {...pageProps} />;
}
23 changes: 23 additions & 0 deletions ssr-testing/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import * as React from 'react';
import Head from 'next/head';
import Link from 'next/link';

export default function Home() {
return (
<>
<Head>
<title>Home</title>
<link rel="icon" href="/favicon.ico" />
</Head>

<main>
<h1>Components</h1>
<ul>
<li>
<Link href="./radio-group">RadioGroup</Link>
</li>
</ul>
</main>
</>
);
}
18 changes: 18 additions & 0 deletions ssr-testing/pages/radio-group.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import * as React from 'react';
import { RadioGroup, RadioGroupItem, RadioGroupIndicator } from '@radix-ui/react-radio-group';

export default function RadioGroupPage() {
return (
<RadioGroup defaultValue="1">
<RadioGroupItem value="1">
<RadioGroupIndicator>x</RadioGroupIndicator>
</RadioGroupItem>
<RadioGroupItem value="2">
<RadioGroupIndicator>x</RadioGroupIndicator>
</RadioGroupItem>
<RadioGroupItem value="3">
<RadioGroupIndicator>x</RadioGroupIndicator>
</RadioGroupItem>
</RadioGroup>
);
}
Binary file added ssr-testing/public/favicon.ico
Binary file not shown.
13 changes: 13 additions & 0 deletions ssr-testing/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"module": "esnext",
"isolatedModules": true,
"jsx": "preserve"
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
"exclude": ["node_modules"]
}

0 comments on commit ae0512c

Please sign in to comment.