Live data from Hacker News

The Makefile I use with JavaScript projects

olioapps.com

321–330 of 525 posts

Re: The Makefile I use with JavaScript projects

#321

Earlier quoted context omitted.

The core of make is really just a control flow model that understands file dependencies as a first class thing, and permits arbitrary user supplied actions to be specified to update those files. All those default rules around how to handle C files are really more like a standard library and can be easily overridden as desired. IMHO what makes it annoying for projects other than C or C++ is that there isn't an equival…

The thing about Java is that it has its own dependency system embedded in the compiler. This design decision made it difficult to integrate with a tool like make.

I don't think having dependencies built into the language and/or compiler means it needs to be difficult to integrate with something like make. In fact gcc has dependency analysis built into it. It just knows how to output that information in a simple format that make can then consume.

I feel like this choice has more to do with early java culture and/or constraints as compared to unix/linux. With "the unix way" it is really common to solve a problem by writing two separate programs that are loosely coupled by a simple text based file format. When done well, this approach has a lot of the benefits of well done microservices-style applications built today. By contrast, (and probably for a variety of reasons) this approach was always very rare in early java days. It seemed for a while like the norm was to rewrite everything in java and run it all in one giant JVM in order to avoid JVM startup overhead. ;-) The upshot being you often ended up with a lot more monolithic/tightly coupled designs in Java. (I think this is less true about Java today.)

Re: The Makefile I use with JavaScript projects

#322
post #282
post #23

Make's interface is horrible. Significant tabs. Syntax which relies on bizarre punctuation... If only whoever authored Make 40 years ago had had the design acumen of a Ken Thompson or a Dennis Ritchie! We're stuck with Make because of network effects. I wish that it could just become "lost" forever and a different dependency-based-programming build tool could replace it... but that's just wishful thinking. The pace o…

I'm really glad software development has largely moved away from the terse names and symbols that used to be so common. I mean patsubst? What a terrible function name! At the very least I would have added the 'h' in path.

Why would you add an 'h' to 'pattern'?

Re: The Makefile I use with JavaScript projects

#323

Thank you. It's nice to know that I'm not alone in this dark, dark world. It's so depressing when people use arguments like "it's old", "it uses tabs", and "it's hard to learn". As described by one Peter Miller, "Make is an expert system". If a tool is the most powerful, standard, and expressive among its peers, its age or the fact that it uses tabs should be inconsequential. If anything, the fact that it's decades o…

The tools are not the same on every platform. That’s reason enough for me to not use it with my JavaScript projects. The bigger reason though is that it’s not very idiomatic for JavaScript projects to use Make. It sounds like the only reason that some people go out of their way to use it is because they actually don’t want to learn something.

What is the build tool used in the javascript world this week? Broccoli? Grunt? Gulp? Talp?

Just dealing with breaking changes in any one of those is a full time job!

Re: The Makefile I use with JavaScript projects

#324

Earlier quoted context omitted.

