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

Fix rust projects with hyphenated names #663

Merged
merged 2 commits into from
Jan 26, 2018

Conversation

richard-uk1
Copy link
Contributor

Currently, parcel will not successfully bundle rust code if the cargo project name has a hyphen in it. This PR fixes this bug.

In Rust, hyphens in project names are converted to underscores both in code and in output file names.

@codecov-io
Copy link

codecov-io commented Jan 25, 2018

Codecov Report

Merging #663 into master will decrease coverage by 0.21%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #663      +/-   ##
==========================================
- Coverage   88.82%   88.61%   -0.22%     
==========================================
  Files          61       61              
  Lines        1897     1897              
==========================================
- Hits         1685     1681       -4     
- Misses        212      216       +4
Impacted Files Coverage Δ
src/assets/RustAsset.js 89.28% <100%> (-1.2%) ⬇️
src/Logger.js 32.72% <0%> (-5.46%) ⬇️

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 1cd3cf7...66e4e10. Read the comment docs.

@@ -153,7 +153,8 @@ class RustAsset extends Asset {

// Get output file paths
let outDir = path.join(cargoDir, 'target', RUST_TARGET, 'release');
let rustName = cargoConfig.package.name;
// Rust converts '-' to '_' when outputting files.
let rustName = cargoConfig.package.name.replace('-', '_');
Copy link
Member

Choose a reason for hiding this comment

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

This will only replace the first dash. We should make sure to replace every instance.

@devongovett devongovett merged commit e78baca into parcel-bundler:master Jan 26, 2018
@richard-uk1 richard-uk1 deleted the rust_project_hyphen branch January 29, 2018 10:08
devongovett pushed a commit that referenced this pull request Oct 15, 2018
* Fix rust projects with hyphenated names

* Update RustAsset.js
devongovett pushed a commit that referenced this pull request Oct 15, 2018
* Fix rust projects with hyphenated names

* Update RustAsset.js
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.

4 participants