Skip to content

Allow publishing from a specific folder using publishPath attribute - #102

Closed
thivi wants to merge 1 commit into
release-it-plugins:masterfrom
thivi:master
Closed

Allow publishing from a specific folder using publishPath attribute#102
thivi wants to merge 1 commit into
release-it-plugins:masterfrom
thivi:master

Conversation

@thivi

@thivi thivi commented May 18, 2023

Copy link
Copy Markdown

This is to allow publishing only a specific folder from within a package. In order to publish a specific folder, developers can add the following attribute to the relevant package's package.json file:

"publishPath": "dist"

This will run the npm publish command from within the dist folder, allowing only the content of this directory to be published.

@scalvert

Copy link
Copy Markdown
Collaborator

Thanks for the PR!

This is a fairly unconventional use case you're asking for, and one that could likely be accomplished by using the conventional mechanism npm uses. Would this not work for you?

@thivi

thivi commented May 19, 2023

Copy link
Copy Markdown
Author

Hi @scalvert,

Thank you for your swift response. The problem with the above approach is that you can't publish the content of a folder. Instead, you will be publishing the folder itself.

For example, let's assume that the structure of my repo is as follows:

|_dist
|__index.js
|__index.d.ts
|__package.json
|_src
|__index.ts
|_package.json

I want to publish the content of the dist folder. If I use the approach you suggested, the npm pack will look like this:

|_dist
|__index.js
|__index.d.ts
|__package.json

Instead, I want the npm pack to look like this:

|_index.js
|_index.d.ts
|_package.json

Release It actually supports this using the publishPath config. I would appreciate it if the workspaces plugin also supported something similar. https://github.com/release-it/release-it/blob/main/docs/npm.md#publish-path

@scalvert

Copy link
Copy Markdown
Collaborator

Thank you for this feature, @thivi! It's been rebased onto current master and reimplemented in #146 (the publishing logic moved from findAdditionalManifests to getWorkspaces since 2023, so the original diff no longer applied cleanly). Your authorship is credited there. Closing in favor of #146.

@scalvert scalvert closed this Jun 17, 2026
@thivi

thivi commented Jun 17, 2026

Copy link
Copy Markdown
Author

Thank you, @scalvert!

scalvert added a commit that referenced this pull request Jun 18, 2026
Allow an individual workspace to be published from a subdirectory (e.g.
`dist`) by setting a `publishPath` field on its `package.json`. When
present, the publish command runs from `<package>/<publishPath>` instead
of the package root. The version bump is still written to the workspace's
own `package.json`, so the build that produces the published folder is
responsible for including an up-to-date manifest.

Originally proposed in #102 by @thivi.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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