Skip to content

build: add deploy preview of the Vega editor#3925

Merged
hydrosquall merged 16 commits intomainfrom
cameron.yick/deploy-previews-vega
May 24, 2024
Merged

build: add deploy preview of the Vega editor#3925
hydrosquall merged 16 commits intomainfrom
cameron.yick/deploy-previews-vega

Conversation

@hydrosquall
Copy link
Copy Markdown
Member

@hydrosquall hydrosquall commented May 19, 2024

Motivation

Changes

  • Set explicit yarn and node versions so that the build step can succeed in Cloudflare CI
  • Move installing data out of the postinstall as it was causing the initial install to break. I moved it to a docs building step
  • Add a build script for setting up a site deploy preview

Testing

image

@hydrosquall hydrosquall changed the title build: add deploy preview for the vega editor build: add deploy preview of the Vega editor May 19, 2024
@hydrosquall hydrosquall force-pushed the cameron.yick/deploy-previews-vega branch from e4e9ddb to cfb8f33 Compare May 19, 2024 20:22
@hydrosquall hydrosquall force-pushed the cameron.yick/deploy-previews-vega branch from cfb8f33 to 8aeb370 Compare May 19, 2024 20:24
@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented May 19, 2024

Deploying vega with  Cloudflare Pages  Cloudflare Pages

Latest commit: bd6d74e
Status: ✅  Deploy successful!
Preview URL: https://654eaa71.vega-628.pages.dev
Branch Preview URL: https://cameron-yick-deploy-previews.vega-628.pages.dev

View logs

