Live data from Hacker News

The Makefile I use with JavaScript projects

olioapps.com

471–480 of 525 posts

Re: The Makefile I use with JavaScript projects

#471

Earlier quoted context omitted.

If you're able, I'd be very interested in seeing some examples.

SHELL=/bin/bash VERSION=1.0 build: clean docker build -t webservice:$(VERSION).$$(date +"%y-%m-%d") . shell: docker run -it -v $$(pwd)/src:/opt/app \ -p 8888:8888 \ --name webservice \ -e SECRET1=$$SECRET1 \ -e SECRET2=$$SECRET2 \ webservice:$(VERSION).$$(date +"%y-%m-%d") \ /bin/bash run: docker run -it \ -p 8888:8888 \ --name webservice \ -e SECRET1=$$SECRET1 \ -e SECRET2=$$SECRET2 \ webservice:$(VERSION).$$(date +…

Tidy and to the point.

Thanks for sharing! I'll be using this as inspiration in the future.

Re: The Makefile I use with JavaScript projects

#472

Earlier quoted context omitted.

> though it’s probably a bug that whitespace in target names must be escaped, since it’s just one token that ends in a colon It's perfectly fine for a rule to have multiple targets, e.g. output.txt error.txt: source build source > output.txt 2> error.txt

Interesting! So in that case one could defend the need for escaped whitespace. Still leaves automatic variables, I guess.

Well it could be rewritten to use 0x1f (i.e. unit separator) to separate items. I mean it already has significant tabs. Though invariably people would be like "How is it acceptable for make to not support filenames which contain unit separators? It's 2020 guys, get with the program!"

Re: The Makefile I use with JavaScript projects

#474
post #187

Earlier quoted context omitted.

But it's not true that everything is a file. A row in a relational database, for example, is not a file, even in unix.

> A row in a relational database, for example, is not a file, even in unix. Says who? Nothing stops you from creating an interface that maps that row to a file. That's the whole point of Unix. Heck, look at the /proc filesystem tree. Even cpu sensor data is available as a file.

> Nothing stops you from creating an interface that maps that row to a file.

That's true, nothing stops you, though it is worth noting that no one actually does this, and there's a reason for that. So suppose you did this; how are you going to use that in a makefile?

Re: The Makefile I use with JavaScript projects

#475
post #50
post #42

Earlier quoted context omitted.

because then people new to your project can see a makefile and know that “make” and “make test” and “make install” probably work without having to learn your homebrew, one-off build system.

This argument for Make is exclusively based on network effects. Fine. we accept that we're stuck with it. It still sucks.

I disagree. It’s an argument for convention. This is the same reason we have package.json or Dockerfile or Pipfile or Rakefile - it tells us the standard interface for “install this”. It’s not specific to make.

Docker is new and didn’t have any network effect until recently.

Re: The Makefile I use with JavaScript projects

#476
post #419
post #412

Earlier quoted context omitted.

I think you're missing the point. I have a workflow where I have to perform some action if the result of a join on a DB meets some criterion. How does "make" help in that case?

In that case, it doesn't help much. For Plan 9 mk, there's a way to use a custom condition to decide if the action should be executed: rule:P check_query.rc: prereq rules doaction Where check_query may be a small shell script: #!/bin/rc # redirect stdin/stdout to /mnt/sql/ctl /mnt/sql/ctl { # send the query to the DB echo query # print the response, check it for # your condition. cat `{sed 1q} | awk '$2 != "condition…

> You'd have to do something like:

That's exactly right, but notice that you are not actually using make at all any more at this point, except as a vehicle to run

check_query.sh && doaction

which is doing all work.

Re: The Makefile I use with JavaScript projects

#477
post #165

Earlier quoted context omitted.

Exactly. If C hadn't been invented then someone would have invented it later under a different name. Because it's obvious people need a minimalistic portable assembler.

Before C was invented there were already other companies writing OSes in high level languages, but yeah thanks to its victory now it gets all the credits. History is re-written by winners as usual.

I wasn't thinking in terms of winners.

But what were those other OSs and languages? Sounds interesting!

Re: The Makefile I use with JavaScript projects

#478

I used make heavily in the 80s and 90s, but haven't much since then. Recently I started a project that had source files getting processed into PDF files, for use by humans. Since this is the 21st century, those files have spaces in their names. At a certain point, I realized that I should be managing this processing somehow, so I thought of using a simple Makefile. A little searching reveals that the consensus on usi…

Demanding the support of spaces in filenames significantly complicates code as simple space delimination no longer works and other delimination schemes are much more error prone -- forgetting balancing quotes, any one? While you are allowing spaces, you probabaly are allowing all possible code points or maybe even a null byte? Thinking about it gives me headaches. I hate hearing people using 21st century or modern as…

> The merits of filenames with spaces is they read better in a GUI explorer.

Even this merit is debatable. Is foo bar two things or one? I know foo-bar is one.

Re: The Makefile I use with JavaScript projects

#479

Earlier quoted context omitted.

Webpack, by itself, doesn't generate configs, unless you're referring to the Webpack CLI tool. FWIW, Webpack 4 (which just went final a few days ago) now has "zero-config" defaults out of the box. You may want to give that a shot.

Eh, I tend towards “let’s not touch this if it works”. I’ve already had to upgrade from Webpack 1 to 2, and 2 to 3. If it ain’t broke, don’t fix it.

Sure, I can sympathize. That said, I've seen a bunch of "here's my results after upgrading to Webpack 4" tweets going around, and they all indicate much faster builds and somewhat smaller bundle sizes, with very minimal config changes needed.

Re: The Makefile I use with JavaScript projects

#480

Earlier quoted context omitted.

>I did have to swap out the ASCII SP (character 32) for the Unicode non-blank space (code 160) How? EDIT: Ok, now I got it. Boy that was a wild ride.

Could you explain how you did it?

Replacing breaking space with non-breaking space :

1. Set up your compose key on linux(Top right corner settings->system settings->keyboards->shortcut->typing->Compose key(choose an appropriate one)).

2. Whenever you need to type breaking space instead type (compose key + spacebar + spacebar). This puts a non-breaking space there instead. That's it.

3. Create file -> sudo nano hello(compose key + spacebar + spacebar)world.c

4. Paste the code to execute.

5. Makefile-> hello(compose key + space + space)world:

6. make

7. ./hello world (pressing tab will recognise the executable automatically).

NOTE: Don't do this ever in any production code or just ever. This hack can take up hours to resolve and a lot of frustration which could have better been spent on fixing something meaningful. This is a frowned upon practice. The only cool part is that your directory can have two files with whose name look exactly the same.

Post reply on HN