Skip to content

Commit 83b2804

Browse files
committed
feat: init monorepo
1 parent 1b1d5ec commit 83b2804

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+10334
-4348
lines changed

.github/dependabot.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
5+
6+
version: 2
7+
updates:
8+
- package-ecosystem: "npm" # See documentation for possible values
9+
directory: "/" # Location of package manifests
10+
schedule:
11+
interval: "monthly"

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,6 @@ yarn-error.log*
3636
# Misc
3737
.DS_Store
3838
*.pem
39+
40+
# Storybook
41+
storybook-static

.husky/pre-commit

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
npx lint-staged

README.md

Lines changed: 36 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,84 +1,51 @@
1-
# Turborepo starter
1+
<h1 align="center">
2+
<br>
3+
Front-end Monorepo Template
4+
<br>
5+
</h1>
26

3-
This is an official starter Turborepo.
7+
<h4 align="center">A typescript monorepo template for Front-End projects</h4>
48

5-
## Using this example
9+
## Installation
610

7-
Run the following command:
11+
```bash
12+
# Clone this repository
13+
$ git clone --depth 1 --single-branch https://github.com/mlacosta/frontend-monorepo-template your-project-name
814

9-
```sh
10-
npx create-turbo@latest
11-
```
12-
13-
## What's inside?
14-
15-
This Turborepo includes the following packages/apps:
16-
17-
### Apps and Packages
18-
19-
- `docs`: a [Next.js](https://nextjs.org/) app
20-
- `web`: another [Next.js](https://nextjs.org/) app
21-
- `@repo/ui`: a stub React component library shared by both `web` and `docs` applications
22-
- `@repo/eslint-config`: `eslint` configurations (includes `eslint-config-next` and `eslint-config-prettier`)
23-
- `@repo/typescript-config`: `tsconfig.json`s used throughout the monorepo
24-
25-
Each package/app is 100% [TypeScript](https://www.typescriptlang.org/).
15+
# Go into the repository
16+
$ cd your-project-name
2617

27-
### Utilities
28-
29-
This Turborepo has some additional tools already setup for you:
30-
31-
- [TypeScript](https://www.typescriptlang.org/) for static type checking
32-
- [ESLint](https://eslint.org/) for code linting
33-
- [Prettier](https://prettier.io) for code formatting
34-
35-
### Build
36-
37-
To build all apps and packages, run the following command:
38-
39-
```
40-
cd my-turborepo
41-
pnpm build
18+
# Install dependencies
19+
$ yarn install
4220
```
4321

44-
### Develop
22+
## How to use
4523

46-
To develop all apps and packages, run the following command:
24+
```bash
25+
# Run a package script
26+
$ yarn workspace @<your-project-name>/<package-name> <your-command>
4727

