Skip to content

Commit cfd70d3

Browse files
authored
Merge pull request #40 from DarthHater/master
Initial RFC for publishConfig for yarn
2 parents b2c1b42 + d15fd1d commit cfd70d3

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

text/0000-publish-config.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
- Start Date: (1-10-17)
2+
- RFC PR: (leave this empty)
3+
- Yarn Issue: (leave this empty)
4+
5+
# Summary
6+
7+
Right now yarn does not have a concept of publishConfig. This setting already
8+
exists in package.json for many npm packages. The setting allows you to set the
9+
registry url where you want your package published.
10+
11+
# Motivation
12+
13+
The addition of picking up publishConfig from package.json will allow developers
14+
creating internal packages to move across to using yarn with greater ease.
15+
16+
Developers will be able to use yarn publish to send their package to an internal
17+
registry such as Nexus Repository Manager or Artifactory, while maintaining a
18+
separate setting for the main registries such as npmjs or the yarn mirror. These
19+
are very useful on their own for installing packages, but in many cases a
20+
developer is going to want to publish their package to a different registry.
21+
22+
# Detailed design
23+
24+
To implement this I propose that publish.js be modified in such a way that it will override
25+
registry settings if a package.json contains a publishConfig url. This will need to
26+
modify seteps 2 and 3 of the process, particular the getToken (this occurs against a registry url)
27+
and publish. I believe this can be accomplished by a if(pkg.publishConfig) and overriding
28+
the registry url in config.
29+
30+
# How We Teach This
31+
32+
Since this is an existing npm feature, I believe not much will be needed
33+
for users to understand or grasp this. Changes to documentation for yarn
34+
publish are likely in order, but small changes to explain the behavior.
35+
36+
At least on our side (since this originates with Sonatype), we would likely
37+
blog about this new behavior for our users so that they can adopt yarn
38+
as well.
39+
40+
# Drawbacks
41+
42+
As with any new code, it's new code. Adding it expands the amount of functionality
43+
that yarn now supports. That's the largest drawback I can think of.
44+
45+
# Alternatives
46+
47+
I considered a --registry flag for the yarn publish command. This would likely accomplish the
48+
same functionality but is prone to error as most hand typed things are.
49+
50+
# Unresolved questions
51+
52+
I'm a relative newbie to yarn, so my design might be too simplistic or not accounting
53+
for things I just don't know about.

0 commit comments

Comments
 (0)