mirror of
https://github.com/AleoHQ/leo.git
synced 2024-11-10 18:22:19 +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-input",
|
||||
"leo-package",
|
||||
"leo-parser",
|
||||
"leo-state",
|
||||
"leo-synthesizer",
|
||||
"notify",
|
||||
|
@ -61,6 +61,10 @@ version = "1.5.2"
|
||||
path = "./package"
|
||||
version = "1.5.2"
|
||||
|
||||
[dependencies.leo-parser]
|
||||
path = "./parser"
|
||||
version = "1.5.2"
|
||||
|
||||
[dependencies.leo-state]
|
||||
path = "./state"
|
||||
version = "1.5.2"
|
||||
|
@ -20,6 +20,7 @@ use leo_package::{
|
||||
outputs::OutputsDirectory,
|
||||
root::{ZipFile, AUTHOR_PLACEHOLDER},
|
||||
};
|
||||
use leo_parser::KEYWORD_TOKENS;
|
||||
|
||||
use anyhow::{anyhow, Result};
|
||||
use structopt::StructOpt;
|
||||
@ -47,6 +48,10 @@ impl Command for Publish {
|
||||
let manifest = context.manifest()?;
|
||||
|
||||
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();
|
||||
|
||||
match (
|
||||
|
@ -25,6 +25,7 @@
|
||||
extern crate thiserror;
|
||||
|
||||
pub(crate) mod tokenizer;
|
||||
pub use tokenizer::KEYWORD_TOKENS;
|
||||
pub(crate) use tokenizer::*;
|
||||
|
||||
pub mod errors;
|
||||
|
@ -22,6 +22,7 @@
|
||||
pub(crate) mod token;
|
||||
use std::sync::Arc;
|
||||
|
||||
pub use self::token::KEYWORD_TOKENS;
|
||||
pub(crate) use self::token::*;
|
||||
|
||||
pub(crate) mod lexer;
|
||||
|
Loading…
Reference in New Issue
Block a user