|
| 1 | +package: |
| 2 | + name: nodejs-22 |
| 3 | + version: 22.0.0 |
| 4 | + epoch: 0 |
| 5 | + description: "JavaScript runtime built on V8 engine" |
| 6 | + dependencies: |
| 7 | + provides: |
| 8 | + - nodejs=${{package.full-version}} |
| 9 | + copyright: |
| 10 | + - license: MIT |
| 11 | + |
| 12 | +environment: |
| 13 | + contents: |
| 14 | + packages: |
| 15 | + - brotli-dev |
| 16 | + - build-base |
| 17 | + - busybox |
| 18 | + - c-ares-dev |
| 19 | + - ca-certificates-bundle |
| 20 | + - icu-dev |
| 21 | + - libuv-dev |
| 22 | + - linux-headers |
| 23 | + - nghttp2-dev |
| 24 | + - openssl-dev |
| 25 | + - py3-jinja2 |
| 26 | + - py3-setuptools |
| 27 | + - python3 |
| 28 | + - samurai |
| 29 | + - wolfi-base |
| 30 | + - zlib-dev |
| 31 | + |
| 32 | +pipeline: |
| 33 | + - uses: fetch |
| 34 | + with: |
| 35 | + uri: https://nodejs.org/dist/v${{package.version}}/node-v${{package.version}}.tar.gz |
| 36 | + expected-sha256: 47cd57486564a8cb4728ec01f1d98b510c6547e19e96a7f7583cf882d803d0c6 |
| 37 | + |
| 38 | + - name: Configure and build |
| 39 | + runs: | |
| 40 | + # Add defines recommended in libuv readme. |
| 41 | + common_flags="-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" |
| 42 | +
|
| 43 | + # Compiling with O2 instead of Os increases binary size by ~10% |
| 44 | + # (53.1 MiB -> 58.6 MiB), but also increases performance by ~20% |
| 45 | + # according to v8/web-tooling-benchmark. Node.js is quite huge anyway; |
| 46 | + # there are better options for size constrained environments. |
| 47 | + export CFLAGS="${CFLAGS/-Os/-O2} $common_flags" |
| 48 | + export CXXFLAGS="${CXXFLAGS/-Os/-O2} $common_flags" |
| 49 | + export CPPFLAGS="${CPPFLAGS/-Os/-O2} $common_flags" |
| 50 | + python3 configure.py --prefix=/usr \ |
| 51 | + --shared-brotli \ |
| 52 | + --shared-zlib \ |
| 53 | + --shared-openssl \ |
| 54 | + --shared-cares \ |
| 55 | + --shared-nghttp2 \ |
| 56 | + --shared-libuv \ |
| 57 | + --ninja \ |
| 58 | + --openssl-use-def-ca-store \ |
| 59 | + --with-icu-default-data-dir=$(icu-config --icudatadir) \ |
| 60 | + --with-intl=system-icu \ |
| 61 | + --openssl-conf-name=openssl_conf \ |
| 62 | + --without-corepack |
| 63 | +
|
| 64 | + make BUILDTYPE=Release -j$(nproc) |
| 65 | +
|
| 66 | + - uses: autoconf/make |
| 67 | + |
| 68 | + - uses: autoconf/make-install |
| 69 | + |
| 70 | + - runs: | |
| 71 | + make DESTDIR="$${{targets.destdir}}" install |
| 72 | +
|
| 73 | + - uses: strip |
| 74 | + |
| 75 | + # Get rid of the bundled npm, we don't need it. |
| 76 | + - runs: | |
| 77 | + rm -rf "${{targets.destdir}}"/usr/lib/node_modules |
| 78 | + rm "${{targets.destdir}}"/usr/bin/npm |
| 79 | + rm "${{targets.destdir}}"/usr/bin/npx |
| 80 | +
|
| 81 | +update: |
| 82 | + enabled: true |
| 83 | + github: |
| 84 | + identifier: nodejs/node |
| 85 | + strip-prefix: v |
| 86 | + use-tag: true |
| 87 | + tag-filter: v22. |
| 88 | + |
| 89 | +test: |
| 90 | + pipeline: |
| 91 | + - name: Verify Node.js Installation |
| 92 | + runs: | |
| 93 | + node --version || exit 1 |
| 94 | + - name: Execute Basic JavaScript |
| 95 | + runs: | |
| 96 | + cat <<'EOF' > test.js |
| 97 | + console.log('Hello, World!'); |
| 98 | + EOF |
| 99 | + node test.js | grep 'Hello, World!' || exit 1 |
| 100 | + - name: Test International Number Formatting |
| 101 | + runs: | |
| 102 | + cat <<'EOF' > testIntl.js |
| 103 | + console.log(new Intl.NumberFormat('en-EN').format(1234.56)); |
| 104 | + console.log(new Intl.NumberFormat('de-DE').format(1234.56)); |
| 105 | + EOF |
| 106 | + node testIntl.js | grep '1,234.56' && node testIntl.js | grep '1.234,56' || exit 1 |
0 commit comments