From 6d3ec33ebebfc63895ab38a5c3d9d5fb4bc3500a Mon Sep 17 00:00:00 2001 From: Alex Eagle Date: Mon, 13 Jul 2020 07:46:31 -0700 Subject: [PATCH] chore: remove ts_setup_workspace This has been a no-op since 1.0 when we vendored requirejs for ts_devserver in https://github.com/bazelbuild/rules_nodejs/pull/1159/files#diff-fe375cd73fb89504b9b9a9a751518849 We should never add WORKSPACE dependencies so I don't see a value in users carrying this weight. BREAKING CHANGE: ts_setup_workspace was a no-op and has been removed. Simply remove it from your WORKSPACE file. Fixes #2033 --- WORKSPACE | 4 --- e2e/ts_devserver/WORKSPACE | 4 --- e2e/typescript/WORKSPACE | 4 --- examples/angular/WORKSPACE | 5 ---- examples/angular_view_engine/WORKSPACE | 5 ---- examples/app/WORKSPACE | 4 --- examples/protocol_buffers/WORKSPACE | 4 --- examples/user_managed_deps/WORKSPACE | 4 --- examples/web_testing/WORKSPACE | 4 --- packages/create/index.js | 6 ----- packages/create/test.js | 4 --- packages/typescript/index.bzl | 2 -- packages/typescript/index.docs.bzl | 2 -- packages/typescript/install.md | 8 ------ packages/typescript/internal/BUILD.bazel | 1 - .../internal/internal_ts_repositories.bzl | 5 ---- .../typescript/internal/ts_repositories.bzl | 27 ------------------- 17 files changed, 93 deletions(-) delete mode 100644 packages/typescript/internal/ts_repositories.bzl diff --git a/WORKSPACE b/WORKSPACE index 3e3ae85d48..c4c8edc836 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -130,10 +130,6 @@ load("@build_bazel_rules_typescript//internal:ts_repositories.bzl", "ts_setup_de ts_setup_dev_workspace() -load("//packages/typescript/internal:ts_repositories.bzl", "ts_setup_workspace") - -ts_setup_workspace() - # # Install @bazel/cypress dependencies # diff --git a/e2e/ts_devserver/WORKSPACE b/e2e/ts_devserver/WORKSPACE index bc1445c606..0635c4bcf2 100644 --- a/e2e/ts_devserver/WORKSPACE +++ b/e2e/ts_devserver/WORKSPACE @@ -33,10 +33,6 @@ yarn_install( yarn_lock = "//:yarn.lock", ) -load("@npm//@bazel/typescript:index.bzl", "ts_setup_workspace") - -ts_setup_workspace() - load("@npm//@bazel/protractor:package.bzl", "npm_bazel_protractor_dependencies") npm_bazel_protractor_dependencies() diff --git a/e2e/typescript/WORKSPACE b/e2e/typescript/WORKSPACE index 0b3018ed47..17d9e21f50 100644 --- a/e2e/typescript/WORKSPACE +++ b/e2e/typescript/WORKSPACE @@ -32,7 +32,3 @@ yarn_install( package_json = "//:package.json", yarn_lock = "//:yarn.lock", ) - -load("@npm//@bazel/typescript:index.bzl", "ts_setup_workspace") - -ts_setup_workspace() diff --git a/examples/angular/WORKSPACE b/examples/angular/WORKSPACE index 6d66b5eed7..df608243b0 100644 --- a/examples/angular/WORKSPACE +++ b/examples/angular/WORKSPACE @@ -63,11 +63,6 @@ browser_repositories( firefox = True, ) -# Setup the rules_typescript tooolchain -load("@npm//@bazel/typescript:index.bzl", "ts_setup_workspace") - -ts_setup_workspace() - # Setup the rules_sass toolchain load("@io_bazel_rules_sass//sass:sass_repositories.bzl", "sass_repositories") diff --git a/examples/angular_view_engine/WORKSPACE b/examples/angular_view_engine/WORKSPACE index c49f3aab53..7e1dba8f19 100644 --- a/examples/angular_view_engine/WORKSPACE +++ b/examples/angular_view_engine/WORKSPACE @@ -70,11 +70,6 @@ browser_repositories( firefox = True, ) -# Setup the rules_typescript tooolchain -load("@npm//@bazel/typescript:index.bzl", "ts_setup_workspace") - -ts_setup_workspace() - # Setup the rules_sass toolchain load("@io_bazel_rules_sass//sass:sass_repositories.bzl", "sass_repositories") diff --git a/examples/app/WORKSPACE b/examples/app/WORKSPACE index 88cd924722..a1da81c8ee 100644 --- a/examples/app/WORKSPACE +++ b/examples/app/WORKSPACE @@ -33,10 +33,6 @@ yarn_install( yarn_lock = "//:yarn.lock", ) -load("@npm//@bazel/typescript:index.bzl", "ts_setup_workspace") - -ts_setup_workspace() - load("@npm//@bazel/protractor:package.bzl", "npm_bazel_protractor_dependencies") npm_bazel_protractor_dependencies() diff --git a/examples/protocol_buffers/WORKSPACE b/examples/protocol_buffers/WORKSPACE index 37711ae037..7d50e2766c 100644 --- a/examples/protocol_buffers/WORKSPACE +++ b/examples/protocol_buffers/WORKSPACE @@ -78,10 +78,6 @@ browser_repositories( firefox = True, ) -load("@npm//@bazel/typescript:index.bzl", "ts_setup_workspace") - -ts_setup_workspace() - load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps") protobuf_deps() diff --git a/examples/user_managed_deps/WORKSPACE b/examples/user_managed_deps/WORKSPACE index 0aeef0bd3a..4d39f66122 100644 --- a/examples/user_managed_deps/WORKSPACE +++ b/examples/user_managed_deps/WORKSPACE @@ -63,7 +63,3 @@ go_register_toolchains() load("@build_bazel_rules_typescript//internal:ts_repositories.bzl", "ts_setup_dev_workspace") ts_setup_dev_workspace() - -load("@build_bazel_rules_nodejs//packages/typescript/internal:ts_repositories.bzl", "ts_setup_workspace") - -ts_setup_workspace() diff --git a/examples/web_testing/WORKSPACE b/examples/web_testing/WORKSPACE index efc71b558f..52e1e1c893 100644 --- a/examples/web_testing/WORKSPACE +++ b/examples/web_testing/WORKSPACE @@ -47,7 +47,3 @@ browser_repositories( chromium = True, firefox = True, ) - -load("@npm//@bazel/typescript:index.bzl", "ts_setup_workspace") - -ts_setup_workspace() diff --git a/packages/create/index.js b/packages/create/index.js index 8f9744b037..24f1bcfba1 100644 --- a/packages/create/index.js +++ b/packages/create/index.js @@ -162,13 +162,7 @@ http_archive( ) ${pkgMgr === 'yarn' ? yarnInstallCmd : npmInstallCmd}`; - if (args['typescript']) { - workspaceContent += ` -# Setup TypeScript toolchain -load("//packages/typescript:index.bzl", "ts_setup_workspace") -ts_setup_workspace()`; - } write('WORKSPACE.bazel', workspaceContent); write('.bazelignore', `node_modules dist diff --git a/packages/create/test.js b/packages/create/test.js index 4055d9c957..105d69c9f7 100644 --- a/packages/create/test.js +++ b/packages/create/test.js @@ -77,7 +77,3 @@ let pkgContent = read('with_ts/package.json'); if (pkgContent.indexOf('"@bazel/typescript": "latest"') < 0) { fail('should install @bazel/typescript dependency', pkgContent); } -wkspContent = read('with_ts/WORKSPACE.bazel'); -if (wkspContent.indexOf('ts_setup_workspace(') < 0) { - fail('should install extra TS repositories'); -} diff --git a/packages/typescript/index.bzl b/packages/typescript/index.bzl index 2eff491f78..de754f0f9a 100644 --- a/packages/typescript/index.bzl +++ b/packages/typescript/index.bzl @@ -20,10 +20,8 @@ Users should not load files under "/internal" load("//packages/typescript/internal:build_defs.bzl", _ts_library = "ts_library_macro") load("//packages/typescript/internal:ts_config.bzl", _ts_config = "ts_config") load("//packages/typescript/internal:ts_project.bzl", _ts_project = "ts_project_macro") -load("//packages/typescript/internal:ts_repositories.bzl", _ts_setup_workspace = "ts_setup_workspace") load("//packages/typescript/internal/devserver:ts_devserver.bzl", _ts_devserver = "ts_devserver_macro") -ts_setup_workspace = _ts_setup_workspace ts_library = _ts_library ts_config = _ts_config ts_devserver = _ts_devserver diff --git a/packages/typescript/index.docs.bzl b/packages/typescript/index.docs.bzl index e218625549..75b6d1ed48 100644 --- a/packages/typescript/index.docs.bzl +++ b/packages/typescript/index.docs.bzl @@ -21,10 +21,8 @@ So this is a copy of index.bzl with macro indirection removed. load("//packages/typescript/internal:build_defs.bzl", _ts_library = "ts_library") load("//packages/typescript/internal:ts_config.bzl", _ts_config = "ts_config") load("//packages/typescript/internal:ts_project.bzl", _ts_project = "ts_project_macro") -load("//packages/typescript/internal:ts_repositories.bzl", _ts_setup_workspace = "ts_setup_workspace") load("//packages/typescript/internal/devserver:ts_devserver.bzl", _ts_devserver = "ts_devserver") -ts_setup_workspace = _ts_setup_workspace ts_library = _ts_library ts_config = _ts_config ts_project = _ts_project diff --git a/packages/typescript/install.md b/packages/typescript/install.md index 6e12ec0c3c..edf4532d62 100644 --- a/packages/typescript/install.md +++ b/packages/typescript/install.md @@ -42,14 +42,6 @@ $ npm install --save-dev @bazel/typescript Watch for any peerDependency warnings - we assume you have already installed the `typescript` package from npm. -Some rules require you to add this to your `WORKSPACE` file: - -```python -# Set up TypeScript toolchain -load("@npm//@bazel/typescript:index.bzl", "ts_setup_workspace") -ts_setup_workspace() -``` - Create a `BUILD.bazel` file in your workspace root. If your `tsconfig.json` file is in the root, use ```python diff --git a/packages/typescript/internal/BUILD.bazel b/packages/typescript/internal/BUILD.bazel index 97a9f0b454..0a95c526ff 100644 --- a/packages/typescript/internal/BUILD.bazel +++ b/packages/typescript/internal/BUILD.bazel @@ -63,7 +63,6 @@ filegroup( "build_defs.bzl", "ts_config.bzl", "ts_project.bzl", - "ts_repositories.bzl", "//packages/typescript/internal/devserver:package_contents", ], visibility = ["//packages/typescript:__subpackages__"], diff --git a/packages/typescript/internal/internal_ts_repositories.bzl b/packages/typescript/internal/internal_ts_repositories.bzl index ed04fe3bad..01dfe7f45d 100644 --- a/packages/typescript/internal/internal_ts_repositories.bzl +++ b/packages/typescript/internal/internal_ts_repositories.bzl @@ -20,13 +20,8 @@ load("@bazel_gazelle//:deps.bzl", "go_repository") def ts_setup_dev_workspace(): """ Setup the toolchain needed for local development, but not needed by users. - - These needs to be in a separate file from ts_setup_workspace() so as not - to leak load statements. """ - ts_setup_workspace() - go_repository( name = "com_github_kylelemons_godebug", commit = "9ff306d4fbead574800b66369df5b6144732d58e", # v1.1.0 diff --git a/packages/typescript/internal/ts_repositories.bzl b/packages/typescript/internal/ts_repositories.bzl deleted file mode 100644 index 7c1519efbd..0000000000 --- a/packages/typescript/internal/ts_repositories.bzl +++ /dev/null @@ -1,27 +0,0 @@ -# Copyright 2017 The Bazel Authors. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"Install toolchain dependencies" - -load("@build_bazel_rules_nodejs//:index.bzl", "check_rules_nodejs_version") - -def ts_setup_workspace(): - """This repository rule should be called from your WORKSPACE file. - - It creates some additional Bazel external repositories that are used internally - by the TypeScript rules. - """ - - # 0.16.8: ng_package fix for packaging binary files - check_rules_nodejs_version("0.16.8")