
Security News
The Changelog Podcast: Practical Steps to Stay Safe on npm
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.
lask is a build tool for TypeScript libraries. It uses esbuild to build and bundle code and tsc to generate types. It is pretty opinionated. You might use it as a reference for building your own mini build tool.
npm install lask --dev
or
yarn add lask --dev
lask to your project's devDependencies.yarn lask to build your project, or yarn lask -d to start your project in development mode.If you like what you get, add lask to your package.json's scripts section:
{
  "scripts": {
    "build": "lask",
    "dev": "lask -d",
    "test": "lask test"
  }
}
By default, lask expects your root directory to have:
src directorydist directorytsconfig.json file in the root directorytsconfig.dev.json file in the root directorytsconfig.build.json file in the root directorypackage.json with the following fields:You can configure lask by creating a lask.config.json (sorry) in your project's root directory.
This config can include some or all of the following properties:
interface Options {
  isDev: boolean
  isNode: boolean
  entryPoints: string[]
  outDir: string
  clean: boolean
  external: {
    dependencies: boolean
    devDependencies: boolean
    peerDependencies: boolean
  }
  target: string
  format: 'esm' | 'cjs' | ('esm' | 'cjs')[]
  devFormat: 'esm' | 'cjs'
  devConfig: string
  buildConfig: string
  define: { [key: string]: string }
  calculateSize: boolean
}
For example:
{
  "isNode": true,
  "entryPoints": ["./src/index.ts"],
  "clean": true,
  "outDir": "dist",
  "external": {
    "dependencies": true,
    "devDependencies": true,
    "peerDependencies": true
  },
  "devConfig": "tsconfig.dev.json",
  "buildConfig": "tsconfig.build.json",
  "format": ["cjs", "esm"],
  "calculateSize": true
}
isNodeWhether to build / develop for node, rather than neutral JavaScript.
outDirWhere to place the output files. By default, this is dist. This means that your package.json should look like:
  "main": "./dist/index.js",
  "module": "./dist/index.mjs",
  "types": "./dist/index.d.ts",
  "source": "./src/index.ts",
If you set a different value for outDir, be sure to also update those fields in your package.json.
buildConfigThe location of the tsconfig file to use for lask. Defaults to tsconfig.build.json.
devConfigThe location of the tsconfig file to use for lask -d. Defaults to tsconfig.dev.json.
cleanWhether to remove the dist folder before building. Defaults to true.
externalBy default, all three options here are set to true, which means that lask will exclude all dependencies / peerDependencies / devDependencies from the bundled output.
definePassed to esbuild's define option. By default, define is set to either { "process.env.NODE_ENV": "production" } or { "process.env.NODE_ENV": "development" } depending on the isDev option.
formatWhether to build to "esm", "cjs", or ["cjs", "esm"]. Defaults to ["cjs", "esm"].
calculateSizeWhether to calculate the size of the output for each format. Defaults to true.
Be sure that the outDir in your tsconfig.json (or tsconfig.build.json, etc.) is pointing to the correct folder. If you're outputting types to ./dist but your tsconfig.json has an outDir set to ./dist/types, the conversion won't work.
This project is MIT licensed.
FAQs
A manager for build and dev.
We found that lask demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.

Security News
Ruby's creator Matz assumes control of RubyGems and Bundler repositories while former maintainers agree to step back and transfer all rights to end the dispute.