mirror of
https://github.com/ProvableHQ/leo.git
synced 2024-12-24 10:41:57 +03:00
validate that a package being published doesn't conflict with keywords
This commit is contained in:
parent
bcb50ae27f
commit
a0d9047faf
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -1222,6 +1222,7 @@ dependencies = [
|
|||||||
"leo-imports",
|
"leo-imports",
|
||||||
"leo-input",
|
"leo-input",
|
||||||
"leo-package",
|
"leo-package",
|
||||||
|
"leo-parser",
|
||||||
"leo-state",
|
"leo-state",
|
||||||
"leo-synthesizer",
|
"leo-synthesizer",
|
||||||
"notify",
|
"notify",
|
||||||
|
@ -61,6 +61,10 @@ version = "1.5.2"
|
|||||||
path = "./package"
|
path = "./package"
|
||||||
version = "1.5.2"
|
version = "1.5.2"
|
||||||
|
|
||||||
|
[dependencies.leo-parser]
|
||||||
|
path = "./parser"
|
||||||
|
version = "1.5.2"
|
||||||
|
|
||||||
[dependencies.leo-state]
|
[dependencies.leo-state]
|
||||||
path = "./state"
|
path = "./state"
|
||||||
version = "1.5.2"
|
version = "1.5.2"
|
||||||
|
@ -20,6 +20,7 @@ use leo_package::{
|
|||||||
outputs::OutputsDirectory,
|
outputs::OutputsDirectory,
|
||||||
root::{ZipFile, AUTHOR_PLACEHOLDER},
|
root::{ZipFile, AUTHOR_PLACEHOLDER},
|
||||||
};
|
};
|
||||||
|
use leo_parser::KEYWORD_TOKENS;
|
||||||
|
|
||||||
use anyhow::{anyhow, Result};
|
use anyhow::{anyhow, Result};
|
||||||
use structopt::StructOpt;
|
use structopt::StructOpt;
|
||||||
@ -47,6 +48,10 @@ impl Command for Publish {
|
|||||||
let manifest = context.manifest()?;
|
let manifest = context.manifest()?;
|
||||||
|
|
||||||
let package_name = manifest.get_package_name();
|
let package_name = manifest.get_package_name();
|
||||||
|
if KEYWORD_TOKENS.iter().any(|keyword| keyword.to_string() == package_name) {
|
||||||
|
return Err(anyhow!("Cannot name a package after a keyword"));
|
||||||
|
}
|
||||||
|
|
||||||
let package_version = manifest.get_package_version();
|
let package_version = manifest.get_package_version();
|
||||||
|
|
||||||
match (
|
match (
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
extern crate thiserror;
|
extern crate thiserror;
|
||||||
|
|
||||||
pub(crate) mod tokenizer;
|
pub(crate) mod tokenizer;
|
||||||
|
pub use tokenizer::KEYWORD_TOKENS;
|
||||||
pub(crate) use tokenizer::*;
|
pub(crate) use tokenizer::*;
|
||||||
|
|
||||||
pub mod errors;
|
pub mod errors;
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
pub(crate) mod token;
|
pub(crate) mod token;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
|
pub use self::token::KEYWORD_TOKENS;
|
||||||
pub(crate) use self::token::*;
|
pub(crate) use self::token::*;
|
||||||
|
|
||||||
pub(crate) mod lexer;
|
pub(crate) mod lexer;
|
||||||
|
Loading…
Reference in New Issue
Block a user