> "The tools are not the same on every platform." Any common examples? > "It’s not very idiomatic for JavaScript projects to use Make." While I agree that popularity is a factor in picking a tool, it shouldn't be a deciding factor. Going by popularity is precisely how we end up with a new Build System of the Year(TM) every few years. The fact that we've gone through 4 fairly prominent tools (Gulp, Grunt, Broccoli, We…

This comment points out the kind of problems that can occur just on Unix systems - https://news.ycombinator.com/item?id=16485637 And then there’s Windows... Anyway, the fact that things change quickly in JS-land is more of a testament to how popular it is than anything else IMO. If C were used in the same environments as JS, I’m sure that you'd see just as much churn.

C is used in a lot of platforms.

Js only in the browser (thankfully mostly converged) and in node.

Re: The Makefile I use with JavaScript projects

#325
post #322
post #282

Earlier quoted context omitted.

I'm really glad software development has largely moved away from the terse names and symbols that used to be so common. I mean patsubst? What a terrible function name! At the very least I would have added the 'h' in path.

Why would you add an 'h' to 'pattern'?

I think that just supports my argument, really. I've never really used makefiles. The blog post talked about using patsubst to change a path. The name of the function essentially gives no clue at all what it does.

Re: The Makefile I use with JavaScript projects

#326
post #312

Earlier quoted context omitted.

I expect you mean NUL (ASCII 0) - but that's typically not a good choice, because POSIX decrees it invalid, along with '/'. But anything else is fair game, sure. Handling every Unicode char might be a pain, but that's the filing system's job, not yours! Most programming languages manage to get this right. You have a quoting syntax with an escape character that lets you express the quotes, the escape character, and an…

And regarding slashes: are you bemused that unix does not support them in filenames? (Thanks for correcting the nul reference)

No, not really - I have no particular opinion about what POSIX chooses to support or not.

But I'm going to go back to my original point. What I do have an opinion about is how reasonable it is for tools not to support a character that is valid in file names, when that character is straightforward to support with everyday, well known syntax.

And when that character is ' ', the standard English word separator, as straightforwardly supported by approximately ever kind of quoting or escaping syntax ever, my opinion about a lack of support is: it's crap.

Re: The Makefile I use with JavaScript projects

#327

Earlier quoted context omitted.

> Window's users, on the other hand, still call their PC computers. I guess that is ok if computers are appliances. It seems that 90% of computer use has moved into the web browser. Heck outside of writing code, almost everything I do is in a browser, and my code editor of choice happens to be built as fancy skinned web browser... > To clarify, beneath the GUI interface is the actual code that implements that interfa…

> It seems that 90% of computer use has moved into the web browser. This is an extremely (web) developer-centric viewpoint IMHO. Try telling 3D modellers/sculptors, games programmers, audio engineers that 90% of their computer use has moved into a browser. They will look at you with a blank face since they all require traditional "fat" desktop apps to get their work done at professional level. And those are just the…

Do all of those computer users constitute more than 10% of computer users? I don't think there's even 5% of computer users there.

Talking about 3D modelling, game programming and producers like they're the majority is a technologist-centric view.

Most computer use is by people who think the web is the internet and use 'inbox' as a verb.

Re: The Makefile I use with JavaScript projects

#328

Thank you. It's nice to know that I'm not alone in this dark, dark world. It's so depressing when people use arguments like "it's old", "it uses tabs", and "it's hard to learn". As described by one Peter Miller, "Make is an expert system". If a tool is the most powerful, standard, and expressive among its peers, its age or the fact that it uses tabs should be inconsequential. If anything, the fact that it's decades o…

> If anything, the fact that it's decades old and used in every major software project is a testament to its effectiveness, not a drawback.

Part of the reason is because people see the superficial issues (like the discussion regarding spaces) before they see the value of years (or decades) of work. It doesn't help that when folks bring this up many times you get "you're holding it wrong" type responses.

I sympathise with both sides of the argument. I don't know the solution but it's unfortunate seeing folks reinventing the wheel and struggling with problems solved in the past.

Re: The Makefile I use with JavaScript projects

#329
post #326

Earlier quoted context omitted.

And regarding slashes: are you bemused that unix does not support them in filenames? (Thanks for correcting the nul reference)

No, not really - I have no particular opinion about what POSIX chooses to support or not. But I'm going to go back to my original point. What I do have an opinion about is how reasonable it is for tools not to support a character that is valid in file names, when that character is straightforward to support with everyday, well known syntax. And when that character is ' ', the standard English word separator, as strai…

Please write a makefile that uses an environment variable as a mysql password to connect to a mysql server and perform an arbitrary administrative task.

Now do the same, assuming that the password can have a dollar in it.

You can do it. It is not as easy, readable or maintanable. Avoid it if you can.

Re: The Makefile I use with JavaScript projects

#330

A tiny improvement that could be added - instead of locating Babel by adding your project's `node_modules/.bin` to your path or directly linking to it, you can always write: `npx babel` This will use any installed version of babel in your node_modules, or, if not installed, will temporarily install it for the duration of the command.

> or, if not installed, will temporarily install it for the duration of the command.

Wait... doesn't that make typosquatting even more of a danger? People get used to typing "npx ", they mistype the command once in a while, an attacker uploads packages named after the most likely typos, and done - the attacker wins.

I question the wisdom of that shortcut.

Post reply on HN