javascript-studio / studio-changes

📦 Generate a changelog as part of the npm version command
https://medium.com/javascript-studio/nice-and-easy-module-releases-a32c906b564e
MIT License
49 stars 7 forks source link

Publish to npm with public access when package is scoped and public #39

Closed m90 closed 3 years ago

m90 commented 3 years ago

N.B.: This PR might not even be needed, but I noticed that after opening it :sweat_smile:


I use @studio/changes for some projects and always just copied over my npm scripts from the previous project. For the last package I just ran into the following situation:

This PR would allow users to pass through a non-default access level to npm publish.

The one thing I do not understand however: this very package (@studio/changes) does not pass --access public when publishing, nor does it specify private in package.json. How does it work here?

Documentation on --access can be found here: https://docs.npmjs.com/cli/v7/commands/npm-publish#description

mantoni commented 3 years ago

Publishing is out of scope for Studio Changes. It hooks into the version command and whether you actually publish to a registry or not is up to you to define in the postversion script.

We could add this flag for the init command, but I'm not sure whether it makes sense to maintain an edge case like this.

How about generating --access automatically if a package has a scoped name and private: false?

m90 commented 3 years ago

We could add this flag for the init command, but I'm not sure whether it makes sense to maintain an edge case like this.

Yeah, this PR is nothing more but an additional flag for the init command.

How about generating --access automatically if a package has a scoped name and private: false?

I think that sounds like a brilliant idea. Would you keep the flag for --init too or remove it again?

m90 commented 3 years ago

How about generating --access automatically if a package has a scoped name and private: false?

I added this.

Let me know if you want to keep the flag or if it should be removed (I'm mostly impartial about it).

mantoni commented 3 years ago

If you can think of a case where the automatic --access generation would not be sufficient, we can keep the flag. Otherwise I'd remove it to keep things simple.

m90 commented 3 years ago

If you can think of a case where the automatic --access generation would not be sufficient, we can keep the flag. Otherwise I'd remove it to keep things simple.

Not really, I think inferring this from package.json is enough, i.e. I removed the flag.

mantoni commented 3 years ago

📦 This has been published as v2.2.0.

Thank you! 🙏