Skip to content

Commit

Permalink
chore: restructure packages and migrate to pnpm
Browse files Browse the repository at this point in the history
  • Loading branch information
efoken committed Oct 15, 2023
1 parent 95cac45 commit 1d836ff
Show file tree
Hide file tree
Showing 286 changed files with 19,153 additions and 21,242 deletions.
5 changes: 1 addition & 4 deletions .knip.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,8 @@
"ignoreDependencies": [
"@md3-ui/core",
"@md3-ui/test-utils",
"@preconstruct/hook",
"@svgr/plugin-jsx",
"prettier-plugin-organize-imports",
"webpack",
"yarn-deduplicate"
"prettier-plugin-organize-imports"
],
"rules": {
"unresolved": "off"
Expand Down
2 changes: 2 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
strict-peer-dependencies=false
enable-pre-post-scripts=true
62 changes: 35 additions & 27 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -1,43 +1,51 @@
import { StorybookConfig } from "@storybook/react-webpack5"
import webpack from "webpack"
import { StorybookConfig } from "@storybook/react-vite"
import { mergeConfig } from "vite"

const extensions = [
".web.js",
".js",
".web.jsx",
".jsx",
".web.ts",
".ts",
".web.tsx",
".tsx",
".json",
]

const config: StorybookConfig = {
stories: ["../packages/*/stories/*.stories.tsx"],
stories: ["../packages/*/src/**/*.stories.tsx"],
addons: [
"@storybook/addon-a11y",
"@storybook/addon-essentials",
{
name: "@storybook/addon-essentials",
options: {
docs: false,
},
},
"storybook-addon-performance",
"storybook-dark-mode",
],
framework: {
name: "@storybook/react-webpack5",
name: "@storybook/react-vite",
options: {
strictMode: true,
builder: {
fsCache: true,
lazyCompilation: true,
},
},
},
webpackFinal: (config) => ({
...config,
plugins: [
...(config.plugins ?? []),
new webpack.DefinePlugin({
__DEV__: JSON.stringify(true),
}),
],
resolve: {
...config.resolve,
alias: {
...config.resolve?.alias,
"react-native": "react-native-web",
viteFinal: (config) =>
mergeConfig(config, {
optimizeDeps: {
esbuildOptions: {
resolveExtensions: extensions,
},
},
extensions: [".web.js", ".web.jsx", ".web.ts", ".web.tsx"].concat(
config.resolve?.extensions ?? [],
),
},
}),
resolve: {
alias: {
"react-native": "react-native-web",
},
extensions,
},
}),
}

export default config
1 change: 1 addition & 0 deletions app/metro.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@ module.exports = {
],
// 3. Force Metro to resolve (sub)dependencies only from `nodeModulesPaths`
disableHierarchicalLookup: true,
unstable_enableSymlinks: true,
},
}
7 changes: 3 additions & 4 deletions app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,15 @@
"main": "src/index.ts",
"dependencies": {
"@expo/vector-icons": "^13.0.0",
"@md3-ui/core": "^0.2.1",
"@md3-ui/core": "workspace:*",
"expo": "^49.0.13",
"expo-status-bar": "~1.6.0",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-native": "0.72.5",
"react-native": "0.72.6",
"react-native-iphone-x-helper": "^1.3.1",
"react-native-safe-area-context": "4.6.3",
"react-router-native": "^6.16.0",
"uuid": "^3.4.0"
"react-router-native": "^6.16.0"
},
"devDependencies": {
"babel-preset-expo": "^9.5.2",
Expand Down
24 changes: 0 additions & 24 deletions babel.config.js

This file was deleted.

45 changes: 21 additions & 24 deletions docs/next.config.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import nextMDX from "@next/mdx"
import withPreconstruct from "@preconstruct/next"
import remarkEmoji from "remark-emoji"
import remarkGfm from "remark-gfm"
import remarkSlug from "remark-slug"
Expand All @@ -13,28 +12,26 @@ const withMDX = nextMDX({
},
})

