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

Run npm install in post-merge hook #1445

Merged
merged 3 commits into from
Aug 15, 2022
Merged

Run npm install in post-merge hook #1445

merged 3 commits into from
Aug 15, 2022

Conversation

qwerty287
Copy link
Contributor

To update JS dependencies just like Composer dependencies. Only runs in dev mode.

@qwerty287 qwerty287 requested a review from a team August 6, 2022 10:07
Copy link
Member

@ildyria ildyria left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may also want to run mix then: https://laravel.com/docs/8.x/mix#running-mix

@qwerty287
Copy link
Contributor Author

qwerty287 commented Aug 6, 2022

But don't we include the compiled JS file already in the Git repo?

@ildyria
Copy link
Member

ildyria commented Aug 6, 2022

But don't we include the compiled JS file already in the Git repo?

But then what is the point of npm install ? :) I am not sure how this is actually done in this case, but I don't think the npm install is necessary. I may be wrong.

@qwerty287
Copy link
Contributor Author

qwerty287 commented Aug 6, 2022

It updates the JS dependencies in node_modules that will then be used if you call mix. Similar to what composer install is doing with PHP dependencies. If the dependencies aren't installed, you can't use mix.

@d7415
Copy link
Contributor

d7415 commented Aug 6, 2022

It updates the JS dependencies in node_modules that will then be used if you call mix. Similar to what composer install is doing with PHP dependencies. If the dependencies aren't installed, you can't use mix.

In that case, I'd suggest both or neither. I'd lean towards neither, especially as we're not really using livewire yet.

@ildyria
Copy link
Member

ildyria commented Aug 7, 2022

The more I think of it, the more unsure I am as we commit the JS and css files. As a result we do not need to compile them each times.
Otherwise this requires an additional nodeJs dependency which I am not too happy to add for users. I would rather have php being the only requirement. :)

@nagmat84
Copy link
Collaborator

nagmat84 commented Aug 8, 2022

The more I think of it, the more unsure I am as we commit the JS and css files. As a result we do not need to compile them each times.
Otherwise this requires an additional nodeJs dependency which I am not too happy to add for users. I would rather have php being the only requirement. :)

Total agreement. I don't like adding development dependencies to the main line. But it is up to you, @ildyria, you approved this PR. If you are getting second thoughts, then you should revoke the approval. I am not a big fan of this PR.

I have already asked in #1440 (comment) why we need NPM at all, because I have never needed it before.

Copy link
Member

@ildyria ildyria left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make this "optional" in other words, do not fail if npm is not available.

@qwerty287
Copy link
Contributor Author

@ildyria it now only runs if npm is available.

Copy link
Member

@ildyria ildyria left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@codecov
Copy link

codecov bot commented Aug 15, 2022

Codecov Report

Merging #1445 (f90c025) into master (1121784) will decrease coverage by 0.81%.
The diff coverage is n/a.

@qwerty287 qwerty287 merged commit 507aa26 into master Aug 15, 2022
@qwerty287 qwerty287 deleted the npm-i-post branch August 15, 2022 13:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants