Skip to content

Commit f794ee9

Browse files
authored
refactor: move npm-workspaces example to root module (#467)
* refactor: move npm_workspaces example to root module * chore: update gazelle config
1 parent 9d2db38 commit f794ee9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+293
-1071
lines changed

.aspect/cli/config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ configure:
55
protobuf: true
66
python: true
77
plugins:
8+
- .aspect/cli/main.star
89
- .aspect/cli/rules_cc.star
910
plugins:
1011
- name: fix-visibility

pnpm-workspaces/.aspect/cli/main.star renamed to .aspect/cli/main.star

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ aspect.register_rule_kind("js_binary", {
66
})
77

88
def declare_main_js(ctx):
9-
if len(ctx.sources) == 0:
10-
ctx.targets.remove("main")
9+
if len(ctx.sources) == 0 or not ctx.rel.startswith("nodejs_apps"):
1110
return
1211

1312
entry_point = ctx.sources[0].path.replace(".ts", ".js")

.bazelignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ jest/
1616
nestjs/
1717
node_snapshot_flags/
1818
oci_java_image/
19-
pnpm-workspaces/
2019
prisma/
2120
rules_nodejs_to_rules_js_migration/
2221
ts_project_transpiler/

.github/workflows/ci.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ jobs:
6060
go_workspaces/**
6161
jest/**
6262
nestjs/**
63-
pnpm-workspaces/**
6463
prisma/**
6564
bufbuild/**
6665
rules_nodejs_to_rules_js_migration/**

angular/projects/my-app/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ load("@aspect_bazel_lib//lib:copy_to_bin.bzl", "copy_to_bin")
22
load("@rules_angular//src/architect:ng_application.bzl", "ng_application")
33
load("@rules_angular//src/architect:ng_test.bzl", "ng_test")
44

5+
# aspect:generation_mode update_only
56
package(default_visibility = ["//visibility:public"])
67

78
copy_to_bin(

nodejs_apps/javascript/BUILD.bazel

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
load("@aspect_rules_js//js:defs.bzl", "js_binary", "js_library")
2+
load("@npm//:defs.bzl", "npm_link_all_packages")
3+
4+
# aspect:generation_mode update_only
5+
npm_link_all_packages(name = "node_modules")
6+
7+
js_library(
8+
name = "tsc",
9+
srcs = ["src/main.js"],
10+
deps = [
11+
":node_modules/@bazel-examples/shared",
12+
":node_modules/@bazel-examples/two",
13+
":node_modules/inspirational-quotes",
14+
":node_modules/trek-quotes",
15+
],
16+
)
17+
18+
js_binary(
19+
name = "main",
20+
data = [":tsc"],
21+
entry_point = "src/main.js",
22+
)
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"dependencies": {
3+
"@bazel-examples/shared": "workspace:*",
4+
"@bazel-examples/two": "workspace:*",
5+
"inspirational-quotes": "2.0.1",
6+
"trek-quotes": "1.1.1"
7+
}
8+
}

pnpm-workspaces/apps/beta/src/main.js renamed to nodejs_apps/javascript/src/main.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
const Shared = require('@bazel-poc/shared');
2-
const Two = require('@bazel-poc/two');
1+
const Shared = require('@bazel-examples/shared');
2+
const Two = require('@bazel-examples/two');
33
const IQuote = require('inspirational-quotes');
44
const TQuote = require('trek-quotes');
55

pnpm-workspaces/apps/alpha/BUILD.bazel renamed to nodejs_apps/typescript/BUILD.bazel

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
11
load("@aspect_rules_js//js:defs.bzl", "js_binary", "js_library")
2+
load("@aspect_rules_ts//ts:defs.bzl", "ts_project")
23
load("@npm//:defs.bzl", "npm_link_all_packages")
3-
load("//:defs.bzl", "ts_project")
44

5+
# aspect:generation_mode update_only
56
npm_link_all_packages(name = "node_modules")
67

78
ts_project(
89
name = "tsc",
910
srcs = ["src/main.ts"],
1011
declaration = True,
11-
tsconfig = "//:tsconfig",
12+
tsconfig = {},
1213
deps = [
14+
":node_modules/@bazel-examples/one",
15+
":node_modules/@bazel-examples/shared",
16+
":node_modules/@types/node",
1317
":node_modules/inspirational-quotes",
14-
"//:node_modules/@bazel-poc/one",
15-
"//:node_modules/@bazel-poc/shared",
16-
"//:node_modules/@types/node",
17-
"//:node_modules/star-wars-quotes",
18+
":node_modules/star-wars-quotes",
1819
],
1920
)
2021

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"dependencies": {
3+
"inspirational-quotes": "2.0.1",
4+
"@bazel-examples/one": "workspace:*",
5+
"@bazel-examples/shared": "workspace:*",
6+
"@types/node": "18.11.9",
7+
"star-wars-quotes": "1.0.2"
8+
}
9+
}

0 commit comments

Comments
 (0)