| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 5ffdb57 commit c522762
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -192,6 +192,14 @@ jobs: | |||
| 192 | 192 | cat temp-output | |
| 193 | 193 | tail -n1 temp-output | grep "NEW_VERSION=" >> "$GITHUB_ENV" || true | |
| 194 | 194 | rm temp-output | |
| 195 | + - id: uvwasi | ||
| 196 | + subsystem: deps | ||
| 197 | + label: dependencies | ||
| 198 | + run: | | ||
| 199 | + ./tools/dep_updaters/update-uvwasi.sh > temp-output | ||
| 200 | + cat temp-output | ||
| 201 | + tail -n1 temp-output | grep "NEW_VERSION=" >> "$GITHUB_ENV" || true | ||
| 202 | + rm temp-output | ||
| 195 | 203 | steps: | |
| 196 | 204 | - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 | |
| 197 | 205 | with: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -78,13 +78,6 @@ Node.js GitHub organization. As needed, an updated copy | |||
| 78 | 78 | is vendored into the Node.js deps in | |
| 79 | 79 | [deps/uvwasi](https://github.com/nodejs/node/tree/main/deps/uvwasi). | |
| 80 | 80 | ||
| 81 | - To update the copy of uvwasi in the Node.js deps: | ||
| 82 | - | ||
| 83 | - * Copy over the contents of `include` and `src` to the corresponding | ||
| 84 | - directories. | ||
| 85 | - * Check if any additional files have been added and need to be added | ||
| 86 | - to the `sources` list in `deps/uvwasi/uvwasi.gyp`. | ||
| 87 | - | ||
| 88 | 81 | In addition to the code from uvwasi, Node.js includes bindings and | |
| 89 | 82 | APIs that allow WebAssembly to be run with WASI support from Node.js. | |
| 90 | 83 | The documentation for this API is in | |
@@ -95,3 +88,12 @@ The implementation of the bindings and the public API is in: | |||
| 95 | 88 | * [src/node\_wasi.h](https://github.com/nodejs/node/blob/main/src/node_wasi.h) | |
| 96 | 89 | * [src/node\_wasi.cc](https://github.com/nodejs/node/blob/main/src/node_wasi.cc) | |
| 97 | 90 | * [lib/wasi.js](https://github.com/nodejs/node/blob/main/lib/wasi.js) | |
| 91 | + | ||
| 92 | + ### Running the update script | ||
| 93 | + | ||
| 94 | + The `tools/dep_updaters/update-uvwasi.sh` script automates the update of | ||
| 95 | + the uvwasi source files. | ||
| 96 | + | ||
| 97 | + ```bash | ||
| 98 | + ./tools/dep_updaters/update-uvwasi.sh | ||
| 99 | + ``` | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,78 @@ | |||
| 1 | + #!/bin/sh | ||
| 2 | + set -e | ||
| 3 | + # Shell script to update uvwasi in the source tree to a specific version | ||
| 4 | + | ||
| 5 | + BASE_DIR=$(cd "$(dirname "$0")/../.." && pwd) | ||
| 6 | + DEPS_DIR="$BASE_DIR/deps" | ||
| 7 | + | ||
| 8 | + [ -z "$NODE" ] && NODE="$BASE_DIR/out/Release/node" | ||
| 9 | + [ -x "$NODE" ] || NODE=$(command -v node) | ||
| 10 | + | ||
| 11 | + NEW_VERSION="$("$NODE" --input-type=module <<'EOF' | ||
| 12 | + const res = await fetch('https://api.github.com/repos/nodejs/uvwasi/releases/latest'); | ||
| 13 | + if (!res.ok) throw new Error(`FetchError: ${res.status} ${res.statusText}`, { cause: res }); | ||
| 14 | + const { tag_name } = await res.json(); | ||
| 15 | + console.log(tag_name.replace('v', '')); | ||
| 16 | + EOF | ||
| 17 | + )" | ||
| 18 | + | ||
| 19 | + CURRENT_MAJOR_VERSION=$(grep "#define UVWASI_VERSION_MAJOR" "$DEPS_DIR/uvwasi/include/uvwasi.h" | sed -n "s/^.*MAJOR \(.*\)/\1/p") | ||
| 20 | + CURRENT_MINOR_VERSION=$(grep "#define UVWASI_VERSION_MINOR" "$DEPS_DIR/uvwasi/include/uvwasi.h" | sed -n "s/^.*MINOR \(.*\)/\1/p") | ||
| 21 | + CURRENT_PATCH_VERSION=$(grep "#define UVWASI_VERSION_PATCH" "$DEPS_DIR/uvwasi/include/uvwasi.h" | sed -n "s/^.*PATCH \(.*\)/\1/p") | ||
| 22 | + CURRENT_VERSION="$CURRENT_MAJOR_VERSION.$CURRENT_MINOR_VERSION.$CURRENT_PATCH_VERSION" | ||
| 23 | + | ||
| 24 | + echo "Comparing $NEW_VERSION with $CURRENT_VERSION" | ||
| 25 | + | ||
| 26 | + if [ "$NEW_VERSION" = "$CURRENT_VERSION" ]; then | ||
| 27 | + echo "Skipped because uvwasi is on the latest version." | ||
| 28 | + exit 0 | ||
| 29 | + fi | ||
| 30 | + | ||
| 31 | + echo "Making temporary workspace" | ||
| 32 | + | ||
| 33 | + WORKSPACE=$(mktemp -d 2> /dev/null || mktemp -d -t 'tmp') | ||
| 34 | + echo "$WORKSPACE" | ||
| 35 | + cleanup () { | ||
| 36 | + EXIT_CODE=$? | ||
| 37 | + [ -d "$WORKSPACE" ] && rm -rf "$WORKSPACE" | ||
| 38 | + exit $EXIT_CODE | ||
| 39 | + } | ||
| 40 | + | ||
| 41 | + trap cleanup INT TERM EXIT | ||
| 42 | + | ||
| 43 | + UVWASI_ZIP="uvwasi-$NEW_VERSION" | ||
| 44 | + cd "$WORKSPACE" | ||
| 45 | + | ||
| 46 | + echo "Fetching UVWASI source archive..." | ||
| 47 | + curl -sL -o "$UVWASI_ZIP.zip" "https://github.com/nodejs/uvwasi/archive/refs/tags/v$NEW_VERSION.zip" | ||
| 48 | + | ||
| 49 | + echo "Moving existing GYP build file" | ||
| 50 | + mv "$DEPS_DIR/uvwasi/"*.gyp "$WORKSPACE/" | ||
| 51 | + rm -rf "$DEPS_DIR/uvwasi/" | ||
| 52 | + | ||
| 53 | + echo "Unzipping..." | ||
| 54 | + unzip "$UVWASI_ZIP.zip" -d "$DEPS_DIR/uvwasi/" | ||
| 55 | + rm "$UVWASI_ZIP.zip" | ||
| 56 | + | ||
| 57 | + mv "$WORKSPACE/"*.gyp "$DEPS_DIR/uvwasi/" | ||
| 58 | + cd "$DEPS_DIR/uvwasi/" | ||
| 59 | + | ||
| 60 | + echo "Copying new files to deps folder" | ||
| 61 | + cp -r "$UVWASI_ZIP/include" "$DEPS_DIR/uvwasi/" | ||
| 62 | + cp -r "$UVWASI_ZIP/src" "$DEPS_DIR/uvwasi/" | ||
| 63 | + cp "$UVWASI_ZIP/LICENSE" "$DEPS_DIR/uvwasi/" | ||
| 64 | + rm -rf "$UVWASI_ZIP" | ||
| 65 | + | ||
| 66 | + echo "All done!" | ||
| 67 | + echo "" | ||
| 68 | + echo "Please git add uvwasi, commit the new version:" | ||
| 69 | + echo "" | ||
| 70 | + echo "$ git add -A deps/uvwasi" | ||
| 71 | + echo "$ git commit -m \"deps: update uvwasi to $NEW_VERSION\"" | ||
| 72 | + echo "" | ||
| 73 | + echo "Make sure to update the deps/uvwasi/uvwasi.gyp if any significant changes have occurred upstream" | ||
| 74 | + echo "" | ||
| 75 | + | ||
| 76 | + # The last line of the script should always print the new version, | ||
| 77 | + # as we need to add it to $GITHUB_ENV variable. | ||
| 78 | + echo "NEW_VERSION=$NEW_VERSION" | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments