Skip to content

Commit

Permalink
docs: Add pack docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
milesj committed Nov 15, 2020
1 parent 16f297e commit 9173b27
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 15 deletions.
6 changes: 3 additions & 3 deletions src/commands/Watch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ export class WatchCommand extends Command<GlobalOptions> {
this.log('Watching for changes...');
}

enqueueRebuild = (event: string, path: string) => {
@Bind()
enqueueRebuild(event: string, path: string) {
if (event !== 'add' && event !== 'change' && event !== 'unlink') {
return;
}
Expand All @@ -62,7 +63,7 @@ export class WatchCommand extends Command<GlobalOptions> {
this.packagesToRebuild.add(changedPkg);
this.triggerRebuilds();
}
};
}

triggerRebuilds() {
if (this.rebuildTimer) {
Expand All @@ -74,7 +75,6 @@ export class WatchCommand extends Command<GlobalOptions> {
}, this.debounce);
}

@Bind()
async rebuildPackages() {
if (this.rebuilding) {
this.triggerRebuilds();
Expand Down
11 changes: 3 additions & 8 deletions website/docs/build.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: Building packages
title: Build
sidebar_label: build
---

Expand All @@ -14,16 +14,11 @@ to their configured build targets (platform, formats, etc).
```json title="package.json"
{
"scripts": {
"build:internal": "packemon build --addEngines --generateDeclaration=api",
"build": "NODE_ENV=production yarn run build:internal",
"release": "yarn run build && yarn publish"
"build": "packemon build --addEngines"
}
}
```

> When publishing, be sure to set `NODE_ENV` to production to remove all development and testing
> configuration settings.
## Options

Build supports the following command line options.
Expand All @@ -44,7 +39,7 @@ Build supports the following command line options.
- `standard` - Generates multiple `d.ts` files with `tsc`.
- `api` - Generates a single `d.ts` file for each input. Uses
[@microsoft/api-extractor](https://www.npmjs.com/package/@microsoft/api-extractor) to _only_
generate the public API. (NOTE: this is quite slow)
generate the public API. _(NOTE: this is quite slow)_
- `--skipPrivate` - Skip `private` packages from being built.
- `--timeout` - Timeout in milliseconds before a build is cancelled. Defaults to no timeout.

Expand Down
2 changes: 1 addition & 1 deletion website/docs/clean.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: Cleaning packages
title: Clean
sidebar_label: clean
---

Expand Down
28 changes: 28 additions & 0 deletions website/docs/pack.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
title: Pack
sidebar_label: pack
---

The `pack` command is a multi-step pre-release solution for preparing packages for distribution.
When ran, it begins by [cleaning workspaces](./clean.md), then [building all packages](./build.md),
and finally [validating all packages](./validate.md) before a release.

If any of the steps fail, a non-zero exit code will be triggered, allowing the release cycle to be
aborted.

```json title="package.json"
{
"scripts": {
"pack": "NODE_ENV=production packemon pack --addEngines --generateDeclaration=api",
"release": "yarn run pack && yarn publish"
}
}
```

> When releasing, be sure to set `NODE_ENV` to production to remove all development and testing
> configuration settings.
## Options

Pack supports all the same command line options as [`build`](./build.md). The validation step cannot
be customized and will vaidate _everything_ by default.
3 changes: 1 addition & 2 deletions website/docs/validate.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: Validating packages
title: Validate
sidebar_label: validate
---

Expand All @@ -14,7 +14,6 @@ pre-publish step. It accomplishes this by inspecting each package's `package.jso
```json title="package.json"
{
"scripts": {
"release": "yarn run build && yarn run validate && yarn publish",
"validate": "packemon validate"
}
}
Expand Down
2 changes: 1 addition & 1 deletion website/sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module.exports = {
type: 'category',
label: 'Commands',
collapsed: false,
items: ['build', 'clean', 'validate', 'watch'],
items: ['build', 'clean', 'pack', 'validate', 'watch'],
},
'advanced',
{
Expand Down

0 comments on commit 9173b27

Please sign in to comment.