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

Configuring Published Files: blocks copying of assets into source location #3958

Open
2 of 4 tasks
roydukkey opened this issue Feb 14, 2024 · 1 comment
Open
2 of 4 tasks

Comments

@roydukkey
Copy link
Contributor

roydukkey commented Feb 14, 2024

Documentation issue

  • Reporting a typo
  • Reporting a documentation bug
  • Documentation improvement
  • Documentation feedback

Is there a specific documentation page you are reporting?

https://lerna.js.org/docs/concepts/configuring-published-files#--directory

Additional context or description

I've struggled for a considerable amount of time before looking at the source to find that copying of assets is being blocked when the trying to copy into the source location.

if (normalize(pkg.location) === normalize(pkg.contents)) {
// no need to copy assets if publishing from the source location
return;
}

This isn't clear in the documentation. But why even block copying under this condition?

For example, I have a mono-repo with package-a and package-b that source assets from {workspaceRoot}. This scenario doesn't currently work.

I'm willing to create a PR, if you agree this restriction should be removed. Let me know.

@roydukkey
Copy link
Contributor Author

if (!pkg.lernaConfig?.command?.publish?.assets) {
return;
}

Actually, I wonder too if the preceding conditionally never gets the configuration from the following code:

} else if (this.project.config.command?.publish?.["assets"]) {
// Root level
const assets = this.project.config.command?.publish?.["assets"].map((asset) =>
interpolateAsset(asset, interpolateStr)
);
pkg.lernaConfig = pkg.lernaConfig || {};
pkg.lernaConfig.command = pkg.lernaConfig.command || {};
pkg.lernaConfig.command.publish = pkg.lernaConfig.command.publish || {};
pkg.lernaConfig.command.publish.assets = assets;
}

I do see this log for the my configuration, but this conditional still catches and returns early.

lerna verb silly Interpolated string "../../README.md" for node "package-a" to produce "../../README.md"
{
  "$schema": "node_modules/lerna/schemas/lerna-schema.json",
  "npmClient": "pnpm",
  "version": "independent",
  "changelogPreset": "conventional-changelog-conventionalcommits",
  "command": {
    "version": {
      "message": "chore(release): publish",
      "conventionalCommits": true,
      "private": false
    },
    "publish": {
      "registry": "https://npm.pkg.github.com/",
      "private": false,
      "assets": [
        "../../README.md"
      ]
    }
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant