Skip to content

Commit

Permalink
WIP prototype of symlinking user node_modules in yarn_install & npm_i…
Browse files Browse the repository at this point in the history
…nstall
  • Loading branch information
gregmagolan committed Apr 6, 2019
1 parent 61e35d3 commit c03f414
Show file tree
Hide file tree
Showing 62 changed files with 509 additions and 316 deletions.
8 changes: 8 additions & 0 deletions .bazelignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
node_modules
examples/program/node_modules
internal/history-server/node_modules
internal/http-server/node_modules
internal/npm_install/test/package/node_modules
internal/npm_install/node_modules
internal/rollup/node_modules
internal/web_package/node_modules
dist
# Each e2e test is a nested workspace
e2e/
Expand All @@ -12,6 +17,9 @@ packages/
# TODO(gregmagolan): move these to /e2e
internal/e2e/bazel_workspaces
internal/e2e/bazel_workspaces_compat
internal/e2e/fine_grained_deps/npm/node_modules
internal/e2e/fine_grained_deps/yarn/node_modules
internal/e2e/fine_grained_no_bin/node_modules
internal/e2e/fine_grained_symlinks
internal/e2e/node_loader_no_preserve_symlinks
internal/e2e/node_loader_preserve_symlinks
Expand Down
3 changes: 2 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,8 @@ jobs:
- *attach_workspace
- *init_environment
- *init_bazel
- run: ./scripts/setup_examples_angular.sh
# TODO(gmagolan): put this back in once it works with user node_modules
# - run: ./scripts/setup_examples_angular.sh
# Some examples such as app require xvfb
- run: xvfb-run -a ./scripts/test_examples_all.sh ${CIRCLE_NODE_INDEX} ${CIRCLE_NODE_TOTAL}

Expand Down
18 changes: 0 additions & 18 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -64,24 +64,6 @@ node_repositories(

yarn_install(
name = "npm",
data = [
"@build_bazel_rules_nodejs//:tools/npm_packages/hello/index.js",
"@build_bazel_rules_nodejs//:tools/npm_packages/hello/package.json",
"@build_bazel_rules_nodejs//:tools/npm_packages/node_resolve_index/index.js",
"@build_bazel_rules_nodejs//:tools/npm_packages/node_resolve_index_2/index.js",
"@build_bazel_rules_nodejs//:tools/npm_packages/node_resolve_index_2/package.json",
"@build_bazel_rules_nodejs//:tools/npm_packages/node_resolve_index_3/index.js",
"@build_bazel_rules_nodejs//:tools/npm_packages/node_resolve_index_3/package.json",
"@build_bazel_rules_nodejs//:tools/npm_packages/node_resolve_index_4/index.js",
"@build_bazel_rules_nodejs//:tools/npm_packages/node_resolve_index_4/package.json",
"@build_bazel_rules_nodejs//:tools/npm_packages/node_resolve_main/main.js",
"@build_bazel_rules_nodejs//:tools/npm_packages/node_resolve_main/package.json",
"@build_bazel_rules_nodejs//:tools/npm_packages/node_resolve_main_2/main.js",
"@build_bazel_rules_nodejs//:tools/npm_packages/node_resolve_main_2/package.json",
"@build_bazel_rules_nodejs//:tools/npm_packages/node_resolve_nested_main/nested/main.js",
"@build_bazel_rules_nodejs//:tools/npm_packages/node_resolve_nested_main/nested/package.json",
"@build_bazel_rules_nodejs//:tools/npm_packages/node_resolve_nested_main/package.json",
],
package_json = "//:package.json",
yarn_lock = "//:yarn.lock",
)
Expand Down
1 change: 1 addition & 0 deletions e2e/bazel_bin/.bazelignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
4 changes: 0 additions & 4 deletions e2e/bazel_bin/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ load("@build_bazel_rules_nodejs//:defs.bzl", "yarn_install")

yarn_install(
name = "npm",
data = [
"@e2e_bazel_bin//:npm/testy/index.js",
"@e2e_bazel_bin//:npm/testy/package.json",
],
package_json = "//:package.json",
yarn_lock = "//:yarn.lock",
)
1 change: 1 addition & 0 deletions e2e/define_var/.bazelignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
1 change: 1 addition & 0 deletions e2e/jasmine/.bazelignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
1 change: 1 addition & 0 deletions e2e/karma/.bazelignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
1 change: 1 addition & 0 deletions e2e/karma_stack_trace/.bazelignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
1 change: 1 addition & 0 deletions e2e/karma_typescript/.bazelignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
1 change: 1 addition & 0 deletions e2e/tsconfig_extends/.bazelignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
1 change: 1 addition & 0 deletions e2e/typescript_2.7/.bazelignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
1 change: 1 addition & 0 deletions e2e/typescript_2.8/.bazelignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
1 change: 1 addition & 0 deletions e2e/typescript_2.9/.bazelignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
1 change: 1 addition & 0 deletions e2e/typescript_3.0/.bazelignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
1 change: 1 addition & 0 deletions e2e/typescript_3.1/.bazelignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
1 change: 1 addition & 0 deletions examples/bazel_managed_deps/.bazelignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
1 change: 1 addition & 0 deletions examples/parcel/.bazelignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
6 changes: 1 addition & 5 deletions examples/program/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,4 @@ load("@build_bazel_rules_nodejs//:defs.bzl", "node_repositories")
# bazel run @nodejs//:yarn
# or
# bazel run @nodejs//:npm
node_repositories(
node_version = "8.11.1",
package_json = ["//:package.json"],
yarn_version = "1.5.1",
)
node_repositories(package_json = ["//:package.json"])
1 change: 1 addition & 0 deletions examples/vendored_node/.bazelignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
1 change: 1 addition & 0 deletions examples/web_testing/.bazelignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
1 change: 1 addition & 0 deletions examples/webapp/.bazelignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
7 changes: 0 additions & 7 deletions internal/e2e/bazel_workspaces/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,6 @@ load("@build_bazel_rules_nodejs//:defs.bzl", "yarn_install")

yarn_install(
name = "npm",
data = [
"@bazel_workspaces//:npm/test_workspace/WORKSPACE",
"@bazel_workspaces//:npm/test_workspace/package.json",
"@bazel_workspaces//:npm/test_workspace/src/BUILD.bazel",
"@bazel_workspaces//:npm/test_workspace/src/test.spec.js",
"@bazel_workspaces//:npm/test_workspace/yarn.lock",
],
package_json = "//:package.json",
yarn_lock = "//:yarn.lock",
)
Expand Down
17 changes: 0 additions & 17 deletions internal/e2e/bazel_workspaces_compat/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,6 @@ load("@build_bazel_rules_nodejs//:defs.bzl", "yarn_install")

yarn_install(
name = "npm",
data = [
"@bazel_workspaces_compat//:npm/test_workspace_a/WORKSPACE",
"@bazel_workspaces_compat//:npm/test_workspace_a/package.json",
"@bazel_workspaces_compat//:npm/test_workspace_a/src/BUILD.bazel",
"@bazel_workspaces_compat//:npm/test_workspace_a/src/test.spec.js",
"@bazel_workspaces_compat//:npm/test_workspace_a/yarn.lock",
"@bazel_workspaces_compat//:npm/test_workspace_b/WORKSPACE",
"@bazel_workspaces_compat//:npm/test_workspace_b/package.json",
"@bazel_workspaces_compat//:npm/test_workspace_b/src/BUILD.bazel",
"@bazel_workspaces_compat//:npm/test_workspace_b/src/test.spec.js",
"@bazel_workspaces_compat//:npm/test_workspace_b/yarn.lock",
"@bazel_workspaces_compat//:npm/test_workspace_c/WORKSPACE",
"@bazel_workspaces_compat//:npm/test_workspace_c/package.json",
"@bazel_workspaces_compat//:npm/test_workspace_c/src/BUILD.bazel",
"@bazel_workspaces_compat//:npm/test_workspace_c/src/test.spec.js",
"@bazel_workspaces_compat//:npm/test_workspace_c/yarn.lock",
],
package_json = "//:package.json",
yarn_lock = "//:yarn.lock",
)
Expand Down
16 changes: 0 additions & 16 deletions internal/e2e/fine_grained_deps/npm/package.json

This file was deleted.

16 changes: 0 additions & 16 deletions internal/e2e/fine_grained_deps/yarn/package.json

This file was deleted.

2 changes: 1 addition & 1 deletion internal/e2e/fine_grained_no_bin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
"dependencies": {
"fs.realpath": "1.0.0"
}
}
}
1 change: 0 additions & 1 deletion internal/e2e/packages/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ filegroup(

VARIANTS = [
"npm_install",
"npm_no_lockfile",
"yarn_install",
]

Expand Down
2 changes: 1 addition & 1 deletion internal/e2e/packages/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ 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")

Expand Down
File renamed without changes.
12 changes: 12 additions & 0 deletions internal/e2e/packages/npm1/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"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 //..."
}
}
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.

12 changes: 12 additions & 0 deletions internal/e2e/packages/npm2/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"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 //..."
}
}
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 c03f414

Please sign in to comment.