export default withPreconstruct(
withMDX({
transpilePackages: [
"react-native",
"react-native-safe-area-context",
"react-native-svg",
"react-native-web",
],
pageExtensions: ["js", "jsx", "ts", "tsx", "md", "mdx"],
reactStrictMode: true,
webpack: (config) => ({
...config,
resolve: {
...config.resolve,
alias: {
...config.resolve.alias,
"react-native": "react-native-web",
},
extensions: [".web.js", ".web.jsx", ".web.ts", ".web.tsx"].concat(
config.resolve.extensions,
),
export default withMDX({
transpilePackages: [
"react-native",
"react-native-safe-area-context",
"react-native-svg",
"react-native-web",
],
pageExtensions: ["js", "jsx", "ts", "tsx", "md", "mdx"],
reactStrictMode: true,
webpack: (config) => ({
...config,
resolve: {
...config.resolve,
alias: {
...config.resolve.alias,
"react-native": "react-native-web",
},
}),
extensions: [".web.js", ".web.jsx", ".web.ts", ".web.tsx"].concat(
config.resolve.extensions,
),
},
}),
)
})
18 changes: 8 additions & 10 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,27 @@
"start": "next start"
},
"dependencies": {
"@md3-ui/core": "^0.2.1",
"@md3-ui/icons": "^0.2.1",
"@md3-ui/props-docs": "^0.2.1",
"@md3-ui/utils": "^0.2.1",
"@md3-ui/core": "workspace:*",
"@md3-ui/icons": "workspace:*",
"@md3-ui/props-docs": "workspace:*",
"@md3-ui/utils": "workspace:*",
"@mdx-js/loader": "^2.3.0",
"@mdx-js/react": "^2.3.0",
"@next/mdx": "^13.5.4",
"@preconstruct/next": "^4.0.0",
"copy-to-clipboard": "^3.3.3",
"next": "^13.5.4",
"next-seo": "^6.1.0",
"prism-react-renderer": "^2.1.0",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-live": "^4.1.5",
"react-native": "0.72.5",
"react-native": "0.72.6",
"react-native-safe-area-context": "4.6.3",
"react-native-svg": "13.9.0",
"react-native-svg": "13.10.0",
"react-native-web": "^0.19.9",
"remark-emoji": "^4.0.0",
"remark-gfm": "^4.0.0",
"remark-slug": "^7.0.1",
"webpack": "^5.88.2"
"remark-gfm": "^3.0.1",
"remark-slug": "^7.0.1"
},
"devDependencies": {
"eslint": "^8.51.0",
Expand Down
2 changes: 1 addition & 1 deletion docs/pages/docs/components/button.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export const meta = {
title: "Button",
description:
"Buttons help people initiate actions, from sending an email, to sharing a document, to liking a post.",
package: "@md3-ui/button",
package: "@md3-ui/components",
}

There are five types of common buttons: elevated, filled, filled tonal,
Expand Down
2 changes: 1 addition & 1 deletion docs/pages/docs/components/checkbox.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export const meta = {
title: "Checkbox",
description:
"Checkboxes allow users to select one or more items from a set. Checkboxes can turn an option on or off.",
package: "@md3-ui/checkbox",
package: "@md3-ui/components",
}

There's one type of checkbox in Material. Use this selection control when the
Expand Down
2 changes: 1 addition & 1 deletion docs/pages/docs/components/divider.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export const meta = {
title: "Divider",
description:
"A divider is a thin line that groups content in lists and containers.",
package: "@md3-ui/layout",
package: "@md3-ui/components",
}

There's one type of checkbox in Material. Use this selection control when the
Expand Down
2 changes: 1 addition & 1 deletion docs/pages/docs/components/icon-button.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export const meta = {
title: "Icon Button",
description:
"Icon buttons help people take supplementary actions with a single tap.",
package: "@md3-ui/button",
package: "@md3-ui/components",
}

Use icon buttons when a compact button is required, such as in a toolbar or
Expand Down
2 changes: 1 addition & 1 deletion docs/pages/docs/components/list.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Layout } from "../../../src/layouts/layout"
export const meta = {
title: "List",
description: "Lists are continuous, vertical indexes of text or images.",
package: "@md3-ui/list",
package: "@md3-ui/components",
}

Lists consist of one or more list items, and can contain actions represented by
Expand Down
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const config = {
],
},
transformIgnorePatterns: [
"node_modules/(?!(jest-)?react-native(-.*)?|@react-native(-community)?/)",
"node_modules/(?!(?:.pnpm/)?((jest-)?react-native(-.*)?|@react-native(-community)?/))",
],
setupFilesAfterEnv: ["./jest.setup.js"],
watchPlugins: [
Expand Down
3 changes: 1 addition & 2 deletions lerna.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"npmClient": "yarn",
"useWorkspaces": true,
"npmClient": "pnpm",
"packages": ["packages/*", "tools/*", "app", "docs"],
"version": "0.2.1",
"command": {
Expand Down
Loading

0 comments on commit 1d836ff

Please sign in to comment.