Skip to content

Commit a5e8e07

Browse files
committed
docs: update
1 parent d2080b2 commit a5e8e07

File tree

5 files changed

+70
-0
lines changed

5 files changed

+70
-0
lines changed

docs/.vitepress/config.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { defineConfig } from 'vitepress'
55
export default defineConfig({
66
description: 'Standard for Moeru AI.',
77
themeConfig: {
8+
logo: 'https://github.com/moeru-ai.png',
89
// https://vitepress.dev/reference/default-theme-config
910
nav: [
1011
{ link: '/', text: 'Home' },
@@ -13,6 +14,7 @@ export default defineConfig({
1314

1415
sidebar: calculateSidebar([
1516
'lib',
17+
'node',
1618
// 'Notes',
1719
// { folderName: 'Articles', separate: true },
1820
]),

docs/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,5 @@ features:
1818
- title: TypeScript Library
1919
link: /lib
2020
- title: Node.js Project Architecture
21+
link: /node
2122
---

docs/node/bundler.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Bundler
2+
3+
There are many bundlers out there, so just pick the one that meets your needs.
4+
5+
If I had to recommend one, my recommendation would be [`pkgroll`](https://github.com/privatenumber/pkgroll).
6+
7+
It has the following advantages:
8+
9+
## Zero Configuration
10+
11+
You don't need to configure it, it will be configured automatically based on your package.json.
12+
13+
## Dependency Externalization
14+
15+
Just put the packages you want inline into `devDependencies` instead of `dependencies`.
16+
17+
It will be inline, even including the type (something many other bundlers can't do)
18+
19+
## NOT Opinionated
20+
21+
pkgroll doesn't have the same configuration headaches as unbuild, such as forcing `.cjs`, `.mjs` extensions. (Why am I using the `.mjs` extension when my package is ESM only?)

docs/node/index.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Node.js Project Architecture
2+
3+
Okay, it's 2025 and we're getting ready to write a new Node.js library and publish it to npm.
4+
5+
Let's identify some (for Moeru AI) basics:
6+
7+
- **ESM only**
8+
- Did you know that ESM has been supported since Node.js 12?
9+
- Restricting to ESM only not only reduces package size, but also gives you the freedom to use new features such as top-level-await.
10+
- **TypeScript**
11+
- As a library, not including type definitions is unacceptable to me.
12+
- While other solutions like JSDoc can be used, but DX is extremely poor.
13+
- **pnpm**
14+
- pnpm provides many of the features that will be used below.

docs/node/pnpm.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# pnpm
2+
3+
## [Workspace](https://pnpm.io/workspaces)
4+
5+
## [Catalogs](https://pnpm.io/catalogs)
6+
7+
## [publishConfig](https://pnpm.io/package_json#publishconfig)
8+
9+
pnpm supports overriding something at publish time via publishConfig.
10+
11+
So we can do that:
12+
13+
```json
14+
{
15+
"exports": {
16+
".": "./src/index.ts"
17+
},
18+
"publishConfig": {
19+
"exports": {
20+
".": {
21+
"types": "./dist/index.d.ts",
22+
"default": "./dist/index.js"
23+
}
24+
},
25+
"main": "./dist/index.js",
26+
"module": "./dist/index.js",
27+
"types": "./dist/index.d.ts"
28+
}
29+
}
30+
```
31+
32+
This package will distribute TypeScript directly during local development, no build is required! you no longer need `watch` or `stub`.

0 commit comments

Comments
 (0)