File tree Expand file tree Collapse file tree 3 files changed +42
-1
lines changed Expand file tree Collapse file tree 3 files changed +42
-1
lines changed Original file line number Diff line number Diff line change 11configure :
22 languages :
33 javascript : true
4+ plugins :
5+ - .aspect/cli/main.star
Original file line number Diff line number Diff line change 1+ # TODO: delete when all rules_js rules added to aspect-cli
2+ aspect .register_rule_kind ("js_binary" , {
3+ "From" : "@aspect_rules_js//js:defs.bzl" ,
4+ "MergeableAttrs" : ["data" ],
5+ "ResolveAttrs" : ["entry_point" , "data" ],
6+ })
7+
8+ def declare_main_js (ctx ):
9+ if len (ctx .sources ) == 0 :
10+ ctx .targets .remove ("main" )
11+ return
12+
13+ entry_point = ctx .sources [0 ].path .replace (".ts" , ".js" )
14+
15+ ctx .targets .add (
16+ name = "main" ,
17+ kind = "js_binary" ,
18+ attrs = {
19+ # The entry point file
20+ "entry_point" : entry_point ,
21+ "data" : [
22+ aspect .Label (
23+ pkg = ctx .rel ,
24+ name = "tsc" ,
25+ ),
26+ ],
27+ },
28+ )
29+
30+ aspect .register_configure_extension (
31+ id = "main_js" ,
32+ prepare = lambda _ : aspect .PrepareResult (
33+ sources = [
34+ aspect .SourceGlobs ("**/main.ts" ),
35+ aspect .SourceGlobs ("**/main.js" ),
36+ ],
37+ ),
38+ declare = declare_main_js ,
39+ )
Original file line number Diff line number Diff line change @@ -26,6 +26,6 @@ js_library(
2626
2727js_binary (
2828 name = "main" ,
29- data = [":pkg " ],
29+ data = [":tsc " ],
3030 entry_point = "src/main.js" ,
3131)
You can’t perform that action at this time.
0 commit comments