Skip to content
This repository has been archived by the owner on Feb 24, 2024. It is now read-only.

Replace hard-coded webpack with node script call #1718

Merged
merged 5 commits into from
Jul 3, 2019

Conversation

stanislas-m
Copy link
Member

@stanislas-m stanislas-m commented Jun 28, 2019

This PR replaces the hardcoded webpack commands (dev & build) with standard package.json scripts which can be called with either npm or yarn.

The new applications will be generated with the following new section in the package.json:

  "scripts": {
    "build": "webpack -p --progress",
    "dev": "webpack --watch"
  }

Buffalo will then call yarn run build (or npm run build) when you call buffalo build; and it will call yarn run dev (or npm run dev) when you call buffalo dev. This allows you to customize the scripts buffalo calls on these steps, providing custom args to the webpack command or even running your own toolchain instead.

Thanks to #1729, we'll preserve compatibility with current apps which didn't migrate by hand or run buffalo fix : if the build or dev scripts can't be found, we'll fallback on the old behavior running the hardcoded webpack commands.

Migration

The buffalo fix command rewrites the package.json file if necessary, adding this new scripts section if it doesn't already exist.

Fixes #1116.

@stanislas-m stanislas-m marked this pull request as ready for review June 29, 2019 13:27
@stanislas-m stanislas-m requested a review from a team as a code owner June 29, 2019 13:27
markbates
markbates previously approved these changes Jul 2, 2019
Currently, the only way to generate a project with node is to use
Webpack. If the --skip-webpack flag is used, WithNodeJs must be false
then.
@stanislas-m stanislas-m merged commit f3351e3 into development Jul 3, 2019
@stanislas-m stanislas-m deleted the feat/npm-scripts branch July 3, 2019 13:14
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants