File tree Expand file tree Collapse file tree 1 file changed +16
-7
lines changed Expand file tree Collapse file tree 1 file changed +16
-7
lines changed Original file line number Diff line number Diff line change 6
6
load ("//:constants.bzl" , "SNAPSHOT_REPOS" )
7
7
8
8
def _generate_snapshot_repo_filter ():
9
- filter = ""
10
- for (i , pkg_name ) in enumerate (SNAPSHOT_REPOS .keys ()):
11
- filter += "{sep}(..|objects|select(has(\" {pkg_name}\" )))[\" {pkg_name}\" ] |= \" github:{snapshot_repo}#BUILD_SCM_HASH-PLACEHOLDER\" \n " .format (
12
- sep = "| " if i > 0 else "" ,
13
- pkg_name = pkg_name ,
14
- snapshot_repo = SNAPSHOT_REPOS [pkg_name ],
9
+ individual_pkg_filters = []
10
+ for pkg_name , snapshot_repo in SNAPSHOT_REPOS .items ():
11
+ individual_pkg_filters .append (
12
+ """
13
+ . as $root
14
+ | [paths(..)]
15
+ | [(.[] | select(
16
+ contains(["{pkg_name}"]) and
17
+ contains(["peerDependenciesMeta"]) != true))] as $paths
18
+ | $paths | reduce $paths[] as $path ($root; setpath($path; "github:{snapshot_repo}#BUILD_SCM_HASH-PLACEHOLDER")) | .
19
+ """ .format (
20
+ pkg_name = pkg_name ,
21
+ snapshot_repo = snapshot_repo ,
22
+ ),
15
23
)
16
- return filter
24
+
25
+ return " | " .join (individual_pkg_filters )
17
26
18
27
# jq filter that replaces package.json dependencies with snapshot repos
19
28
SNAPSHOT_REPO_JQ_FILTER = _generate_snapshot_repo_filter ()
You can’t perform that action at this time.
0 commit comments