Live data from Hacker News

The Makefile I use with JavaScript projects

olioapps.com

1–10 of 525 posts

Re: The Makefile I use with JavaScript projects

#2
One thing I've found useful about gulp and webpack is the fact that it's multiplatform.

What is the best approach to make sure your Makefile will work as expected on every platform, meaning, windows included?

For example: Can we write file paths using forward-slashes, or is it still an issue? I imagine running it via git bash (bash provided by the git installer on windows).

Re: The Makefile I use with JavaScript projects

#3
Yes! I recently used Make on some JS projects and my coworkers looked at me like I was insane. Even if you don't know advanced Make-fu it's a really good way to run all of your build steps in the right order without some crazy JSON config format.

Re: The Makefile I use with JavaScript projects

#4
post #2

One thing I've found useful about gulp and webpack is the fact that it's multiplatform. What is the best approach to make sure your Makefile will work as expected on every platform, meaning, windows included? For example: Can we write file paths using forward-slashes, or is it still an issue? I imagine running it via git bash (bash provided by the git installer on windows).

Ah yes, the horror of autoconf and automake...

Re: The Makefile I use with JavaScript projects

#6
After going through a few build systems for Javascript, I realized they were all reinventing the wheel in one way or the other, and pulled out venerable Make from the closet. It turned out to be way more expressive and easy to read.

One target to build (prod), another to run with fsevents doing auto-rebuild when a file is saved (instant gratification during dev), then a few targets for cleaup & housekeeping. All said, the file is 1/4 the size of any other JS-based build systems.

Re: The Makefile I use with JavaScript projects

#9
post #2

One thing I've found useful about gulp and webpack is the fact that it's multiplatform. What is the best approach to make sure your Makefile will work as expected on every platform, meaning, windows included? For example: Can we write file paths using forward-slashes, or is it still an issue? I imagine running it via git bash (bash provided by the git installer on windows).

You can use forward slashes for paths on Windows in your Makefile. They are actually required if you want to use wildcards.

Re: The Makefile I use with JavaScript projects

#10

I'm not a web dev, but this article has uncovered yet another thing in the js ecosystem that just seems crazy to me. This makefile snippet: lib/index.js: src/index.js mkdir -p $(dir $@) babel $ The source and the output are both called index.js? Why, God, WHY???

Because `require` and `import` look at your package's `main`, which (if it's a directory) implies `dirname/index.js`. Building to an `index.js` entry file is, then, the most standard name that allows `require 'modulename'` to work.

The capitalized rending-of-garments is silly. This is transpiling; file names should remain the same from input to output.

Post reply on HN