From 32969882ec79c28e6dff8c1b66dd28a509ecf1e4 Mon Sep 17 00:00:00 2001 From: Taras Yemets Date: Tue, 12 Apr 2022 10:13:18 +0300 Subject: [PATCH] bext: refactor to use yarn workspaces in commands (#33700) --- client/browser/README.md | 2 +- client/browser/scripts/create-source-zip.js | 2 +- doc/dev/background-information/ci/index.md | 2 +- enterprise/dev/ci/internal/ci/operations.go | 14 +++++++------- package.json | 6 +++--- sg.config.yaml | 10 +++++----- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/client/browser/README.md b/client/browser/README.md index 636fe991b3c..33752220709 100644 --- a/client/browser/README.md +++ b/client/browser/README.md @@ -129,7 +129,7 @@ Click reload for Sourcegraph at `about:debugging` > **Note**: Requires MacOS with Xcode installed -1. `yarn --cwd client/browser dev:safari` +1. `yarn workspace @sourcegraph/browser dev:safari` 1. Open Safari then: `Develop > Allow Unsigned Extensions` 1. Open `client/browser/build/Sourcegraph for Safari/Sourcegraph for Safari.xcodeproj` using Xcode 1. Choose `Sourcegraph for Safari (macOS)` in the top toolbar and click Run icon diff --git a/client/browser/scripts/create-source-zip.js b/client/browser/scripts/create-source-zip.js index c6ae3d9615d..553c7166f3f 100644 --- a/client/browser/scripts/create-source-zip.js +++ b/client/browser/scripts/create-source-zip.js @@ -69,7 +69,7 @@ signale.success('Downloaded and unzipped sourcegraph/sourcegraph repository') if (includeCodeIntelExtensions) { shelljs.pushd(rootDirectoryNameForZip) shelljs.exec('yarn install') - shelljs.exec('yarn --cwd client/browser run fetch-code-intel-extensions') + shelljs.exec('yarn workspace @sourcegraph/browser run fetch-code-intel-extensions') shelljs.popd() } diff --git a/doc/dev/background-information/ci/index.md b/doc/dev/background-information/ci/index.md index ecabd6690fb..693c1aeadec 100644 --- a/doc/dev/background-information/ci/index.md +++ b/doc/dev/background-information/ci/index.md @@ -234,7 +234,7 @@ Will result in a single trace span for the `./dev/check/docsite.sh` script. But pipeline.AddStep(fmt.Sprintf(":%s: Puppeteer tests for %s extension", browser, browser), // ... bk.Cmd("yarn --frozen-lockfile --network-timeout 60000"), - bk.Cmd("yarn --cwd client/browser -s run build"), + bk.Cmd("yarn workspace @sourcegraph/browser -s run build"), bk.Cmd("yarn run cover-browser-integration"), bk.Cmd("yarn nyc report -r json"), bk.Cmd("dev/ci/codecov.sh -c -F typescript -F integration"), diff --git a/enterprise/dev/ci/internal/ci/operations.go b/enterprise/dev/ci/internal/ci/operations.go index baa5a3a39b4..5099f38690f 100644 --- a/enterprise/dev/ci/internal/ci/operations.go +++ b/enterprise/dev/ci/internal/ci/operations.go @@ -225,7 +225,7 @@ func addBrowserExt(pipeline *bk.Pipeline) { // bk.Env("POLLYJS_MODE", "replay"), // ensure that we use existing recordings // bk.Cmd("git-lfs fetch"), // bk.Cmd("yarn --frozen-lockfile --network-timeout 60000"), - // bk.Cmd("yarn --cwd client/browser -s run build"), + // bk.Cmd("yarn workspace @sourcegraph/browser -s run build"), // bk.Cmd("yarn run cover-browser-integration"), // bk.Cmd("yarn nyc report -r json"), // bk.Cmd("dev/ci/codecov.sh -c -F typescript -F integration"), @@ -417,7 +417,7 @@ func addBrowserExtensionE2ESteps(pipeline *bk.Pipeline) { bk.Env("LOG_BROWSER_CONSOLE", "true"), bk.Env("SOURCEGRAPH_BASE_URL", "https://sourcegraph.com"), bk.Cmd("yarn --frozen-lockfile --network-timeout 60000"), - bk.Cmd("yarn --cwd client/browser -s run build"), + bk.Cmd("yarn workspace @sourcegraph/browser -s run build"), bk.Cmd("yarn -s mocha ./client/browser/src/end-to-end/github.test.ts ./client/browser/src/end-to-end/gitlab.test.ts"), bk.ArtifactPaths("./puppeteer/*.png")) } @@ -433,21 +433,21 @@ func addBrowserExtensionReleaseSteps(pipeline *bk.Pipeline) { pipeline.AddStep(":rocket::chrome: Extension release", withYarnCache(), bk.Cmd("yarn --frozen-lockfile --network-timeout 60000"), - bk.Cmd("yarn --cwd client/browser -s run build"), - bk.Cmd("yarn --cwd client/browser release:chrome")) + bk.Cmd("yarn workspace @sourcegraph/browser -s run build"), + bk.Cmd("yarn workspace @sourcegraph/browser release:chrome")) // Build and self sign the FF add-on and upload it to a storage bucket pipeline.AddStep(":rocket::firefox: Extension release", withYarnCache(), bk.Cmd("yarn --frozen-lockfile --network-timeout 60000"), - bk.Cmd("yarn --cwd client/browser release:firefox")) + bk.Cmd("yarn workspace @sourcegraph/browser release:firefox")) // Release to npm pipeline.AddStep(":rocket::npm: npm Release", withYarnCache(), bk.Cmd("yarn --frozen-lockfile --network-timeout 60000"), - bk.Cmd("yarn --cwd client/browser -s run build"), - bk.Cmd("yarn --cwd client/browser release:npm")) + bk.Cmd("yarn workspace @sourcegraph/browser -s run build"), + bk.Cmd("yarn workspace @sourcegraph/browser release:npm")) } // Adds a Buildkite pipeline "Wait". diff --git a/package.json b/package.json index 537add59e02..f6188e68feb 100644 --- a/package.json +++ b/package.json @@ -24,10 +24,10 @@ "test": "jest --testPathIgnorePatterns end-to-end regression integration storybook /out/.*test.js", "test-integration:base": "TS_NODE_PROJECT=client/web/src/integration/tsconfig.json mocha --parallel=$CI --retries=1 --jobs=2", "test-integration": "yarn test-integration:base \"./client/web/src/integration/**/*.test.ts\"", - "test-browser-integration": "yarn --cwd client/browser run test-integration", + "test-browser-integration": "yarn workspace @sourcegraph/browser run test-integration", "cover-integration:base": "nyc --hook-require=false yarn test-integration:base", "cover-integration": "nyc --hook-require=false yarn test-integration", - "cover-browser-integration": "nyc --hook-require=false yarn --cwd client/browser test-integration", + "cover-browser-integration": "nyc --hook-require=false yarn workspace @sourcegraph/browser test-integration", "test-lighthouse": "SOURCEGRAPH_API_URL=https://sourcegraph.com lhci collect && lhci open", "test-e2e": "TS_NODE_PROJECT=client/web/src/end-to-end/tsconfig.json mocha ./client/web/src/end-to-end/**/*.test.ts", "cover-e2e": "nyc --hook-require=false --silent=true yarn test-e2e", @@ -44,7 +44,7 @@ "deduplicate": "yarn-deduplicate -s fewer", "release": "cd dev/release && yarn run release", "docsite:serve": "./dev/docsite.sh -config doc/docsite.json serve -http=localhost:5080", - "build-browser-extension": "yarn --cwd client/browser run build", + "build-browser-extension": "yarn workspace @sourcegraph/browser run build", "install:sg": "dev/sg/install.sh", "optimize-svg-assets": "svgo --multipass --config=\"./svgo.config.js\"" }, diff --git a/sg.config.yaml b/sg.config.yaml index 46463cf7a19..0d98c547c52 100644 --- a/sg.config.yaml +++ b/sg.config.yaml @@ -693,7 +693,7 @@ commands: cmd: env bext: - cmd: yarn --cwd client/browser dev + cmd: yarn workspace @sourcegraph/browser dev install: yarn defaultCommandset: enterprise @@ -944,16 +944,16 @@ tests: install: ENTERPRISE=1 yarn build-web bext: - cmd: yarn --cwd client/browser test + cmd: yarn workspace @sourcegraph/browser test bext-build: - cmd: EXTENSION_PERMISSIONS_ALL_URLS=true yarn --cwd client/browser build + cmd: EXTENSION_PERMISSIONS_ALL_URLS=true yarn workspace @sourcegraph/browser build bext-integration: - cmd: POLLYJS_MODE=replay yarn --cwd client/browser test-integration + cmd: POLLYJS_MODE=replay yarn workspace @sourcegraph/browser test-integration bext-e2e: - cmd: yarn --cwd client/browser mocha ./src/end-to-end/github.test.ts ./src/end-to-end/gitlab.test.ts + cmd: yarn workspace @sourcegraph/browser mocha ./src/end-to-end/github.test.ts ./src/end-to-end/gitlab.test.ts env: SOURCEGRAPH_BASE_URL: https://sourcegraph.com