Skip to content

Commit 94ba8d3

Browse files
committed
dev: remove stale --oss flag from ui subcommand
The `dev ui watch` command and its helpers contained a boolean `--oss` flag and corresponding logic to build only the open-source parts of the UI. This build path is no longer used, as development now exclusively targets the CCL version. This change completely removes the `--oss` flag, its constant, and all related conditional logic within `pkg/cmd/dev/ui.go`. The build process for `dev ui watch` is now streamlined to always build the CCL version. As part of this cleanup, the `arrangeFilesForWatchers` helper function was refactored to remove the now-redundant `ossOnly` parameter, simplifying its signature and call sites in the `test` and `storybook` subcommands as well. This resolves a piece of technical debt, making the UI development tooling easier to understand and maintain. Fixes #136606 Release note (cli change): Removed the stale `--oss` flag from the `dev ui watch` subcommand. This flag was no longer in use, as the UI development workflow now exclusively targets the CCL build. This change simplifies the tool by removing an unused build path and potential confusion for developers.
1 parent 314510c commit 94ba8d3

File tree

3 files changed

+11
-52
lines changed

3 files changed

+11
-52
lines changed

dev

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ fi
88
set -euo pipefail
99

1010
# Bump this counter to force rebuilding `dev` on all machines.
11-
DEV_VERSION=110
11+
DEV_VERSION=111
1212

1313
THIS_DIR=$(cd "$(dirname "$0")" && pwd)
1414
BINARY_DIR=$THIS_DIR/bin/dev-versions

pkg/cmd/dev/testdata/datadriven/ui

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,6 @@ pnpm --dir crdb-checkout/pkg/ui/workspaces/cluster-ui run build:watch
1616
pnpm --dir crdb-checkout/pkg/ui/workspaces/cluster-ui run tsc:watch
1717
pnpm --dir crdb-checkout/pkg/ui/workspaces/db-console exec webpack-dev-server --config webpack.config.js --mode development --env.WEBPACK_SERVE --env.dist=ccl --env.target=http://localhost:8080 --port 3000
1818

19-
exec
20-
dev ui watch --oss
21-
----
22-
bazel info workspace --color=no
23-
pnpm --dir crdb-checkout/pkg/ui install
24-
bazel build //pkg/ui/workspaces/cluster-ui:cluster-ui-lib
25-
bazel info bazel-bin --color=no
26-
bazel info workspace --color=no
27-
cp sandbox/pkg/ui/workspaces/db-console/src/js/protos.js crdb-checkout/pkg/ui/workspaces/db-console/src/js/protos.js
28-
cp sandbox/pkg/ui/workspaces/db-console/src/js/protos.d.ts crdb-checkout/pkg/ui/workspaces/db-console/src/js/protos.d.ts
29-
rm -rf crdb-checkout/pkg/ui/workspaces/cluster-ui/dist
30-
cp -r sandbox/pkg/ui/workspaces/cluster-ui/dist crdb-checkout/pkg/ui/workspaces/cluster-ui/dist
31-
pnpm --dir crdb-checkout/pkg/ui/workspaces/cluster-ui run build:watch
32-
pnpm --dir crdb-checkout/pkg/ui/workspaces/cluster-ui run tsc:watch
33-
pnpm --dir crdb-checkout/pkg/ui/workspaces/db-console exec webpack-dev-server --config webpack.config.js --mode development --env.WEBPACK_SERVE --env.dist=oss --env.target=http://localhost:8080 --port 3000
34-
3519
exec
3620
dev ui watch --secure
3721
----

pkg/cmd/dev/ui.go

Lines changed: 10 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,6 @@ import (
1717
"github.com/spf13/cobra"
1818
)
1919

20-
const (
21-
// ossFlag is the name of the boolean long (GNU-style) flag that builds only
22-
// the open-source parts of the UI.
23-
ossFlag = "oss"
24-
)
25-
2620
// makeUICmd initializes the top-level 'ui' subcommand.
2721
func makeUICmd(d *dev) *cobra.Command {
2822
uiCmd := &cobra.Command{
@@ -288,11 +282,6 @@ Replaces 'make ui-watch'.`,
288282
return err
289283
}
290284

291-
isOss, err := cmd.Flags().GetBool(ossFlag)
292-
if err != nil {
293-
return err
294-
}
295-
296285
// Ensure node dependencies are up-to-date.
297286
err = d.exec.CommandContextInheritingStdStreams(
298287
ctx,
@@ -309,13 +298,11 @@ Replaces 'make ui-watch'.`,
309298
args := []string{
310299
"build",
311300
"//pkg/ui/workspaces/cluster-ui:cluster-ui-lib",
312-
}
313-
if !isOss {
314-
args = append(args, "//pkg/ui/workspaces/db-console/ccl/src/js:crdb-protobuf-client-ccl-lib")
315-
args = append(args, "//pkg/ui/workspaces/db-console/src/js:crdb-protobuf-client_files")
316-
args = append(args, "//pkg/ui/workspaces/db-console/src/js:crdb-protobuf-client")
317-
args = append(args, "//pkg/ui/workspaces/db-console/ccl/src/js:crdb-protobuf-client-ccl_files")
318-
args = append(args, "//pkg/ui/workspaces/db-console/ccl/src/js:crdb-protobuf-client-ccl")
301+
"//pkg/ui/workspaces/db-console/ccl/src/js:crdb-protobuf-client-ccl-lib",
302+
"//pkg/ui/workspaces/db-console/src/js:crdb-protobuf-client_files",
303+
"//pkg/ui/workspaces/db-console/src/js:crdb-protobuf-client",
304+
"//pkg/ui/workspaces/db-console/ccl/src/js:crdb-protobuf-client-ccl_files",
305+
"//pkg/ui/workspaces/db-console/ccl/src/js:crdb-protobuf-client-ccl",
319306
}
320307
logCommand("bazel", args...)
321308
err = d.exec.CommandContextInheritingStdStreams(ctx, "bazel", args...)
@@ -325,7 +312,7 @@ Replaces 'make ui-watch'.`,
325312
return err
326313
}
327314

328-
if err := arrangeFilesForWatchers(d, isOss); err != nil {
315+
if err := arrangeFilesForWatchers(d); err != nil {
329316
log.Fatalf("failed to arrange files for watchers: %v", err)
330317
return err
331318
}
@@ -382,13 +369,6 @@ Replaces 'make ui-watch'.`,
382369
}
383370
}
384371

385-
var webpackDist string
386-
if isOss {
387-
webpackDist = "oss"
388-
} else {
389-
webpackDist = "ccl"
390-
}
391-
392372
args = []string{
393373
"--dir",
394374
dirs.dbConsole,
@@ -399,7 +379,7 @@ Replaces 'make ui-watch'.`,
399379
// Polyfill WEBPACK_SERVE for webpack v4; it's set in webpack v5 via
400380
// `webpack serve`.
401381
"--env.WEBPACK_SERVE",
402-
"--env.dist=" + webpackDist,
382+
"--env.dist=ccl",
403383
"--env.target=" + dbTarget,
404384
"--port", port,
405385
}
@@ -425,7 +405,6 @@ Replaces 'make ui-watch'.`,
425405
watchCmd.Flags().Int16P(portFlag, "p", 3000, "port to serve UI on")
426406
watchCmd.Flags().String(dbTargetFlag, "http://localhost:8080", "url to proxy DB requests to")
427407
watchCmd.Flags().Bool(secureFlag, false, "serve via HTTPS")
428-
watchCmd.Flags().Bool(ossFlag, false, "build only the open-source parts of the UI")
429408
watchCmd.Flags().StringArray(
430409
clusterUiDestinationsFlag,
431410
[]string{},
@@ -482,7 +461,7 @@ func makeUIStorybookCmd(d *dev) *cobra.Command {
482461
return err
483462
}
484463

485-
if err := arrangeFilesForWatchers(d /* ossOnly */, false); err != nil {
464+
if err := arrangeFilesForWatchers(d); err != nil {
486465
log.Fatalf("failed to arrange files for watchers: %v", err)
487466
return err
488467
}
@@ -745,7 +724,7 @@ func makeUICleanCmd(d *dev) *cobra.Command {
745724
// mode) to be executed from directly within a pkg/ui/workspaces/... directory.
746725
//
747726
// See https://github.com/bazelbuild/rules_nodejs/issues/2028
748-
func arrangeFilesForWatchers(d *dev, ossOnly bool) error {
727+
func arrangeFilesForWatchers(d *dev) error {
749728
bazelBin, err := d.getBazelBin(d.cli.Context(), []string{})
750729
if err != nil {
751730
return err
@@ -773,10 +752,6 @@ func arrangeFilesForWatchers(d *dev, ossOnly bool) error {
773752
return err
774753
}
775754

776-
if ossOnly {
777-
continue
778-
}
779-
780755
cclDst := filepath.Join(dbConsoleCclDst, relPath)
781756
if err := d.os.CopyFile(filepath.Join(dbConsoleCclSrc, relPath), cclDst); err != nil {
782757
return err
@@ -845,7 +820,7 @@ Replaces 'make ui-test' and 'make ui-test-watch'.`,
845820
return err
846821
}
847822

848-
err = arrangeFilesForWatchers(d, false /* ossOnly */)
823+
err = arrangeFilesForWatchers(d)
849824
if err != nil {
850825
// nolint:errwrap
851826
return fmt.Errorf("unable to arrange files properly for watch-mode testing: %+v", err)

0 commit comments

Comments
 (0)