From 426861f2b28b65c3f611ba6c821ac6409e112e23 Mon Sep 17 00:00:00 2001 From: Bojan Jovanovic Date: Mon, 5 Aug 2019 17:10:06 -0400 Subject: [PATCH] feat(builtin): support yarn --frozen_lockfile --- internal/npm_install/npm_install.bzl | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/internal/npm_install/npm_install.bzl b/internal/npm_install/npm_install.bzl index 737cb6bf69..482d08dcc6 100644 --- a/internal/npm_install/npm_install.bzl +++ b/internal/npm_install/npm_install.bzl @@ -372,6 +372,9 @@ def _yarn_install_impl(repository_ctx): str(repository_ctx.attr.network_timeout * 1000), # in ms ] + if repository_ctx.attr.frozen_lockfile: + args.append("--frozen-lockfile") + if repository_ctx.attr.prod_only: args.append("--prod") if not repository_ctx.attr.use_global_yarn_cache: @@ -406,6 +409,13 @@ yarn_install = repository_rule( doc = """Maximum duration of the command "yarn install" in seconds (default is 3600 seconds).""", ), + "frozen_lockfile": attr.bool( + default = False, + doc = """Passes the --frozen-lockfile flag to prevent updating yarn.lock. + + Note that enabling this option will require that you run yarn outside of Bazel + when making changes to package.json.""", + ), "network_timeout": attr.int( default = 300, doc = """Maximum duration of a network request made by yarn in seconds