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

Move package.json files for tests to a different folders (admin and storefront), e.g. a subfolder tests #217

Open
AndreasA opened this issue Oct 29, 2021 · 4 comments
Labels
Question / Issue Further information is requested

Comments

@AndreasA
Copy link

With current shopware production template all plugin dependencies call a npm install for all installed plugins in admin and storefront build processes:
https://github.com/shopware/production/blob/v6.4.5.1/bin/build-storefront.sh#L32

This means that the npm install is triggered for your tests which seems unnecessary if those dependencies are really only necessary for tests.

@boxblinkracer
Copy link
Collaborator

Hi

thank you for this

as far as I know, this is based on the guides of Shopware.
if they install it it including dev-dependencies, that that build file should be fixed.

theres a clear section for prod and dev dependencies in package.json
that has to be respected by the calling instance.

so i think its better if shopware itself get fixed...or maybe theres a reason for this
what do you think?

@boxblinkracer boxblinkracer added the Question / Issue Further information is requested label Nov 3, 2021
@AndreasA
Copy link
Author

AndreasA commented Nov 3, 2021

@boxblinkracer Dev dependencies can be required by webpack to correctly do the dependency build.

E.g. usually in dependencies one puts things that are deployed in the end but things like webpack/babel/file loaders etc. are still required to build it, which are to be placed in devDependencies. devDependencies for node are a bit different to require-dev in PHP. They are modules that are not required during runtime but still required during development / building of assets. So if I want to build my plugin javascript files and the mollie plugin is installed, those dependencies are could still be required.

One scenario would be a plugin adding a fileloader and adding webpack build adjustments (which is possible), in this case the file loader will be required to successfully completely the build.

However, if I understand it correctly you only use it for tests, so the question is are those dependencies needed at all. Probably not but Shopware cannot make that distinction. Your plugin can though by e.g. moving the package.json in a tests subfolder or similar.

Though I could be wrong but from what I understand that's how it is, e.g. according to: https://medium.com/@dylanavery720/npmmmm-1-dev-dependencies-dependencies-8931c2583b0c

@boxblinkracer
Copy link
Collaborator

Hi there

thanks for this,
ah yeah..sorry, kinda confusing day :D totally makes sense that that build command has dev-dependencies haha :D

ok so you basically just mean,
the overhead of the testing stuff can be avoided if not needed by anyone else
so we could move it to a different file that is not automatically run by shopware

now i got you, right?

@AndreasA
Copy link
Author

AndreasA commented Nov 3, 2021

@boxblinkracer Yes. I think it would make sense to do so?
It isn't strictly a must but it would simplify running storefront / admin builds locally and it should be easy to do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Question / Issue Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants