Skip to content

Commit

Permalink
chore: vue example cleanup and add trivial test target
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Eagle authored and alexeagle committed Jul 8, 2020
1 parent f42cb8e commit 17c0244
Show file tree
Hide file tree
Showing 26 changed files with 708 additions and 8,930 deletions.
4 changes: 2 additions & 2 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import %workspace%/common.bazelrc
# This lets us glob() up all the files inside the examples to make them inputs to tests
# To update these lines, just run `yarn bazel:update-deleted-packages`
# (Note, we cannot use common --deleted_packages because the bazel version command doesn't support it)
build --deleted_packages=examples/angular,examples/angular/e2e,examples/angular/node_modules/@angular-devkit/core/third_party/github.com/chalk/supports-color,examples/angular/node_modules/@angular-devkit/core/third_party/github.com/sindresorhus/has-flag,examples/angular/node_modules/@schematics/angular/third_party/github.com/Microsoft/TypeScript,examples/angular/src/app/home,examples/angular/src/app/hello-world,examples/angular/src/app,examples/angular/src/app/todos,examples/angular/src/app/todos/reducers,examples/angular/src/shared/material,examples/angular/src/lib/shorten,examples/angular/src,examples/angular/src/assets,examples/angular/tools,examples/angular_bazel_architect,examples/angular_bazel_architect/node_modules/@angular-devkit/core/third_party/github.com/chalk/supports-color,examples/angular_bazel_architect/node_modules/@angular-devkit/core/third_party/github.com/sindresorhus/has-flag,examples/angular_bazel_architect/node_modules/@schematics/angular/third_party/github.com/Microsoft/TypeScript,examples/angular_bazel_architect/projects/frontend-lib,examples/angular_view_engine,examples/angular_view_engine/e2e,examples/angular_view_engine/node_modules/@angular-devkit/core/node_modules/rxjs/src/webSocket,examples/angular_view_engine/node_modules/@angular-devkit/core/node_modules/rxjs/src/operators,examples/angular_view_engine/node_modules/@angular-devkit/core/node_modules/rxjs/src/testing,examples/angular_view_engine/node_modules/@angular-devkit/core/node_modules/rxjs/src,examples/angular_view_engine/node_modules/@angular-devkit/core/node_modules/rxjs/src/ajax,examples/angular_view_engine/node_modules/@angular-devkit/core/third_party/github.com/chalk/supports-color,examples/angular_view_engine/node_modules/@angular-devkit/core/third_party/github.com/sindresorhus/has-flag,examples/angular_view_engine/node_modules/@angular-devkit/architect/node_modules/rxjs/src/webSocket,examples/angular_view_engine/node_modules/@angular-devkit/architect/node_modules/rxjs/src/operators,examples/angular_view_engine/node_modules/@angular-devkit/architect/node_modules/rxjs/src/testing,examples/angular_view_engine/node_modules/@angular-devkit/architect/node_modules/rxjs/src,examples/angular_view_engine/node_modules/@angular-devkit/architect/node_modules/rxjs/src/ajax,examples/angular_view_engine/node_modules/@angular-devkit/schematics/node_modules/rxjs/src/webSocket,examples/angular_view_engine/node_modules/@angular-devkit/schematics/node_modules/rxjs/src/operators,examples/angular_view_engine/node_modules/@angular-devkit/schematics/node_modules/rxjs/src/testing,examples/angular_view_engine/node_modules/@angular-devkit/schematics/node_modules/rxjs/src,examples/angular_view_engine/node_modules/@angular-devkit/schematics/node_modules/rxjs/src/ajax,examples/angular_view_engine/node_modules/@schematics/update/node_modules/rxjs/src/webSocket,examples/angular_view_engine/node_modules/@schematics/update/node_modules/rxjs/src/operators,examples/angular_view_engine/node_modules/@schematics/update/node_modules/rxjs/src/testing,examples/angular_view_engine/node_modules/@schematics/update/node_modules/rxjs/src,examples/angular_view_engine/node_modules/@schematics/update/node_modules/rxjs/src/ajax,examples/angular_view_engine/node_modules/@schematics/angular/third_party/github.com/Microsoft/TypeScript,examples/angular_view_engine/src/app/home,examples/angular_view_engine/src/app/hello-world,examples/angular_view_engine/src/app,examples/angular_view_engine/src/app/todos,examples/angular_view_engine/src/app/todos/reducers,examples/angular_view_engine/src/shared/material,examples/angular_view_engine/src/lib/typography,examples/angular_view_engine/src/lib/shorten,examples/angular_view_engine/src,examples/angular_view_engine/src/assets,examples/app,examples/app/styles,examples/app/test,examples/closure,examples/cypress,examples/jest,examples/kotlin,examples/nestjs,examples/nestjs/src,examples/parcel,examples/protocol_buffers,examples/react_webpack,examples/user_managed_deps,examples/vendored_node,examples/vendored_node_and_yarn,examples/web_testing,examples/webapp,examples/worker,e2e/bazel_managed_deps,e2e/fine_grained_symlinks,e2e/jasmine,e2e/node_loader_no_preserve_symlinks,e2e/node_loader_preserve_symlinks,e2e/packages,e2e/symlinked_node_modules_npm,e2e/symlinked_node_modules_yarn,e2e/ts_devserver,e2e/ts_devserver/genrule,e2e/ts_devserver/subpackage,e2e/typescript,e2e/webapp
query --deleted_packages=examples/angular,examples/angular/e2e,examples/angular/node_modules/@angular-devkit/core/third_party/github.com/chalk/supports-color,examples/angular/node_modules/@angular-devkit/core/third_party/github.com/sindresorhus/has-flag,examples/angular/node_modules/@schematics/angular/third_party/github.com/Microsoft/TypeScript,examples/angular/src/app/home,examples/angular/src/app/hello-world,examples/angular/src/app,examples/angular/src/app/todos,examples/angular/src/app/todos/reducers,examples/angular/src/shared/material,examples/angular/src/lib/shorten,examples/angular/src,examples/angular/src/assets,examples/angular/tools,examples/angular_bazel_architect,examples/angular_bazel_architect/node_modules/@angular-devkit/core/third_party/github.com/chalk/supports-color,examples/angular_bazel_architect/node_modules/@angular-devkit/core/third_party/github.com/sindresorhus/has-flag,examples/angular_bazel_architect/node_modules/@schematics/angular/third_party/github.com/Microsoft/TypeScript,examples/angular_bazel_architect/projects/frontend-lib,examples/angular_view_engine,examples/angular_view_engine/e2e,examples/angular_view_engine/node_modules/@angular-devkit/core/node_modules/rxjs/src/webSocket,examples/angular_view_engine/node_modules/@angular-devkit/core/node_modules/rxjs/src/operators,examples/angular_view_engine/node_modules/@angular-devkit/core/node_modules/rxjs/src/testing,examples/angular_view_engine/node_modules/@angular-devkit/core/node_modules/rxjs/src,examples/angular_view_engine/node_modules/@angular-devkit/core/node_modules/rxjs/src/ajax,examples/angular_view_engine/node_modules/@angular-devkit/core/third_party/github.com/chalk/supports-color,examples/angular_view_engine/node_modules/@angular-devkit/core/third_party/github.com/sindresorhus/has-flag,examples/angular_view_engine/node_modules/@angular-devkit/architect/node_modules/rxjs/src/webSocket,examples/angular_view_engine/node_modules/@angular-devkit/architect/node_modules/rxjs/src/operators,examples/angular_view_engine/node_modules/@angular-devkit/architect/node_modules/rxjs/src/testing,examples/angular_view_engine/node_modules/@angular-devkit/architect/node_modules/rxjs/src,examples/angular_view_engine/node_modules/@angular-devkit/architect/node_modules/rxjs/src/ajax,examples/angular_view_engine/node_modules/@angular-devkit/schematics/node_modules/rxjs/src/webSocket,examples/angular_view_engine/node_modules/@angular-devkit/schematics/node_modules/rxjs/src/operators,examples/angular_view_engine/node_modules/@angular-devkit/schematics/node_modules/rxjs/src/testing,examples/angular_view_engine/node_modules/@angular-devkit/schematics/node_modules/rxjs/src,examples/angular_view_engine/node_modules/@angular-devkit/schematics/node_modules/rxjs/src/ajax,examples/angular_view_engine/node_modules/@schematics/update/node_modules/rxjs/src/webSocket,examples/angular_view_engine/node_modules/@schematics/update/node_modules/rxjs/src/operators,examples/angular_view_engine/node_modules/@schematics/update/node_modules/rxjs/src/testing,examples/angular_view_engine/node_modules/@schematics/update/node_modules/rxjs/src,examples/angular_view_engine/node_modules/@schematics/update/node_modules/rxjs/src/ajax,examples/angular_view_engine/node_modules/@schematics/angular/third_party/github.com/Microsoft/TypeScript,examples/angular_view_engine/src/app/home,examples/angular_view_engine/src/app/hello-world,examples/angular_view_engine/src/app,examples/angular_view_engine/src/app/todos,examples/angular_view_engine/src/app/todos/reducers,examples/angular_view_engine/src/shared/material,examples/angular_view_engine/src/lib/typography,examples/angular_view_engine/src/lib/shorten,examples/angular_view_engine/src,examples/angular_view_engine/src/assets,examples/app,examples/app/styles,examples/app/test,examples/closure,examples/cypress,examples/jest,examples/kotlin,examples/nestjs,examples/nestjs/src,examples/parcel,examples/protocol_buffers,examples/react_webpack,examples/user_managed_deps,examples/vendored_node,examples/vendored_node_and_yarn,examples/web_testing,examples/webapp,examples/worker,e2e/bazel_managed_deps,e2e/fine_grained_symlinks,e2e/jasmine,e2e/node_loader_no_preserve_symlinks,e2e/node_loader_preserve_symlinks,e2e/packages,e2e/symlinked_node_modules_npm,e2e/symlinked_node_modules_yarn,e2e/ts_devserver,e2e/ts_devserver/genrule,e2e/ts_devserver/subpackage,e2e/typescript,e2e/webapp
build --deleted_packages=examples/angular,examples/angular/e2e,examples/angular/src/app/home,examples/angular/src/app/hello-world,examples/angular/src/app,examples/angular/src/app/todos,examples/angular/src/app/todos/reducers,examples/angular/src/shared/material,examples/angular/src/lib/shorten,examples/angular/src,examples/angular/src/assets,examples/angular/tools,examples/angular_bazel_architect,examples/angular_bazel_architect/projects/frontend-lib,examples/angular_view_engine,examples/angular_view_engine/e2e,examples/angular_view_engine/src/app/home,examples/angular_view_engine/src/app/hello-world,examples/angular_view_engine/src/app,examples/angular_view_engine/src/app/todos,examples/angular_view_engine/src/app/todos/reducers,examples/angular_view_engine/src/shared/material,examples/angular_view_engine/src/lib/typography,examples/angular_view_engine/src/lib/shorten,examples/angular_view_engine/src,examples/angular_view_engine/src/assets,examples/app,examples/app/styles,examples/app/test,examples/closure,examples/cypress,examples/jest,examples/kotlin,examples/nestjs,examples/nestjs/src,examples/parcel,examples/protocol_buffers,examples/react_webpack,examples/user_managed_deps,examples/vendored_node,examples/vendored_node_and_yarn,examples/vue,examples/vue/src,examples/web_testing,examples/webapp,examples/worker,e2e/bazel_managed_deps,e2e/fine_grained_symlinks,e2e/jasmine,e2e/node_loader_no_preserve_symlinks,e2e/node_loader_preserve_symlinks,e2e/packages,e2e/symlinked_node_modules_npm,e2e/symlinked_node_modules_yarn,e2e/ts_devserver,e2e/ts_devserver/genrule,e2e/ts_devserver/subpackage,e2e/typescript,e2e/webapp
query --deleted_packages=examples/angular,examples/angular/e2e,examples/angular/src/app/home,examples/angular/src/app/hello-world,examples/angular/src/app,examples/angular/src/app/todos,examples/angular/src/app/todos/reducers,examples/angular/src/shared/material,examples/angular/src/lib/shorten,examples/angular/src,examples/angular/src/assets,examples/angular/tools,examples/angular_bazel_architect,examples/angular_bazel_architect/projects/frontend-lib,examples/angular_view_engine,examples/angular_view_engine/e2e,examples/angular_view_engine/src/app/home,examples/angular_view_engine/src/app/hello-world,examples/angular_view_engine/src/app,examples/angular_view_engine/src/app/todos,examples/angular_view_engine/src/app/todos/reducers,examples/angular_view_engine/src/shared/material,examples/angular_view_engine/src/lib/typography,examples/angular_view_engine/src/lib/shorten,examples/angular_view_engine/src,examples/angular_view_engine/src/assets,examples/app,examples/app/styles,examples/app/test,examples/closure,examples/cypress,examples/jest,examples/kotlin,examples/nestjs,examples/nestjs/src,examples/parcel,examples/protocol_buffers,examples/react_webpack,examples/user_managed_deps,examples/vendored_node,examples/vendored_node_and_yarn,examples/vue,examples/vue/src,examples/web_testing,examples/webapp,examples/worker,e2e/bazel_managed_deps,e2e/fine_grained_symlinks,e2e/jasmine,e2e/node_loader_no_preserve_symlinks,e2e/node_loader_preserve_symlinks,e2e/packages,e2e/symlinked_node_modules_npm,e2e/symlinked_node_modules_yarn,e2e/ts_devserver,e2e/ts_devserver/genrule,e2e/ts_devserver/subpackage,e2e/typescript,e2e/webapp

