Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JamPack runs in build and postbuild step #194

Closed
maehr opened this issue Oct 24, 2024 · 0 comments · Fixed by #195
Closed

JamPack runs in build and postbuild step #194

maehr opened this issue Oct 24, 2024 · 0 comments · Fixed by #195
Assignees
Labels
bug Something isn't working

Comments

@maehr
Copy link
Member

maehr commented Oct 24, 2024

Current Behavior

Build and postbuild in https://github.com/Stadt-Geschichte-Basel/stadtgeschichtebasel.ch/blob/main/.github/workflows/sveltekitci.yml run JamPack twice (see also https://github.com/Stadt-Geschichte-Basel/stadtgeschichtebasel.ch/blob/main/package.json)

Remove extra postbuild step from https://github.com/Stadt-Geschichte-Basel/stadtgeschichtebasel.ch/blob/main/.github/workflows/sveltekitci.yml

Reproduction / Steps To Reproduce

  1. Go to https://github.com/Stadt-Geschichte-Basel/stadtgeschichtebasel.ch/actions/runs/11499387482
  2. See step build and postbuild

Anything else?

does node run postbuild command when running npm build?

ChatGPT

No, npm build does not automatically run a postbuild script. The postbuild script is only triggered if you define it in your package.json, and it will run after the build script has completed successfully.

Here's how it works:

  1. You define a build script in your package.json:

    {
      "scripts": {
        "build": "some-build-command"
      }
    }
  2. If you also define a postbuild script, it will be run automatically after npm run build completes:

    {
      "scripts": {
        "build": "some-build-command",
        "postbuild": "some-post-build-command"
      }
    }

When you run npm run build, Node will execute the build script first, and if it succeeds, it will automatically execute the postbuild script right afterward.

This is a general feature of npm scripts, where pre and post scripts (e.g., prebuild, postbuild) run automatically before and after the corresponding main script (build in this case).

@maehr maehr added the bug Something isn't working label Oct 24, 2024
@maehr maehr self-assigned this Oct 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant