-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(cli): support js deps via package.json types (#7589)
The package.json `types|typings` field should be considered a dependency just like the `main` field. --- ### Changes are visible to end-users: yes - Searched for relevant documentation and updated as needed: yes - Breaking change (forces users to change their own code or config): no - Suggested release notes appear below: yes Support `aspect configure` detecting dependencies from `package.json` `types|typings` fields. ### Test plan - Covered by existing test cases - New test cases added GitOrigin-RevId: f0198476cbbe8f755510e4b0992b020fdcf3059c
- Loading branch information
Showing
35 changed files
with
252 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
genrule( | ||
name = "foo", | ||
srcs = [], | ||
outs = ["types.d.ts"], | ||
cmd = "echo \"export const foo: number\" > \"$@\"", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
load("@aspect_rules_js//npm:defs.bzl", "npm_package") | ||
load("@npm//:defs.bzl", "npm_link_all_packages") | ||
|
||
genrule( | ||
name = "foo", | ||
srcs = [], | ||
outs = ["types.d.ts"], | ||
cmd = "echo \"export const foo: number\" > \"$@\"", | ||
) | ||
|
||
npm_link_all_packages(name = "node_modules") | ||
|
||
npm_package( | ||
name = "pkg", | ||
srcs = [ | ||
"package.json", | ||
":types.d.ts", | ||
], | ||
visibility = ["//visibility:public"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"name": "types-js-gen", | ||
"private": true, | ||
"types": "types.d.ts" | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
load("@aspect_rules_js//js:defs.bzl", "js_library") | ||
load("@aspect_rules_js//npm:defs.bzl", "npm_package") | ||
load("@npm//:defs.bzl", "npm_link_all_packages") | ||
|
||
npm_link_all_packages(name = "node_modules") | ||
|
||
js_library( | ||
name = "tsc", | ||
srcs = [ | ||
"start.js", | ||
"types.d.ts", | ||
], | ||
) | ||
|
||
npm_package( | ||
name = "pkg", | ||
srcs = [ | ||
"package.json", | ||
":tsc", | ||
], | ||
visibility = ["//visibility:public"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"name": "types-js", | ||
"private": true, | ||
"main": "start.js", | ||
"types": "types.d.ts" | ||
} |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
genrule( | ||
name = "foo", | ||
srcs = [], | ||
outs = ["types.d.ts"], | ||
cmd = "echo \"export const foo: number\" > \"$@\"", | ||
) |
20 changes: 20 additions & 0 deletions
20
gazelle/js/tests/npm_package_deps/typings-js-gen/BUILD.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
load("@aspect_rules_js//npm:defs.bzl", "npm_package") | ||
load("@npm//:defs.bzl", "npm_link_all_packages") | ||
|
||
genrule( | ||
name = "foo", | ||
srcs = [], | ||
outs = ["types.d.ts"], | ||
cmd = "echo \"export const foo: number\" > \"$@\"", | ||
) | ||
|
||
npm_link_all_packages(name = "node_modules") | ||
|
||
npm_package( | ||
name = "pkg", | ||
srcs = [ | ||
"package.json", | ||
":types.d.ts", | ||
], | ||
visibility = ["//visibility:public"], | ||
) |
5 changes: 5 additions & 0 deletions
5
gazelle/js/tests/npm_package_deps/typings-js-gen/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"name": "typings-js-gen", | ||
"private": true, | ||
"typings": "types.d.ts" | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
load("@aspect_rules_js//js:defs.bzl", "js_library") | ||
load("@aspect_rules_js//npm:defs.bzl", "npm_package") | ||
load("@npm//:defs.bzl", "npm_link_all_packages") | ||
|
||
npm_link_all_packages(name = "node_modules") | ||
|
||
js_library( | ||
name = "tsc", | ||
srcs = [ | ||
"start.js", | ||
"types.d.ts", | ||
], | ||
) | ||
|
||
npm_package( | ||
name = "pkg", | ||
srcs = [ | ||
"package.json", | ||
":tsc", | ||
], | ||
visibility = ["//visibility:public"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"name": "typings-js", | ||
"private": true, | ||
"main": "start.js", | ||
"typings": "types.d.ts" | ||
} |
Empty file.
Empty file.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
genrule( | ||
name = "foo", | ||
srcs = [], | ||
outs = ["types.d.ts"], | ||
cmd = "echo \"export const foo: number\" > \"$@\"", | ||
) |
18 changes: 18 additions & 0 deletions
18
gazelle/js/tests/npm_package_deps_lib/types-js-gen/BUILD.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
load("@aspect_rules_js//js:defs.bzl", "js_library") | ||
load("@npm//:defs.bzl", "npm_link_all_packages") | ||
|
||
genrule( | ||
name = "foo", | ||
srcs = [], | ||
outs = ["types.d.ts"], | ||
cmd = "echo \"export const foo: number\" > \"$@\"", | ||
) | ||
|
||
npm_link_all_packages(name = "node_modules") | ||
|
||
js_library( | ||
name = "pkg", | ||
srcs = ["package.json"], | ||
visibility = ["//visibility:public"], | ||
deps = [":types.d.ts"], | ||
) |
5 changes: 5 additions & 0 deletions
5
gazelle/js/tests/npm_package_deps_lib/types-js-gen/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"name": "types-js-gen", | ||
"private": true, | ||
"types": "types.d.ts" | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
load("@aspect_rules_js//js:defs.bzl", "js_library") | ||
load("@npm//:defs.bzl", "npm_link_all_packages") | ||
|
||
npm_link_all_packages(name = "node_modules") | ||
|
||
js_library( | ||
name = "tsc", | ||
srcs = [ | ||
"start.js", | ||
"types.d.ts", | ||
], | ||
) | ||
|
||
js_library( | ||
name = "pkg", | ||
srcs = ["package.json"], | ||
visibility = ["//visibility:public"], | ||
deps = [":tsc"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"name": "types-js", | ||
"private": true, | ||
"main": "start.js", | ||
"types": "types.d.ts" | ||
} |
Empty file.
Empty file.
6 changes: 6 additions & 0 deletions
6
gazelle/js/tests/npm_package_deps_lib/typings-js-gen/BUILD.in
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
genrule( | ||
name = "foo", | ||
srcs = [], | ||
outs = ["types.d.ts"], | ||
cmd = "echo \"export const foo: number\" > \"$@\"", | ||
) |
18 changes: 18 additions & 0 deletions
18
gazelle/js/tests/npm_package_deps_lib/typings-js-gen/BUILD.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
load("@aspect_rules_js//js:defs.bzl", "js_library") | ||
load("@npm//:defs.bzl", "npm_link_all_packages") | ||
|
||
genrule( | ||
name = "foo", | ||
srcs = [], | ||
outs = ["types.d.ts"], | ||
cmd = "echo \"export const foo: number\" > \"$@\"", | ||
) | ||
|
||
npm_link_all_packages(name = "node_modules") | ||
|
||
js_library( | ||
name = "pkg", | ||
srcs = ["package.json"], | ||
visibility = ["//visibility:public"], | ||
deps = [":types.d.ts"], | ||
) |
5 changes: 5 additions & 0 deletions
5
gazelle/js/tests/npm_package_deps_lib/typings-js-gen/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"name": "typings-js-gen", | ||
"private": true, | ||
"typings": "types.d.ts" | ||
} |
Empty file.
19 changes: 19 additions & 0 deletions
19
gazelle/js/tests/npm_package_deps_lib/typings-js/BUILD.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
load("@aspect_rules_js//js:defs.bzl", "js_library") | ||
load("@npm//:defs.bzl", "npm_link_all_packages") | ||
|
||
npm_link_all_packages(name = "node_modules") | ||
|
||
js_library( | ||
name = "tsc", | ||
srcs = [ | ||
"start.js", | ||
"types.d.ts", | ||
], | ||
) | ||
|
||
js_library( | ||
name = "pkg", | ||
srcs = ["package.json"], | ||
visibility = ["//visibility:public"], | ||
deps = [":tsc"], | ||
) |
6 changes: 6 additions & 0 deletions
6
gazelle/js/tests/npm_package_deps_lib/typings-js/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"name": "typings-js", | ||
"private": true, | ||
"main": "start.js", | ||
"typings": "types.d.ts" | ||
} |
Empty file.
Empty file.