Skip to content

feature(cli): add support for publishing from a subdirectory using publishConfig.directory - #428

Merged
emmatown merged 7 commits into
changesets:masterfrom
dotansimha:publish-subdirectory
Aug 4, 2020
Merged

emmatown merged 7 commits into
changesets:masterfrom
dotansimha:publish-subdirectory

Conversation

@dotansimha

@dotansimha dotansimha commented Aug 4, 2020 •

Copy link
Copy Markdown
Contributor

The PR resolves this issue: #423

@Andarist

@atlassian-cla-bot

atlassian-cla-bot Bot commented Aug 4, 2020 •

Copy link
Copy Markdown

Hooray! All contributors have signed the CLA.

@changeset-bot

changeset-bot Bot commented Aug 4, 2020 •

Copy link
Copy Markdown

🦋 Changeset is good to go

Latest commit: f1a1f5a

We got this.

This PR includes changesets to release 2 packages
Name Type
@changesets/cli Minor
@changesets/types Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@Andarist

Andarist commented Aug 4, 2020

Copy link
Copy Markdown
Member

If a different location needs to be published, then changesets version should be executed in order to update the original package.json with the new version number, and commit it.

Is this any different from what we do now? I fail to see the difference.

In tools like lerna, it's possible to set publishConfig.directory and this tell the publish command that the actual directory is different.

Could you link to their docs about this feature? Are there any tools handling it in the same way?

Comment thread .changeset/real-spoons-raise.md Resolved
Comment thread .changeset/real-spoons-raise.md Resolved
@dotansimha

dotansimha commented Aug 4, 2020 •

Copy link
Copy Markdown
Contributor Author

@Andarist The difference is where do you run the npm run publish.
Our setup has this after changesets version and yarn build:

packages/
  - a/
     - package.json
     - dist/
         - compiled.js
         - package.json
     - src/...

So there is a temporary package.json under dist, and this is the one we would like to publish, not the source one. To do that, we need to run the npm run publish from ./dist and not from ./ (the current one, hardcoded)

And here's a reference for that: https://www.npmjs.com/package/@lerna/publish#publishconfigdirectory

@dotansimha
dotansimha force-pushed the publish-subdirectory branch from 7cedb61 to 56cd7bd Compare August 4, 2020 10:37
@codecov

codecov Bot commented Aug 4, 2020 •

Copy link
Copy Markdown

Codecov Report

❗ No coverage uploaded for pull request base (master@dca4a91). Click here to learn what that means.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master     #428   +/-   ##
=========================================
  Coverage          ?   77.84%           
=========================================
  Files             ?       42           
  Lines             ?     1255           
  Branches          ?      301           
=========================================
  Hits              ?      977           
  Misses            ?      268           
  Partials          ?       10           
Impacted Files Coverage Δ
...ckages/cli/src/commands/publish/publishPackages.ts 74.46% <100.00%> (ø)
packages/get-github-info/src/index.ts 80.85% <0.00%> (ø)
packages/git/src/index.ts 87.80% <0.00%> (ø)
packages/logger/src/index.ts 100.00% <0.00%> (ø)
packages/get-release-plan/src/index.ts 100.00% <0.00%> (ø)
packages/cli/src/utils/isCI.ts 0.00% <0.00%> (ø)
packages/cli/src/changelog/index.ts 100.00% <0.00%> (ø)
...y-release-plan/src/test-utils/failing-functions.ts 50.00% <0.00%> (ø)
packages/cli/src/commands/add/createChangeset.ts 50.61% <0.00%> (ø)
...ages/apply-release-plan/src/get-changelog-entry.ts 100.00% <0.00%> (ø)
... and 33 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update dca4a91...f1a1f5a. Read the comment docs.

@dotansimha

Copy link
Copy Markdown
Contributor Author

@Andarist resolved all comments :)

@Andarist

Andarist commented Aug 4, 2020

Copy link
Copy Markdown
Member

@Andarist The difference is where do you run the npm run publish.

Right, this matter for the publish alone though - it doesn't matter for the versioning step though. Maybe I've misunderstood your original comment somehow.

Comment thread .changeset/tame-pumas-bathe.md Resolved

@Andarist Andarist left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, I'm going to keep this open for a little bit more time so others have a chance to look at this as well.

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