Senior Developer Advocate
Microsoft
More at wassim.dev
Angular GDE (core team alumni.)
Bazel Web Team contributor
GDE for the Google Assistant
Angular Universal (original core team alumni.)
GDE for GCP (alumni.)
Auth0 Ambassador
Member of the Node.js org. (OpenJS Foundation)
NestJS contributor
Compodoc core team
Just what you need to know to get started
@rules_nodejs// on master and ⬢ v14.1.0
➜ find ./ -iname "WORKSPACE"
.//WORKSPACE
.//examples/angular/WORKSPACE
.//examples/kotlin/WORKSPACE
.//examples/angular_view_engine/WORKSPACE
.//examples/nestjs/WORKSPACE
.//packages/labs/src/WORKSPACE
.//packages/typescript/src/WORKSPACE
.//packages/karma/src/WORKSPACE
.//packages/rollup/src/WORKSPACE
.//packages/terser/src/WORKSPACE
.//packages/jasmine/src/WORKSPACE
.//packages/protractor/src/WORKSPACE
.//e2e/jasmine/WORKSPACE
...
A package defines a set of instructions about how to build, test and run the current package.
The primary unit of code organization in a workspace. A folder containing a file named
BUILD.bazel
@rules_nodejs// on master and ⬢ v13.7.0
➜ find ./ -iname "BUILD.bazel"
./internal/BUILD.bazel
./internal/linker/test/BUILD.bazel
./internal/linker/BUILD.bazel
./internal/pkg_npm/test/BUILD.bazel
./internal/pkg_npm/BUILD.bazel
./internal/golden_file_test/BUILD.bazel
./internal/providers/BUILD.bazel
./internal/js_library/BUILD.bazel
./internal/common/test/BUILD.bazel
./internal/common/BUILD.bazel
./internal/bazel_integration_test/BUILD.bazel
./internal/node/test/lib1/BUILD.bazel
./internal/node/test/BUILD.bazel
...
package(default_visibility = ["//visibility:public"])
load("@io_bazel_rules_rust//rust:rust.bzl", "rust_binary")
load("@io_bazel_rules_rust//wasm_bindgen:wasm_bindgen.bzl", "rust_wasm_bindgen")
rust_binary(
name = "hello_world_rust",
srcs = ["main.rs"],
edition = "2018",
deps = [
"@io_bazel_rules_rust//wasm_bindgen/raze:wasm_bindgen"
]
)
rust_wasm_bindgen(
name = "hello_world_bindgen",
wasm_file = ":hello_world_rust",
bindgen_flags = ["--nodejs"]
)
# //src/lib/shorten/BUILD.bazel
ts_library(
name = "shorten",
srcs = ["shorten.ts"],
module_name = "@bazel/shorten",
module_root = "shorten",
deps = [
"//some/dep",
"@npm//other/dep",
],
)
# Output:
# - shorten.d.ts
# - shorten.js
ts_library()
rollup_bundle()
@angular/core/**/*.ts
./core.js
./core.d.ts
./bundles/core.umd.js
tsc -p tsconfig.json ...
ts_library()
* Needs to be configured separately! (read more)
# 1. create a VM on Azure, enable SSH and open port 4200
az group create --name bazel-remote-cache --location francecentral
az vm create --resource-group bazel-remote-cache --name bazelRemoteCache --image UbuntuLTS \
--admin-username bazel --generate-ssh-keys
az vm open-port --port 4200 --resource-group bazel-remote-cache --name bazelRemoteCache
# 2. Access VM through SSH
ssh bazel@bazel-remote-cache-ip
# 3. Download a copy of bazel-remote
curl -L https://github.com/buchgr/bazel-remote/releases/download/v1.3.3/bazel-remote-1.3.3-linux-x86_64 > bazel-remote
chmod +x bazel-remote
# 4. Start bazel-remote server on port 4200
mkdir ./bazel-remote-cache
./bazel-remote --dir=./bazel-remote-cache --port=4200
bazel build //... --remote_cache=http://bazel-remote-cache-pi:4200
Next runs...
First run...
Read the QuickStart
npm init @bazel my_workspace
All cartoons used in this deck are under the Adobe Stock Standard License terms. Read more: https://stock.adobe.com/license-terms
dev.to/wassimchegham
dev.to/angular
dev.to/bazel