2023-11-30 14:21:35 +01:00
|
|
|
/**
|
|
|
|
|
* this script finds a given native modules version as found in package-lock.json and
|
|
|
|
|
* outputs the path where a cached build would be expected to stdout.
|
|
|
|
|
* We can then restore that path from cache.
|
|
|
|
|
*
|
|
|
|
|
* This is useful in CI to know the location of the build before
|
|
|
|
|
* we install the dependencies and rebuild from scratch.
|
|
|
|
|
* (see .github/workflows/test.yml)
|
|
|
|
|
* */
|
2023-04-19 13:58:49 +02:00
|
|
|
import fs from "node:fs/promises"
|
|
|
|
|
import { buildCachedLibPath } from "./nativeLibraryProvider.js"
|
|
|
|
|
|
|
|
|
|
const packageJson = JSON.parse(await fs.readFile("package-lock.json", "utf-8"))
|
|
|
|
|
const module = process.argv[2]
|
|
|
|
|
// we have a git commit as a version in dependencies, we want the actually resolved version number
|
|
|
|
|
const version = packageJson.packages[`node_modules/${module}`].version
|
|
|
|
|
console.log(
|
|
|
|
|
await buildCachedLibPath({
|
|
|
|
|
rootDir: "test",
|
|
|
|
|
platform: "linux",
|
|
|
|
|
environment: "node",
|
2024-02-23 14:03:19 +01:00
|
|
|
versionedEnvironment: `node-${process.versions.modules}`,
|
2023-04-19 13:58:49 +02:00
|
|
|
nodeModule: module,
|
|
|
|
|
libraryVersion: version,
|
|
|
|
|
architecture: process.arch,
|
|
|
|
|
}),
|
|
|
|
|
)
|