jshttp.github.io icon indicating copy to clipboard operation
jshttp.github.io copied to clipboard

don't use makefile :)

Open dougwilson opened this issue 11 years ago • 11 comments

would anyone be offended if i moved the stuff in makefile into the npm scripts?

dougwilson avatar Aug 18 '14 03:08 dougwilson

It'll be more useful later when we have multiple pages because it does all that mtime checking as well

jonathanong avatar Aug 18 '14 03:08 jonathanong

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 :)

dougwilson avatar Aug 18 '14 03:08 dougwilson

Why can't we do this in a js script?

Fishrock123 avatar Aug 18 '14 13:08 Fishrock123

Because make exists already and does a better job?

I don't really understand that urge to rewrite anything in javascript...

rlidwka avatar Aug 18 '14 13:08 rlidwka

Idk I think make doesn't run well on windows or something, doesn't actually matter much to me.

Fishrock123 avatar Aug 18 '14 13:08 Fishrock123

well make runs rather nicely on windows under vagrant :)

rlidwka avatar Aug 18 '14 13:08 rlidwka

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.

dougwilson avatar Aug 18 '14 14:08 dougwilson

alternative is to make a watch script

jonathanong avatar Aug 19 '14 01:08 jonathanong

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-db
  • npm 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.

rlidwka avatar Aug 20 '14 03:08 rlidwka

we should probably add a readme that contains rebuilding instructions, by the way

dougwilson avatar Aug 20 '14 03:08 dougwilson

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...

jonathanong avatar Mar 04 '16 04:03 jonathanong