0.1.1 • Published 4 years ago

@hulkstack/heft-local-task v0.1.1

Weekly downloads
4
License
MIT
Repository
-
Last release
4 years ago

@hulkstack/heft-local-task

A Heft plugin for injecting scoped tasks into the pipeline without a plugin.

Note: This should NOT be used as a replacement to writing your own plugins, but rather as a utility for injecting simple tasks into the build pipeline when it doesn't make sense to develop and maintain a plugin.

Usage

1. Register the plugin in your heft.json

"heftPlugins": [
  // ...other plugins
  {
    "plugin": "@hulkstack/heft-local-plugin"
  }
]

2. Add a local-task.json file in your config folder

{
  "$schema": "../node_modules/@hulkstack/heft-local-task/lib/schemas/local-task.schema.json",
  /**
   * (Required) The list of tasks to be injected.
   */
  "tasks": [
    {
      /**
       * (Required) The command the task will execute.
       *
       * NOTE: This is executed as a shell command with the project folder
       * as the current working directory.
       */
      "command": "npm run some-script",
      /**
       * (Required) The task name. Avoid whitespace in the name.
       */
      "taskId": "some-script",
      /**
       * (Optional) The heft stage when this task should be executed.
       *
       * Options: "preCompile", "compile", "bundle", "postBuild"
       */
      "heftEvent": "preCompile",
      /**
       * (Optional) The condition for which the task should be executed.
       *
       * Options: "watch", "build"
       */
      "runOn": "watch",
      /**
       * (Optional) A list of glob patterns that select files to be watched
       * when running in watch mode.
       */
      "watchGlobs": ["src/**/*.ts"]
    }
  ]
}