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

feat: lockfiles #3231

Merged
merged 14 commits into from
Nov 3, 2019
Merged
Prev Previous commit
Next Next commit
cleanup
  • Loading branch information
ry committed Oct 29, 2019
commit 72ac9386032f40ff74979bcbfb81a356a6c5c003
8 changes: 0 additions & 8 deletions cli/lockfile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,6 @@ pub struct Lockfile {
}

impl Lockfile {
pub fn from_flag(flag: &Option<String>) -> Option<Lockfile> {
if let Some(filename) = flag {
Some(Self::new(filename.to_string()))
} else {
None
}
}

pub fn new(filename: String) -> Lockfile {
Lockfile {
map: HashMap::new(),
Expand Down
6 changes: 5 additions & 1 deletion cli/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,11 @@ impl ThreadSafeState {
let modules = Arc::new(Mutex::new(deno::Modules::new()));

// Note: reads lazily from disk on first call to lockfile.check()
let lockfile = Lockfile::from_flag(&flags.lock).map(Mutex::new);
let lockfile = if let Some(filename) = &flags.lock {
Some(Mutex::new(Lockfile::new(filename.to_string())))
} else {
None
};

let state = State {
main_module,
Expand Down