Skip to content

Commit

Permalink
Fix/merge webpack (#160)
Browse files Browse the repository at this point in the history
* bump dependencies

* fix: handle plugins from user

* refactor: merge multiple providers
  • Loading branch information
malcolm-kee authored Aug 7, 2022
1 parent 7f049c2 commit 946f49c
Show file tree
Hide file tree
Showing 22 changed files with 3,612 additions and 1,714 deletions.
5 changes: 5 additions & 0 deletions .changeset/dirty-beers-share.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'react-showroom': patch
---

Bug fix: Fix broken build if any plugins is provided by user
9 changes: 9 additions & 0 deletions .changeset/sour-crabs-refuse.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
'@showroomjs/core': minor
'@showroomjs/device-frames': minor
'@showroomjs/measure': minor
'react-showroom': minor
'@showroomjs/ui': minor
---

Bump dependencies
12 changes: 6 additions & 6 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"license": "MIT",
"version": "1.1.39",
"dependencies": {
"@babel/runtime": "^7.18.6",
"@babel/runtime": "^7.18.9",
"@heroicons/react": "^1.0.6",
"classnames": "^2.3.1",
"esbuild-loader": "^2.19.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-hook-form": "^7.33.1",
"react-hook-form": "^7.34.0",
"react-showroom": "workspace:*"
},
"scripts": {
Expand All @@ -19,13 +19,13 @@
},
"devDependencies": {
"@tailwindcss/forms": "^0.5.2",
"autoprefixer": "^10.4.7",
"autoprefixer": "^10.4.8",
"css-loader": "^6.7.1",
"css-minimizer-webpack-plugin": "^4.0.0",
"mini-css-extract-plugin": "^2.6.1",
"postcss": "^8.4.14",
"postcss-loader": "^7.0.0",
"postcss": "^8.4.16",
"postcss-loader": "^7.0.1",
"style-loader": "^3.3.1",
"tailwindcss": "^3.1.4"
"tailwindcss": "^3.1.8"
}
}
10 changes: 5 additions & 5 deletions examples/client-only-example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@
"build-showroom": "react-showroom build"
},
"dependencies": {
"@babel/runtime": "^7.18.6",
"@babel/runtime": "^7.18.9",
"classnames": "^2.3.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-showroom": "workspace:*"
},
"devDependencies": {
"autoprefixer": "^10.4.7",
"postcss": "^8.4.14",
"tailwindcss": "^3.1.4",
"autoprefixer": "^10.4.8",
"postcss": "^8.4.16",
"tailwindcss": "^3.1.8",
"typescript": "~4.6.4",
"webpack": "^5.73.0"
"webpack": "^5.74.0"
}
}
14 changes: 7 additions & 7 deletions examples/cra-example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^5.16.4",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.3.0",
"@testing-library/user-event": "^14.2.1",
"@types/jest": "^28.1.4",
"@testing-library/user-event": "^14.4.2",
"@types/jest": "^28.1.6",
"@types/node": "^18.0.1",
"@types/react": "^18.0.14",
"@types/react-dom": "^18.0.5",
"@types/react": "^18.0.16",
"@types/react-dom": "^18.0.6",
"classnames": "^2.3.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
Expand Down Expand Up @@ -46,7 +46,7 @@
"devDependencies": {
"@types/testing-library__jest-dom": "^5.14.5",
"react-showroom": "workspace:*",
"sass": "^1.53.0",
"tailwindcss": "^3.1.4"
"sass": "^1.54.3",
"tailwindcss": "^3.1.8"
}
}
30 changes: 16 additions & 14 deletions examples/react-example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"test:e2e": "pnpm run test:playwright -c playwright.ssr.config.ts && pnpm run test:playwright -c playwright.spa.config.ts"
},
"dependencies": {
"@babel/runtime": "^7.18.6",
"@babel/runtime": "^7.18.9",
"@heroicons/react": "^1.0.6",
"@tailwindcss/forms": "^0.5.2",
"classnames": "^2.3.1",
Expand All @@ -24,31 +24,33 @@
"msw": "^0.42.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-hook-form": "^7.33.1",
"react-hook-form": "^7.34.0",
"react-query": "^3.39.1",
"react-showroom": "workspace:*",
"react-textarea-autosize": "^8.3.4"
},
"devDependencies": {
"@babel/core": "^7.18.6",
"@babel/plugin-transform-runtime": "^7.18.6",
"@babel/preset-env": "^7.18.6",
"@babel/core": "^7.18.10",
"@babel/plugin-transform-runtime": "^7.18.10",
"@babel/preset-env": "^7.18.10",
"@babel/preset-react": "^7.18.6",
"@babel/preset-typescript": "^7.18.6",
"@testing-library/dom": "^8.14.0",
"@testing-library/dom": "^8.16.1",
"@testing-library/react": "^13.3.0",
"@testing-library/user-event": "^14.2.1",
"@types/jest": "^28.1.4",
"autoprefixer": "^10.4.7",
"@testing-library/user-event": "^14.4.2",
"@types/jest": "^28.1.6",
"@vanilla-extract/css": "^1.7.2",
"@vanilla-extract/webpack-plugin": "^2.1.11",
"autoprefixer": "^10.4.8",
"babel-loader": "^8.2.5",
"css-loader": "^6.7.1",
"jest": "^28.1.2",
"postcss": "^8.4.14",
"postcss-loader": "^7.0.0",
"jest": "^28.1.3",
"postcss": "^8.4.16",
"postcss-loader": "^7.0.1",
"style-loader": "^3.3.1",
"tailwindcss": "^3.1.4",
"tailwindcss": "^3.1.8",
"typescript": "~4.6.4",
"webpack": "^5.73.0"
"webpack": "^5.74.0"
},
"msw": {
"workerDirectory": "public"
Expand Down
6 changes: 5 additions & 1 deletion examples/react-example/react-showroom.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
// @ts-check
const path = require('path');
const { defineConfig } = require('react-showroom');
const { VanillaExtractPlugin } = require('@vanilla-extract/webpack-plugin');

module.exports = defineConfig((command) => ({
module.exports = defineConfig(() => ({
require: ['tailwindcss/tailwind.css', './src/custom.css'],
items: [
{
Expand Down Expand Up @@ -75,4 +76,7 @@ module.exports = defineConfig((command) => ({
},
assetDir: 'public',
wrapper: 'docs/provider.tsx',
webpackConfig: {
plugins: [new VanillaExtractPlugin()],
},
}));
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { style } from '@vanilla-extract/css';

export const baseStyle = style({
borderRadius: '6px',
borderColor: '#d1d5db',
});
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import cx from 'classnames';
import * as React from 'react';
import { callAll } from '../../lib/call-all';
import { baseStyle } from './text-input.css';

export interface TextInputProps
extends React.ComponentPropsWithoutRef<'input'> {
Expand All @@ -21,7 +22,7 @@ export const TextInput = React.forwardRef<HTMLInputElement, TextInputProps>(
<input
type="text"
className={cx(
'rounded-md border-gray-300',
baseStyle,
inputProps.disabled && 'bg-gray-200',
className
)}
Expand Down
12 changes: 6 additions & 6 deletions examples/subpath-example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,20 @@
"test:e2e": "playwright test"
},
"dependencies": {
"@babel/runtime": "^7.18.6",
"@babel/runtime": "^7.18.9",
"@tailwindcss/forms": "^0.5.2",
"classnames": "^2.3.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-showroom": "workspace:*"
},
"devDependencies": {
"autoprefixer": "^10.4.7",
"autoprefixer": "^10.4.8",
"msw": "^0.42.1",
"postcss": "^8.4.14",
"postcss-loader": "^7.0.0",
"tailwindcss": "^3.1.4",
"tsup": "6.1.3",
"postcss": "^8.4.16",
"postcss-loader": "^7.0.1",
"tailwindcss": "^3.1.8",
"tsup": "6.2.1",
"typescript": "~4.6.4"
},
"msw": {
Expand Down
28 changes: 14 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,41 +5,41 @@
"main": "index.js",
"license": "MIT",
"devDependencies": {
"@changesets/cli": "^2.23.0",
"@playwright/test": "^1.23.1",
"@rollup/plugin-commonjs": "^22.0.1",
"@changesets/cli": "^2.24.2",
"@playwright/test": "^1.24.2",
"@rollup/plugin-commonjs": "^22.0.2",
"@rollup/plugin-node-resolve": "^13.3.0",
"@rollup/plugin-typescript": "^8.3.3",
"@rollup/plugin-typescript": "^8.3.4",
"@types/cross-spawn": "^6.0.2",
"@types/fs-extra": "^9.0.13",
"@types/github-slugger": "^1.3.0",
"@types/glob": "^7.2.0",
"@types/hast": "^2.3.4",
"@types/jest": "^28.1.4",
"@types/jest": "^28.1.6",
"@types/lz-string": "^1.3.34",
"@types/mdast": "^3.0.10",
"@types/mime-types": "^2.1.1",
"@types/react": "^18.0.14",
"@types/react-dom": "^18.0.5",
"@types/react": "^18.0.16",
"@types/react-dom": "^18.0.6",
"@types/react-helmet": "^6.1.5",
"@types/react-highlight-words": "^0.16.4",
"@types/rimraf": "^3.0.2",
"@types/string-similarity": "^4.0.0",
"@types/stringify-object": "4.0.1",
"@types/temp": "^0.9.1",
"concurrently": "^7.2.2",
"concurrently": "^7.3.0",
"http-server": "^14.1.1",
"jest": "^28.1.2",
"jest": "^28.1.3",
"monaco-editor": "^0.33.0",
"prettier": "^2.7.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"rimraf": "^3.0.2",
"rollup": "^2.75.7",
"tailwindcss": "^3.1.4",
"ts-jest": "^28.0.5",
"turbo": "^1.3.1",
"type-fest": "^2.16.0",
"rollup": "^2.77.2",
"tailwindcss": "^3.1.8",
"ts-jest": "^28.0.7",
"turbo": "^1.4.2",
"type-fest": "^2.18.0",
"why-is-node-running": "^2.2.2"
},
"scripts": {
Expand Down
8 changes: 4 additions & 4 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,20 @@
"test:ci": "jest --watchAll=false --coverage --runInBand"
},
"devDependencies": {
"axe-core": "^4.4.2",
"esbuild": "0.14.48",
"axe-core": "^4.4.3",
"esbuild": "0.14.53",
"html-webpack-tags-plugin": "^3.0.2",
"react-docgen-typescript": "^2.2.2",
"typescript": "~4.6.4",
"webpack": "^5.73.0"
"webpack": "^5.74.0"
},
"peerDependencies": {
"axe-core": "*",
"esbuild": "^0.14.0",
"webpack": "^5.0.0"
},
"dependencies": {
"acorn": "^8.7.1",
"acorn": "^8.8.0",
"acorn-walk": "^8.2.0",
"domutils": "^3.0.1",
"htmlparser2": "^8.0.1",
Expand Down
4 changes: 2 additions & 2 deletions packages/device-frames/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
"dev": "pnpm run build --watch"
},
"devDependencies": {
"postcss": "^8.4.14",
"tsup": "6.1.3",
"postcss": "^8.4.16",
"tsup": "6.2.1",
"typescript": "~4.6.4"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/measure/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"dev": "pnpm run build --watch"
},
"devDependencies": {
"tsup": "6.1.3",
"tsup": "6.2.1",
"typescript": "~4.6.4"
},
"files": [
Expand Down
24 changes: 13 additions & 11 deletions packages/react-showroom/client/app/preview-app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
SupportedLanguage,
} from '@showroomjs/core';
import { useMeasure } from '@showroomjs/measure';
import { Alert, useConstant, useId } from '@showroomjs/ui';
import { Alert, useConstant, useId, Tooltip } from '@showroomjs/ui';
import * as React from 'react';
import allCompMetadata from 'react-showroom-all-components-docs';
import allImports from 'react-showroom-all-imports';
Expand Down Expand Up @@ -34,16 +34,18 @@ const componentsMetas = Object.values(allCompMetadata);
export const PreviewApp = () => {
return (
<Wrapper>
<CodeImportsContextProvider value={allImports}>
<Routes>
<Route
path="/:codeHash/:componentId"
element={<ComponentPreviewPage />}
/>
<Route path="/:codeHash" element={<GenericPreviewPage />} />
<Route path="*" element={<ErrorPage />} />
</Routes>
</CodeImportsContextProvider>
<Tooltip.Provider>
<CodeImportsContextProvider value={allImports}>
<Routes>
<Route
path="/:codeHash/:componentId"
element={<ComponentPreviewPage />}
/>
<Route path="/:codeHash" element={<GenericPreviewPage />} />
<Route path="*" element={<ErrorPage />} />
</Routes>
</CodeImportsContextProvider>
</Tooltip.Provider>
</Wrapper>
);
};
Expand Down
Loading

0 comments on commit 946f49c

Please sign in to comment.