3.0.24 • Published 8 years ago

pragmatist v3.0.24

Weekly downloads
3
License
BSD-3-Clause
Repository
github
Last release
8 years ago

Pragmatist

NPM version js-canonical-style

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, *.scss and *.js files in ./src and ./tests directories.

fix

build

  • Copies all files from ./src directory to ./dist.
  • Uses Babel to compile files in ./src directory.
    • Compiled files overwrite the existing files in ./dist directory.
    • Source Maps are stored in the ./dist directory`.
    • Uses babel-plugin-lodash.
    • Babel compiler is configured to use stage 0 ES features.

test

  • Uses Babel to compile files in ./tests directory.
  • Uses Istanbul to generate test coverage.
  • Uses Mocha to execute tests in ./tests directory.

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:test

CLI Program

pragmatist can be used as a CLI program to run all the tasks.

npm install pragmatist -g

Tasks 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 --es5

Notifications

Use --notifications flag to enable OS level notifications about errors that occur during the build.

pragmatist build --notifications

Types

Use --type-assertions flag to enable runtime type assertions.

pragmatist build --type-assertions

NPM

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.yml

Add to .npmignore

src
tests
coverage
.*
*.log
3.0.24

8 years ago

3.0.21

8 years ago

3.0.20

8 years ago

3.0.19

8 years ago

3.0.16

8 years ago

3.0.15

8 years ago

3.0.14

8 years ago

3.0.13

8 years ago

3.0.11

8 years ago

3.0.10

8 years ago

3.0.9

8 years ago

3.0.8

8 years ago

3.0.6

8 years ago

3.0.5

8 years ago

3.0.4

8 years ago

3.0.3

8 years ago

3.0.2

8 years ago

3.0.1

8 years ago

2.3.74

8 years ago

2.3.73

8 years ago

2.3.71

8 years ago

2.3.70

8 years ago

2.3.68

8 years ago

2.3.67

8 years ago

2.3.66

8 years ago

2.3.65

8 years ago

2.3.64

8 years ago

2.3.63

8 years ago

2.3.62

8 years ago

2.3.61

8 years ago

2.3.60

8 years ago

2.3.59

8 years ago

2.3.58

8 years ago

2.3.57

8 years ago

2.3.56

8 years ago

2.3.55

8 years ago

2.3.52

8 years ago

2.3.51

8 years ago

2.3.39

8 years ago

2.3.38

8 years ago

2.3.37

8 years ago

2.3.36

8 years ago

2.3.35

8 years ago

2.3.34

8 years ago

2.3.33

8 years ago

2.3.30

8 years ago

2.3.29

8 years ago

2.3.28

8 years ago

2.3.27

8 years ago

2.3.26

8 years ago

2.3.25

8 years ago

2.3.24

8 years ago

2.3.23

8 years ago

2.3.22

8 years ago

2.3.21

8 years ago

2.3.20

8 years ago

2.3.19

8 years ago

2.3.18

8 years ago

2.3.17

8 years ago

2.3.16

8 years ago

2.3.15

8 years ago

2.3.14

8 years ago

2.3.13

8 years ago

2.3.12

8 years ago

2.3.11

8 years ago

2.3.10

8 years ago

2.3.9

8 years ago

2.3.8

8 years ago

2.3.7

8 years ago

2.3.6

8 years ago

2.3.5

8 years ago

2.3.3

8 years ago

2.3.2

8 years ago

2.3.1

8 years ago

2.3.0

8 years ago

2.2.0

8 years ago

2.1.1

8 years ago

2.1.0

8 years ago

2.0.3

8 years ago

2.0.2

8 years ago

2.0.1

8 years ago

2.0.0

8 years ago

1.9.7

8 years ago

1.9.6

8 years ago

1.9.5

8 years ago

1.9.4

8 years ago

1.9.3

8 years ago

1.9.2

8 years ago

1.9.1

8 years ago

1.9.0

8 years ago

1.8.0

8 years ago

1.7.1

8 years ago

1.7.0

8 years ago

1.6.1

8 years ago

1.6.0

8 years ago

1.5.0

8 years ago

1.4.6

8 years ago

1.4.5

8 years ago

1.4.4

8 years ago

1.4.3

8 years ago

1.4.2

8 years ago

1.4.1

8 years ago

1.4.0

8 years ago

1.3.0

8 years ago

1.2.3

8 years ago

1.2.2

8 years ago

1.2.1

9 years ago

1.2.0

9 years ago

1.1.7

9 years ago

1.1.6

9 years ago

1.1.5

9 years ago

1.1.4

9 years ago

1.1.3

9 years ago

1.1.2

9 years ago

1.1.1

9 years ago

1.1.0

9 years ago

1.0.3

9 years ago

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago