Title: Standardize npm script naming in the Gutenberg project
Author: Aki Hamano
Published: August 10, 2022

---

 [  ](https://profiles.wordpress.org/wildworks/) [Aki Hamano](https://profiles.wordpress.org/wildworks/)
10:42 am _on_ August 10, 2022     
Tags: [gutenberg ( 555 )](https://make.wordpress.org/core/tag/gutenberg/)

# Standardize npm script naming in the Gutenberg project

This is an announcement to all contributors to the GutenbergGutenberg The Gutenberg
project is the new Editor Interface for WordPress. The editor improves the process
and experience of creating new content, making writing rich content much simpler.
It uses ‘blocks’ to add richness rather than shortcodes, custom HTML etc. [https://wordpress.org/gutenberg/](https://wordpress.org/gutenberg/)
project.

The Gutenberg project has a number of `npm` scripts defined in the main `package.
json` used for development purposes or with Continues Integration. The naming was
standardized to make understanding each script’s role easier and avoid confusion
over conventions used when new scripts need to be added.

To standardize script naming, [scriptlint](https://github.com/peerigon/scriptlint)
tool was used to drive the process.

## New `start` script

There were `test` and `dev` scripts originally defined. To complement that `start`
script got added that acts as an alias for `dev` script.

## Use namespace

Using namespaced script names improves readability and makes the intent more obvious.
Namespaces are used to group related scripts, and a colon is used to separate namespaces.

Based on this rule, most of the scripts were renamed to use namespaces. Here are
some examples:

 * `lint-css` to `lint:css`
 * `test-e2e` to `test:e2e`
 * `changelog` to `other:changelog`

## Alphabetic order

Sorting script names alphabetically makes it easier to find a particular script.
The `pre*` / `post*` hooksHooks In WordPress theme and development, hooks are functions
that can be applied to an action or a Filter in WordPress. Actions are functions
performed when a certain event occurs in WordPress. Filters allow you to modify 
certain functions. Arguments used to hook both filters and actions look the same.
are exceptionally grouped by caller script:

    ```language-json
    {
      "lint:md:docs": "wp-scripts lint-md-docs",
      "prelint:php": "wp-env run composer \"install --no-interaction\"",
      "lint:php": "wp-env run composer run-script lint"
    }
    ```

## Unify parallel commands

The way of parallelizing commands was a mixture of connecting them with & and `npm-
run-all` package, but scripts were unified to use npm-run-all as possible.

A list of new scripts can be found at [this link](https://github.com/WordPress/gutenberg/blob/d07ad8ba66a614ab2b73af315a47371efdcd4a61/package.json#L243-L310).

For more info, see [#19949](https://github.com/WordPress/gutenberg/issues/19949)
and [#42368](https://github.com/WordPress/gutenberg/pull/42368).

Props to [@mkaz](https://profiles.wordpress.org/mkaz/) for the initial suggestion,
to [@gziolo](https://profiles.wordpress.org/gziolo/), [@zieladam](https://profiles.wordpress.org/zieladam/),
and [@mamaduka](https://profiles.wordpress.org/mamaduka/) for reviewing.

[#gutenberg](https://make.wordpress.org/core/tag/gutenberg/)

### Share this:

 * [  Threads ](https://make.wordpress.org/core/2022/08/10/standardize-npm-script-naming-in-the-gutenberg-project/?share=threads)
 * [  Mastodon ](https://make.wordpress.org/core/2022/08/10/standardize-npm-script-naming-in-the-gutenberg-project/?share=mastodon)
 * [  Bluesky ](https://make.wordpress.org/core/2022/08/10/standardize-npm-script-naming-in-the-gutenberg-project/?share=bluesky)
 * [  X ](https://make.wordpress.org/core/2022/08/10/standardize-npm-script-naming-in-the-gutenberg-project/?share=x)
 * [  Facebook ](https://make.wordpress.org/core/2022/08/10/standardize-npm-script-naming-in-the-gutenberg-project/?share=facebook)
 * [  LinkedIn ](https://make.wordpress.org/core/2022/08/10/standardize-npm-script-naming-in-the-gutenberg-project/?share=linkedin)

 1. ![](https://secure.gravatar.com/avatar/323cf209e19dd825678e9ccc51bc3f745f96571f1c68af26ae7955c1fa9ad1f2?
    s=32&d=mm&r=g)
 2.  [Aaron Jorbin](https://profiles.wordpress.org/jorbin/)  5:20 pm _on_ August 11,
    2022
 3. This is great, but I think that it would be valuable to standardize this across
    all coreCore Core is the set of software required to run WordPress. The Core Development
    Team builds WordPress. projects, not just GutenbergGutenberg The Gutenberg project
    is the new Editor Interface for WordPress. The editor improves the process and 
    experience of creating new content, making writing rich content much simpler. It
    uses ‘blocks’ to add richness rather than shortcodes, custom HTML etc.
     [https://wordpress.org/gutenberg/](https://wordpress.org/gutenberg/).
    No matter how someone is contributing code to WordPress Core, the experience should
    be consistent and predictable.
 4. Is there a way to create a set of linter rules to enforce this?
 5. Do you think [https://developer.wordpress.org/coding-standards/wordpress-coding-standards/](https://developer.wordpress.org/coding-standards/wordpress-coding-standards/)
    would be the best place to document this?
 6.  * ![](https://secure.gravatar.com/avatar/f5c8f73507dcc1114563828cc6d82f4192f62acdccd797f25ef651410041d0ef?
       s=32&d=mm&r=g)
     *  [Aki Hamano](https://profiles.wordpress.org/wildworks/)  2:11 am _on_ August
       12, 2022
     * This standardization was done within the limited scope of “scripts” in `package.
       json`, but some coreCore Core is the set of software required to run WordPress.
       The Core Development Team builds WordPress. projects do not have npm scripts.
       
       Also, few projects have as many scripts as GutenbergGutenberg The Gutenberg 
       project is the new Editor Interface for WordPress. The editor improves the process
       and experience of creating new content, making writing rich content much simpler.
       It uses ‘blocks’ to add richness rather than shortcodes, custom HTML etc. [https://wordpress.org/gutenberg/](https://wordpress.org/gutenberg/).
       I think it’s better to apply this rule flexibly depending on the circumstances
       of each project and the number of scripts.

Comments are closed.

# Post navigation

[← Agenda, Dev Chat, August 10, 2022](https://make.wordpress.org/core/2022/08/09/agenda-dev-chat-august-10-2022/)

[Proposal: Stop merging experimental APIs from Gutenberg to WordPress Core →](https://make.wordpress.org/core/2022/08/10/proposal-stop-merging-experimental-apis-from-gutenberg-to-wordpress-core/)