@@ -216,8 +216,7 @@ Here is a short summary of the various commands and their primary function. Plea
216216
217217For the most part, frontend-specific third-party dependencies are hosted by
218218[npm](https://docs.npmjs.com/about-npm) and managed by
219- [yarn](https://classic.yarnpkg.com/). Some of our build-time dependencies are
220- managed by [bazel](https://bazel.build/).
219+ [yarn](https://classic.yarnpkg.com/).
221220
222221The source of truth for ` yarn` is a combination of the ` package.json` and
223222` yarn.lock` files. ` package.json` is maintained by us developers and describes
@@ -245,13 +244,61 @@ to be edited by hand.
245244
2462453. Run `yarn run yarn-deduplicate`.
247246
248- 4. Cross reference your updates with the bazel `WORKSPACE` file and determine if any
249- bazel dependencies should also be updated.
250-
251- - Googlers, for information on how to mirror WORKSPACE dependencies that
252- need to be downloaded, refer to go/tensorboard-tf-mirror.
253-
254- 5. Rebuild and test TensorBoard to make sure it works:
255- - `rm -rf node_modules; bazel clean --expunge; yarn`
256- - `bazel run tensorboard --logdir <your favorite logdir>`
257- - `bazel test --test_output=errors tensorboard/webapp/...`
247+ 4. Rebuild and test TensorBoard to make sure it works:
248+ * `rm -rf node_modules; bazel clean --expunge; yarn`
249+ * `bazel run tensorboard --logdir <your favorite logdir>`
250+ * `bazel test --test_output=errors tensorboard/webapp/...`
251+
252+ ## Updating rules_nodejs
253+
254+ The [bazel](https://bazel.build/) rules we use for compiling, bundling, testing,
255+ and running our frontend code come from
256+ [rules_nodejs](https://github.com/bazelbuild/rules_nodejs).
257+
258+ When upgrading rules_nodejs we generally must also consider upgrading:
259+ * The npm packages scoped with `@bazel`
260+ * The rules_sass bazel library
261+ * The bazel version
262+
263+ Sample upgrade: https://github.com/tensorflow/tensorboard/pull/5977
264+
265+ 1. Determine which version of rules_nodejs to upgrade to and find its release
266+ notes in https://github.com/bazelbuild/rules_nodejs/releases. Read the
267+ upgrade instructions for that release and every other release since our
268+ previous upgrade. Typically these instructions follow the same pattern but
269+ there are occasionally special instructions, especially for major releases.
270+ Make a mental note of any of these special instructions.
271+
272+ 2. Update the build_bazel_rules_nodejs target in the WORKSPACE file as described
273+ in the rules_nodejs release notes. Also remove or comment out the now-stale
274+ links to "http://mirror.tensorflow.org/".
275+
276+ 3. Update npm packages scoped with `@bazel` in package.json using yarn.
277+ * Use the same version as the rules_nodejs version.
278+ * See the previous section for instructions on how to use yarn.
279+
280+ 4. Update the rules_sass target in the WORKSPACE file.
281+ * Examine https://github.com/bazelbuild/rules_sass/tags to see the list
282+ of rules_sass releases.
283+ * Pick a tag (the most recent is likely good enough) and use that version to
284+ modify the rules_sass target in the WORKSPACE file.
285+
286+ 5. Update the minimum bazel version to match the one supported by rules_nodejs:
287+ * Examine https://github.com/bazelbuild/rules_nodejs/blob/stable/index.bzl
288+ and find the SUPPORTED_BAZEL_VERSIONS constant.
289+ * Compare the minimum bazel version supported by rules_nodejs to the one we
290+ have specified in the WORKSPACE file. Modify the WORKSPACE file and
291+ ci.yml with a new minimum version, if necessary.
292+
293+ 6. Attempt to rebuild and test TensorBoard to make sure it works:
294+ * `rm -rf node_modules; bazel clean --expunge; yarn`
295+ * `bazel run tensorboard --logdir <your favorite logdir>`
296+ * `bazel test --test_output=errors tensorboard/webapp/...`
297+
298+ 7. The first attempt to rebuild and test TensorBoard rarely works. Investigate
299+ the problems and fix them. At this point, some of the special instructions in
300+ the rules_nodejs release notes (from Step 1) might be helpful.
301+
302+ 8. Generate mirrors for the new versions of rules_nodejs and rules_sass and
303+ update the WORKSPACE file with the new "http://mirror.tensorflow.org/" URLs.
304+ Googlers, see information at go/tensorboard-tf-mirror.
0 commit comments