Socket
Socket
Sign inDemoInstall

boiler-dev

Package Overview
Dependencies
57
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    boiler-dev

Boilerplate generator framework & low-code power tool 🛠ī¸


Version published
Maintainers
1
Created

Readme

Source

boiler

Boilerplate generator framework & low-code power tool 🛠ī¸

npm install -g boiler-dev

Generator lifecycle

ActionCommand
Start a new TypeScript projectboiler new [project-name]
Change directory to projectcd [project-name]
Install and run generatorboiler generate [git url]
Update generatorboiler update [boiler/generator-name]
Regenerate installed generatorboiler generate [boiler/generator-name]
Create new generatorboiler new [boiler/generator-name]
Commit and push generatorboiler commit [boiler/generator-name]
Status of generator reposboiler status [boiler/generator-name]

When commands are run without arguments, it will run across all installed generators.

For successive generate calls, boiler will regenerate with saved user input unless the --new flag is specified.

Important files

PathDescription
.boiler.jsonRecord of generator runs, with version and user input data
boiler/Installed generator repos

Usage examples

Install boiler

npm install -g boiler-dev

Run generator

  1. cd to your project
  2. boiler generate [git repo]

The generate command automatically installs new generators.

Generator repos are cloned to the boiler directory within your project. The boiler directory is like node_modules for your generators.

ℹī¸ Explore example generators on the boiler-dev GitHub org.

Update and regenerate

  1. cd to your project
  2. boiler update [boiler/my-generator]
  3. boiler generate [boiler/my-generator]

New generator

  1. cd to your project
  2. boiler new boiler/my-generator

Develop generator

  1. Modify boiler/my-generator/boiler.ts (see next section for API details)
  2. boiler generate boiler/my-generator
  3. boiler commit boiler/my-generator "First commit"

Generator API — boiler.ts

Each generator repo must have a boiler.ts or boiler.js file:

import {
  InstallBoiler,
  PromptBoiler,
  GenerateBoiler,
  UninstallBoiler,
} from "boiler-dev"

export const install: InstallBoiler = async ({
  files,
  rootDirPath,
}) => {}

export const prompt: PromptBoiler = async ({
  files,
  rootDirPath,
}) => {
  const prompts = []
  return prompts
}

export const generate: GenerateBoiler = async ({
  answers,
  files,
  rootDirPath,
}) => {
  const actions = []
  return actions
}

export const uninstall: UninstallBoiler = async ({
  answers,
  files,
  rootDirPath,
}) => {}

Prompt

The prompt function returns an array of "prompts" that define user input to retrieve.

Prompts are essentially an array of Inquirer.js Questions.

Generate

The generate function returns an array of "actions" necessary to install the boilerplate.

Actions are a convenience; feel free to run your own async code within installBoiler and return nothing.

Write file action
actions.push({
  action: "write",
  path: "bin/hi",
  source: "#!/usr/bin/env node",
  bin: true,
})

ℹī¸ The bin option runs chmod +x on the file.

Merge JSON action
actions.push({
  action: "merge",
  path: "package.json",
  source: { hi: true },
})

ℹī¸ The merge functionality comes from deepmerge.

NPM install action
actions.push({
  action: "npmInstall",
  source: ["typescript"],
  dev: true,
})

New project

When not used within a boiler/ directory, the boiler new command creates a new TypeScript project to kick things off:

boiler new my-project

ℹī¸ This is a shortcut for manually running the following generators:

FAQs

Last updated on 27 Mar 2020

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡ī¸ by Socket Inc