-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move to Makefile for building, add dist/ to .gitignore (diff noise)
Bower is still workable through the make script, which will force-add dist/.
- Loading branch information
Showing
9 changed files
with
107 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
.idea | ||
*.iml | ||
node_modules/ | ||
dist/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,6 @@ | |
example | ||
script | ||
specs | ||
bower.json | ||
karma.conf.js | ||
webpack.config.js | ||
dist/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# Mostly lifted from https://andreypopp.com/posts/2013-05-16-makefile-recipes-for-node-js.html | ||
# Thanks @andreypopp | ||
|
||
BIN = ./node_modules/.bin | ||
SRC = $(wildcard lib/*.js) | ||
LIB = $(SRC:lib/%.js=dist/%.js) | ||
MIN = $(SRC:lib/%.js=dist/%.min.js) | ||
|
||
.PHONY: test dev | ||
|
||
build: $(LIB) $(MIN) | ||
|
||
# Allows usage of `make install`, `make link` | ||
install link: | ||
@npm $@ | ||
|
||
# FIXME | ||
dist/%.min.js: $(BIN) | ||
@$(BIN)/uglifyjs dist/react-draggable.js \ | ||
--output dist/react-draggable.min.js \ | ||
--source-map dist/react-draggable.min.map \ | ||
--source-map-url react-draggable.min.map \ | ||
--in-source-map dist/react-draggable.map \ | ||
--compress warnings=false | ||
|
||
dist/%.js: $(BIN) | ||
@$(BIN)/webpack --devtool source-map | ||
|
||
test: $(BIN) | ||
@$(BIN)/karma start --browsers Firefox --single-run | ||
|
||
dev: $(BIN) | ||
script/build-watch | ||
|
||
node_modules/.bin: install | ||
|
||
define release | ||
VERSION=`node -pe "require('./package.json').version"` && \ | ||
NEXT_VERSION=`node -pe "require('semver').inc(\"$$VERSION\", '$(1)')"` && \ | ||
node -e "\ | ||
['./package.json', './bower.json'].forEach(function(fileName) {\ | ||
var j = require(fileName);\ | ||
j.version = \"$$NEXT_VERSION\";\ | ||
var s = JSON.stringify(j, null, 2);\ | ||
require('fs').writeFileSync(fileName, s);\ | ||
});" && \ | ||
git add package.json bower.json CHANGELOG.md && \ | ||
git add -f dist/ && \ | ||
git commit -m "release v$$NEXT_VERSION" && \ | ||
git tag "v$$NEXT_VERSION" -m "release v$$NEXT_VERSION" | ||
endef | ||
|
||
release-patch: test build | ||
@$(call release,patch) | ||
|
||
release-minor: test build | ||
@$(call release,minor) | ||
|
||
release-major: test build | ||
@$(call release,major) | ||
|
||
publish: | ||
git push --tags origin HEAD:master | ||
npm publish |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,4 +52,4 @@ module.exports = function(config) { | |
require('karma-webpack') | ||
] | ||
}); | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,24 @@ | ||
#!/bin/sh | ||
webpack --watch --devtool inline-source-map | ||
#!/bin/bash -e | ||
|
||
function finish { | ||
echo -e "\nExiting..." | ||
kill $WEBPACK_PID | ||
kill $SERVER_PID | ||
} | ||
|
||
webpack --watch --devtool inline-source-map & | ||
WEBPACK_PID=$! | ||
|
||
# # Run a static server and run the example in it. | ||
static-server . & | ||
SERVER_PID=$! | ||
|
||
# Open browser | ||
node -e "\ | ||
var open = require('open'); open('http://localhost:9080/example'); \ | ||
" | ||
|
||
# Kill webpack on exit. | ||
trap finish EXIT | ||
|
||
wait |
This file was deleted.
Oops, something went wrong.