Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow publishing from a specific folder using publishPath attribute #102

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

thivi
Copy link

@thivi thivi commented May 18, 2023

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
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
Copy link
Author

thivi commented May 19, 2023

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

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.

None yet

3 participants