Skip to content

adamjosefus/esbuilder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

17 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

ESBuilder

Simple and easy to use solution for building your modules to native ES syntax.

You can found this project on Deno.land registry.

Installations

  1. Install Deno πŸ¦•
  2. Check if your .deno folder is in PATH
  3. Install it!

Install from Deno (Simpliest way)

Run the following command:

deno install \
 --allow-read \
 --allow-write \
 --allow-env \
 --allow-run \
 --name esbuilder \
 https://deno.land/x/esbuilder/builder.ts

Install by VSCode task runner (No terminal way)

  • Clone this repository
  • Open repo in VS Code
  • Open Command Pallete (Ctrl + Shift + P / ⌘ + Shift + P)
    • Select β†’ Tasks: Run Task
    • Run β†’ Install ESBuilder

Install in Terminal from Repository

  • Clone this repository
  • Run the following command:
deno install \
 --allow-read \
 --allow-write \
 --allow-env \
 --allow-run \
 --allow-net \
 --no-prompt \
 --name esbuilder \
 ./builder.ts

Uninstallations

Simple!

deno uninstall esbuilder

Usage

esbuilder --config=./config.json

Help

esbuilder --help

Alternative

deno run --allow-all ./builder.ts --config=./config.json
deno run --allow-all ./builder.bundled.js --config=./config.json

Configuration

Example

{
    "version": "1.0",
    "sourceDir": "./src",
    "outDir": "./dist",
    "files": [
        "./file1.ts",
        "./file2.ts",
    ],
    "build": {
        "bundle": true,
        "minify": true,
        "sourcemap": true
    },
    "options": {
        "watch": true,
        "gitignore": true,
    }
}

Properties

Version β€” Required

Version of config schema/syntax. Defaults to current version of Builder.

{
    "version": "1.0"
}

The notation "1.0" and "1.0.0" are equivalent.

Source directory β€” Optional

Path to source directory. Defaults to ./.

{
    "sourceDir": "./src"
}

Output directory β€” Optional

Path to output directory. Defaults to ./build.

{
    "outDir": "./dist"
}

Files / Entry points β€” Optional

Paths to entry files relative to sourceDir.

{
    "files": [
        "./file1.ts",
        "./dir/file2.ts",
    ]
}
{
    "files": {
        "MyGroupA": "./file1.ts",
        "MyGroupB": [
            "./file1.ts",
            "./dir/file2.ts"
        ]
    }
}

Build Settings β€” Optional

Bundle β€” Optional

Whether to bundle entry file (with dependecies) into a single file. Defaults to false.

{
    "build": {
        "bundle": true
    }
}

Minify β€” Optional

Whether to minify the output. Defaults to false.

{
    "build": {
        "minify": true
    }
}

Source Maps β€” Optional

Whether to create source map files. Defaults to false.

{
    "build": {
        "sourcemap": true
    }
}

Options β€” Optional

Verbose β€” Optional

Whether to print verbose output. Defaults to true.

{
    "options": {
        "verbose": false
    }
}

Watch β€” Optional

If true, watch for changes in source files and rebuild. Defaults to false.

You can forced by passing --watch flag.

{
    "options": {
        "watch": true
    }
}

tsconfig β€” Optional

Path to tsconfig.json. Defaults to null.

{
    "options": {
        "tsconfig": "./tsconfig.json"
    }
}

Generate .gitignore β€” Optional

Whether to create .gitignore with built outputs. Defaults to false.

{
    "options": {
        "gitignore": true
    }
}

Generate Output summary β€” Optional

Whether to create json file with description of all built outputs. Defaults to false.

{
    "options": {
        "outputSummary": true
    }
}

Example I of output summary:

{
    "version": "1.0",
    "files": [
        "./file1.js",
        "./file1.js.map",
        "./dir/file2.js",
        "./dir/file2.js.map"
    ]
}

Example II of output summary:

{
    "version": "1.0",
    "files": {
        "MyGroupA": [
            "./file1.js",
            "./file1.js.map"
        ],
        "MyGroupB": [
            "./file1.js",
            "./file1.js.map",
            "./dir/file2.js",
            "./dir/file2.js.map"
        ]
    }
}

Output Summary Filename β€” Optional

Name of the output summary file. Defaults to output-summary.json.

{
    "options": {
        "outputSummaryFilename": "output-summary.json"
    }
}