# Mock versioning command to test the --stamp behavior
build --workspace_status_command="echo BUILD_SCM_VERSION 1.2.3"
Expand Down
5 changes: 5 additions & 0 deletions examples/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,11 @@ example_integration_test(
tags = ["manual"],
)

example_integration_test(
name = "examples_vue",
npm_packages = {},
)

example_integration_test(
name = "examples_worker",
# There are no tests in this example
Expand Down
File renamed without changes.
48 changes: 48 additions & 0 deletions examples/vue/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
load("@build_bazel_rules_nodejs//:index.bzl", "copy_to_bin", "nodejs_test")
load("@npm//@vue/cli-service:index.bzl", "vue_cli_service")

vue_cli_service(
name = "serve",
args = ["serve"],
data = [
"babel.config.js",
":package.json",
"//src",
],
)

vue_cli_service(
name = "build",
outs = ["dist"],
args = [
"build",
"--dest",
"$(@D)/dist",
"--skip-plugins",
"eslint",
],
data = [
"babel.config.js",
":package.json",
"//src",
"@npm//vue",
"@npm//@vue/cli-plugin-babel",
# Shouldn't be needed since it's in skip-plugins ?
"@npm//@vue/cli-plugin-eslint",
],
)

copy_to_bin(
name = "test_in_bin",
srcs = ["smoke.test.js"],
)

# The example should have a Jest or Mocha test following the Vue instructions
# https://cli.vuejs.org/config/#unit-testing
# And probably also some e2e test that the server works.
# For now, just a trivial test to ensure we can build
nodejs_test(
name = "test",
data = [":build"],
entry_point = "test_in_bin",
)
21 changes: 21 additions & 0 deletions examples/vue/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,25 @@ Add the NodeJS Rules to your Workspace, as well as the NPM Packages.
## Adding Building and Serving to your Ruleset
TODO

## Project setup
```
npm install
```

### Compiles and hot-reloads for development
```
npm run serve
```

### Compiles and minifies for production
```
npm run build
```

### Lints and fixes files
```
npm run lint
```

### Customize configuration
See [Configuration Reference](https://cli.vuejs.org/config/).
13 changes: 5 additions & 8 deletions examples/vue/hello-world/WORKSPACE → examples/vue/WORKSPACE
Original file line number Diff line number Diff line change
@@ -1,25 +1,22 @@
workspace(
name = "helloworld",
name = "vue_example",
managed_directories = {"@npm": ["node_modules"]},
)

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
name = "build_bazel_rules_nodejs",
sha256 = "f9e7b9f42ae202cc2d2ce6d698ccb49a9f7f7ea572a78fd451696d03ef2ee116",
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/1.6.0/rules_nodejs-1.6.0.tar.gz"],
)

load("@build_bazel_rules_nodejs//:index.bzl", "node_repositories")


load("@build_bazel_rules_nodejs//:index.bzl", "node_repositories", "npm_install")

node_repositories(package_json = ["//:package.json"])

load("@build_bazel_rules_nodejs//:index.bzl", "yarn_install")

yarn_install(
npm_install(
name = "npm",
package_json = "//:package.json",
yarn_lock = "//:yarn.lock",
package_lock_json = "//:package-lock.json",
)
3 changes: 3 additions & 0 deletions examples/vue/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
presets: ['@vue/cli-plugin-babel/preset']
}
24 changes: 0 additions & 24 deletions examples/vue/hello-world/BUILD

This file was deleted.

24 changes: 0 additions & 24 deletions examples/vue/hello-world/README.md

This file was deleted.

5 changes: 0 additions & 5 deletions examples/vue/hello-world/babel.config.js

This file was deleted.

1 change: 0 additions & 1 deletion examples/vue/hello-world/bazel-bin

This file was deleted.

1 change: 0 additions & 1 deletion examples/vue/hello-world/bazel-hello-world

This file was deleted.

1 change: 0 additions & 1 deletion examples/vue/hello-world/bazel-testlogs

This file was deleted.

5 changes: 0 additions & 5 deletions examples/vue/hello-world/src/BUILD

This file was deleted.

8 changes: 0 additions & 8 deletions examples/vue/hello-world/src/main.js

This file was deleted.

Loading

0 comments on commit 17c0244

Please sign in to comment.