Make
Reusable Makefiles for my open source projects.
Usage
Install with:
npm install --save-dev @rowanmanning/make
Create a Makefile
in the root of your project and add the boilerplate content:
# Reusable Makefile
# ------------------------------------------------------------------------
# This section of the Makefile should not be modified, it includes
# commands from my reusable Makefile: https://github.com/rowanmanning/make
include node_modules/@rowanmanning/make/<LANGUAGE>/index.mk
# [edit below this line]
# ------------------------------------------------------------------------
where <LANGUAGE>
is one of the following:
- javascript
Now you can use the following commands, based on which language you choose.
JavaScript
Commands
-
all
: Run theinstall
andci
tasks. -
ci
: Run theverify
andtest
tasks. -
clean
: Cleans the working directory. Relies ongit
. -
install
: Runsnpm install
but only ifpackage.json
has changed more recently than thenode_modules
folder. This speeds up installing to be instant if nothing needs doing. This task also prunes extra dependencies. -
env
: Copies asample.env
file to.env
if the sample file exists. -
verify
: Run theverify-javascript
andverify-dust
tasks. -
verify-javascript
: Run theverify-eslint
,verify-jshint
, andverify-jscs
tasks. -
verify-dust
: If an.dustmiterc
file is present in the project root, run Dustmite against the code. -
verify-eslint
: If an.eslintrc
file is present in the project root, run ESLint against the code. -
verify-jscs
: If a.jscsrc
file is present in the project root, run JSCS against the code. -
verify-jshint
: If a.jshintrc
file is present in the project root, run JSHint against the code. -
verify-coverage
: If acoverage/lcov-report
folder is present in the project root and thenyc
module is installed, check that coverage is above90%
. This is configurable by specifyingexport EXPECTED_COVERAGE := <value>
in your dependant Makefile. -
test
: Run thetest-unit-coverage
,verify-coverage
, andtest-integration
tasks. -
test-unit
: If atest/unit
folder is present in the project root, run Mocha recursively on any files that end in.test.js
. -
test-unit-coverage
: If atest/unit
folder is present in the project root and thenyc
module is installed, run Mocha recursively on any files that end in.test.js
with coverage reporting. Ifnyc
is not present, fall back to runningmake test-unit
-
test-integration
: If atest/integration
folder is present in the project root, run Mocha recursively on any files that end in.test.js
. -
publish-npm
: If anNPM_PUBLISH_TAG
(orCIRCLE_TAG
/TRAVIS_TAG
), and anNPM_AUTH_TOKEN
environment variable is present, publish the module to npm.
Helpers
-
The
TASK_DONE
output helper allows you to quickly output a check-marked notice after a task has completed successfully. Just add it to your own tasks like this:mytask: @do something @$(TASK_DONE)
-
The folder
./node_modules/.bin
is added to thePATH
environment variable so that you don't need to explicitly reference it in calls to further commands.
License
ESLint Config is licensed under the MIT license.
Copyright © 2017, Rowan Manning