Skip to content

Commit d5a40d9

Browse files
committed
fix: turbo generators + tsconfig
1 parent 59b2303 commit d5a40d9

File tree

10 files changed

+329
-40
lines changed

10 files changed

+329
-40
lines changed

apps/storybook/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"@fontsource/roboto": "^5.1.0",
1919
"@repo/ui": "*",
2020
"@storybook/addon-themes": "^8.4.7",
21-
"next": "^15.2.4",
21+
"next": "^15.5.4",
2222
"react": "^19.0.0",
2323
"react-dom": "^19.0.0"
2424
},

apps/web/package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,19 @@
88
"build": "next build",
99
"start": "next start",
1010
"lint": "next lint --max-warnings 0",
11+
"lint:fix": "next lint --fix",
1112
"check-types": "tsc --noEmit"
1213
},
1314
"dependencies": {
1415
"@emotion/cache": "^11.14.0",
1516
"@emotion/react": "^11.14.0",
17+
"@mui/material": "^6.3.0",
1618
"@mui/material-nextjs": "^6.3.0",
1719
"@repo/ui": "*",
18-
"next": "^15.2.4",
20+
"next": "^15.5.4",
1921
"react": "^19.0.0",
2022
"react-dom": "^19.0.0",
21-
"@mui/material": "^6.3.0"
23+
"rxjs": "^7.8.1"
2224
},
2325
"devDependencies": {
2426
"@repo/eslint-config": "*",

apps/web/tsconfig.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,12 @@
55
{
66
"name": "next"
77
}
8-
]
8+
],
9+
"paths": {
10+
"@/*": [
11+
"./src/*"
12+
]
13+
}
914
},
1015
"include": [
1116
"**/*.ts",
@@ -16,10 +21,5 @@
1621
],
1722
"exclude": [
1823
"node_modules"
19-
],
20-
"paths": {
21-
"@/*": [
22-
"./src/*"
23-
]
24-
}
24+
]
2525
}

apps/web/turbo.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"extends": ["//"],
3+
"$schema": "https://turbo.build/schema.json",
4+
"tasks": {
5+
"dev": {
6+
"dependsOn": ["@repo/ui#build"],
7+
"cache": false,
8+
"persistent": true
9+
}
10+
}
11+
}

packages/ui/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"@repo/typescript-config": "*",
2525
"@swc/core": "^1.10.2",
2626
"@swc/jest": "^0.2.37",
27-
"@turbo/gen": "^2.4.4",
27+
"@turbo/gen": "^2.5.8",
2828
"@types/node": "^20.11.24",
2929
"@types/react": "18.3.1",
3030
"@types/react-dom": "19.0.1",

packages/ui/tsup.config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { defineConfig, Options } from "tsup";
1+
import { defineConfig } from "tsup";
2+
import type { Options } from "tsup";
23

34
export default defineConfig((options: Options) => ({
45
banner: {
Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1-
import type { PlopTypes } from "@turbo/gen";
2-
31
// Learn more about Turborepo Generators at https://turbo.build/repo/docs/core-concepts/monorepos/code-generation
42

5-
export default function generator(plop: PlopTypes.NodePlopAPI): void {
6-
// A simple generator to add a new React component to the internal UI library
3+
module.exports = function generator(plop) {
74
plop.setGenerator("ReactComponent", {
8-
description: "Adds a new React component",
5+
description: "Adds a new React component with Storybook stories",
96
prompts: [
107
{
118
type: "input",
@@ -16,15 +13,20 @@ export default function generator(plop: PlopTypes.NodePlopAPI): void {
1613
actions: [
1714
{
1815
type: "add",
19-
path: "src/{{pascalCase name}}/index.ts",
16+
path: "src/{{pascalCase name}}/index.tsx",
2017
templateFile: "templates/component.hbs",
2118
},
19+
{
20+
type: "add",
21+
path: "src/{{pascalCase name}}/index.stories.tsx",
22+
templateFile: "templates/stories.hbs",
23+
},
2224
{
2325
type: "append",
24-
path: "src/index.tsx",
26+
path: "src/index.ts",
2527
pattern: /(?<insertion>.*)/g,
2628
template: 'export * from "./{{pascalCase name}}";',
2729
},
2830
],
2931
});
30-
}
32+
};
Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
export const {{ pascalCase name }} = ({ children }: { children: React.ReactNode }) => {
2-
return (
3-
<div>
4-
<h1>{{ pascalCase name }} Component</h1>
5-
{children}
6-
</div>
7-
);
8-
};
1+
import { Box } from "@mui/material"
2+
3+
export const {{ pascalCase name }} = () => {
4+
return <Box>
5+
Hello World!
6+
</Box>
7+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import type { Meta, StoryObj } from '@storybook/react';
2+
import { {{ pascalCase name }} } from "@repo/ui";
3+
4+
const meta: Meta<typeof {{ pascalCase name }}> = {
5+
component: {{ pascalCase name }},
6+
};
7+
8+
export default meta;
9+
10+
type Story = StoryObj<typeof meta>;
11+
12+
export const Primary: Story = {
13+
args: {
14+
appName: '{{ pascalCase name }}',
15+
children: 'I am a primary {{ pascalCase name }}.',
16+
},
17+
};

0 commit comments

Comments
 (0)