Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

@dopt/pkg-build

Package Overview
Dependencies
Maintainers
6
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dopt/pkg-build

A utility/tool for building packages

latest
Source
npmnpm
Version
1.1.1
Version published
Maintainers
6
Created
Source

@dopt/pkg-build

A CLI for building packages.

This CLI is a thin abstraction on top of unbuild. It centralizes our build configuration, which helps us consistently build opensource packages that support both module systems (CJS and ESM).

Install

# w/ pnpm
pnpm add -D @dopt/pkg-build

# w/ yarn
yarn add -D @dopt/pkg-build

# w/ npm
npm install -D @dopt/pkg-build

Usage

Create a build.config.ts in your package root that imports @dopt/pkg-build.

This package exports external and internal build configurations. External are for package we externalize i.e. opensource and publish.

We provide four different external package build configurations.

  • node
  • isomorphic
  • browser
  • react

If we were building a node package, our build.config.ts might look like the following.

import { external } from '@dopt/pkg-build';

export default external.node({
  // ... override any default build configuration
})

Now, in your package.json, you can use the exported cli pkg-build in your build script e.g.

"scripts": {
  "build": "pkg-build"
}

Using your package manager, you can now run the build script to build your package.

FAQs

Package last updated on 13 Sep 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts