Skip to content

Commit

Permalink
chore: regen makefile from template generator
Browse files Browse the repository at this point in the history
  • Loading branch information
DonutEspresso committed Aug 15, 2019
1 parent a12edc6 commit 1f5bc05
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 612 deletions.
45 changes: 35 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#
ROOT_SLASH := $(dir $(realpath $(firstword $(MAKEFILE_LIST))))
ROOT := $(patsubst %/,%,$(ROOT_SLASH))
LIB := $(ROOT)/lib
TEST := $(ROOT)/test
TOOLS := $(ROOT)/tools
GITHOOKS_SRC := $(TOOLS)/githooks
Expand All @@ -23,19 +24,23 @@ PACKAGE_LOCK := $(ROOT)/package-lock.json
#
# Tools and binaries
#
DOCUMENT := $(NODE_BIN)/documentation
NPM := npm
YARN := yarn
ESLINT := $(NODE_BIN)/eslint
MOCHA := $(NODE_BIN)/mocha
NYC := $(NODE_BIN)/nyc
PRETTIER := $(NODE_BIN)/prettier
UNLEASH := $(NODE_BIN)/unleash
CONVENTIONAL_RECOMMENDED_BUMP := $(NODE_BIN)/conventional-recommended-bump
COVERALLS := $(NODE_BIN)/coveralls
CHANGELOG := $(TOOLS)/changelog.js


#
# Files and globs
#
PACKAGE_JSON := $(ROOT)/package.json
API_MD := $(ROOT)/api.md
GITHOOKS := $(wildcard $(GITHOOKS_SRC)/*)
LCOV := $(COVERAGE)/lcov.info
ALL_FILES := $(shell find $(ROOT) \
Expand All @@ -54,6 +59,11 @@ $(NODE_MODULES): $(PACKAGE_JSON) ## Install node_modules
@touch $(NODE_MODULES)


.PHONY: docs
docs: $(DOCUMENT) $(ALL_FILES)
@$(DOCUMENT) build $(LIB) -f md -o $(API_MD)


.PHONY: help
help:
@perl -nle'print $& if m{^[a-zA-Z_-]+:.*?## .*$$}' $(MAKEFILE_LIST) \
Expand All @@ -69,34 +79,49 @@ githooks: $(GITHOOKS) ## Symlink githooks
)


.PHONY: changelog
changelog: $(NODE_MODULES) $(CHANGELOG) ## Run changelog
@$(CHANGELOG) generate
.PHONY: release-dry
release-dry: $(NODE_MODULES) ## Dry run of `release` target
@$(UNLEASH) -d --type=$(shell $(CONVENTIONAL_RECOMMENDED_BUMP) -p angular)


.PHONY: release
release: $(NODE_MODULES) $(CHANGELOG) ## Create a release
@$(CHANGELOG) release
release: $(NODE_MODULES) security ## Versions, tags, and updates changelog based on commit messages
@$(UNLEASH) --type=$(shell $(CONVENTIONAL_RECOMMENDED_BUMP) -p angular) --no-publish
@$(NPM) publish


.PHONY: lint
lint: $(NODE_MODULES) $(ESLINT) $(ALL_FILES) ## Run lint checker (eslint).
@$(ESLINT) $(ALL_FILES)


.PHONY: lint-fix
lint-fix: $(NODE_MODULES) $(PRETTIER) $(ALL_FILES) ## Reprint code (prettier, eslint).
@$(PRETTIER) --write $(ALL_FILES)
@$(ESLINT) --fix $(ALL_FILES)


.PHONY: security
security: $(NODE_MODULES) ## Check for dependency vulnerabilities.
@$(NPM) install --package-lock-only
@$(NPM) audit
@# remove lockfile, reinstall to get latest deps and regen lockfile
@rm $(YARN_LOCK) || true
@$(YARN)
@$(YARN) audit || EXIT_CODE=$$?; \
if [ $$EXIT_CODE -gt 15 ] ; then \
echo "'yarn audit' exited with error code $$EXIT_CODE, critical vulnerabilities found!"; \
exit 1; \
else \
echo "'yarn audit' exited with error code $$EXIT_CODE, no critical vulnerabilities found."; \
fi


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


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


.PHONY: coverage
Expand Down
27 changes: 27 additions & 0 deletions api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->

### Table of Contents

- [sort][1]
- [Parameters][2]

## sort

sort an array or object by alpha order.

### Parameters

- `obj` **([Object][3] \| [Array][4])** an object or an array
- `recursive` **[Boolean][5]** if true, sorts all nested objs and arrays

Returns **([Object][3] \| [Array][4])**

[1]: #sort

[2]: #parameters

[3]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object

[4]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array

[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean
19 changes: 13 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,20 @@
"alpha sort"
],
"devDependencies": {
"chai": "^4.1.2",
"coveralls": "^3.0.1",
"eslint": "^4.19.1",
"mocha": "^5.2.0",
"nyc": "^12.0.2"
"chai": "^4.2.0",
"conventional-changelog-angular": "^5.0.3",
"conventional-recommended-bump": "^6.0.0",
"coveralls": "^3.0.6",
"documentation": "^12.0.0",
"eslint": "^6.1.0",
"eslint-config-prettier": "^6.0.0",
"eslint-plugin-prettier": "^3.1.0",
"mocha": "^6.2.0",
"nyc": "^14.1.1",
"prettier": "^1.18.2",
"unleash": "^2.0.1"
},
"dependencies": {
"lodash": "^4.17.10"
"lodash": "^4.17.15"
}
}
Loading

0 comments on commit 1f5bc05

Please sign in to comment.