Skip to content

Commit 66f5b25

Browse files
authored
fix(quick-edit): deploy script setup (#6624)
1 parent f30c61f commit 66f5b25

File tree

7 files changed

+37
-16
lines changed

7 files changed

+37
-16
lines changed

.changeset/bright-radios-fail.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@cloudflare/quick-edit": patch
3+
---
4+
5+
fix: quick editor deploy script setup

.github/workflows/deploy-pages-previews.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,7 @@ jobs:
5858
if: contains(github.event.*.labels.*.name, 'preview:quick-edit')
5959
# Quick Edit requires yarn and VS Code build deps, so needs fairly specific logic
6060
run: |
61-
sudo apt-get install -y libkrb5-dev
62-
yarn global add node-gyp
6361
cd packages/quick-edit
64-
yarn setup
65-
yarn custom:build
6662
pnpm run deploy
6763
env:
6864
DEBIAN_FRONTEND: noninteractive

packages/quick-edit-extension/scripts/bundle.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ type BuildFlags = {
77

88
async function buildMain(flags: BuildFlags = {}) {
99
const options: esbuild.BuildOptions = {
10-
watch: flags.watch,
1110
entryPoints: ["./src/extension.ts"],
1211
bundle: true,
1312
outfile: "./dist/extension.js",
@@ -41,15 +40,18 @@ async function buildMain(flags: BuildFlags = {}) {
4140
],
4241
};
4342

44-
await esbuild.build(options);
43+
if (flags.watch) {
44+
const ctx = await esbuild.context(options);
45+
46+
// Start watching for changes...
47+
await ctx.watch();
48+
} else {
49+
await esbuild.build(options);
50+
}
4551
}
4652

4753
async function run() {
48-
await buildMain();
49-
if (process.argv.includes("--watch")) {
50-
console.log("Built. Watching for changes...");
51-
await Promise.all([buildMain({ watch: true })]);
52-
}
54+
await buildMain({ watch: process.argv.includes("--watch") });
5355
}
5456

5557
run().catch((e) => {

packages/quick-edit/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ This package contains Cloudflare's fork VSCode for Web, to support web editing o
66

77
1. You must switch your NodeJS version to NodeJS 18 (using a tool like nvm). VSCode's build process requires this. For instance, if you use `nvm`, running `nvm use` would be enough to switch to the correct NodeJS version.
88
2. Run `pnpm install`
9-
3. Run `yarn setup`, which will install dependencies, clone VSCode (currently v1.85.2), apply the patches specified in `./patches`, and symlink the top level packages within `workers-sdk`.
9+
3. Run `pnpm run setup`, which will install dependencies, clone VSCode (currently v1.85.2), apply the patches specified in `./patches`, and symlink the top level packages within `workers-sdk`.
1010
4. Run `pnpm run dev`. This will start various dev servers for VSCode and `quick-edit-extension`. Note, this takes a _long_ time to start up. Expect up to 3 minutes, although reloads will be much faster. You can access the VSCode dev server at `http://localhost:8788`
1111

1212
## Building
1313

14-
Follow steps (1), (2) and (3) from above, and then run `yarn custom:build`
14+
Follow steps (1), (2) and (3) from above, and then run `pnpm run custom:build`
1515

1616
## Deployment
1717

@@ -26,7 +26,7 @@ Deployments are managed by Github Actions:
2626

2727
## Patching VSCode
2828

29-
If you need to add additional patches to VSCode, ensure you've run `yarn setup`. Then:
29+
If you need to add additional patches to VSCode, ensure you've run `pnpm run setup`. Then:
3030

3131
1. Make your changes in the checked out VSCode in `vendor/vscode`.
3232
2. Commit your changes with `git commit -m "YOUR MESSAGE" --no-verify` (run this in the `vendor/vscode` directory).

packages/quick-edit/build.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
set -eu
22

3+
# The preinstall script in vscode will fail if npm_execpath is not set by yarn
4+
# This make sure the env is unset so yarn can set it accordingly
5+
unset npm_execpath
6+
# We cannot run yarn without disabling the corepack check as the packageManager field is set to pnpm
7+
SKIP_YARN_COREPACK_CHECK=0
8+
39
# Cleanup development symlink to vscode
410
rm -f web/assets
511

packages/quick-edit/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"check:lint": "eslint functions --max-warnings=0",
1414
"check:type": "tsc",
1515
"custom:build": "./build.sh",
16-
"deploy": "CLOUDFLARE_ACCOUNT_ID=e35fd947284363a46fd7061634477114 pnpm exec wrangler pages deploy --project-name quick-edit ./web",
16+
"deploy": "pnpm run setup && pnpm run custom:build && CLOUDFLARE_ACCOUNT_ID=e35fd947284363a46fd7061634477114 pnpm exec wrangler pages deploy --project-name quick-edit ./web",
1717
"dev": "concurrently 'pnpm exec wrangler pages dev ./web' 'npm --prefix web/quick-edit-extension run watch-web' 'yarn --cwd ../../vendor/vscode watch' 'yarn --cwd ../../vendor/vscode watch-web'",
1818
"setup": "rm -rf web/assets web/quick-edit-extension && ./setup.sh"
1919
},

packages/quick-edit/setup.sh

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
11
set -eu
2+
# The preinstall script in vscode will fail if npm_execpath is not set by yarn
3+
# This make sure the env is unset so yarn can set it accordingly
4+
unset npm_execpath
5+
26
# The upstream VSCode version (tag) to build from
37
VERSION="1.85.2"
8+
# We cannot run yarn without disabling the corepack check as the packageManager field is set to pnpm
9+
SKIP_YARN_COREPACK_CHECK=0
10+
11+
# Setup for the CI environment
12+
if [ -n "${CI:-}" ]; then
13+
sudo apt-get install -y libkrb5-dev
14+
yarn global add node-gyp
15+
fi
416

517
rm -rf web
618
rm -rf ../../vendor/vscode
@@ -22,7 +34,7 @@ git config user.email "[email protected]"
2234
git config user.name "Workers DevProd"
2335

2436
git am ../../packages/quick-edit/patches/*.patch
25-
pnpm exec yarn
37+
yarn install
2638
cd ../../packages/quick-edit
2739
pnpm exec tsx bundle-dts.ts
2840
ln -s $PWD/../../vendor/vscode $PWD/web/assets

0 commit comments

Comments
 (0)