Merge pull request #1185 from printfn/workspace-inheritance

Add support for workspace inheritance
master
Jesper Håkansson 2 years ago committed by GitHub
commit e1010233b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 207
      Cargo.lock
  2. 20
      Cargo.toml
  3. 93
      src/manifest/mod.rs
  4. 14
      tests/all/log_level.rs
  5. 9
      tests/all/manifest.rs

207
Cargo.lock generated

@ -53,7 +53,7 @@ version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2"
dependencies = [
"winapi 0.3.9",
"winapi",
]
[[package]]
@ -84,7 +84,7 @@ checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
dependencies = [
"hermit-abi 0.1.19",
"libc",
"winapi 0.3.9",
"winapi",
]
[[package]]
@ -110,9 +110,9 @@ dependencies = [
[[package]]
name = "base64"
version = "0.13.1"
version = "0.21.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8"
checksum = "a4a4ddaa51a5bc52a6948f74c06d20aaaddb71924eab79b8c97a8c556e942d6a"
[[package]]
name = "base64ct"
@ -167,9 +167,9 @@ dependencies = [
[[package]]
name = "bumpalo"
version = "3.11.1"
version = "3.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "572f695136211188308f16ad2ca5c851a712c464060ae6974944458eb83880ba"
checksum = "0d261e256854913907f67ed06efbc3338dfe6179796deefc1ff763fc1aee5535"
[[package]]
name = "byteorder"
@ -263,7 +263,7 @@ dependencies = [
"num-traits",
"time 0.1.45",
"wasm-bindgen",
"winapi 0.3.9",
"winapi",
]
[[package]]
@ -290,18 +290,6 @@ dependencies = [
"vec_map",
]
[[package]]
name = "clicolors-control"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1f84dec9bc083ce2503908cd305af98bd363da6f54bf8d4bf0ac14ee749ad5d1"
dependencies = [
"kernel32-sys",
"lazy_static 0.2.11",
"libc",
"winapi 0.3.9",
]
[[package]]
name = "codespan-reporting"
version = "0.11.1"
@ -314,29 +302,12 @@ dependencies = [
[[package]]
name = "console"
version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ecd48adf136733979b49e15bc3b4c43cc0d3c85ece7bd08e6daa414c6fcb13e6"
dependencies = [
"atty",
"clicolors-control",
"lazy_static 1.4.0",
"libc",
"parking_lot",
"regex",
"termios",
"unicode-width",
"winapi 0.3.9",
]
[[package]]
name = "console"
version = "0.15.4"
version = "0.15.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c9b6515d269224923b26b5febea2ed42b2d5f2ce37284a4dd670fedd6cb8347a"
checksum = "c3d79fbe8970a77e3e34151cc13d3b3e248aa0faaecb9f6091fa07ebefe5ad60"
dependencies = [
"encode_unicode",
"lazy_static 1.4.0",
"lazy_static",
"libc",
"unicode-width",
"windows-sys",
@ -413,7 +384,7 @@ dependencies = [
"openssl-sys",
"schannel",
"socket2",
"winapi 0.3.9",
"winapi",
]
[[package]]
@ -428,14 +399,14 @@ dependencies = [
"openssl-sys",
"pkg-config",
"vcpkg",
"winapi 0.3.9",
"winapi",
]
[[package]]
name = "cxx"
version = "1.0.86"
version = "1.0.88"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "51d1075c37807dcf850c379432f0df05ba52cc30f279c5cfc43cc221ce7f8579"
checksum = "322296e2f2e5af4270b54df9e85a02ff037e271af20ba3e7fe1575515dc840b8"
dependencies = [
"cc",
"cxxbridge-flags",
@ -445,9 +416,9 @@ dependencies = [
[[package]]
name = "cxx-build"
version = "1.0.86"
version = "1.0.88"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5044281f61b27bc598f2f6647d480aed48d2bf52d6eb0b627d84c0361b17aa70"
checksum = "017a1385b05d631e7875b1f151c9f012d37b53491e2a87f65bff5c262b2111d8"
dependencies = [
"cc",
"codespan-reporting",
@ -460,15 +431,15 @@ dependencies = [
[[package]]
name = "cxxbridge-flags"
version = "1.0.86"
version = "1.0.88"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "61b50bc93ba22c27b0d31128d2d130a0a6b3d267ae27ef7e4fae2167dfe8781c"
checksum = "c26bbb078acf09bc1ecda02d4223f03bdd28bd4874edcb0379138efc499ce971"
[[package]]
name = "cxxbridge-macro"
version = "1.0.86"
version = "1.0.88"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "39e61fda7e62115119469c7b3591fd913ecca96fb766cfd3f2e2502ab7bc87a5"
checksum = "357f40d1f06a24b60ae1fe122542c1fb05d28d32acb2aed064e84bc2ad1e252e"
dependencies = [
"proc-macro2",
"quote",
@ -490,11 +461,12 @@ dependencies = [
[[package]]
name = "dialoguer"
version = "0.10.2"
version = "0.10.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a92e7e37ecef6857fdc0c0c5d42fd5b0938e46590c2183cc92dd310a6d078eb1"
checksum = "af3c796f3b0b408d9fd581611b47fa850821fcb84aa640b83a3c1a5be2d691f2"
dependencies = [
"console 0.15.4",
"console",
"shell-words",
"tempfile",
"zeroize",
]
@ -534,7 +506,7 @@ checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d"
dependencies = [
"libc",
"redox_users",
"winapi 0.3.9",
"winapi",
]
[[package]]
@ -545,9 +517,9 @@ checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10"
[[package]]
name = "either"
version = "1.8.0"
version = "1.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797"
checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91"
[[package]]
name = "encode_unicode"
@ -650,7 +622,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9564fc758e15025b46aa6643b1b77d047d1a56a1aea6e01002ac0c7026876213"
dependencies = [
"libc",
"winapi 0.3.9",
"winapi",
]
[[package]]
@ -753,9 +725,9 @@ dependencies = [
[[package]]
name = "gimli"
version = "0.27.0"
version = "0.27.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dec7af912d60cdbd3677c1af9352ebae6fb8394d165568a2234df0fa00f87793"
checksum = "221996f774192f0f718773def8201c4ae31f02616a54ccfc2d358bb0e5cefdec"
[[package]]
name = "glob"
@ -927,7 +899,7 @@ dependencies = [
"iana-time-zone-haiku",
"js-sys",
"wasm-bindgen",
"winapi 0.3.9",
"winapi",
]
[[package]]
@ -981,7 +953,7 @@ version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "302d553b8abc8187beb7d663e34c065ac4570b273bc9511a50e940e99409c577"
dependencies = [
"winapi 0.3.9",
"winapi",
]
[[package]]
@ -1017,22 +989,6 @@ dependencies = [
"wasm-bindgen",
]
[[package]]
name = "kernel32-sys"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
dependencies = [
"winapi 0.2.8",
"winapi-build",
]
[[package]]
name = "lazy_static"
version = "0.2.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "76f033c7ad61445c5b347c7382dd1237847eb1bce590fe50365dcb33d546be73"
[[package]]
name = "lazy_static"
version = "1.4.0"
@ -1124,7 +1080,7 @@ version = "0.2.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e"
dependencies = [
"lazy_static 1.4.0",
"lazy_static",
"libc",
"log",
"openssl",
@ -1173,9 +1129,9 @@ dependencies = [
[[package]]
name = "object"
version = "0.30.2"
version = "0.30.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b8c786513eb403643f2a88c244c2aaa270ef2153f55094587d0c48a3cf22a83"
checksum = "ea86265d3d3dcb6a27fc51bd29a4bf387fae9d2986b823079d4986af253eb439"
dependencies = [
"memchr",
]
@ -1382,9 +1338,9 @@ dependencies = [
[[package]]
name = "proc-macro2"
version = "1.0.49"
version = "1.0.50"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57a8eca9f9c4ffde41714334dee777596264c7825420f521abc92b5b5deb63a5"
checksum = "6ef7d57beacfaf2d8aee5937dab7b7f28de3cb8b1828479bb5de2a7106f2bae2"
dependencies = [
"unicode-ident",
]
@ -1453,14 +1409,14 @@ version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7"
dependencies = [
"winapi 0.3.9",
"winapi",
]
[[package]]
name = "reqwest"
version = "0.11.13"
version = "0.11.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "68cc60575865c7831548863cc02356512e3f1dc2f3f82cb837d7fc4cc8f3c97c"
checksum = "21eed90ec8570952d53b772ecf8f206aa1ec9a3d76b2521c56c42973f2d91ee9"
dependencies = [
"base64",
"bytes",
@ -1537,9 +1493,9 @@ checksum = "ddccb15bcce173023b3fedd9436f882a0739b8dfb45e4f6b6002bee5929f61b2"
[[package]]
name = "security-framework"
version = "2.7.0"
version = "2.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2bc1bb97804af6631813c55739f771071e0f2ed33ee20b68c86ec505d906356c"
checksum = "7c4437699b6d34972de58652c68b98cb5b53a4199ab126db8e20ec8ded29a721"
dependencies = [
"bitflags",
"core-foundation",
@ -1550,9 +1506,9 @@ dependencies = [
[[package]]
name = "security-framework-sys"
version = "2.6.1"
version = "2.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0160a13a177a45bfb43ce71c01580998474f556ad854dcbca936dd2841a5c556"
checksum = "31c9bb296072e961fcbd8853511dd39c2d8be2deb1e17c6860b1d30732b323b4"
dependencies = [
"core-foundation-sys",
"libc",
@ -1621,13 +1577,13 @@ dependencies = [
[[package]]
name = "serial_test"
version = "0.10.0"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1c789ec87f4687d022a2405cf46e0cd6284889f1839de292cadeb6c6019506f2"
checksum = "538c30747ae860d6fb88330addbbd3e0ddbe46d662d032855596d8a8ca260611"
dependencies = [
"dashmap",
"futures",
"lazy_static 1.4.0",
"lazy_static",
"log",
"parking_lot",
"serial_test_derive",
@ -1635,9 +1591,9 @@ dependencies = [
[[package]]
name = "serial_test_derive"
version = "0.10.0"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b64f9e531ce97c88b4778aad0ceee079216071cffec6ac9b904277f8f92e7fe3"
checksum = "079a83df15f85d89a68d64ae1238f142f172b1fa915d0d76b26a7cba1b659a69"
dependencies = [
"proc-macro2",
"quote",
@ -1666,6 +1622,12 @@ dependencies = [
"digest",
]
[[package]]
name = "shell-words"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "24188a676b6ae68c3b2cb3a01be17fbf7240ce009799bb56d5b1409051e78fde"
[[package]]
name = "siphasher"
version = "0.3.10"
@ -1694,7 +1656,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "02e2d2db9033d13a1567121ddd7a095ee144db4e1ca1b1bda3419bc0da294ebd"
dependencies = [
"libc",
"winapi 0.3.9",
"winapi",
]
[[package]]
@ -1716,7 +1678,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c6b5c64445ba8094a6ab0c3cd2ad323e07171012d9c98b0b15651daf1787a10"
dependencies = [
"clap",
"lazy_static 1.4.0",
"lazy_static",
"structopt-derive",
]
@ -1772,27 +1734,18 @@ dependencies = [
"libc",
"redox_syscall",
"remove_dir_all",
"winapi 0.3.9",
"winapi",
]
[[package]]
name = "termcolor"
version = "1.1.3"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755"
checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6"
dependencies = [
"winapi-util",
]
[[package]]
name = "termios"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "411c5bf740737c7918b8b1fe232dca4dc9f8e754b8ad5e20966814001ed0ac6b"
dependencies = [
"libc",
]
[[package]]
name = "termtree"
version = "0.4.0"
@ -1836,7 +1789,7 @@ checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a"
dependencies = [
"libc",
"wasi 0.10.0+wasi-snapshot-preview1",
"winapi 0.3.9",
"winapi",
]
[[package]]
@ -1883,9 +1836,9 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c"
[[package]]
name = "tokio"
version = "1.24.1"
version = "1.24.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1d9f76183f91ecfb55e1d7d5602bd1d979e38a3a522fe900241cf195624d67ae"
checksum = "597a12a59981d9e3c38d216785b0c37399f6e415e8d0712047620f189371b0bb"
dependencies = [
"autocfg",
"bytes",
@ -1924,9 +1877,9 @@ dependencies = [
[[package]]
name = "toml"
version = "0.5.10"
version = "0.5.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1333c76748e868a4d9d1017b5ab53171dfd095f70c712fdb4653a406547f598f"
checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234"
dependencies = [
"serde",
]
@ -1971,9 +1924,9 @@ checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba"
[[package]]
name = "unicode-bidi"
version = "0.3.8"
version = "0.3.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992"
checksum = "d54675592c1dbefd78cbd98db9bacd89886e1ca50692a0692baefffdeb92dd58"
[[package]]
name = "unicode-ident"
@ -2056,7 +2009,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56"
dependencies = [
"same-file",
"winapi 0.3.9",
"winapi",
"winapi-util",
]
@ -2158,13 +2111,13 @@ dependencies = [
"binary-install",
"cargo_metadata",
"chrono",
"console 0.6.2",
"console",
"curl",
"dialoguer",
"env_logger",
"glob",
"human-panic",
"lazy_static 1.4.0",
"lazy_static",
"log",
"openssl",
"parking_lot",
@ -2197,21 +2150,15 @@ dependencies = [
[[package]]
name = "which"
version = "4.3.0"
version = "4.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1c831fbbee9e129a8cf93e7747a82da9d95ba8e16621cae60ec2cdc849bacb7b"
checksum = "2441c784c52b289a054b7201fc93253e288f094e2f4be9058343127c4226a269"
dependencies = [
"either",
"libc",
"once_cell",
]
[[package]]
name = "winapi"
version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"
[[package]]
name = "winapi"
version = "0.3.9"
@ -2222,12 +2169,6 @@ dependencies = [
"winapi-x86_64-pc-windows-gnu",
]
[[package]]
name = "winapi-build"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc"
[[package]]
name = "winapi-i686-pc-windows-gnu"
version = "0.4.0"
@ -2240,7 +2181,7 @@ version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"
dependencies = [
"winapi 0.3.9",
"winapi",
]
[[package]]
@ -2312,7 +2253,7 @@ version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d"
dependencies = [
"winapi 0.3.9",
"winapi",
]
[[package]]

@ -13,36 +13,36 @@ documentation = "https://rustwasm.github.io/wasm-pack/"
[dependencies]
anyhow = "1.0.68"
atty = "0.2.14"
binary-install = "0.1.0"
cargo_metadata = "0.15.2"
console = "0.6.2"
dialoguer = "0.10.2"
chrono = "0.4.23"
console = "0.15.5"
curl = "0.4.44"
dialoguer = "0.10.3"
env_logger = { version = "0.10.0", default-features = false }
human-panic = "1.0.3"
glob = "0.3.1"
human-panic = "1.0.3"
log = "0.4.17"
openssl = { version = '0.10.45', optional = true }
parking_lot = "0.12.1"
reqwest = { version = "0.11.13", features = ["blocking"] }
reqwest = { version = "0.11.14", features = ["blocking"] }
semver = "1.0.16"
serde = "1.0.152"
serde_derive = "1.0.152"
serde_ignored = "0.1.7"
serde_json = "1.0.91"
strsim = "0.10.0"
siphasher = "0.3.10"
strsim = "0.10.0"
structopt = "0.3.26"
toml = "0.5.10"
which = "4.3.0"
binary-install = "0.1.0"
toml = "0.5.11"
walkdir = "2.3.2"
chrono = "0.4.23"
which = "4.4.0"
[dev-dependencies]
assert_cmd = "2.0.8"
lazy_static = "1.4.0"
predicates = "2.1.5"
serial_test = "0.10.0"
serial_test = "1.0.0"
tempfile = "3.3.0"
[features]

@ -50,12 +50,6 @@ pub struct CargoManifest {
#[derive(Deserialize)]
struct CargoPackage {
name: String,
description: Option<String>,
license: Option<String>,
#[serde(rename = "license-file")]
license_file: Option<String>,
repository: Option<String>,
homepage: Option<String>,
#[serde(default)]
metadata: CargoMetadata,
@ -522,9 +516,13 @@ impl CrateData {
)
}
fn pkg(&self) -> &cargo_metadata::Package {
&self.data.packages[self.current_idx]
}
/// Get the crate name for the crate at the given path.
pub fn crate_name(&self) -> String {
let pkg = &self.data.packages[self.current_idx];
let pkg = self.pkg();
match pkg
.targets
.iter()
@ -545,12 +543,15 @@ impl CrateData {
/// Get the license for the crate at the given path.
pub fn crate_license(&self) -> &Option<String> {
&self.manifest.package.license
&self.pkg().license
}
/// Get the license file path for the crate at the given path.
pub fn crate_license_file(&self) -> &Option<String> {
&self.manifest.package.license_file
pub fn crate_license_file(&self) -> Option<String> {
self.pkg()
.license_file
.clone()
.map(|license_file| license_file.into_string())
}
/// Returns the path to this project's target directory where artifacts are
@ -654,14 +655,14 @@ impl CrateData {
dts_file,
files,
main: js_file,
homepage: self.manifest.package.homepage.clone(),
homepage: self.pkg().homepage.clone(),
keywords,
}
}
fn license(&self) -> Option<String> {
self.manifest.package.license.clone().or_else(|| {
self.manifest.package.license_file.clone().map(|file| {
self.crate_license().clone().or_else(|| {
self.crate_license_file().clone().map(|file| {
// When license is written in file: https://docs.npmjs.com/files/package.json#license
format!("SEE LICENSE IN {}", file)
})
@ -683,18 +684,13 @@ impl CrateData {
NpmPackage::CommonJSPackage(CommonJSPackage {
name: data.name,
collaborators: pkg.authors.clone(),
description: self.manifest.package.description.clone(),
description: self.pkg().description.clone(),
version: pkg.version.to_string(),
license: self.license(),
repository: self
.manifest
.package
.repository
.clone()
.map(|repo_url| Repository {
ty: "git".to_string(),
url: repo_url,
}),
repository: self.pkg().repository.clone().map(|repo_url| Repository {
ty: "git".to_string(),
url: repo_url,
}),
files: data.files,
main: data.main,
homepage: data.homepage,
@ -719,18 +715,13 @@ impl CrateData {
NpmPackage::ESModulesPackage(ESModulesPackage {
name: data.name,
collaborators: pkg.authors.clone(),
description: self.manifest.package.description.clone(),
description: self.pkg().description.clone(),
version: pkg.version.to_string(),
license: self.license(),
repository: self
.manifest
.package
.repository
.clone()
.map(|repo_url| Repository {
ty: "git".to_string(),
url: repo_url,
}),
repository: self.pkg().repository.clone().map(|repo_url| Repository {
ty: "git".to_string(),
url: repo_url,
}),
files: data.files,
module: data.main,
homepage: data.homepage,
@ -756,18 +747,13 @@ impl CrateData {
NpmPackage::ESModulesPackage(ESModulesPackage {
name: data.name,
collaborators: pkg.authors.clone(),
description: self.manifest.package.description.clone(),
description: self.pkg().description.clone(),
version: pkg.version.to_string(),
license: self.license(),
repository: self
.manifest
.package
.repository
.clone()
.map(|repo_url| Repository {
ty: "git".to_string(),
url: repo_url,
}),
repository: self.pkg().repository.clone().map(|repo_url| Repository {
ty: "git".to_string(),
url: repo_url,
}),
files: data.files,
module: data.main,
homepage: data.homepage,
@ -793,18 +779,13 @@ impl CrateData {
NpmPackage::NoModulesPackage(NoModulesPackage {
name: data.name,
collaborators: pkg.authors.clone(),
description: self.manifest.package.description.clone(),
description: self.pkg().description.clone(),
version: pkg.version.to_string(),
license: self.license(),
repository: self
.manifest
.package
.repository
.clone()
.map(|repo_url| Repository {
ty: "git".to_string(),
url: repo_url,
}),
repository: self.pkg().repository.clone().map(|repo_url| Repository {
ty: "git".to_string(),
url: repo_url,
}),
files: data.files,
browser: data.main,
homepage: data.homepage,
@ -816,13 +797,13 @@ impl CrateData {
fn check_optional_fields(&self) {
let mut messages = vec![];
if self.manifest.package.description.is_none() {
if self.pkg().description.is_none() {
messages.push("description");
}
if self.manifest.package.repository.is_none() {
if self.pkg().repository.is_none() {
messages.push("repository");
}
if self.manifest.package.license.is_none() && self.manifest.package.license_file.is_none() {
if self.pkg().license.is_none() && self.pkg().license_file.is_none() {
messages.push("license");
}

@ -4,18 +4,22 @@ use predicates::boolean::PredicateBooleanExt;
use predicates::prelude::predicate::str::contains;
use predicates::reflection::PredicateReflection;
use predicates::Predicate;
use wasm_pack::emoji;
fn matches_info() -> impl Predicate<str> + PredicateReflection {
contains("[INFO]: Checking for the Wasm target...")
.and(contains("[INFO]: Compiling to Wasm..."))
contains(format!("[INFO]: {}Checking for the Wasm target...", emoji::TARGET))
.and(contains(format!("[INFO]: {}Compiling to Wasm...", emoji::CYCLONE)))
.and(contains("[INFO]: License key is set in Cargo.toml but no LICENSE file(s) were found; Please add the LICENSE file(s) to your project directory"))
.and(contains("[INFO]: Optimizing wasm binaries with `wasm-opt`..."))
.and(contains("[INFO]: :-) Done in "))
.and(contains("[INFO]: :-) Your wasm pkg is ready to publish at "))
.and(contains(format!("[INFO]: {} Done in ", emoji::SPARKLE)))
.and(contains(format!("[INFO]: {} Your wasm pkg is ready to publish at ", emoji::PACKAGE)))
}
fn matches_warn() -> impl Predicate<str> + PredicateReflection {
contains("[WARN]: :-) origin crate has no README")
contains(format!(
"[WARN]: {} origin crate has no README",
emoji::WARN
))
}
fn matches_cargo() -> impl Predicate<str> + PredicateReflection {

@ -5,7 +5,7 @@ use std::fs;
use std::path::PathBuf;
use wasm_pack::command::build::Target;
use wasm_pack::command::utils::get_crate_path;
use wasm_pack::{self, license, manifest};
use wasm_pack::{self, emoji, license, manifest};
#[test]
fn it_gets_the_crate_name_default_path() {
@ -559,10 +559,11 @@ fn parse_crate_data_returns_unused_keys_in_cargo_toml() {
.arg("build")
.assert()
.success()
.stderr(predicates::str::contains(
"[WARN]: :-) \"package.metadata.wasm-pack.profile.production\" is an unknown key and will \
.stderr(predicates::str::contains(format!(
"[WARN]: {} \"package.metadata.wasm-pack.profile.production\" is an unknown key and will \
be ignored. Please check your Cargo.toml.",
));
emoji::WARN
)));
}
#[test]

Loading…
Cancel
Save