Skip to content

Commit

Permalink
Merge pull request #17646 from wolfi-dev/version-stream-nodejs-22
Browse files Browse the repository at this point in the history
  • Loading branch information
ajayk authored Apr 25, 2024
2 parents 34732a8 + b337181 commit 2f5d609
Showing 1 changed file with 106 additions and 0 deletions.
106 changes: 106 additions & 0 deletions nodejs-22.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
package:
name: nodejs-22
version: 22.0.0
epoch: 0
description: "JavaScript runtime built on V8 engine"
dependencies:
provides:
- nodejs=${{package.full-version}}
copyright:
- license: MIT

environment:
contents:
packages:
- brotli-dev
- build-base
- busybox
- c-ares-dev
- ca-certificates-bundle
- icu-dev
- libuv-dev
- linux-headers
- nghttp2-dev
- openssl-dev
- py3-jinja2
- py3-setuptools
- python3
- samurai
- wolfi-base
- zlib-dev

pipeline:
- uses: fetch
with:
uri: https://nodejs.org/dist/v${{package.version}}/node-v${{package.version}}.tar.gz
expected-sha256: 47cd57486564a8cb4728ec01f1d98b510c6547e19e96a7f7583cf882d803d0c6

- name: Configure and build
runs: |
# Add defines recommended in libuv readme.
common_flags="-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
# Compiling with O2 instead of Os increases binary size by ~10%
# (53.1 MiB -> 58.6 MiB), but also increases performance by ~20%
# according to v8/web-tooling-benchmark. Node.js is quite huge anyway;
# there are better options for size constrained environments.
export CFLAGS="${CFLAGS/-Os/-O2} $common_flags"
export CXXFLAGS="${CXXFLAGS/-Os/-O2} $common_flags"
export CPPFLAGS="${CPPFLAGS/-Os/-O2} $common_flags"
python3 configure.py --prefix=/usr \
--shared-brotli \
--shared-zlib \
--shared-openssl \
--shared-cares \
--shared-nghttp2 \
--shared-libuv \
--ninja \
--openssl-use-def-ca-store \
--with-icu-default-data-dir=$(icu-config --icudatadir) \
--with-intl=system-icu \
--openssl-conf-name=openssl_conf \
--without-corepack
make BUILDTYPE=Release -j$(nproc)
- uses: autoconf/make

- uses: autoconf/make-install

- runs: |
make DESTDIR="$${{targets.destdir}}" install
- uses: strip

# Get rid of the bundled npm, we don't need it.
- runs: |
rm -rf "${{targets.destdir}}"/usr/lib/node_modules
rm "${{targets.destdir}}"/usr/bin/npm
rm "${{targets.destdir}}"/usr/bin/npx
update:
enabled: true
github:
identifier: nodejs/node
strip-prefix: v
use-tag: true
tag-filter: v22.

test:
pipeline:
- name: Verify Node.js Installation
runs: |
node --version || exit 1
- name: Execute Basic JavaScript
runs: |
cat <<'EOF' > test.js
console.log('Hello, World!');
EOF
node test.js | grep 'Hello, World!' || exit 1
- name: Test International Number Formatting
runs: |
cat <<'EOF' > testIntl.js
console.log(new Intl.NumberFormat('en-EN').format(1234.56));
console.log(new Intl.NumberFormat('de-DE').format(1234.56));
EOF
node testIntl.js | grep '1,234.56' && node testIntl.js | grep '1.234,56' || exit 1

0 comments on commit 2f5d609

Please sign in to comment.