mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-06-12 20:41:24 +00:00
Try to improve the publish script
This commit is contained in:
45
publish.rs
45
publish.rs
@ -9,27 +9,30 @@
|
|||||||
//! * Merge when green
|
//! * Merge when green
|
||||||
//! * Execute `./publish publish` to publish crates
|
//! * Execute `./publish publish` to publish crates
|
||||||
|
|
||||||
|
use std::collections::HashMap;
|
||||||
use std::env;
|
use std::env;
|
||||||
use std::fs;
|
use std::fs;
|
||||||
|
use std::io;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
|
|
||||||
|
// note that this list must be topologically sorted by dependencies
|
||||||
const CRATES_TO_PUBLISH: &[&str] = &[
|
const CRATES_TO_PUBLISH: &[&str] = &[
|
||||||
"wasm-bindgen",
|
|
||||||
"js-sys",
|
|
||||||
"wasm-bindgen-backend",
|
|
||||||
"wasm-bindgen-cli",
|
|
||||||
"wasm-bindgen-cli-support",
|
|
||||||
"wasm-bindgen-futures",
|
|
||||||
"wasm-bindgen-gc",
|
|
||||||
"wasm-bindgen-macro",
|
|
||||||
"wasm-bindgen-macro-support",
|
|
||||||
"wasm-bindgen-shared",
|
"wasm-bindgen-shared",
|
||||||
"wasm-bindgen-test",
|
"wasm-bindgen-backend",
|
||||||
|
"wasm-bindgen-gc",
|
||||||
|
"wasm-bindgen-macro-support",
|
||||||
|
"wasm-bindgen-macro",
|
||||||
"wasm-bindgen-test-macro",
|
"wasm-bindgen-test-macro",
|
||||||
|
"wasm-bindgen-test",
|
||||||
"wasm-bindgen-wasm-interpreter",
|
"wasm-bindgen-wasm-interpreter",
|
||||||
"wasm-bindgen-webidl",
|
"wasm-bindgen-webidl",
|
||||||
"wasm-bindgen-threads-xform",
|
"wasm-bindgen-threads-xform",
|
||||||
|
"wasm-bindgen-cli-support",
|
||||||
|
"wasm-bindgen-cli",
|
||||||
|
"wasm-bindgen",
|
||||||
|
"wasm-bindgen-futures",
|
||||||
|
"js-sys",
|
||||||
"web-sys",
|
"web-sys",
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -55,6 +58,13 @@ fn main() {
|
|||||||
crates.push(read_crate("./Cargo.toml".as_ref()));
|
crates.push(read_crate("./Cargo.toml".as_ref()));
|
||||||
find_crates("crates".as_ref(), &mut crates);
|
find_crates("crates".as_ref(), &mut crates);
|
||||||
|
|
||||||
|
let pos = CRATES_TO_PUBLISH.iter()
|
||||||
|
.chain(CRATES_TO_AVOID_PUBLISH)
|
||||||
|
.enumerate()
|
||||||
|
.map(|(i, c)| (*c, i))
|
||||||
|
.collect::<HashMap<_, _>>();
|
||||||
|
crates.sort_by_key(|krate| pos[&krate.name[..]]);
|
||||||
|
|
||||||
match &env::args().nth(1).expect("must have one argument")[..] {
|
match &env::args().nth(1).expect("must have one argument")[..] {
|
||||||
"bump" => {
|
"bump" => {
|
||||||
for krate in crates.iter() {
|
for krate in crates.iter() {
|
||||||
@ -186,6 +196,14 @@ fn publish(krate: &Crate) {
|
|||||||
if !CRATES_TO_PUBLISH.iter().any(|s| *s == krate.name) {
|
if !CRATES_TO_PUBLISH.iter().any(|s| *s == krate.name) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if krate.name == "wasm-bindgen" {
|
||||||
|
println!("ABOUT TO PUBLISH wasm-bindgen");
|
||||||
|
println!("for this to work you need to comment out the `dev-dependencies`");
|
||||||
|
println!("section in `Cargo.toml` and everything below");
|
||||||
|
println!("");
|
||||||
|
println!("hit enter when done");
|
||||||
|
drop(io::stdin().read_line(&mut String::new()));
|
||||||
|
}
|
||||||
let status = Command::new("cargo")
|
let status = Command::new("cargo")
|
||||||
.arg("publish")
|
.arg("publish")
|
||||||
.current_dir(krate.manifest.parent().unwrap())
|
.current_dir(krate.manifest.parent().unwrap())
|
||||||
@ -196,4 +214,11 @@ fn publish(krate: &Crate) {
|
|||||||
if !status.success() {
|
if !status.success() {
|
||||||
println!("FAIL: failed to publish `{}`: {}", krate.name, status);
|
println!("FAIL: failed to publish `{}`: {}", krate.name, status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if krate.name == "wasm-bindgen" {
|
||||||
|
println!("ok please now uncomment the section you just commented");
|
||||||
|
println!("");
|
||||||
|
println!("hit enter when done");
|
||||||
|
drop(io::stdin().read_line(&mut String::new()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user