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

Remove node_modules dir from all plugins #373

Merged
merged 2 commits into from
Nov 17, 2019

Conversation

ashthespy
Copy link
Contributor

No description provided.

@a-i-ks
Copy link
Contributor

a-i-ks commented Nov 5, 2019

I welcome this pull request. Is npm install called automatically when installing plugins or must each plugin call it in the install.sh? If the latter is the case, npm_install should be added to each install.sh where the node_modules dir has been removed.

@ashthespy
Copy link
Contributor Author

ashthespy commented Nov 5, 2019

@a-i-ks node_modules are packaged into the plugin.zip that is hosted on gh_pages branch of this repo. This is to avoid having to build external modules/bindings on poor pi's..

Edit: The recommended workflow is to use volumio plugin publish - but I for one don't develop on my device, so need to package it manually before submitting a PR.

@a-i-ks
Copy link
Contributor

a-i-ks commented Nov 5, 2019

@ashthespy Thanks for the explanation. So if I understood that correctly, the best way is to add the node_modules folder to the .gitignore. And don't run the npm install in install.sh. Instead use the volumio plugin publish command as soon as the plugin is finished developed?

@ashthespy
Copy link
Contributor Author

ashthespy commented Nov 5, 2019

Yeah, this is my .gitignore, should probably add it to this PR as well.

# Ignore all node_modules in all sub dirs
node_modules/

When you package your plugin, just include your node_modules folder, that contains all the right modules for your architecture. The packaged plugin should then be a PR at the gh_pages branch, while this branch aims to keep just the code checked in. I wrote some scripts to automate this via a CI, but its a pain to work with this repo in its current state.

volumio plugin publish does this by running npm install if it doesn't find a node_modules folder.

@volumio
Copy link
Owner

volumio commented Nov 5, 2019

Thanks for the PR, very useful indeed.
I believe to make this effective we should "rebase" the repo, to clean all the node_modules history as well. Do you have any idea on that?

@ashthespy
Copy link
Contributor Author

Not sure if rebasing will help - to reduce the size of the repo, you'd have to re-write the history of the repo by deleting all instances of node_modules from history using --index-filter for example.

Maybe its an option to finally split out each plugin into its own repo plugin-* - like how the current platform-* repos are handled? I should have some scripts that does this, keeping the commit history, like in Volumio-SpotifyConnect

@volumio
Copy link
Owner

volumio commented Nov 14, 2019

as of now I've not foun an easy solution.. Ash could you help on that? We want to remove ideally all histories of committed node_modules.
+1 for the idea of separate repos for sources. We are studying a new iteration of plugin manager and repo, I will contact you for your opinion if you like ;)

One action we could do, is to push gh-pages without history. Do you have an idea on how to achieve that?

@ashthespy
Copy link
Contributor Author

Removing node_modules from history will rewrite all commits from the point, so it will break all the current forks. Not sure if we should do that now.
Would rather wait for this new iteration of plugin manager, I am eager for it, as IMO the current ecosystem is becoming hard to work with! We could still have a central "collection" repo that becomes the official distribution source, while checking in the code into separate repos, this should greatly help with proper versioning and tracking of changes. Either way, I'd be happy to help, let me know!

One action we could do, is to push gh-pages without history. Do you have an idea on how to achieve that?

Currently all the git clone operations in the plugin helper use shallow clone - volumio/Volumio2#1515
So culling the history of the gh-pages branch doesn't bring in much savings. We could invistigate the savings by just setting --depth 1 instead of the --depth 5?

@volumio
Copy link
Owner

volumio commented Nov 17, 2019

OK, ash. I will contact you for the new plugin manager ;)

@volumio volumio merged commit a0839b2 into volumio:master Nov 17, 2019
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.

3 participants