Skip to content

Commit

Permalink
docs: Add clean command.
Browse files Browse the repository at this point in the history
  • Loading branch information
milesj committed Oct 29, 2020
1 parent 3d21436 commit 8793fd1
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 7 deletions.
3 changes: 1 addition & 2 deletions src/Packemon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import {
PackemonPackageConfig,
Platform,
TypesBuild,
AnalyzeType,
} from './types';

const debug = createDebugger('packemon:core');
Expand Down Expand Up @@ -79,7 +78,7 @@ export default class Packemon {
const options = optimal(baseOptions, {
addEngines: bool(),
addExports: bool(),
analyzeBundle: string('treemap').oneOf<AnalyzeType>(['sunburst', 'treemap', 'network']),
analyzeBundle: string().oneOf(['', 'sunburst', 'treemap', 'network']),
checkLicenses: bool(),
concurrency: number(1).gte(1),
generateDeclaration: bool(),
Expand Down
2 changes: 1 addition & 1 deletion src/commands/Clean.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Packemon from '../Packemon';

export type CleanParams = [string];

@Config('clean', 'Clean build artifacts from all packages.')
@Config('clean', 'Clean build artifacts from packages.')
export class CleanCommand extends Command<GlobalOptions, CleanParams> {
@Arg.Params<CleanParams>({
description: 'Project root that contains a `package.json`',
Expand Down
7 changes: 4 additions & 3 deletions website/docs/build.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
---
title: Building packages
sidebar_label: build
---

Packemon was primarily designed and engineered for building packages. But what is building you ask?
Building is the process of parsing, transforming, and bundling a package's source code into
distributable and consumable files for NPM, using community favorite tools like [Babel][babel] and
[Rollup][rollup].

With that being said, the `packemon build` command can be used to build all packages in a project
according to their configured build targets (platform, formats, etc).
With that being said, the `build` command can be used to build all packages in a project according
to their configured build targets (platform, formats, etc).

```
packemon build --checkLicenses --generateDeclaration
Expand Down Expand Up @@ -153,7 +154,7 @@ The environment preset is always enabled and configures the following.
- `@babel/preset-env`
- Defines `modules` and `targets` based on the chosen [platform](./config.md#platforms) and
[format](./config.md#formats).
- Enables `spec` and disables `loose` for spec compliance.
- Enables `spec` (in development) and disables `loose` for closer compliance.
- Enables `bugfixes` and `shippedProposals` for smaller file sizes.
- Disables `useBuiltIns` as consumers of the package should polyfill accordingly.

Expand Down
15 changes: 15 additions & 0 deletions website/docs/clean.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
title: Cleaning packages
sidebar_label: clean
---

Building packages generate temporary files or folders that clutter a project. Sometimes these
artifacts aren't properly cleaned up because a process failed midway. The `clean` command can be
used to remove all temporary files _and_ all build artifacts (lib, esm, etc folders).

```bash
packemon clean
```

> Cleaning a project before a release is a good practice for ensuring unknown artifacts are not
> distributed.
7 changes: 6 additions & 1 deletion website/sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@ module.exports = {
'install',
'setup',
'config',
'build',
{
type: 'category',
label: 'Commands',
collapsed: false,
items: ['build', 'clean'],
},
'advanced',
{
type: 'link',
Expand Down

0 comments on commit 8793fd1

Please sign in to comment.