@hydrosquall hydrosquall force-pushed the cameron.yick/deploy-previews-vega branch from 5429e38 to 4858d26 Compare May 19, 2024 20:28
@hydrosquall hydrosquall force-pushed the cameron.yick/deploy-previews-vega branch from 4858d26 to 2ea19fd Compare May 19, 2024 20:29
Comment thread package.json
"workspaces": [
"packages/*"
],
"engines": {
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

Comment thread package.json
"engines": {
"node": ">=18.18.0"
},
"packageManager": "yarn@1.22.19"
Copy link
Copy Markdown
Member Author

@hydrosquall hydrosquall May 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without this, we get an auto-upgrade to yarn 3.

16:26:44.651 | Detected the following tools from environment: yarn@3.6.3, nodejs@18.17.1
-- | --
16:26:44.651 | Installing project dependencies: yarn
16:26:45.212 | ➤ YN0070: Migrating from Yarn 1; automatically enabling the compatibility node-modules linker 👍
16:26:45.212 |  
16:26:45.342 | ➤ YN0000: ┌ Resolution step
16:26:46.174 | ➤ YN0032: │ canvas@npm:2.11.2: Implicit dependencies on node-gyp are discouraged
16:26:46.421 | ➤ YN0032: │ nan@npm:2.17.0: Implicit dependencies on node-gyp are discouraged
16:26:47.253 | ➤ YN0032: │ fsevents@npm:2.3.2: Implicit dependencies on node-gyp are discouraged
16:26:49.121 | ➤ YN0061: │ @npmcli/move-file@npm:2.0.1 is deprecated: This functionality has been moved to @npmcli/fs
16:26:49.642 | ➤ YN0061: │ request@npm:2.88.2 is deprecated: request has been deprecated, see https://github.com/request/request/issues/3142
16:26:49.660 | ➤ YN0061: │ uuid@npm:3.4.0 is deprecated: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
16:26:49.815 | ➤ YN0061: │ har-validator@npm:5.1.5 is deprecated: this library is no longer supported
16:26:50.972 | ➤ YN0032: │ @parcel/watcher@npm:2.0.4: Implicit dependencies on node-gyp are discouraged
16:26:51.046 | ➤ YN0032: │ node-addon-api@npm:3.2.1: Implicit dependencies on node-gyp are discouraged
16:27:01.937 | ➤ YN0002: │ @nrwl/devkit@npm:16.10.0 doesn't provide nx (p048f2), requested by @nx/devkit
16:27:01.937 | ➤ YN0060: │ root-workspace-0b6124@workspace:. provides eslint (p1305c) with version 8.53.0, which doesn't satisfy what typescript-eslint and some of its descendants request
16:27:01.938 | ➤ YN0000: │ Some peer dependencies are incorrectly met; run yarn explain peer-requirements <hash> for details, where <hash> is the six-letter p-prefixed code
16:27:01.942 | ➤ YN0000: └ Completed in 16s 599ms
16:27:02.015 | ➤ YN0000: ┌ Post-resolution validation
16:27:02.016 | ➤ YN0028: │ The lockfile would have been modified by this install, which is explicitly forbidden.


@hydrosquall hydrosquall force-pushed the cameron.yick/deploy-previews-vega branch 2 times, most recently from 99f2f6f to 550a7ee Compare May 19, 2024 20:51
@hydrosquall hydrosquall force-pushed the cameron.yick/deploy-previews-vega branch from 550a7ee to 5c08192 Compare May 19, 2024 20:56
@hydrosquall hydrosquall force-pushed the cameron.yick/deploy-previews-vega branch from 86866e9 to 7a8c8f0 Compare May 19, 2024 21:27
@hydrosquall hydrosquall force-pushed the cameron.yick/deploy-previews-vega branch from 0d17c99 to ae5c73c Compare May 19, 2024 21:42
Comment thread package.json
"test:no-lint": "lerna run test --ignore vega-typings && lerna run test --scope vega-typings",
"lint": "ESLINT_USE_FLAT_CONFIG=true yarn eslint -c eslint.config.mjs .",
"format": "yarn lint --fix",
"postinstall": "yarn data"
Copy link
Copy Markdown
Member Author

@hydrosquall hydrosquall May 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we must keep this as a postinstall step and can't move this to docsbuild, an alternate approach would be to replace this with a guard so that I can disable the postinstall step with an env variable.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Convinced myself it would be less of a change for existing devs to take this route.

d4bacf0

Comment thread package.json Outdated
"node": ">=18.18.0"
},
"packageManager": "yarn@1.22.19",
"volta": {
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recommended node version manager - can drop this if it's distracting / people prefer to bring their own node version management solution

https://volta.sh/

As it stands, you won't be able to build the project if you have an older version (like node 18.15) running locally.

@hydrosquall hydrosquall force-pushed the cameron.yick/deploy-previews-vega branch from f2886e1 to d4bacf0 Compare May 22, 2024 02:46
@hydrosquall hydrosquall force-pushed the cameron.yick/deploy-previews-vega branch from d4bacf0 to 9c7fb3f Compare May 22, 2024 02:48
@hydrosquall hydrosquall self-assigned this May 22, 2024
@hydrosquall hydrosquall marked this pull request as ready for review May 22, 2024 03:10
@hydrosquall hydrosquall requested a review from a team as a code owner May 22, 2024 03:10
Copy link
Copy Markdown
Member

@domoritz domoritz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove logs of course.

Comment thread package.json Outdated
"node": ">=18.18.0"
},
"packageManager": "yarn@1.22.19",
"volta": {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's remove this. I use Volta but not everyone does and I like to use node 20+ since 18 is pretty old now.

echo "Installing Vega"

# Link every package to make sure the editor uses the local version
for package in packages/*; do
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't lerna do this?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lerna can handle running a command in every package, but for linking it delegates to yarn / npm https://lerna.js.org/docs/legacy-package-management#migrating-from-lerna-bootstrap-lerna-add-and-lerna-link-in-lerna-v7-and-later

It's supposed to prefer the local version if that packages the package version but the bug we're currently facing in vega is that multiple versions of the subpackages are active at once

image

image

The yarn monorepo solution for this is the workspaces:* protocol so we can make the package prefer the version in this monorepo, the specific version number would be replaced on the publish step. To use it we would have to upgrade to yarn v2 and up.

I think that move is worth it, but didn't want to get that tied up in the scope of this PR.

Comment thread scripts/build-editor-preview.sh Outdated
cd editor
yarn --frozen-lockfile --ignore-scripts

# Make sure we prefer the local version to the one from npm
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like a hack. What goes wrong if we didn't have this?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd agree this is a hack, ideally we shouldn't need to install these from NPM

Ideally we can remove this after we run through and make sure there's only 1 version of each package ( @lsh mentioned he might get to look into it in the vega slack , I didn't open a new issue for it )

Comment thread scripts/postinstall.sh
set -eo pipefail

# Run this script as long as the env variable
# DISABLE_POSTINSTALL_SCRIPT is not set.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is this set?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the CI dashboard config: https://dash.cloudflare.com//pages/view/vega/settings/environment-variables

image

@hydrosquall hydrosquall merged commit 11a33fb into main May 24, 2024
@hydrosquall hydrosquall deleted the cameron.yick/deploy-previews-vega branch May 24, 2024 03:13
@lsh lsh mentioned this pull request Jun 13, 2024
lsh pushed a commit that referenced this pull request Jun 14, 2024
Changes since v5.29.0

**vega-functions**
- make default vega format null as "null" (via #3926). (Thanks @kanitw &
@domoritz )!

**docs**
- Add 4 new examples (via #3851). (Thanks @avatorl & @domoritz!)

**monorepo**
- Deploy editor preview (via #3925, #3931). (Thanks @hydrosquall!)
- Bump all `vega-*` deps in topological order to eliminate version
mismatches within the monorepo (via #3932). (Thanks @lsh!)

Signed-off-by: Lukas Hermann <lukas.hermann@databricks.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

developer-experience: deployment previews for pull requests

2 participants