Skip to content

Commit

Permalink
added docker and makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Stockdale committed Aug 21, 2018
1 parent 7426fbe commit 43f5212
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 3 deletions.
64 changes: 64 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
################
# Entry Points #
################
.PHONY: test

publish-patch:
docker-compose run --rm node make _devdeps _release-patch _clean _publish

publish-minor:
docker-compose run --rm node make _devdeps _release-minor _clean _publish

publish-major:
docker-compose run --rm node make _devdeps _release-major _clean _publish

test:
docker-compose run --rm node make _devdeps _testUnitWithCoverage

shell:
docker-compose run --rm node bash


##########
# Others #
##########

_test:
npm test

_testUnitWithCoverage:
npm run cover

_deps:
npm install --production

_devdeps:
npm install

_clean:
rm -fr node_modules

define release
VERSION=`node -pe "require('./package.json').version"` && \
NEXT_VERSION=`node -pe "require('semver').inc(\"$$VERSION\", '$(1)')"` && \
node -e "\
var j = require('./package.json');\
j.version = \"$$NEXT_VERSION\";\
var s = JSON.stringify(j, null, 2);\
require('fs').writeFileSync('./package.json', s);"
endef

_release-patch: _test _adduser
@$(call release,patch)

_release-minor: _test _adduser
@$(call release,minor)

_release-major: _test _adduser
@$(call release,major)

_adduser:
npm adduser

_publish:
npm publish --access public
15 changes: 13 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,23 @@ A small library that adds commas to numbers

Output should be `35,666`


## Tests

`npm test`
or
`make test`

## Deploy/Publish

### With Make

`make publish-patch`
or
`make publish-minor`
or
`make publish-major`

## Deploy
### Without Make

```
npm version patch -m "Version %s - add sweet badges"
Expand Down
9 changes: 9 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
version: '0.1'

services:

node:
image: node:latest
volumes:
- .:/opt/app
working_dir: /opt/app
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"chai": "~3.0.0",
"coveralls": "^2.11.2",
"istanbul": "^0.3.17",
"mocha": "~2.2.5"
"mocha": "~2.2.5",
"semver": "^5.5.1"
}
}

0 comments on commit 43f5212

Please sign in to comment.