Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Packaging edits #50

Merged
merged 3 commits into from
Aug 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/maestros/app/(maestros)/monorepos/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function Page() {
</h1>
<SubscribeButton />

<div className="z-10 w-full h-full p-2 pt-8 prose lg:prose-lg sm:p-6 dark:prose-invert">
<div className="container z-10 w-full h-full p-2 pt-8 prose lg:prose-lg sm:p-6 dark:prose-invert">
<p>
Some of the largest software engineering organizations in the world
deliver using monorepos and you can, too. With the right knowledge and
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: External Package
sidebarOrderPosition: 0
sidebarOrderPosition: 3
ogDescription: Using the External Packages in a monorepo
---

Expand Down
10 changes: 7 additions & 3 deletions apps/maestros/content/maestros/lessons/packaging/index.mdx
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
---
title: Packaging patterns
title: Compilation patterns
sidebarOrderPosition: 5
ogDescription: Package compilation patterns in monorepos
---

import { UnderConstruction } from '../UnderConstruction';
Making the most out of your monorepo means ensuring that you're packaging your workspaces correctly. Our workspaces need to be given the correct configurations for code sharing and deployment.

<UnderConstruction />
There are three different strategies for compiling your packages within your monorepo:

- [Internal Package](/monorepos/packaging/internal): Compile the source code for your workspace package in your monorepo and share it through installation into other workspaces. This strategy allows you to have hot-reloading for your packages in development and caching for your production builds.
- [Just-In-Time Package](/monorepos/packaging/jit): If you'd like to avoid setting up a compiler, most modern frameworks can compile your packages _as they consume them_. While this strategy is easier to set up, it does come with the tradeoff that you won't be able to cache the build outputs for your packages.
- [External packages](/monorepos/packaging/external): Pull your packages in from the npm registry. This strategy is likely what you want to move away from for any packages that you control the source code for but can still be useful in some scenarios. You'll be moving outside of a typical monorepo workflow in these situations. If you're unsure if a publishing your own external package is right for your monorepo, it probably isn't.
10 changes: 5 additions & 5 deletions apps/maestros/content/maestros/lessons/packaging/internal.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Internal Package
sidebarOrderPosition: 1
sidebarOrderPosition: 0
ogDescription: Using the Internal Package pattern in a monorepo.
---

Expand Down Expand Up @@ -72,7 +72,7 @@ Create a `package.json` in your workspace directory. We'll fill in `"exports"` a
"@repo/tsconfig": "workspace:*",
"@types/react": "^18.2.20",
"@types/react-dom": "^18.2.0",
"tsup": "^7.2.0",
"tsup": "^7.2.0", // Bundler for compilation
"typescript": "^5.1.6"
}
}
Expand Down Expand Up @@ -129,8 +129,8 @@ Head back to your `package.json` and add some scripts:
"exports": {}, // Entry points for your application
// focus(1:4)
"scripts": {
"dev": "tsup -w",
"build": "tsup"
"build": "tsup",
"dev": "tsup --watch"
},
"dependencies": {...},
"devDependencies": {...}
Expand Down Expand Up @@ -160,8 +160,8 @@ To create the entrypoint, we'll fill in the `"exports"` field of the `package.js
}
},
"scripts": {
"dev": "tsup -w",
"build": "tsup",
"dev": "tsup -w"
},
"dependencies": {...},
"devDependencies": {...}
Expand Down
2 changes: 1 addition & 1 deletion apps/maestros/content/maestros/lessons/packaging/jit.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Just-In-Time Package
sidebarOrderPosition: 2
sidebarOrderPosition: 1
ogDescription: Using Just-In-Time Packages in a monorepo
---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export default defineConfig((options) => ({
}));
```

### Add a new to `exports`
### Add a new entry to `exports`

Last, we'll add the entrypoint to our `package.json`.

Expand Down
2 changes: 1 addition & 1 deletion apps/maestros/dictionary.txt
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,4 @@ formatter
CLI
linter
Formatters
whitespace
whitespace