Closed PhMemmel closed 4 months ago
Hello @PhMemmel,
Like in moodle core github repository where the whole node_modules directory already is being included in the git repository
That is not the case, and it is generally recommended not to do that. We use shrinkwrap
to lock dependencies and include npm-shrinkwrap.json
in the repo.
If for whatever reason node_modules
is already included in plugin, running npm install
will be quick. I do not see the benefits of this patch TBH, would be good to hear more opinions.
Hello @kabalin,
thanks for correcting me regarding the inclusion of node_modules
directory, I was confused by the fact that whenever I'm working in the sourcecode, it's of course there and there are no git issues because it's in the .gitignore file :)
Let me elaborate on my use case besides that:
npm install
also installs dev dependenciesnpm install
from failing the whole pipeline, because the install command of moodle-plugin-ci fails, I would have to provide the pipeline with authentication to this very specific private repository which the pipeline itself does not need because it is not supposed to install dev dependencies anyway.So I hope you see that there are use cases in which you do not want moodle-plugin-ci to run npm install
for your plugin. I agree with you, that usually it's perfectly fine to run npm install
, that's why I used an additional command line switch and not change the default behavior.
Like in moodle core github repository where the whole
node_modules
directory already is being included in the git repository, most repositories of moodle plugins are already "deployment ready" which means, all libraries are already part of the git repository.Currently, moodle-plugin-ci will execute
npm install
in the plugin directory anywhere as soon as it finds apackage.json
file. This however might not be necessary in most cases IMO, in some cases you even want to prevent this (reduce pipeline run time, traffic). Also moodle-plugin-ci will not check the current state of the repository but the eventually changed one (in case package.json is not in sync with the node_modules directory).I suggest a command line option for the installation command which allows to prevent moodle-plugin-ci of executing the npm install for the plugin.