Skip to content

Commit

Permalink
Cleanup package_example
Browse files Browse the repository at this point in the history
* rename workspace to internal_e2e_packages
* separate folders for each yarn_install & npm_install as prefactor for user node_modules
  • Loading branch information
gregmagolan committed Apr 6, 2019
1 parent 61e35d3 commit c7311a6
Show file tree
Hide file tree
Showing 19 changed files with 391 additions and 46 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ jobs:
# TODO(gmagolan): move these tests into `build` job once
# https://github.com/bazelbuild/bazel/issues/6481 is resolved
- run: bazel test @examples_program//...
- run: bazel test @packages_example//...
- run: bazel test @internal_e2e_packages//...

build_release:
<<: *job_defaults
Expand Down
6 changes: 3 additions & 3 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ local_repository(
)

local_repository(
name = "packages_example",
name = "internal_e2e_packages",
path = "internal/e2e/packages",
)

Expand Down Expand Up @@ -91,9 +91,9 @@ load("@npm//:install_bazel_dependencies.bzl", "install_bazel_dependencies")

install_bazel_dependencies()

load("@packages_example//:setup_workspace.bzl", "packages_example_setup_workspace")
load("@internal_e2e_packages//:setup_workspace.bzl", "internal_e2e_packages_setup_workspace")

packages_example_setup_workspace()
internal_e2e_packages_setup_workspace()

# Dependencies to run skydoc
load("@io_bazel_rules_sass//sass:sass_repositories.bzl", "sass_repositories")
Expand Down
10 changes: 5 additions & 5 deletions internal/e2e/packages/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,20 @@ VARIANTS = [
[jasmine_node_test(
name = "version_" + variant + "_test",
srcs = [variant + ".spec.js"],
node_modules = "@packages_example_" + variant + "//:node_modules",
node_modules = "@internal_e2e_packages_" + variant + "//:node_modules",
deps = [":test_version"],
) for variant in VARIANTS]

jasmine_node_test(
name = "npm_determinism_test",
srcs = ["npm_determinism.spec.js"],
data = ["@packages_example_npm_install//:node_modules"],
node_modules = "@packages_example_npm_install_duplicate_for_determinism_testing//:node_modules",
data = ["@internal_e2e_packages_npm_install//:node_modules"],
node_modules = "@internal_e2e_packages_npm_install_duplicate_for_determinism_testing//:node_modules",
)

jasmine_node_test(
name = "yarn_determinism_test",
srcs = ["yarn_determinism.spec.js"],
data = ["@packages_example_yarn_install//:node_modules"],
node_modules = "@packages_example_yarn_install_duplicate_for_determinism_testing//:node_modules",
data = ["@internal_e2e_packages_yarn_install//:node_modules"],
node_modules = "@internal_e2e_packages_yarn_install_duplicate_for_determinism_testing//:node_modules",
)
8 changes: 4 additions & 4 deletions internal/e2e/packages/WORKSPACE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
workspace(name = "packages_example")
workspace(name = "internal_e2e_packages")

local_repository(
name = "build_bazel_rules_nodejs",
Expand All @@ -10,8 +10,8 @@ load("@build_bazel_rules_nodejs//:defs.bzl", "check_rules_nodejs_version", "node
# Test that check_rules_nodejs_version works as expected
check_rules_nodejs_version(minimum_version_string = "0.11.2")

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

load(":setup_workspace.bzl", "packages_example_setup_workspace")
load(":setup_workspace.bzl", "internal_e2e_packages_setup_workspace")

packages_example_setup_workspace()
internal_e2e_packages_setup_workspace()
File renamed without changes.
10 changes: 10 additions & 0 deletions internal/e2e/packages/npm1/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"description": "runtime dependencies for packages example",
"dependencies": {
"jsesc": "~1.2.0",
"jasmine": "2.8.0"
},
"scripts": {
"postinstall": "node ./postinstall.js"
}
}
108 changes: 108 additions & 0 deletions internal/e2e/packages/npm2/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions internal/e2e/packages/npm2/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"description": "runtime dependencies for packages example",
"dependencies": {
"jsesc": "~1.2.0",
"jasmine": "2.8.0"
},
"scripts": {
"postinstall": "node ./postinstall.js"
}
}
108 changes: 108 additions & 0 deletions internal/e2e/packages/npm3/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions internal/e2e/packages/npm3/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"description": "runtime dependencies for packages example",
"dependencies": {
"jsesc": "~1.2.0",
"jasmine": "2.8.0"
},
"scripts": {
"postinstall": "node ./postinstall.js"
}
}
4 changes: 2 additions & 2 deletions internal/e2e/packages/npm_determinism.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ const packageJsonPath = require.resolve('jsesc').replace('jsesc.js', 'package.js
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath));

const packageJsonPath2 = packageJsonPath.replace(
'/packages_example_npm_install_duplicate_for_determinism_testing/',
'/packages_example_npm_install/');
'/internal_e2e_packages_npm_install_duplicate_for_determinism_testing/',
'/internal_e2e_packages_npm_install/');
const packageJson2 = JSON.parse(fs.readFileSync(packageJsonPath));

describe('jsesc package.json files', () => {
Expand Down
6 changes: 0 additions & 6 deletions internal/e2e/packages/package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
{
"description": "runtime dependencies for packages example",
"dependencies": {
"jsesc": "~1.2.0",
"jasmine": "2.8.0"
},
"scripts": {
"postinstall": "node ./postinstall.js",
"pretest": "bazel run @nodejs//:yarn",
"test": "bazel test //..."
}
}
Loading

0 comments on commit c7311a6

Please sign in to comment.