diff --git a/modules/playground/BUILD.bazel b/modules/playground/BUILD.bazel new file mode 100644 index 0000000000..45e5be832f --- /dev/null +++ b/modules/playground/BUILD.bazel @@ -0,0 +1,6 @@ +exports_files([ + "tsconfig-build.json", + "tsconfig-e2e.json", + "systemjs-config.js", + "systemjs-rxjs-operators.js", +]) diff --git a/modules/playground/README.md b/modules/playground/README.md index 213a5faafb..50172f008d 100644 --- a/modules/playground/README.md +++ b/modules/playground/README.md @@ -1,8 +1,12 @@ -# How to run the examples locally +## How to serve the examples -``` -$ cp -r ./modules/playground ./dist/all/ -$ ./node_modules/.bin/tsc -p modules --emitDecoratorMetadata -w -$ gulp serve -$ open http://localhost:8000/all/playground/src/hello_world/index.html?bundles=false +All playground examples are built and served with Bazel. Below is an example that +demonstrates how a specific example can be built and served with Bazel: + +```bash +# e.g. src/zippy_component +yarn bazel run modules/playground/src/zippy_component:devserver + +# e.g. src/upgrade +yarn bazel run modules/playground/src/upgrade:devserver ``` \ No newline at end of file diff --git a/modules/playground/src/animate/BUILD.bazel b/modules/playground/src/animate/BUILD.bazel new file mode 100644 index 0000000000..de99d38015 --- /dev/null +++ b/modules/playground/src/animate/BUILD.bazel @@ -0,0 +1,32 @@ +load("//tools:defaults.bzl", "ng_module") +load("@build_bazel_rules_typescript//:defs.bzl", "ts_devserver") + +package(default_visibility = ["//modules/playground:__subpackages__"]) + +ng_module( + name = "animate", + srcs = glob(["**/*.ts"]), + assets = glob(["**/*.css"]), + tsconfig = "//modules/playground:tsconfig-build.json", + # TODO: FW-1004 Type checking is currently not complete. + type_check = False, + deps = [ + "//packages/animations", + "//packages/core", + "//packages/platform-browser-dynamic", + "//packages/platform-browser/animations", + ], +) + +ts_devserver( + name = "devserver", + entry_module = "angular/modules/playground/src/animate/index", + index_html = "index.html", + port = 4200, + scripts = ["@ngdeps//node_modules/tslib:tslib.js"], + static_files = [ + "@ngdeps//node_modules/zone.js:dist/zone.js", + "@ngdeps//node_modules/reflect-metadata:Reflect.js", + ], + deps = [":animate"], +) diff --git a/modules/playground/src/animate/app/animate-app.ts b/modules/playground/src/animate/app/animate-app.ts index 0dba74ec69..273fa54415 100644 --- a/modules/playground/src/animate/app/animate-app.ts +++ b/modules/playground/src/animate/app/animate-app.ts @@ -16,7 +16,7 @@ import {Component} from '@angular/core'; '(@backgroundAnimation.done)': 'bgStatusChanged($event, "completed")' }, selector: 'animate-app', - styleUrls: ['css/animate-app.css'], + styleUrls: ['../css/animate-app.css'], template: ` diff --git a/modules/playground/src/animate/index.html b/modules/playground/src/animate/index.html index acaaacef31..f4591b33e0 100644 --- a/modules/playground/src/animate/index.html +++ b/modules/playground/src/animate/index.html @@ -15,6 +15,5 @@