@messageflow/build

Quick build with Gulp

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
@messageflow/build
021.0.06 years ago6 years agoMinified + gzip package size for @messageflow/build in KB

Readme

@messageflow/build

Quick build with Gulp




!NPMnodei-badgenodei-url
!Versionversion-badgeversion-url !Downloadsdownloads-badgedownloads-url !MIT Licensemit-license-badgemit-license-url !Code of Conductcoc-badgecoc-url
!Build Statustravis-badgetravis-url !CircleCIcircleci-badgecircleci-url !Dependency Statusdaviddm-badgedaviddm-url !NSP Statusnsp-badgensp-url !Codecovcodecov-badgecodecov-url !Coverage Statuscoveralls-badgecoveralls-url
!codebeat-badgecodebeat-url !codacy-badgecodacy-url
Better build process with Gulpgulp-url for general Node.jsnode-js-url projects written in TypeScripttypescript-url.

Table of contents

- Install - Usage
- [gulpfile.js](#gulpfilejs)
- DEFAULTIGNOREGLOBS - DEFAULTBABELCONFIG - BuilderParams - builder(options)

Pre-requisites

Setup

Install

# Install via NPM as one of the `devDependencies`
$ npm install --save-dev @messageflow/build

Usage

gulpfile.js

const gulp = require('gulp');
const { builder } = require('@messageflow/build');

const build = builder();
/** `cleanGlobs` can be helpful when the destination directory is not the `dist` directory. */
// const build = builder({
//   dist: '.',
//   cleanGlobs: [
//     './*.js',
//     './*.d.ts',
//     '!./gulpfile.js',
//     '!./json.d.ts',
//   ],
// });

gulp.task('clean', build.clean);
gulp.task('lint', build.lint);
gulp.task('copy', build.copy);
gulp.task('ts', build.ts);
gulp.task('watch', build.watch);
gulp.task('default', build.default);

API Reference

DEFAULTIGNOREGLOBS

[
  '!**/demo*/**/*.ts*',
  '!**/test*/**/*.ts*',
]

DEFAULTBABELCONFIG

{
  presets: [
    ['@babel/preset-env', {
      targets: { node: 'current' },
      spec: true,
      modules: false,
      useBuiltIns: 'usage',
      shippedProposals: true,
    }],
    ['minify', {
      replace: false,
      mangle: { keepFnName: true },
      removeConsole: false,
      removeDebugger: true,
    }],
  ],
}

BuilderParams


builder(options)

  • options <?BuilderParamsbuilderparams-url> Optional configuration for the build process.
  • returns: <Objectobject-mdn-url> An object of build tasks to be assigned as Gulpgulp-url task, e.g. gulp.task('<TASK_NAME>', <GULP_TASK_FUNCTION>). It comprises of a list of tasks fo a common build process with Gulp for most of the projects:

1. clean - Always remove old files from previous build. 2. lint - Always lint all .ts files with given tslint.json. 3. ts - Compile all .ts files with given tsconfig.json. 4. copy - Copy all asset files such as images, json, md, etc. 5. watch - Run the build process by watching for flle changes. 6. default - Default build process that comprises all the above.

License

MIT License
© Rong Sen Ng