This repository has been archived by the owner on Apr 17, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
72 lines (56 loc) · 2.72 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!make
SHELL := env PATH=$(shell npm bin):$(PATH) /bin/bash
git_branch := $(shell git rev-parse --abbrev-ref HEAD)
.PHONY: install test build release
install:
@npm install
test: install
eslint src
mocha --require babel-core/register tests
build: test
rollup src/http-browser.js --format cjs --output dist/browser.js & \
rollup src/http-browser.js --format umd --output dist/browser.umd.js -n \$$http & \
rollup src/http-fetch.js --format cjs --output dist/fetch.js & \
rollup src/http-fetch.js --format umd --output dist/fetch.umd.js -n \$$http & \
rollup src/http-rest.js --format cjs --output dist/http-rest.js & \
babel src/query-string.js --out-file dist/query-string.js & \
wait
cp src/http-node.js dist/http-node.js
cp package.json dist/package.json
cp LICENSE dist/LICENSE
cp README.md dist/README.md
npm.badge:
mkdir -p media
badge npm v$(shell node -e "process.stdout.write(require('./package').version + '\n')") :blue .svg > media/npm-version.svg
npm.increaseVersion:
npm version patch --no-git-tag-version
npm.pushVersion: npm.increaseVersion npm.badge
git commit -a -n -m "v$(shell node -e "process.stdout.write(require('./package').version + '\n')")" 2> /dev/null; true
git push origin $(master_branch)
git.tag: build
git pull --tags
git add dist -f --all
-git commit -n -m "updating dist" 2> /dev/null; true
git tag -a v$(shell node -e "process.stdout.write(require('./package').version + '\n')") -m "v$(shell node -e "process.stdout.write(require('./package').version + '\n')")"
git push --tags
# git push origin $(git_branch)
npm.publish: npm.pushVersion git.tag
- cd dist && npm publish --access public
- node -e "var fs = require('fs'); var pkg = require('./dist/package.json'); pkg.name = 'http-rest'; fs.writeFile('dist/package.json', JSON.stringify(pkg, null, ' '), 'utf8', function (err) { if( err ) console.log('Error: ' + err); });"
- cd dist && npm publish
git reset --hard origin/$(git_branch)
@git checkout $(git_branch)
# http://krishicks.com/post/subtree-gh-pages/
github.release: export PKG_NAME=$(shell node -e "console.log(require('./package.json').name);")
github.release: export PKG_VERSION=$(shell node -e "console.log('v'+require('./package.json').version);")
github.release: export RELEASE_URL=$(shell curl -s -X POST -H "Content-Type: application/json" -H "Authorization: Bearer ${GITHUB_TOKEN}" \
-d '{"tag_name": "${PKG_VERSION}", "target_commitish": "$(git_branch)", "name": "${PKG_VERSION}", "body": "", "draft": false, "prerelease": false}' \
-w '%{url_effective}' "https://api.github.com/repos/kiltjs/${PKG_NAME}/releases" )
github.release:
@echo ${RELEASE_URL}
@true
release: npm.publish github.release
echo:
@echo "make options: test build dev live"
# DEFAULT TASKS
.DEFAULT_GOAL := build