Pre-built, offline npm cache tarballs for building OnlyOffice DocumentServer as a FreeBSD port inside a Poudriere jail.
The jail has no outbound internet access by design. This cache supplies every npm
tarball the build needs so that all thirteen npm install invocations complete
fully offline, with minimal packument (registry metadata) fetches.
OnlyOffice DocumentServer's build system calls npm install across multiple
sub-projects. Poudriere jails are intentionally network-isolated, so all required
packages must be available before the build starts. A naive approach of
pre-downloading everything tends to include large amounts of registry metadata
(packuments) that bloat the cache and can still trigger network probes at install
time.
This repository solves that with a minimal-packument strategy:
- Phase 1 — installs each sub-project into a temporary cache and generates
an
npm-shrinkwrap.jsonfor it. Shrinkwraps lock the full dependency tree to exact versions, eliminating all resolution queries at install time. - Phase 2 — discards the temporary cache and rebuilds it from scratch using
the shrinkwraps, plus three flags that suppress every remaining network probe:
--legacy-peer-deps,--no-audit,--no-fund. Mostly tarballs land in the final cache, with minimal packuments.
The result is a ~118 MB cache that satisfies every npm install in the
DocumentServer build with --offline, on FreeBSD, for both amd64 and
aarch64.
| Path | Description |
|---|---|
shrinkwrap/ |
11 npm-shrinkwrap.json files, one per DS sub-project |
yao-pkg-npm-shrinkwrap-amd64.json |
Shrinkwrap for @yao-pkg/pkg (x64) |
yao-pkg-npm-shrinkwrap-aarch64.json |
Shrinkwrap for @yao-pkg/pkg (arm64) |
yao-pkg-package.json |
Seed package.json used for yao-pkg installs |
sdkjs-package.json |
Generated package.json for the sdkjs build-deps install |
extra-patch-pkg-fetch_patches_node.v*.cpp.patch |
Composite FreeBSD patch for @yao-pkg/pkg-fetch, combining the upstream patch with FreeBSD ports tree patches for the matching Node version |
.github/workflows/build-npm-cache.yml |
The workflow that produces all of the above |
The release tarball (attached to each GitHub Release) additionally contains:
| Path | Description |
|---|---|
_cacache/ |
The npm cache directory (content-v2 tarballs + index-v5 metadata) |
build-info.txt |
Exact versions of Node, npm, @yao-pkg/pkg, and @yao-pkg/pkg-fetch used to build this cache |
The cache covers thirteen install targets across the DocumentServer source tree.
All installs use --os freebsd and --cpu x64 (or arm64 for the yao-pkg
aarch64 variant) so that platform-specific optional dependencies resolve
correctly even when building on a Linux runner.
Production mode (NODE_ENV=production):
| # | Directory | Notes |
|---|---|---|
| 1 | sdkjs/build |
|
| 2 | web-apps/vendor/framework7-react |
--include=dev |
| 3 | server/Metrics |
|
| 4 | server/FileConverter |
|
| 5 | server/Common |
|
| 6 | server |
Patched package.json |
| 7 | server/DocService |
Patched package.json |
| 8 | document-server-integration/.../nodejs |
--omit=dev |
Full mode (no NODE_ENV):
| # | Directory | Notes |
|---|---|---|
| 9 | sdkjs |
Generated package.json (grunt + grunt-cli) |
| 10 | web-apps/build |
Patched package.json |
| 11 | document-server-package/.../home/npm |
|
| 12a | @yao-pkg/pkg (amd64) |
--cpu x64 |
| 12b | @yao-pkg/pkg (aarch64) |
--cpu arm64 |
The workflow inputs are designed so that no two inputs can conflict with each other. The dependency chain flows in one direction only:
@yao-pkg/pkg version (you supply this)
└─▶ @yao-pkg/pkg-fetch version (resolved from pkg's package.json)
└─▶ Exact Node patch version (resolved from pkg-fetch's patch filenames)
└─▶ npm version (you supply this — must match www/npm-nodeXX in the jail)
You supply node_major (e.g. 20) as a filter; the workflow resolves the exact
20.x.y by inspecting which Node versions pkg-fetch actually has patches for,
then installs that exact version. This guarantees the Node binary that pkg-fetch
will compile against is always the one it has a patch for.
Go to Actions → Build npm Cache (Minimal Packuments) → Run workflow and fill in the five inputs:
| Input | Description | Example |
|---|---|---|
ds_version |
OnlyOffice DocumentServer DISTVERSION |
9.3.1 |
ds_build |
DS build number | 8 |
node_major |
Node.js major version — minor/patch resolved automatically from @yao-pkg/pkg-fetch |
20 |
npm_version |
npm version used in the Poudriere jail — must exactly match www/npm-nodeXX in the ports tree |
11.12.1 |
yao_pkg_ver |
@yao-pkg/pkg version — @yao-pkg/pkg-fetch and the exact Node version are resolved from this |
6.14.2 |
The workflow will fail fast with a clear error if the requested node_major has
no corresponding patch in the resolved @yao-pkg/pkg-fetch version.
- Bootstrap Node — installs
node_major.x(any patch) to getnpmavailable - Resolve versions — installs
@yao-pkg/pkginto a temp directory; reads@yao-pkg/pkg-fetch's patch filenames to determine the exact Node patch version; readspkg-fetch's version frompkg'spackage.json; cleans up - Install exact Node — re-runs
setup-nodewith the resolved exact version - Install jail npm — shadows the runner's npm with the version matching the Poudriere jail
- Clone sources — shallow-clones all five ONLYOFFICE repositories at the DS release tag, plus the FreeBSD ports tree
- Apply patches — creates patched
package.jsonfiles forserver,server/DocService, andweb-apps/build - Phase 1 — runs all 13 installs into a temporary cache, generating
npm-shrinkwrap.jsonfor each - Phase 2 — discards the temporary cache, rebuilds using shrinkwraps with
--legacy-peer-deps --no-audit --no-fundto produce a tarballs-only cache - Generate pkg-fetch patch — combines the upstream
@yao-pkg/pkg-fetchFreeBSD node patch with patches from the FreeBSD ports tree for the exact Node version, producingextra-patch-pkg-fetch_patches_node.vX.Y.Z.cpp.patch - Smoke test — verifies all 13 directories install successfully from the
cache with
--offline - Commit metadata — commits shrinkwraps and supporting files to the repo
- Create release — tags the commit and publishes a GitHub Release with the cache tarball attached
onlyoffice-DS-npm-cache-<tag>-<datetime>/
├── _cacache/ # npm cache (content-v2 + index-v5)
├── shrinkwrap/ # 11 npm-shrinkwrap.json files
├── build-info.txt # Exact build versions
├── extra-patch-pkg-fetch_patches_node.v*.cpp.patch
├── sdkjs-package.json
├── yao-pkg-npm-shrinkwrap-aarch64.json
├── yao-pkg-npm-shrinkwrap-amd64.json
└── yao-pkg-package.json
The tarball is created with --sort=name, --mtime='UTC 2020-01-01',
--owner=0, and --group=0 for reproducible distinfo SHA256 hashes.
Specify the _PKGFETCH_NODE_VERSION and _NPM_CACHE_TAG variables in the FreeBSD www/onlyoffice-documentserver Makefile.
Ensure the version of www/npm-node within LIB_DEPENDS matches, as well.
BSD 2-Clause. See LICENSE.
The npm package tarballs cached by this tool remain under their own respective licenses. This repository contains only the workflow automation and metadata (shrinkwrap files) needed to reproduce the cache — not the cached packages themselves.