Skip to content

mkbuild 1.0.0-alpha.1

Install from the command line:
Learn more about npm packages
$ npm install @flex-development/mkbuild@1.0.0-alpha.1
Install via package.json:
"@flex-development/mkbuild": "1.0.0-alpha.1"

About this version

mkbuild

conventional commits code style: prettier module type: esm npm license typescript

An esbuild based file-to-file transformer and bundler.

πŸ‘€ Features

πŸ“¦ optimized bundler and transpiler

fast and minimal builds with esbuild (integrates with the build api for plugin support - say toodles πŸ‘‹πŸΎ to transform api hacks! πŸ˜‰)

πŸ“ bundleless dists

create bundleless distributions with file-to-file transpilation and static asset copying

😌 esm friendly

create es modules + add file extensions to specifiers in modules and declaration files

πŸ“‘ dts generation (.d.cts, .d.mts, .d.ts)

generate declarations for .cjs, .cts, .js, .jsx, .mjs, .mts, .ts, and .tsx files

🧬 path alias support

resolve path aliases in .cjs, .cts, .d.cts, .d.mts, .d.ts, .js, .jsx, .mjs, .mts, .ts, and .tsx files

Install

yarn add -D @flex-development/mkbuild esbuild typescript

GitHub Package Registry

To install from the GitHub Package Registry, setup a .npmrc or .yarnrc.yml file to authenticate with the registry.

A Personal Access Token with the read:packages scope is required.

.npmrc

//npm.pkg.github.com/:_authToken=${GITHUB_TOKEN}
@flex-development:registry=https://npm.pkg.github.com/

.yarnrc.yml

npmRegistries:
  //npm.pkg.github.com:
    npmAlwaysAuth: true
    npmAuthToken: ${GITHUB_TOKEN}

npmScopes:
  flex-development:
    npmRegistryServer: https://npm.pkg.github.com

Git

See npm-install or Git - Protocols | Yarn for details on requesting a specific branch, commit, or tag.

NPM

npm i -D flex-development/mkbuild

Yarn

yarn add -D @flex-development/mkbuild@flex-development/mkbuild esbuild typescript

Usage

mkbuild

Running the command above without a build configuration file will create a bundleless esm build with declarations.

Files within the src directory will be transpiled or copied and output to dist/**.{d.mts,mjs}. Declaration files, dist/**.d.mts, will be generated if typescript is installed. The original folder structure and extensions of copied files will remain in tact.

Configuration

Create build.config.{cjs,cts,js,json,mjs,mts,ts}:

/**
 * @file Build Config
 * @module config/build
 */

import { defineBuildConfig } from '@flex-development/mkbuild'

export default defineBuildConfig({
  // esbuild options; see https://esbuild.github.io/api/#build-api
  esbuild: {
    sourcemap: 'external',
    sourcesContent: false,
    treeShaking: true,
    tsconfig: 'tsconfig.build.json'
  }
})

See all configuration options here.

See omitted esbuild options here. Note that most omitted options are applied via the build config, or via build entries.

See options common to build configs and entries here.

Configuring Build Entries

/**
 * @file Build Config
 * @module config/build
 */

import { defineBuildConfig } from '@flex-development/mkbuild'
import tsconfig from './tsconfig.build.json' assert { type: 'json' }

export default defineBuildConfig({
  entries: [
    { dts: true, ignore: ['cli.ts'] }, // dist/**.{d.mts,mjs}
    { dts: true, ext: '.cjs', format: 'cjs', ignore: ['cli.ts'] }, // dist/**.{cjs,d.cts}
    { dts: 'only', ext: '.js', ignore: ['cli.ts'] }, // dist/**.d.ts
    { bundle: true, minify: true, source: 'src/cli.ts' } // dist/cli.mjs
  ],
  esbuild: {
    platform: 'node',
    sourcemap: 'external',
    sourcesContent: false,
    target: [tsconfig.compilerOptions.target, 'node14'],
    treeShaking: true,
    tsconfig: 'tsconfig.build.json'
  }
})

See all build entry options here.

Details


Assets

  • mkbuild-1.0.0-alpha.1.tgz

Download activity

  • Total downloads 13
  • Last 30 days 0
  • Last week 0
  • Today 0