meteor / meteor-feature-requests

A tracker for Meteor issues that are requests for new functionality, not bugs.
Other
89 stars 3 forks source link

Ignore files/directories when publishing a package #387

Open SimonSimCity opened 4 years ago

SimonSimCity commented 4 years ago

Because I again published one of my packages with all the dev npm packages (https://github.com/meteor/meteor/issues/10938#issuecomment-590974079), I propose that we find a way to integrate a pre-publish hook, where I can put some shell scripts removing all the npm packages I want for development.

Another approach which would help me here would be to introduce a .meteorignore - which is a file, similar to .gitignore which defines a list of paths to ignore when running meteor publish.

@filipenevola @benjamn which approach would you rather go for? I'm willing to put down a PR for any of the proposed solutions.

filipenevola commented 4 years ago

@SimonSimCity it would be good to have hooks for this.

For now, I think we should adopt the community template for all the packages. See that in the community template there is a script to publish a package https://github.com/Meteor-Community-Packages/template-package/blob/master/package.json#L19

zodern commented 4 years ago

Meteor is able to remove dev dependencies when copying a node_modules folder: https://github.com/meteor/meteor/blob/devel/tools/isobuild/bundler.js#L2457-L2479, though it hasn't been implemented for packages.

Depending on how it is implemented for packages and if Meteor keeps enough information in the published package, it might also be able to also remove dev dependencies from the package when bundling the app, instead of requiring packages to be republished (there are many with dev dependencies that haven't been updated in a while).

I had got this mostly working before getting distracted with build performance early last year. It included more packages than it should have, so the getProdPackagePredicate might also need some adjustments.