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

Martin-ui packaging issue #1699

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from
Draft

Martin-ui packaging issue #1699

wants to merge 9 commits into from

Conversation

nyurik
Copy link
Member

@nyurik nyurik commented Feb 23, 2025

Seems we still have a packaging issue - npm saves files outside the build dir.

error: failed to verify package tarball

Caused by:
  Source directory was modified by build.rs during cargo publish. Build scripts should not modify anything outside of OUT_DIR.
  Added: .../martin/target/package/martin-0.15.0/martin-ui/dist
  	.../martin/target/package/martin-0.15.0/martin-ui/dist/_
  	.../martin/target/package/martin-0.15.0/martin-ui/dist/_/assets
        ...

Fixes #1667
See prior partial fix in #1668

Seems we still have a packaging issue - npm saves files outside the build dir
@CommanderStorm
Copy link
Collaborator

CommanderStorm commented Feb 23, 2025

Let me prephase this: What I have just pushed is a hooorible hack.

What I just pushed works locally (both publish and running).. wish me luck

image

@CommanderStorm
Copy link
Collaborator

I will not continue working on this today, seems like CI is really against this change..
I need fresh eyes for this => will continue sometime in the week/on the weekend.

If someone wants to look into this or has better oppinions, I would love feedback.

Somewhere I apparently made a change in the code I pushed during final cleanup (=before my first commit here) 😞

@CommanderStorm CommanderStorm marked this pull request as draft February 23, 2025 23:13
fn main() -> std::io::Result<()> {
#[cfg(feature = "webui")]
{
static_files::NpmBuild::new("martin-ui")
// rust requires that all changes are done in OUT_DIR.
Copy link
Member Author

Choose a reason for hiding this comment

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

I wonder if we should simply create a symlink in the outdir - no need to copy anything?

Copy link
Collaborator

@CommanderStorm CommanderStorm Feb 24, 2025

Choose a reason for hiding this comment

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

Sounds good, but as far as my logic goes, that would require basically the same code..

  • if you mean placing a symlink in OUT_DIR:
    The directory is dynamic based on compilation target (package,debug,..) => I don't think hardcoding them is a good way to go.
    These directories are also not documented => we would be setting ourselves up for breaking changes..
  • if you mean generating a symlink in the build.rs file:
    dist and node_modules may not live outside of the OUT_DIR, if compiled by the build.rs file as far as I understand. => code would basically be identical. Maybe 1-2 lines simpler, but not much..

Or do you mean something different?

What might work (thinking about it: I have not tried this part) is deleting dist and node_modules after the build.rs file..
This might fuck devs over in development though..
(think: start martin-ui, then server. node_modules is now gone)

Copy link
Collaborator

@CommanderStorm CommanderStorm Feb 24, 2025

Choose a reason for hiding this comment

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

Thinking about it:
Generating symlinks is a bit simpler code.
No recursion or dir-deletion required.. => more like 4-5 lines

Will migrate to that once I have the time.

Copy link
Member Author

Choose a reason for hiding this comment

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

I looked at all of these usages at github search, but the results are not too many. Mostly they modify .target(...) to use the OUT_DIR, but that would probably only affect the dist dir, not the location of node_modules. I posted an issue, and also asked on stackoveflow... will see

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.

cargo publish -p martin does not work due to Node.js package issue
2 participants