pragmatist v3.0.24
Pragmatist
A collection of tasks to standardize builds.
Tasks
Tasks that are not documented (including dependencies of the documented tasks that are not documented) are considered private and can be changed/renamed or removed without a warning.
lint
- Uses Canonical to lint all
*.css,*.scssand*.jsfiles in./srcand./testsdirectories.
fix
build
- Copies all files from
./srcdirectory to./dist. - Uses Babel to compile files in
./srcdirectory.- Compiled files overwrite the existing files in
./distdirectory. - Source Maps are stored in the
./distdirectory`. - Uses
babel-plugin-lodash. - Babel compiler is configured to use stage 0 ES features.
- Compiled files overwrite the existing files in
test
- Uses Babel to compile files in
./testsdirectory. - Uses Istanbul to generate test coverage.
- Uses Mocha to execute tests in
./testsdirectory.
Istanbul assumes that tests are using ./src files (as opposed to ./dist).
Istanbul coverage report is written to the ./coverage directory. A coverage summary is included in the CLI output.
watch
Runs lint, test and build tasks every time ./src/**/*.js or ./tests/**/*.js changes.
watch-lint
Runs lint task every time ./src/**/*.js or ./tests/**/*.js changes.
watch-test
Runs test task every time ./src/**/*.js or ./tests/**/*.js changes.
watch-build
Runs build task every time ./src/**/*.js or ./tests/**/*.js changes.
Gulp Tasks
pragmatist can be used to extend your existing gulp tasks.
import gulp from 'gulp';
import pragmatist from 'pragmatist';
/**
* @param {Object} gulp
* @param {string} prefix Used to prefix all pragmatist tasks.
* @returns {undefined}
*/
pragmatist(gulp);This will make all pragmatist tasks available under pragmatist: namespace, e.g.
gulp pragmatist:testCLI Program
pragmatist can be used as a CLI program to run all the tasks.
npm install pragmatist -gTasks can be executed by running:
pragmatist <task>Just running pragmatist will execute the test task.
Multiple tasks can be executed one after the other, e.g.
pragmatist <task #1> <task #2> <task #3>ES5
The default behavior for build task is to compile code for node. Specifically, for the latest version of node.
To compile code down to ES5, you must add --es5 flag to the command line, e.g.
pragmatist build --es5Notifications
Use --notifications flag to enable OS level notifications about errors that occur during the build.
pragmatist build --notificationsTypes
Use --type-assertions flag to enable runtime type assertions.
pragmatist build --type-assertionsNPM
A typical project using pragmatist will define the following NPM scripts:
"scripts": {
"lint": "pragmatist lint",
"watch-lint": "pragmatist watch-lint",
"test": "pragmatist --type-assertions test",
"watch-test": "pragmatist --type-assertions test",
"build": "pragmatist --es5 build",
"watch-build": "pragmatist --es5 watch-build"
},Ignore Unnecessary Files
This is just a reminder. Pragmatist will produce several files that you do not want to commit to the repository or include in the npm bundle.
Add to .gitignore:
node_modules
coverage
dist
*.log
.*
!.gitignore
!.npmignore
!.babelrc
!.travis.ymlAdd to .npmignore
src
tests
coverage
.*
*.log10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago