1.0.0 • Published 8 years ago
@messageflow/build v1.0.0
Better build process with Gulp for general Node.js projects written in TypeScript.
Table of contents
Pre-requisites
Setup
Install
# Install via NPM as one of the `devDependencies`
$ npm install --save-dev @messageflow/buildUsage
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
DEFAULT_IGNORE_GLOBS
[
'!**/demo*/**/*.ts*',
'!**/test*/**/*.ts*',
]DEFAULT_BABEL_CONFIG
{
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
src<?string> Optional source directory. Defaults tosrc.dist<?string> Optional destination directory. Defaults todist.cleanGlobs<?string|string[]> Optional glob patterns to clean files/ directories up before every build process initiates. This is required only when the destination directory is not thedistdirectory. Defaults to the value ofdistif unspecified.copyGlobs<?string|string[]> Optional glob patterns to copy files/ directories to destination build directory. Defaults to['<SRC>/**/*.*', '!<SRC>/**/*.ts*', '<SRC>/**/*.d.ts'].ignoreGlobs<?string|string[]> Optional glob patterns to ignore files/ directories. Defaults to DEFAULT_IGNORE_GLOBS. This only works whenisProdis set to true.isProd<?boolean> Optional production flage. Set totrueif the build process is meant for production. Defaults toprocess.env.NODE_ENV === 'production'.rootPath<?string> Optional path to current working directory. Defaults to..babelConfig<?Object> Optional configuration for Babel. This is only needed whenisProdis set to true. Defaults to DEFAULT_BABEL_CONFIG.tsConfig<?string> Optional path totsconfig.json. Defaults to./tsconfig.json.tslintConfig<?string> Optional path totslint.json. Defaults to./tslint.json. This defaults to./tslint.prod.jsonwhenisProdis set to true.
builder(options)
options<?BuilderParams> Optional configuration for the build process.returns: <Object> An object of build tasks to be assigned as Gulp 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:clean- Always remove old files from previous build.lint- Always lint all.tsfiles with giventslint.json.ts- Compile all.tsfiles with giventsconfig.json.copy- Copy all asset files such asimages,json,md, etc.watch- Run the build process by watching for flle changes.default- Default build process that comprises all the above.
License
MIT License © Rong Sen Ng
1.0.0
8 years ago
0.2.0
8 years ago
0.1.1
8 years ago
0.1.0
8 years ago
0.0.12
8 years ago
0.0.11
8 years ago
0.0.10
8 years ago
0.0.9
8 years ago
0.0.8
8 years ago
0.0.7
8 years ago
0.0.6
8 years ago
0.0.5
8 years ago
0.0.4-alpha.1
8 years ago
0.0.4-alpha.0
8 years ago
0.0.4
8 years ago
0.0.3-alpha.3
8 years ago
0.0.3-alpha.2
8 years ago
0.0.3-alpha.1
8 years ago
0.0.3-alpha.0
8 years ago
0.0.3
8 years ago
0.0.2
8 years ago
0.0.1
8 years ago
