Skip to content

Commit

Permalink
docs(nano-build): Add nano-build usage and configuration instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
alimd committed Dec 20, 2023
1 parent 9b78cbf commit 8596b12
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 1 deletion.
70 changes: 70 additions & 0 deletions packages/nano-build/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,73 @@
# Nano build

Build/bundle tools for ECMAScript, TypeScript, and JavaScript libraries. It's easy to use, doesn't require any setup, and adheres to best practices. It has no dependencies and uses esbuild for enhanced performance.

## Usage

Install the package:

```bash
yarn add -D @alwatr/nano-build
```

Add the following scripts to your `package.json`:

```json
{
"scripts": {
"build": "nano-build",
"watch": "nano-build --watch",
"clean": "rm -rfv dist .tsbuildinfo"
},
}
```

## Configuration

Add 'nano-build' field to your `package.json`:

```json
{
"nano-build": {
"bundle": true
},
"nano-build-development": {
"minify": false,
"sourcemap": true
},
"nano-build-production": {
"minify": true,
"sourcemap": false
}
}
```

default configuration:

```json
{
"entryPoints": ["src/main.ts"],
"outdir": "dist",
"logLevel": "info",
"platform": "node",
"target": "es2020",
"format": "esm",
"cjs": true,
"minify": true,
"mangleProps": "_$",
"treeShaking": false,
"sourcemap": true,
"sourcesContent": true,
"bundle": true,
"packages": "external",
"splitting": false,
"charset": "utf8",
"legalComments": "none",
"banner": {
"js": "/* @package_name v@package_version */"
},
"define": {
"__package_version": "'@package_version'"
}
}
```
2 changes: 1 addition & 1 deletion packages/nano-build/nano-build.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const devMode = process.env.NODE_ENV !== 'production';
cjs: true,
minify: true,
mangleProps: '_$',
// treeShaking: true,
treeShaking: false,
sourcemap: true,
sourcesContent: true,
bundle: true,
Expand Down

0 comments on commit 8596b12

Please sign in to comment.