jshttp.github.io
jshttp.github.io copied to clipboard
don't use makefile :)
would anyone be offended if i moved the stuff in makefile into the npm scripts?
It'll be more useful later when we have multiple pages because it does all that mtime checking as well
gotcha. hm, i wonder if there is a good way to keep both... for now i'm going to check in the npm scripts so it's easy for me to run this stuff :)
Why can't we do this in a js script?
Because make exists already and does a better job?
I don't really understand that urge to rewrite anything in javascript...
Idk I think make doesn't run well on windows or something, doesn't actually matter much to me.
well make runs rather nicely on windows under vagrant :)
i can run Makefile with dmake :) I just find that it's nice, especially for new-comers, to not need other tools outside the language the repo is about, since it raises the barrier to entry.
alternative is to make a watch script
Here is probably what will be our makefile soon:
NODE ?= node
NPM ?= npm
index.html: node_modules src/* src/db.json
@${NODE} src/build.js
# command to rebuild db.json, will be executed
# only once if src/db.json isn't present
src/db.json:
@${NODE} --harmony src/make-db.js
# `make db` will force rebuilding db.json even if it exists
db:
@${MAKE} --always-make src/db.json
# removes autogenerated files
clean:
rm src/db.json index.html
# install all packages if they don't exist (repo just been cloned)
node_modules: package.json
@${NPM} install .
.PHONY: db clean
And here are deployment instructions:
Just run `make`, it'll do everything :)
If you do that with npm scripts, you have to ask users to do:
npm install .npm run build-dbnpm run build
If I have node.js installed as /usr/bin/node-0.11, I run NODE=/usr/bin/node-0.11 make, and you simply can't do that in npm scripts.
So all right you can use npm scripts if it works for you, but I don't see any real alternatives here.
we should probably add a readme that contains rebuilding instructions, by the way
i prefer no makefile for open source projects just so we have the lowest barrier to contribution possible. i always use makefiles in my personal projects though...