Skip to content

Commit

Permalink
chore: update dev deps. move to nyc (#8)
Browse files Browse the repository at this point in the history
* chore: update dev deps. move to nyc
* chore: update travis targets
* remove defunct readme badges
* fix: report-coverage should reuse existing generated report
* fix: more travis lifecycle
  • Loading branch information
DonutEspresso authored Jun 13, 2018
1 parent 1016eb7 commit 0fb40b1
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 3,381 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ Thumbs.db

/node_modules/
npm-debug.log
yarn.lock
package-lock.json

# VIM viles #
#############
Expand All @@ -23,3 +25,4 @@ Session.vim
# Unit Test Coverage #
######################
coverage/
.nyc_output/
7 changes: 5 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
language: node_js
node_js:
- "6"
- "8"
- "9"
- "lts/*" # Active LTS release
- "node" # Latest stable release
before_install: 'make clean'
install: 'make'
script: 'make coverage'
after_success: 'make report-coverage'
57 changes: 22 additions & 35 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,56 +4,53 @@
ROOT_SLASH := $(dir $(realpath $(firstword $(MAKEFILE_LIST))))
ROOT := $(patsubst %/,%,$(ROOT_SLASH))
TEST := $(ROOT)/test
TEST_ETC := $(ROOT)/test/etc
TOOLS := $(ROOT)/tools
GITHOOKS_SRC := $(TOOLS)/githooks
GITHOOKS_DEST := $(ROOT)/.git/hooks


#
# Generated Directories
# Generated Files & Directories
#
NODE_MODULES := $(ROOT)/node_modules
NODE_BIN := $(NODE_MODULES)/.bin
COVERAGE := $(ROOT)/coverage
COVERAGE := $(ROOT)/.nyc_output
COVERAGE_RES := $(ROOT)/coverage
YARN_LOCK := $(ROOT)/yarn.lock
PACKAGE_LOCK := $(ROOT)/package-lock.json


#
# Tools and binaries
#
NPM := npm
YARN := yarn
ESLINT := $(NODE_BIN)/eslint
JSCS := $(NODE_BIN)/jscs
MOCHA := $(NODE_BIN)/mocha
_MOCHA := $(NODE_BIN)/_mocha
ISTANBUL := $(NODE_BIN)/istanbul
NSP := $(NODE_BIN)/nsp
NYC := $(NODE_BIN)/nyc
COVERALLS := $(NODE_BIN)/coveralls
NSP_BADGE := $(TOOLS)/nspBadge.js
CHANGELOG := $(TOOLS)/changelog.js


#
# Files and globs
#
PACKAGE_JSON := $(ROOT)/package.json
PACKAGE_LOCK := $(ROOT)/package-lock.json
GITHOOKS := $(wildcard $(GITHOOKS_SRC)/*)
LCOV := $(COVERAGE)/lcov.info
ALL_FILES := $(shell find $(ROOT) \
-not \( -path $(NODE_MODULES) -prune \) \
-not \( -path $(COVERAGE) -prune \) \
-not \( -path $(TEST_ETC) -prune \) \
-name '*.js' -type f)
TEST_FILES := $(shell find $(TEST) \
-not \( -path $(TEST_ETC) -prune \) \
-not \( -path $(COVERAGE_RES) -prune \) \
-name '*.js' -type f)
TEST_FILES := $(shell find $(TEST) -name '*.js' -type f)

#
# Targets
#

$(NODE_MODULES): $(PACKAGE_JSON) ## Install node_modules
@$(NPM) install
@$(YARN)
@touch $(NODE_MODULES)


Expand Down Expand Up @@ -87,44 +84,34 @@ lint: $(NODE_MODULES) $(ESLINT) $(ALL_FILES) ## Run lint checker (eslint).
@$(ESLINT) $(ALL_FILES)


.PHONY: codestyle
codestyle: $(NODE_MODULES) $(JSCS) $(ALL_FILES) ## Run code style checker (jscs).
@$(JSCS) $(ALL_FILES)


.PHONY: codestyle-fix
codestyle-fix: $(NODE_MODULES) $(JSCS) $(ALL_FILES) ## Run code style checker with auto whitespace fixing (jscs).
@$(JSCS) $(ALL_FILES) --fix


.PHONY: nsp
nsp: $(NODE_MODULES) $(NSP) $(NSP_BADGE) ## Run nsp. Shrinkwraps dependencies, checks for vulnerabilities.
@($(NSP) check) | $(NSP_BADGE)
.PHONY: security
security: $(NODE_MODULES) ## Check for dependency vulnerabilities.
@$(NPM) install --package-lock-only
@$(NPM) audit


.PHONY: prepush
prepush: $(NODE_MODULES) lint codestyle coverage nsp ## Git pre-push hook task. Run before committing and pushing.
prepush: $(NODE_MODULES) lint coverage security ## Git pre-push hook task. Run before committing and pushing.


.PHONY: test
test: $(NODE_MODULES) $(MOCHA) ## Run unit tests.
@$(MOCHA) -R spec --full-trace $(TEST_FILES)
@$(MOCHA) -R spec --full-trace --no-exit --no-timeouts $(TEST_FILES)


.PHONY: coverage
coverage: $(NODE_MODULES) $(ISTANBUL) $(_MOCHA) $(COVERAGE_BADGE) ## Run unit tests with coverage reporting. Generates reports into /coverage.
@$(ISTANBUL) cover $(_MOCHA) --report lcovonly -- -R spec $(TEST_FILES)
coverage: $(NODE_MODULES) $(NYC) ## Run unit tests with coverage reporting. Generates reports into /coverage.
@$(NYC) --reporter=html --reporter=text make test


.PHONY: report-coverage ## Report unit test coverage to coveralls
report-coverage: coverage
@cat $(LCOV) | $(COVERALLS)
report-coverage: $(NODE_MODULES) $(NYC) ## Run unit tests with coverage reporting. Generates reports into /coverage.
@$(NYC) report --reporter=text-lcov make test | $(COVERALLS)


.PHONY: clean
clean: ## Cleans unit test coverage files and node_modules.
@rm -rf $(NODE_MODULES)
@rm -rf $(COVERAGE)
@rm -rf $(NODE_MODULES) $(COVERAGE) $(COVERAGE_RES) $(YARN_LOCK) $(PACKAGE_LOCK)


#
Expand Down
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
[![Coverage Status](https://coveralls.io/repos/github/DonutEspresso/big-json/badge.svg?branch=master)](https://coveralls.io/github/DonutEspresso/big-json?branch=master)
[![Dependency Status](https://david-dm.org/DonutEspresso/big-json.svg)](https://david-dm.org/DonutEspresso/big-json)
[![devDependency Status](https://david-dm.org/DonutEspresso/big-json/dev-status.svg)](https://david-dm.org/DonutEspresso/big-json#info=devDependencies)
[![bitHound Overall Score](https://www.bithound.io/github/DonutEspresso/big-json/badges/score.svg)](https://www.bithound.io/github/DonutEspresso/big-json)
[![nsp status](https://img.shields.io/badge/NSP%20status-no%20vulnerabilities-green.svg)](https://travis-ci.org/DonutEspresso/big-json)

> A stream based implementation of JSON.parse and JSON.stringify for big POJOs
Expand Down
Loading

0 comments on commit 0fb40b1

Please sign in to comment.