28+
# Run storybook
29+
$ yarn storybook:run
4830
```
49-
cd my-turborepo
50-
pnpm dev
51-
```
52-
53-
### Remote Caching
54-
55-
> [!TIP]
56-
> Vercel Remote Cache is free for all plans. Get started today at [vercel.com](https://vercel.com/signup?/signup?utm_source=remote-cache-sdk&utm_campaign=free_remote_cache).
5731

58-
Turborepo can use a technique known as [Remote Caching](https://turbo.build/repo/docs/core-concepts/remote-caching) to share cache artifacts across machines, enabling you to share build caches with your team and CI/CD pipelines.
32+
## Packages
5933

60-
By default, Turborepo will cache locally. To enable Remote Caching you will need an account with Vercel. If you don't have an account you can [create one](https://vercel.com/signup?utm_source=turborepo-examples), then enter the following commands:
61-
62-
```
63-
cd my-turborepo
64-
npx turbo login
65-
```
66-
67-
This will authenticate the Turborepo CLI with your [Vercel account](https://vercel.com/docs/concepts/personal-accounts/overview).
68-
69-
Next, you can link your Turborepo to your Remote Cache by running the following command from the root of your Turborepo:
70-
71-
```
72-
npx turbo link
73-
```
34+
This repo uses the following open source packages:
7435

75-
## Useful Links
36+
- [@swc/jest](https://swc.rs/)
37+
- [Dependabot](https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically)
38+
- [Husky](https://typicode.github.io/husky)
39+
- [Material UI](https://mui.com/)
40+
- [Next.js](https://nextjs.org)
41+
- [Prettier](https://www.npmjs.com/package/prettier)
42+
- [Storybook](https://storybook.js.org/)
43+
- [Turborepo](https://turbo.build/)
7644

77-
Learn more about the power of Turborepo:
45+
## How to contribute
7846

79-
- [Tasks](https://turbo.build/repo/docs/core-concepts/monorepos/running-tasks)
80-
- [Caching](https://turbo.build/repo/docs/core-concepts/caching)
81-
- [Remote Caching](https://turbo.build/repo/docs/core-concepts/remote-caching)
82-
- [Filtering](https://turbo.build/repo/docs/core-concepts/monorepos/filtering)
83-
- [Configuration Options](https://turbo.build/repo/docs/reference/configuration)
84-
- [CLI Usage](https://turbo.build/repo/docs/reference/command-line-reference)
47+
1. Fork the Project
48+
2. Create your Feature Branch (`git checkout -b feature/newFeature`)
49+
3. Commit your Changes (`git commit -m 'Add some newFeature'`)
50+
4. Push to the Branch (`git push origin feature/newFeature`)
51+
5. Open a Pull Request

apps/docs/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@
1111
"check-types": "tsc --noEmit"
1212
},
1313
"dependencies": {
14-
"@repo/ui": "workspace:*",
14+
"@repo/ui": "*",
1515
"next": "^15.1.0",
1616
"react": "^19.0.0",
1717
"react-dom": "^19.0.0"
1818
},
1919
"devDependencies": {
20-
"@repo/eslint-config": "workspace:*",
21-
"@repo/typescript-config": "workspace:*",
20+
"@repo/eslint-config": "*",
21+
"@repo/typescript-config": "*",
2222
"@types/node": "^20",
2323
"@types/react": "18.3.1",
2424
"@types/react-dom": "18.3.0",

apps/storybook/.gitignore

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.js
7+
.yarn/install-state.gz
8+
9+
# testing
10+
/coverage
11+
12+
# next.js
13+
/.next/
14+
/out/
15+
16+
# production
17+
/build
18+
19+
# misc
20+
.DS_Store
21+
*.pem
22+
23+
# debug
24+
npm-debug.log*
25+
yarn-debug.log*
26+
yarn-error.log*
27+
28+
# local env files
29+
.env*.local
30+
31+
# vercel
32+
.vercel
33+
34+
# typescript
35+
*.tsbuildinfo
36+
next-env.d.ts
37+
38+
*storybook.log

apps/storybook/.storybook/main.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import type { StorybookConfig } from "@storybook/nextjs";
2+
3+
import { join, dirname } from "path";
4+
5+
/**
6+
* This function is used to resolve the absolute path of a package.
7+
* It is needed in projects that use Yarn PnP or are set up within a monorepo.
8+
*/
9+
function getAbsolutePath(value: string): any {
10+
return dirname(require.resolve(join(value, "package.json")));
11+
}
12+
const config: StorybookConfig = {
13+
stories: ["../../../packages/ui/src/**/*.mdx", "../../../packages/ui/src/**/*.stories.@(js|jsx|mjs|ts|tsx)"],
14+
addons: [
15+
getAbsolutePath("@storybook/addon-onboarding"),
16+
getAbsolutePath("@storybook/addon-essentials"),
17+
getAbsolutePath("@chromatic-com/storybook"),
18+
getAbsolutePath("@storybook/addon-interactions"),
19+
],
20+
framework: {
21+
name: getAbsolutePath("@storybook/nextjs"),
22+
options: {},
23+
},
24+
staticDirs: ["../public"],
25+
};
26+
export default config;
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import type { Preview } from "@storybook/react";
2+
3+
const preview: Preview = {
4+
parameters: {
5+
controls: {
6+
matchers: {
7+
color: /(background|color)$/i,
8+
date: /Date$/i,
9+
},
10+
},
11+
},
12+
};
13+
14+
export default preview;

apps/storybook/README.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
2+
3+
## Getting Started
4+
5+
First, run the development server:
6+
7+
```bash
8+
npm run dev
9+
# or
10+
yarn dev
11+
# or
12+
pnpm dev
13+
# or
14+
bun dev
15+
```
16+
17+
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
18+
19+
You can start editing the page by modifying `pages/index.tsx`. The page auto-updates as you edit the file.
20+
21+
[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.ts`.
22+
23+
The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages.
24+
25+
This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.
26+
27+
## Learn More
28+
29+
To learn more about Next.js, take a look at the following resources:
30+
31+
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
32+
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
33+
34+
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
35+
36+
## Deploy on Vercel
37+
38+
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
39+
40+
Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.

apps/storybook/eslint.config.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import { nextJsConfig } from "@repo/eslint-config/next-js";
2+
3+
/** @type {import("eslint").Linter.Config} */
4+
export default nextJsConfig;

0 commit comments

Comments
 (0)