mirror of
https://github.com/slint-ui/slint.git
synced 2025-10-02 06:41:14 +00:00
Avoid including the tarball for npm
Don't include the package inside itself if it's there.
This commit is contained in:
parent
008455a106
commit
b782038aad
1 changed files with 13 additions and 11 deletions
|
@ -44,6 +44,19 @@ pub fn generate() -> Result<(), Box<dyn std::error::Error>> {
|
|||
cp(root.join("LICENSE.md"), node_dir.join("LICENSE.md"))
|
||||
.context("Error copying LICENSE.md into the node dir for packaging")?;
|
||||
|
||||
let package_json_source =
|
||||
read_file(node_dir.join("package.json")).context("Error reading package.json")?;
|
||||
|
||||
let package_json: serde_json::Value = serde_json::from_str(&package_json_source)?;
|
||||
|
||||
let file_name = node_dir.join(format!(
|
||||
"{}-{}.tar.gz",
|
||||
package_json["name"].as_str().unwrap(),
|
||||
package_json["version"].as_str().unwrap()
|
||||
));
|
||||
|
||||
rm_rf(file_name.clone()).context("Error deleting old archive")?;
|
||||
|
||||
println!("Running npm package to create the tarball");
|
||||
|
||||
{
|
||||
|
@ -59,17 +72,6 @@ pub fn generate() -> Result<(), Box<dyn std::error::Error>> {
|
|||
|
||||
rm_rf(node_dir.join("LICENSE.md")).context("Error deleting LICENSE.md copy")?;
|
||||
|
||||
let package_json_source =
|
||||
read_file(node_dir.join("package.json")).context("Error reading package.json")?;
|
||||
|
||||
let package_json: serde_json::Value = serde_json::from_str(&package_json_source)?;
|
||||
|
||||
let file_name = node_dir.join(format!(
|
||||
"{}-{}.tar.gz",
|
||||
package_json["name"].as_str().unwrap(),
|
||||
package_json["version"].as_str().unwrap()
|
||||
));
|
||||
|
||||
println!("Source package created and located in {}", file_name.to_string_lossy());
|
||||
|
||||
Ok(())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue