From a61dc2775ab35dd77af1ee27abd32e8d7b2c742d Mon Sep 17 00:00:00 2001 From: Quinn Slack Date: Fri, 6 Oct 2023 08:57:12 -0700 Subject: [PATCH] rename env var WEBPACK_DEV_SERVER to WEB_BUILDER_DEV_SERVER (#57410) This env var was already used when running either Webpack or esbuild. In the future Webpack will no longer be used, so a more general name not tied to the specific bundler is best. (Command: `fastmod -e yaml,go,md WEBPACK_DEV_SERVER WEB_BUILDER_DEV_SERVER`) --- cmd/frontend/internal/app/ui/handlers.go | 4 ++-- cmd/frontend/internal/app/ui/tmpl.go | 2 +- cmd/frontend/main.go | 2 +- cmd/sourcegraph/main.go | 2 +- dev/sg/sg.config.example.yaml | 4 ++-- sg.config.yaml | 6 +++--- ui/assets/doc.go | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/cmd/frontend/internal/app/ui/handlers.go b/cmd/frontend/internal/app/ui/handlers.go index 404d97b5008..544adc76475 100644 --- a/cmd/frontend/internal/app/ui/handlers.go +++ b/cmd/frontend/internal/app/ui/handlers.go @@ -91,7 +91,7 @@ type Common struct { Manifest *assets.WebpackManifest - WebpackDevServer bool // whether the Webpack dev server is running (WEBPACK_DEV_SERVER env var) + WebpackDevServer bool // whether the Webpack dev server is running (WEB_BUILDER_DEV_SERVER env var) // The fields below have zero values when not on a repo page. Repo *types.Repo @@ -99,7 +99,7 @@ type Common struct { api.CommitID // resolved SHA1 revision } -var webpackDevServer, _ = strconv.ParseBool(os.Getenv("WEBPACK_DEV_SERVER")) +var webpackDevServer, _ = strconv.ParseBool(os.Getenv("WEB_BUILDER_DEV_SERVER")) // repoShortName trims the first path element of the given repo name if it has // at least two path components. diff --git a/cmd/frontend/internal/app/ui/tmpl.go b/cmd/frontend/internal/app/ui/tmpl.go index 0f9d76cfeb2..4fa4c5b251f 100644 --- a/cmd/frontend/internal/app/ui/tmpl.go +++ b/cmd/frontend/internal/app/ui/tmpl.go @@ -31,7 +31,7 @@ var ( versionCacheMu sync.RWMutex versionCache = make(map[string]string) - _, noAssetVersionString = os.LookupEnv("WEBPACK_DEV_SERVER") + _, noAssetVersionString = os.LookupEnv("WEB_BUILDER_DEV_SERVER") ) // Functions that are exposed to templates. diff --git a/cmd/frontend/main.go b/cmd/frontend/main.go index 7d05c9a0cbe..8dc56a49e3e 100644 --- a/cmd/frontend/main.go +++ b/cmd/frontend/main.go @@ -16,7 +16,7 @@ import ( func main() { sanitycheck.Pass() - if os.Getenv("WEBPACK_DEV_SERVER") == "1" { + if os.Getenv("WEB_BUILDER_DEV_SERVER") == "1" { assets.UseDevAssetsProvider() } svcmain.SingleServiceMainWithoutConf(shared.Service, svcmain.Config{}, svcmain.OutOfBandConfiguration{ diff --git a/cmd/sourcegraph/main.go b/cmd/sourcegraph/main.go index 1b67a5e3431..94ff9f1dc54 100644 --- a/cmd/sourcegraph/main.go +++ b/cmd/sourcegraph/main.go @@ -42,7 +42,7 @@ var services = []service.Service{ func main() { sanitycheck.Pass() - if os.Getenv("WEBPACK_DEV_SERVER") == "1" { + if os.Getenv("WEB_BUILDER_DEV_SERVER") == "1" { assets.UseDevAssetsProvider() } osscmd.MainOSS(services, os.Args) diff --git a/dev/sg/sg.config.example.yaml b/dev/sg/sg.config.example.yaml index ce876758301..219306f1cb9 100644 --- a/dev/sg/sg.config.example.yaml +++ b/dev/sg/sg.config.example.yaml @@ -25,7 +25,7 @@ commands: CONFIGURATION_MODE: server USE_ENHANCED_LANGUAGE_DETECTION: false # This needs to be set on `frontend` too so that `app.html` is rendered correctly - WEBPACK_DEV_SERVER: 1 + WEB_BUILDER_DEV_SERVER: 1 watch: - internal - cmd/frontend @@ -76,7 +76,7 @@ commands: cmd: ./node_modules/.bin/gulp --silent --color dev install: pnpm install env: - WEBPACK_DEV_SERVER: 1 + WEB_BUILDER_DEV_SERVER: 1 NODE_ENV: development NODE_OPTIONS: '--max_old_space_size=8192' diff --git a/sg.config.yaml b/sg.config.yaml index 8da55896941..659a1d77624 100644 --- a/sg.config.yaml +++ b/sg.config.yaml @@ -168,7 +168,7 @@ commands: SITE_CONFIG_FILE: "../dev-private/enterprise/dev/site-config.json" SITE_CONFIG_ESCAPE_HATCH_PATH: "$HOME/.sourcegraph/site-config.json" # frontend processes need this to be so that the paths to the assets are rendered correctly - WEBPACK_DEV_SERVER: 1 + WEB_BUILDER_DEV_SERVER: 1 watch: - lib - internal @@ -938,7 +938,7 @@ commands: env: SITE_CONFIG_FILE: "../dev-private/enterprise/dev/site-config.json" SITE_CONFIG_ESCAPE_HATCH_PATH: "$HOME/.sourcegraph/site-config.json" - WEBPACK_DEV_SERVER: 1 + WEB_BUILDER_DEV_SERVER: 1 watch: - cmd - enterprise @@ -990,7 +990,7 @@ bazelCommands: SITE_CONFIG_FILE: "../dev-private/enterprise/dev/site-config.json" SITE_CONFIG_ESCAPE_HATCH_PATH: "$HOME/.sourcegraph/site-config.json" # frontend processes need this to be so that the paths to the assets are rendered correctly - WEBPACK_DEV_SERVER: 1 + WEB_BUILDER_DEV_SERVER: 1 worker: target: //cmd/worker precmd: | diff --git a/ui/assets/doc.go b/ui/assets/doc.go index f2c24d87c07..5ed4022f252 100644 --- a/ui/assets/doc.go +++ b/ui/assets/doc.go @@ -11,7 +11,7 @@ // And to support working with dev assets, with the webpack process handling them for you, you can use: // // func main() { -// if os.Getenv("WEBPACK_DEV_SERVER") == "1" { +// if os.Getenv("WEB_BUILDER_DEV_SERVER") == "1" { // assets.UseDevAssetsProvider() // } // // ...