Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

synchronize deno and deno_std versions #3415

Merged
merged 2 commits into from
Nov 30, 2019
Merged

synchronize deno and deno_std versions #3415

merged 2 commits into from
Nov 30, 2019

Conversation

axetroy
Copy link
Contributor

@axetroy axetroy commented Nov 27, 2019

close: #3410
close: #3320 (Should it be close?)
close: #3395

Keep deno and std versions consistent

concat!("https://deno.land/[email protected]/", $x)
concat!(
"https://deno.land/std@v",
env!("CARGO_PKG_VERSION"),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

macro_rules! std_url {
  ($x:expr) => {
    concat!(
      "https://deno.land/std@v",
-      crate::version::DENO
+      env!("CARGO_PKG_VERSION"),
      "/",
      $x
    )
  };
}

Theoretically, the value of crate::version::DENO should be read here.

But I'm not familiar with macro_rules.

concat! only accepts literals 😥

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@axetroy Try using lazy_static! instead - here's an example

deno/cli/colors.rs

Lines 12 to 21 in a537c03

lazy_static! {
// STRIP_ANSI_RE and strip_ansi_codes are lifted from the "console" crate.
// Copyright 2017 Armin Ronacher <[email protected]>. MIT License.
static ref STRIP_ANSI_RE: Regex = Regex::new(
r"[\x1b\x9b][\[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-PRZcf-nqry=><]"
).unwrap();
static ref NO_COLOR: bool = {
env::var_os("NO_COLOR").is_some()
};
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be the simplest way of writing, there is no need to write with lazy_static.

CARGO_PKG_VERSION is the environment variable for cargo and is unlikely to change

Copy link
Member

@ry ry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ry ry merged commit 81efa9d into denoland:master Nov 30, 2019
@ry ry mentioned this pull request Dec 5, 2019
ry added a commit to ry/deno that referenced this pull request Dec 5, 2019
bartlomieju pushed a commit to bartlomieju/deno that referenced this pull request Dec 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants