@icebreakers/monorepo-templates 1.2.1 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/.github/workflows/ci.yml +4 -4
- package/assets/.github/workflows/release.yml +8 -7
- package/assets/package.json +2 -1
- package/assets/renovate.json +0 -1
- package/assets-data.mjs +0 -1
- package/dist/cli.mjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{prepare--cxFop8c.mjs → prepare-D7eJqEqy.mjs} +1 -2
- package/package.json +2 -2
- package/templates/cli/package.json +1 -1
- package/templates/client/package.json +1 -1
- package/templates/server/package.json +1 -1
- package/templates/tsdown/package.json +1 -1
- package/templates/vitepress/.vitepress/config.ts +9 -119
- package/templates/vitepress/.vitepress/env.d.ts +1 -0
- package/templates/vitepress/.vitepress/home/content.ts +186 -0
- package/templates/vitepress/.vitepress/home/types.ts +65 -0
- package/templates/vitepress/.vitepress/navigation/routes.ts +138 -0
- package/templates/vitepress/.vitepress/seo.ts +40 -0
- package/templates/vitepress/.vitepress/theme/components/HomePage.vue +134 -0
- package/templates/vitepress/.vitepress/theme/home/foundation.css +180 -0
- package/templates/vitepress/.vitepress/theme/home/index.css +3 -0
- package/templates/vitepress/.vitepress/theme/home/responsive.css +49 -0
- package/templates/vitepress/.vitepress/theme/home/sections.css +153 -0
- package/templates/vitepress/.vitepress/theme/index.ts +9 -1
- package/templates/vitepress/ai/llms-txt.md +2 -2
- package/templates/vitepress/index.md +6 -60
- package/templates/vitepress/package.json +11 -4
- package/templates/vitepress/public/repoctl-doctor.png +0 -0
- package/templates/vitepress/repoctl/workflows.md +35 -0
- package/templates/vitepress/scripts/check-locales.ts +162 -0
- package/templates/vitepress/thinking.md +15 -0
- package/templates/vitepress/tools/changeset.md +17 -12
- package/templates/vitepress/tools/husky.md +41 -3
- package/templates/vitepress/tools/lint-staged.md +32 -5
- package/templates/vitepress/tools/pnpm.md +39 -7
- package/templates/vitepress/tools/renovate.md +27 -3
- package/templates/vitepress/tools/turborepo.md +33 -7
- package/templates/vitepress/tsconfig.json +7 -0
- package/templates/vitepress/why/examples/2.npm-basic-package/README.md +1 -1
- package/templates/vitepress/why/examples/3.npm-basic-package/README.md +1 -1
- package/templates/vitepress/why/how-to-reuse-js-code.md +36 -6
- package/templates/vitepress/why/js-cjs-mjs.md +31 -9
- package/templates/vitepress/why/js-keywords.md +33 -4
- package/templates/vitepress/why/modern/bundlers.md +37 -2
- package/templates/vitepress/why/modern/dts.md +44 -3
- package/templates/vitepress/why/modern/esm-vs-cjs.md +38 -3
- package/templates/vitepress/why/modern/index.md +33 -9
- package/templates/vitepress/why/modern/package-entry-points.md +33 -4
- package/templates/vitepress/why/modern/typescript.md +40 -4
- package/templates/vitepress/why/publish-basic-npm-package.md +37 -13
- package/templates/vitepress/why/what-is-npm-package.md +32 -3
- package/templates/vitepress/wrangler.jsonc +20 -3
- package/templates/vitepress/zh/ai/index.md +1 -1
- package/templates/vitepress/zh/ai/llms-txt.md +1 -1
- package/templates/vitepress/zh/index.md +6 -63
- package/templates/vitepress/zh/repoctl/workflows.md +35 -0
- package/templates/vitepress/zh/thinking.md +9 -6
- package/templates/vitepress/zh/why/examples/2.npm-basic-package/README.md +1 -1
- package/templates/vitepress/zh/why/examples/3.npm-basic-package/README.md +1 -1
- package/templates/vitepress/zh/why/index.md +38 -1
- package/templates/vue-lib/package.json +1 -1
- package/assets/netlify.toml +0 -14
|
@@ -1 +1 @@
|
|
|
1
|
-
https://
|
|
1
|
+
https://repoctl.icebreaker.top/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
https://
|
|
1
|
+
https://repoctl.icebreaker.top/
|
|
@@ -1,9 +1,39 @@
|
|
|
1
|
-
# Reusing JavaScript
|
|
1
|
+
# Reusing JavaScript
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Reuse source code through an explicit package boundary. Copying files between applications is fast once and expensive every time the shared behavior changes; a local workspace package makes ownership, versioning, and tests visible.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
- Use a workspace package when multiple projects in the same repository share versioned behavior.
|
|
7
|
-
- Publish an npm package when external repositories need a stable public API.
|
|
5
|
+
## Start with a workspace package
|
|
8
6
|
|
|
9
|
-
|
|
7
|
+
```json
|
|
8
|
+
{
|
|
9
|
+
"dependencies": {
|
|
10
|
+
"@example/shared": "workspace:*"
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
The workspace protocol uses the local package during development and protects the repository from accidentally resolving an unrelated registry version.
|
|
16
|
+
|
|
17
|
+
## Export a narrow API
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
export function normalizeName(value: string) {
|
|
21
|
+
return value.trim().toLowerCase()
|
|
22
|
+
}
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Keep the public entry point small. A shared package should expose behavior that has a real consumer, not a collection of unrelated helpers that happen to be nearby.
|
|
26
|
+
|
|
27
|
+
## Choose the right reuse level
|
|
28
|
+
|
|
29
|
+
| Need | Better boundary |
|
|
30
|
+
| ---------------------------- | -------------------------------------- |
|
|
31
|
+
| Shared runtime behavior | A versioned package |
|
|
32
|
+
| Shared build and lint policy | A preset package or managed asset |
|
|
33
|
+
| Shared application feature | A feature package with clear ownership |
|
|
34
|
+
| One-off project setup | A template, not a dependency |
|
|
35
|
+
|
|
36
|
+
## Keep Reading
|
|
37
|
+
|
|
38
|
+
- [What Is An npm Package?](./what-is-npm-package.md)
|
|
39
|
+
- [Template Systems](../monorepo/templates.md)
|
|
@@ -1,12 +1,34 @@
|
|
|
1
|
-
# JavaScript
|
|
1
|
+
# JavaScript, CommonJS, and ESM Files
|
|
2
2
|
|
|
3
|
-
Node
|
|
3
|
+
File extensions tell Node which module loader should read a file. Use them deliberately when a package publishes both module formats or when a script must work independently of the nearest `package.json`.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
| --------------- | --------------------------------------------- |
|
|
7
|
-
| `.mjs` | Always ES module |
|
|
8
|
-
| `.cjs` | Always CommonJS |
|
|
9
|
-
| `.js` | Depends on `package.json` `type` |
|
|
10
|
-
| `.mts` / `.cts` | TypeScript source with explicit module intent |
|
|
5
|
+
## Extension rules
|
|
11
6
|
|
|
12
|
-
|
|
7
|
+
| Extension | Module format |
|
|
8
|
+
| --------- | ----------------------------------------------------- |
|
|
9
|
+
| `.mjs` | ESM in every package |
|
|
10
|
+
| `.cjs` | CommonJS in every package |
|
|
11
|
+
| `.js` | Determined by the nearest `package.json` `type` field |
|
|
12
|
+
|
|
13
|
+
```json
|
|
14
|
+
{
|
|
15
|
+
"type": "module"
|
|
16
|
+
}
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
With this declaration, `.js` files are ESM. Use `.cjs` for CommonJS output such as a compatibility build or an older tooling configuration file.
|
|
20
|
+
|
|
21
|
+
## Avoid ambiguous output
|
|
22
|
+
|
|
23
|
+
```text
|
|
24
|
+
dist/index.js ESM output
|
|
25
|
+
dist/index.cjs CommonJS output
|
|
26
|
+
dist/index.d.ts Type declarations
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Connect these files through `exports`; do not ask consumers to infer a `dist` layout. A clear output layout also makes package tarball checks easier.
|
|
30
|
+
|
|
31
|
+
## Keep Reading
|
|
32
|
+
|
|
33
|
+
- [ESM vs CommonJS](./modern/esm-vs-cjs.md)
|
|
34
|
+
- [Package Entry Points](./modern/package-entry-points.md)
|
|
@@ -1,7 +1,36 @@
|
|
|
1
|
-
#
|
|
1
|
+
# JavaScript Runtime Keywords
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Modern JavaScript modules have different runtime globals depending on whether Node loads them as CommonJS or ESM. Know the boundary before copying code between build tools, scripts, and package entry points.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## CommonJS values
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
```js
|
|
8
|
+
console.log(__filename)
|
|
9
|
+
console.log(__dirname)
|
|
10
|
+
console.log(require.main)
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
These values are available in CommonJS modules. They are not automatically present in ESM files.
|
|
14
|
+
|
|
15
|
+
## ESM equivalents
|
|
16
|
+
|
|
17
|
+
```js
|
|
18
|
+
import path from 'node:path'
|
|
19
|
+
import { fileURLToPath } from 'node:url'
|
|
20
|
+
|
|
21
|
+
const filename = fileURLToPath(import.meta.url)
|
|
22
|
+
const dirname = path.dirname(filename)
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Use `import.meta.url` as the starting point for resolving files relative to an ESM module. Prefer explicit Node built-in imports such as `node:path` so bundlers and readers can identify runtime-only dependencies.
|
|
26
|
+
|
|
27
|
+
## Keep code portable
|
|
28
|
+
|
|
29
|
+
- Keep filesystem access behind a small module when browser builds share source code.
|
|
30
|
+
- Do not use CommonJS globals in a package that declares `type: module`.
|
|
31
|
+
- Test generated ESM and CommonJS outputs independently when both are published.
|
|
32
|
+
|
|
33
|
+
## Keep Reading
|
|
34
|
+
|
|
35
|
+
- [JavaScript, CommonJS, and ESM Files](./js-cjs-mjs.md)
|
|
36
|
+
- [Reusing JavaScript](./how-to-reuse-js-code.md)
|
|
@@ -1,5 +1,40 @@
|
|
|
1
1
|
# Bundlers
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Choose a bundler by the package boundary you need to ship. A library build needs reliable entry points and declarations; a component library also needs framework and CSS handling; an application build needs an optimized browser bundle.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Current choices
|
|
6
|
+
|
|
7
|
+
| Tool | Good fit | Notes |
|
|
8
|
+
| ---------- | ----------------------------------------------- | ------------------------------------------------- |
|
|
9
|
+
| `tsdown` | TypeScript libraries and tooling | Produces modern library output with declarations |
|
|
10
|
+
| `vite` | Applications and component libraries | Strong development server and library mode |
|
|
11
|
+
| `rolldown` | Toolchains that need Rollup-compatible behavior | Evaluate ecosystem compatibility before migration |
|
|
12
|
+
|
|
13
|
+
The repoctl generic library template uses `tsdown`. Vue component libraries continue to use Vite library mode.
|
|
14
|
+
|
|
15
|
+
## tsdown library configuration
|
|
16
|
+
|
|
17
|
+
:::code-group
|
|
18
|
+
|
|
19
|
+
```ts [tsdown.config.ts]
|
|
20
|
+
import { defineConfig } from 'tsdown'
|
|
21
|
+
|
|
22
|
+
export default defineConfig({
|
|
23
|
+
entry: ['./src/index.ts'],
|
|
24
|
+
format: ['cjs', 'esm'],
|
|
25
|
+
dts: true,
|
|
26
|
+
clean: true,
|
|
27
|
+
target: 'node18',
|
|
28
|
+
})
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
:::
|
|
32
|
+
|
|
33
|
+
## Retired defaults
|
|
34
|
+
|
|
35
|
+
`tsup` and `unbuild` are not recommended for new repoctl templates. Existing projects can migrate when their build behavior and published artifacts are covered by tests. Do not rewrite a working package merely to follow a tooling trend.
|
|
36
|
+
|
|
37
|
+
## Keep Reading
|
|
38
|
+
|
|
39
|
+
- [TypeScript](./typescript.md)
|
|
40
|
+
- [Package Entry Points](./package-entry-points.md)
|
|
@@ -1,7 +1,48 @@
|
|
|
1
1
|
# Type Declarations
|
|
2
2
|
|
|
3
|
-
Type declarations
|
|
3
|
+
Type declarations describe the public TypeScript contract of a JavaScript package. They must be generated from the same source and exported through the same public entry points as the runtime code.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Emit declarations
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
```json
|
|
8
|
+
{
|
|
9
|
+
"compilerOptions": {
|
|
10
|
+
"declaration": true,
|
|
11
|
+
"declarationMap": true,
|
|
12
|
+
"emitDeclarationOnly": false,
|
|
13
|
+
"outDir": "./dist"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Bundlers such as tsdown can emit declaration files alongside runtime output. The important rule is that declaration paths are stable and match the package exports map.
|
|
19
|
+
|
|
20
|
+
## Link types to exports
|
|
21
|
+
|
|
22
|
+
```json
|
|
23
|
+
{
|
|
24
|
+
"exports": {
|
|
25
|
+
".": {
|
|
26
|
+
"types": "./dist/index.d.ts",
|
|
27
|
+
"import": "./dist/index.js",
|
|
28
|
+
"require": "./dist/index.cjs"
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
The top-level `types` field is useful for simple packages. Per-entry `types` declarations are necessary when a package exposes subpaths or format-specific output.
|
|
35
|
+
|
|
36
|
+
## Test the public contract
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
pnpm tsd
|
|
40
|
+
pnpm pack --dry-run
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Type tests should import from the package name, not a source file. That proves the declarations consumers receive are compatible with the documented API.
|
|
44
|
+
|
|
45
|
+
## Keep Reading
|
|
46
|
+
|
|
47
|
+
- [Package Entry Points](./package-entry-points.md)
|
|
48
|
+
- [TypeScript](./typescript.md)
|
|
@@ -1,7 +1,42 @@
|
|
|
1
1
|
# ESM vs CommonJS
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Node supports two JavaScript module systems. ESM uses `import` and `export`; CommonJS uses `require` and `module.exports`. A package can support both, but it must state how each consumer reaches the correct file.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Identify the format
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
| Signal | Meaning |
|
|
8
|
+
| ------------------------------- | ------------------- |
|
|
9
|
+
| `.mjs` | Always ESM |
|
|
10
|
+
| `.cjs` | Always CommonJS |
|
|
11
|
+
| `.js` with `"type": "module"` | ESM |
|
|
12
|
+
| `.js` without that package type | CommonJS by default |
|
|
13
|
+
|
|
14
|
+
Avoid guessing from syntax alone. Node resolves a `.js` file from its extension and the nearest package boundary.
|
|
15
|
+
|
|
16
|
+
## Publish both formats
|
|
17
|
+
|
|
18
|
+
```json
|
|
19
|
+
{
|
|
20
|
+
"type": "module",
|
|
21
|
+
"exports": {
|
|
22
|
+
".": {
|
|
23
|
+
"import": "./dist/index.js",
|
|
24
|
+
"require": "./dist/index.cjs"
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Use an exports map rather than asking consumers to reach into `dist`. It gives each module system an intentional entry point and prevents accidental private imports becoming a public API.
|
|
31
|
+
|
|
32
|
+
## Interoperability rules
|
|
33
|
+
|
|
34
|
+
- Keep the package API identical across formats where possible.
|
|
35
|
+
- Test both `import` and `require` from a consumer fixture.
|
|
36
|
+
- Do not publish TypeScript source as the runtime entry point.
|
|
37
|
+
- Use `.cjs` for CommonJS output when the package itself declares `type: module`.
|
|
38
|
+
|
|
39
|
+
## Keep Reading
|
|
40
|
+
|
|
41
|
+
- [Package Entry Points](./package-entry-points.md)
|
|
42
|
+
- [Type Declarations](./dts.md)
|
|
@@ -1,14 +1,38 @@
|
|
|
1
1
|
# Modern Package Guide
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A publishable package is more than a source folder. Consumers depend on its runtime format, type declarations, entry points, files list, and compatibility policy. This guide explains the decisions that keep those contracts explicit.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Start with the consumer
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
- Declare every public subpath in `exports`.
|
|
9
|
-
- Emit and test type declarations.
|
|
10
|
-
- Keep development-only files out of the package tarball.
|
|
11
|
-
- Validate the supported Node and bundler matrix.
|
|
12
|
-
- Record public changes through repository versioning.
|
|
7
|
+
Before choosing a bundler or module format, answer these questions:
|
|
13
8
|
|
|
14
|
-
|
|
9
|
+
- Will consumers load the package through ESM, CommonJS, or both?
|
|
10
|
+
- Does the package ship runtime code, types, a CLI, or generated assets?
|
|
11
|
+
- Which Node versions must work?
|
|
12
|
+
- Should consumers import one public entry point or several intentional subpaths?
|
|
13
|
+
|
|
14
|
+
The answers define the package boundary. Tooling should implement that boundary, not invent it.
|
|
15
|
+
|
|
16
|
+
## Recommended shape
|
|
17
|
+
|
|
18
|
+
```text
|
|
19
|
+
src/ source code
|
|
20
|
+
dist/ generated ESM, CommonJS, and declaration files
|
|
21
|
+
package.json public metadata and exports map
|
|
22
|
+
README.md installation and usage contract
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Use `files` to publish only the built output and deliberately included documentation. Run `npm pack --dry-run` before publishing to inspect the actual package tarball.
|
|
26
|
+
|
|
27
|
+
## Topics
|
|
28
|
+
|
|
29
|
+
- [ESM vs CommonJS](./esm-vs-cjs.md)
|
|
30
|
+
- [Type Declarations](./dts.md)
|
|
31
|
+
- [Package Entry Points](./package-entry-points.md)
|
|
32
|
+
- [Bundlers](./bundlers.md)
|
|
33
|
+
- [TypeScript](./typescript.md)
|
|
34
|
+
|
|
35
|
+
## Keep Reading
|
|
36
|
+
|
|
37
|
+
- [What Is An npm Package?](../what-is-npm-package.md)
|
|
38
|
+
- [Publishing A Package](../publish-basic-npm-package.md)
|
|
@@ -1,17 +1,46 @@
|
|
|
1
1
|
# Package Entry Points
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The `exports` field is the public map of a package. It selects files for ESM, CommonJS, types, and intentional subpath imports while preventing consumers from coupling to internal folders.
|
|
4
|
+
|
|
5
|
+
## Define one primary entry
|
|
4
6
|
|
|
5
7
|
```json
|
|
6
8
|
{
|
|
9
|
+
"name": "example-package",
|
|
7
10
|
"exports": {
|
|
8
11
|
".": {
|
|
9
12
|
"types": "./dist/index.d.ts",
|
|
10
|
-
"import": "./dist/index.js"
|
|
11
|
-
|
|
13
|
+
"import": "./dist/index.js",
|
|
14
|
+
"require": "./dist/index.cjs"
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Consumers can now use `import { feature } from 'example-package'` or `require('example-package')` without knowing your output layout.
|
|
21
|
+
|
|
22
|
+
## Add a deliberate subpath
|
|
23
|
+
|
|
24
|
+
```json
|
|
25
|
+
{
|
|
26
|
+
"exports": {
|
|
27
|
+
".": "./dist/index.js",
|
|
28
|
+
"./cli": "./dist/cli.js",
|
|
12
29
|
"./package.json": "./package.json"
|
|
13
30
|
}
|
|
14
31
|
}
|
|
15
32
|
```
|
|
16
33
|
|
|
17
|
-
|
|
34
|
+
Each subpath is a public promise. Add one only when it has a stable purpose, documentation, and tests. Do not expose `./dist/*` as a shortcut around API design.
|
|
35
|
+
|
|
36
|
+
## Verify consumers
|
|
37
|
+
|
|
38
|
+
- Test the root import and every documented subpath.
|
|
39
|
+
- Verify both ESM and CommonJS branches when both are published.
|
|
40
|
+
- Check `npm pack --dry-run` includes every exported file.
|
|
41
|
+
- Treat removing or changing a public subpath as a breaking change.
|
|
42
|
+
|
|
43
|
+
## Keep Reading
|
|
44
|
+
|
|
45
|
+
- [ESM vs CommonJS](./esm-vs-cjs.md)
|
|
46
|
+
- [Type Declarations](./dts.md)
|
|
@@ -1,7 +1,43 @@
|
|
|
1
|
-
# TypeScript
|
|
1
|
+
# TypeScript
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
TypeScript gives a package one source language for implementation and public types. Build output should remain JavaScript plus declarations so consumers do not need your development compiler configuration.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Start with a strict package config
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
```jsonc
|
|
8
|
+
{
|
|
9
|
+
"compilerOptions": {
|
|
10
|
+
"target": "ES2020",
|
|
11
|
+
"module": "ESNext",
|
|
12
|
+
"moduleResolution": "bundler",
|
|
13
|
+
"strict": true,
|
|
14
|
+
"declaration": true,
|
|
15
|
+
"declarationMap": true,
|
|
16
|
+
"outDir": "./dist",
|
|
17
|
+
"skipLibCheck": true
|
|
18
|
+
},
|
|
19
|
+
"include": ["src"]
|
|
20
|
+
}
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Use a separate configuration only when an output format genuinely needs different compiler behavior. Prefer a bundler configuration for output strategy and keep the TypeScript configuration focused on source checking and declaration generation.
|
|
24
|
+
|
|
25
|
+
## Build and test from artifacts
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
pnpm build
|
|
29
|
+
pnpm typecheck
|
|
30
|
+
pnpm tsd
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Run type tests against the generated package contract. A source-only test can pass while the published declaration path or exports map is broken.
|
|
34
|
+
|
|
35
|
+
## Runtime execution
|
|
36
|
+
|
|
37
|
+
For local scripts, `tsx` can run TypeScript without creating a development `dist` directory. That is convenient for tooling, but it is not a replacement for building libraries before testing the package that consumers install.
|
|
38
|
+
|
|
39
|
+
## Keep Reading
|
|
40
|
+
|
|
41
|
+
- [Type Declarations](./dts.md)
|
|
42
|
+
- [Bundlers](./bundlers.md)
|
|
43
|
+
- [Publishing A Package](../publish-basic-npm-package.md)
|
|
@@ -1,19 +1,43 @@
|
|
|
1
|
-
# Publishing
|
|
1
|
+
# Publishing A Package
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
Publishing is the point where the repository's package contract becomes public. Build first, test the built artifacts, inspect the tarball, and publish only after the version intent and changelog describe the consumer-visible change.
|
|
4
|
+
|
|
5
|
+
## Prepare the package
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm --filter example-package build
|
|
9
|
+
pnpm --filter example-package typecheck
|
|
10
|
+
pnpm --filter example-package test
|
|
11
|
+
pnpm --filter example-package tsd
|
|
12
|
+
pnpm --filter example-package pack --pack-destination ../../artifacts
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Run the package commands against generated output where possible. A source-only test does not prove that `exports`, files, or declarations will resolve after installation.
|
|
16
|
+
|
|
17
|
+
## Verify package metadata
|
|
18
|
+
|
|
19
|
+
```json
|
|
20
|
+
{
|
|
21
|
+
"name": "example-package",
|
|
22
|
+
"version": "1.0.0",
|
|
23
|
+
"files": ["dist", "README.md", "LICENSE"],
|
|
24
|
+
"publishConfig": { "access": "public" }
|
|
25
|
+
}
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Use `npm pack --dry-run` to see what users receive. Confirm the runtime entry point, declaration files, README, and license are present.
|
|
29
|
+
|
|
30
|
+
## Release through the repository workflow
|
|
8
31
|
|
|
9
32
|
```bash
|
|
10
|
-
pnpm build
|
|
11
|
-
pnpm lint
|
|
12
|
-
pnpm typecheck
|
|
13
|
-
pnpm tsd
|
|
14
|
-
pnpm test
|
|
15
|
-
pnpm pack
|
|
16
33
|
pnpm change
|
|
34
|
+
pnpm version -r
|
|
35
|
+
pnpm publish -r
|
|
17
36
|
```
|
|
18
37
|
|
|
19
|
-
|
|
38
|
+
The version ledger preserves why the release exists. Do not manually edit a package version to bypass fixed-group or changelog rules.
|
|
39
|
+
|
|
40
|
+
## Keep Reading
|
|
41
|
+
|
|
42
|
+
- [pnpm Versioning](../tools/changeset.md)
|
|
43
|
+
- [Modern Package Guide](./modern/)
|
|
@@ -1,7 +1,36 @@
|
|
|
1
1
|
# What Is An npm Package?
|
|
2
2
|
|
|
3
|
-
An npm package is a
|
|
3
|
+
An npm package is a versioned archive with a `package.json` contract. It may provide runtime JavaScript, type declarations, a command-line binary, configuration presets, or assets. Publishing a folder is easy; maintaining that contract is the real work.
|
|
4
4
|
|
|
5
|
-
The
|
|
5
|
+
## The package boundary
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
```text
|
|
8
|
+
package.json name, version, exports, files, engines
|
|
9
|
+
README.md install and supported usage
|
|
10
|
+
dist/ built runtime and type declarations
|
|
11
|
+
LICENSE license terms for consumers
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Only files named by `files`, exports, and package metadata should be treated as public. Internal source layout is free to change until it appears in the published contract.
|
|
15
|
+
|
|
16
|
+
## Inspect what ships
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npm pack --dry-run
|
|
20
|
+
pnpm pack --pack-destination ./artifacts
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Review the archive after every material packaging change. This catches missing declarations, accidental source publication, and files referenced by `exports` that were not included.
|
|
24
|
+
|
|
25
|
+
## Version with intent
|
|
26
|
+
|
|
27
|
+
- Patch: compatible fix or metadata correction.
|
|
28
|
+
- Minor: compatible capability, such as a new public command or template.
|
|
29
|
+
- Major: incompatible API, behavior, or supported runtime change.
|
|
30
|
+
|
|
31
|
+
Repository versioning tools record that decision, but they cannot determine whether a consumer will be broken. Write the release note from the consumer's point of view.
|
|
32
|
+
|
|
33
|
+
## Keep Reading
|
|
34
|
+
|
|
35
|
+
- [Publishing A Package](./publish-basic-npm-package.md)
|
|
36
|
+
- [Modern Package Guide](./modern/)
|
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$schema": "
|
|
3
|
-
"name": "
|
|
4
|
-
"
|
|
2
|
+
"$schema": "./node_modules/wrangler/config-schema.json",
|
|
3
|
+
"name": "repoctl-docs",
|
|
4
|
+
"compatibility_date": "2026-08-16",
|
|
5
|
+
"compatibility_flags": ["nodejs_compat"],
|
|
6
|
+
"workers_dev": false,
|
|
7
|
+
"preview_urls": true,
|
|
8
|
+
"assets": {
|
|
9
|
+
"directory": ".vitepress/dist",
|
|
10
|
+
"not_found_handling": "404-page"
|
|
11
|
+
},
|
|
12
|
+
"routes": [
|
|
13
|
+
{
|
|
14
|
+
"pattern": "repoctl.icebreaker.top",
|
|
15
|
+
"custom_domain": true
|
|
16
|
+
}
|
|
17
|
+
],
|
|
18
|
+
"observability": {
|
|
19
|
+
"enabled": true,
|
|
20
|
+
"head_sampling_rate": 1
|
|
21
|
+
}
|
|
5
22
|
}
|
|
@@ -16,7 +16,7 @@ AI 文档入口用于给 Cursor、Claude Code、Codex 和其他 AI 编程工具
|
|
|
16
16
|
|
|
17
17
|
## 2. 在 AI 工具里怎么用
|
|
18
18
|
|
|
19
|
-
优先把 `https://
|
|
19
|
+
优先把 `https://repoctl.icebreaker.top/llms.txt` 作为入口提供给 AI 工具。只有当工具不能继续抓取链接,或者你需要离线提供完整上下文时,再使用 `https://repoctl.icebreaker.top/llms-full.txt`。
|
|
20
20
|
|
|
21
21
|
```txt
|
|
22
22
|
先给 llms.txt
|
|
@@ -16,7 +16,7 @@ description: 使用 llms.txt 为大语言模型提供更易读取的 repoctl 文
|
|
|
16
16
|
|
|
17
17
|
## 1. 使用方式
|
|
18
18
|
|
|
19
|
-
访问 `https://
|
|
19
|
+
访问 `https://repoctl.icebreaker.top/llms.txt` 可以获取当前文档的 LLM 索引。如果需要一次性提供完整上下文,可以使用 `https://repoctl.icebreaker.top/llms-full.txt`。
|
|
20
20
|
|
|
21
21
|
当你在 Cursor、Claude Code、Codex 或其他 AI 编程工具里引用 repoctl 文档时,优先提供 `llms.txt`,再按需要补充具体页面链接。
|
|
22
22
|
|
|
@@ -1,66 +1,9 @@
|
|
|
1
1
|
---
|
|
2
|
-
layout:
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
tagline: 用一套 CLI 管理初始化、诊断、创建模板、提交前校验和模板资产同步。
|
|
8
|
-
image:
|
|
9
|
-
src: /logo.jpg
|
|
10
|
-
alt: repoctl logo
|
|
11
|
-
actions:
|
|
12
|
-
- theme: brand
|
|
13
|
-
text: 快速开始
|
|
14
|
-
link: /zh/repoctl/getting-started
|
|
15
|
-
- theme: alt
|
|
16
|
-
text: 命令速查
|
|
17
|
-
link: /zh/repoctl/commands
|
|
18
|
-
- theme: alt
|
|
19
|
-
text: AI 文档入口
|
|
20
|
-
link: /zh/ai/
|
|
21
|
-
|
|
22
|
-
features:
|
|
23
|
-
- title: 从已有仓库开始
|
|
24
|
-
details: 安装 repoctl 后运行 setup 和 doctor,先把 workspace、根脚本、配置冲突和提交链路检查清楚。
|
|
25
|
-
- title: 用模板创建包和应用
|
|
26
|
-
details: repo new 支持交互式创建、指定模板、dry-run、JSON 输出和创建计划落盘。
|
|
27
|
-
- title: 把质量门禁变成日常命令
|
|
28
|
-
details: repo check 统一预览和执行 lint、typecheck、build、test、tsd 等推荐校验。
|
|
29
|
-
- title: 给 AI 工具的文档入口
|
|
30
|
-
details: 构建时自动生成 llms.txt、llms-full.txt 和页面 Markdown,让 AI 编程工具更容易读取 repoctl 文档。
|
|
2
|
+
layout: page
|
|
3
|
+
aside: false
|
|
4
|
+
pageClass: repoctl-home-page
|
|
5
|
+
title: repoctl
|
|
6
|
+
description: 面向 pnpm 与 Turborepo monorepo 的任务型 CLI。
|
|
31
7
|
---
|
|
32
8
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
```bash
|
|
36
|
-
pnpm add -D repoctl
|
|
37
|
-
pnpm exec repo init
|
|
38
|
-
pnpm exec repo doctor
|
|
39
|
-
pnpm exec repo new
|
|
40
|
-
pnpm exec repo check
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
在由 repoctl 创建或初始化的仓库里,同一套工作流会暴露成更短的根脚本:
|
|
44
|
-
|
|
45
|
-
```bash
|
|
46
|
-
pnpm run repo:init
|
|
47
|
-
pnpm run repo:doctor
|
|
48
|
-
pnpm run repo:new
|
|
49
|
-
pnpm run repo:check
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
## 你可以继续阅读
|
|
53
|
-
|
|
54
|
-
- [repoctl 概览](./repoctl/index.md)
|
|
55
|
-
- [快速开始](./repoctl/getting-started.md)
|
|
56
|
-
- [接入已有仓库](./repoctl/adopt-existing.md)
|
|
57
|
-
- [按场景选命令](./repoctl/scenarios.md)
|
|
58
|
-
- [执行模型](./repoctl/execution-model.md)
|
|
59
|
-
- [命令速查](./repoctl/commands.md)
|
|
60
|
-
- [校验链路](./repoctl/checks.md)
|
|
61
|
-
- [doctor 诊断](./repoctl/doctor.md)
|
|
62
|
-
- [配置文件](./repoctl/config.md)
|
|
63
|
-
- [模板与创建](./repoctl/templates.md)
|
|
64
|
-
- [模板资产治理](./repoctl/template-assets.md)
|
|
65
|
-
- [工作流与 CI](./repoctl/workflows.md)
|
|
66
|
-
- [报告与自动化输出](./repoctl/reports.md)
|
|
9
|
+
<HomePage locale="zh" />
|