oliverdavies.uk/content/node.10105b0a-c18f-4b77-8ac9-bec3250e37b7.yml

129 lines
5.4 KiB
YAML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

uuid:
- value: 10105b0a-c18f-4b77-8ac9-bec3250e37b7
langcode:
- value: en
type:
- target_id: daily_email
target_type: node_type
target_uuid: 8bde1f2f-eef9-4f2d-ae9c-96921f8193d7
revision_timestamp:
- value: '2025-05-11T09:00:44+00:00'
revision_uid:
- target_type: user
target_uuid: b8966985-d4b2-42a7-a319-2e94ccfbb849
revision_log: { }
status:
- value: true
uid:
- target_type: user
target_uuid: b8966985-d4b2-42a7-a319-2e94ccfbb849
title:
- value: |
just vs make
created:
- value: '2023-04-11T00:00:00+00:00'
changed:
- value: '2025-05-11T09:00:44+00:00'
promote:
- value: false
sticky:
- value: false
default_langcode:
- value: true
revision_translation_affected:
- value: true
path:
- alias: /daily/2023/04/11/just-vs-make
langcode: en
body:
- value: |
<p><code>just</code> compared to <code>make</code> is something that was asked during my PHP London talk, and whilst they are similar, <code>just</code> has differences for me that explains why I use it:</p>
<h2 id="tabs-or-spaces">Tabs or spaces</h2>
<p>A Makefile needs to use tabs. Justfiles are more flexible and work with tabs or any number of spaces.</p>
<h2 id=".phony">.PHONY</h2>
<p>With a Makefile, you need to declare some targets as "phony". I believe that this is for targets that don't generate artifact files with that name, so as I'm not compiling and building files with <code>make</code>, this is redundant and adds visual noise.</p>
<h2 id="passing-arguments">Passing arguments</h2>
<p>This is how a <code>composer</code> target looks like in a Makefile:</p>
<pre><code class="make">composer:
docker compose exec php composer
</code></pre>
<p>With this, I'd expect to be able to pass arguments to it - e.g. <code>make composer info drupal/core</code>.</p>
<p>But, instead of seeing the expected output, I get an error: <code>make: *** No rule to make target 'info'.  Stop.</code>.</p>
<p>This is what I'd need to do to pass arguments to the <code>composer</code> target:</p>
<pre><code class="make">composer:
docker compose exec php composer $(COMPOSER_ARGS)
</code></pre>
<p>Now I can run <code>make composer COMPOSER_ARGS="info drupal/core"</code> and see what I was expecting but the syntax isn't what I'd want.</p>
<p><code>just</code>, on the other hand, allows for defining parameters to its recipes:</p>
<pre><code class="language-yaml">composer *args:
  docker compose exec php composer
</code></pre>
<p>Here, I can create as many named parameters as needed and use them in the recipe with the syntax that I wanted - <code>just composer info drupal/core</code>.</p>
<p>I can think of a few others but this is is the main reason why I moved from <code>make</code> and later adopted <code>just</code>.</p>
<p><code>just</code>, for me, gives the flexibilty that I need whilst using a simple and familiar syntax but without some of the confusing and complicated behaviours of <code>make</code>.</p>
format: full_html
processed: |
<p><code>just</code> compared to <code>make</code> is something that was asked during my PHP London talk, and whilst they are similar, <code>just</code> has differences for me that explains why I use it:</p>
<h2 id="tabs-or-spaces">Tabs or spaces</h2>
<p>A Makefile needs to use tabs. Justfiles are more flexible and work with tabs or any number of spaces.</p>
<h2 id=".phony">.PHONY</h2>
<p>With a Makefile, you need to declare some targets as "phony". I believe that this is for targets that don't generate artifact files with that name, so as I'm not compiling and building files with <code>make</code>, this is redundant and adds visual noise.</p>
<h2 id="passing-arguments">Passing arguments</h2>
<p>This is how a <code>composer</code> target looks like in a Makefile:</p>
<pre><code class="make">composer:
docker compose exec php composer
</code></pre>
<p>With this, I'd expect to be able to pass arguments to it - e.g. <code>make composer info drupal/core</code>.</p>
<p>But, instead of seeing the expected output, I get an error: <code>make: *** No rule to make target 'info'. &nbsp;Stop.</code>.</p>
<p>This is what I'd need to do to pass arguments to the <code>composer</code> target:</p>
<pre><code class="make">composer:
docker compose exec php composer $(COMPOSER_ARGS)
</code></pre>
<p>Now I can run <code>make composer COMPOSER_ARGS="info drupal/core"</code> and see what I was expecting but the syntax isn't what I'd want.</p>
<p><code>just</code>, on the other hand, allows for defining parameters to its recipes:</p>
<pre><code class="language-yaml">composer *args:
&nbsp; docker compose exec php composer
</code></pre>
<p>Here, I can create as many named parameters as needed and use them in the recipe with the syntax that I wanted - <code>just composer info drupal/core</code>.</p>
<p>I can think of a few others but this is is the main reason why I moved from <code>make</code> and later adopted <code>just</code>.</p>
<p><code>just</code>, for me, gives the flexibilty that I need whilst using a simple and familiar syntax but without some of the confusing and complicated behaviours of <code>make</code>.</p>
summary: null
field_daily_email_cta: { }