MCPcopy
hub / github.com/tldraw/tldraw / enforceNodeEngineOnPackages

Function enforceNodeEngineOnPackages

yarn.config.cjs:45–52  ·  view source on GitHub ↗

* Require a Node version where `require()` of an ES module works natively, so * published packages can depend on ESM-only modules without breaking CommonJS * consumers. Node 20 is EOL, so we require Node 22.12+, where `require(esm)` is * unflagged; earlier versions throw `ERR_REQUIRE_ESM`. * *

({ Yarn })

Source from the content-addressed store, hash-verified

43 * @param {Context} context
44 */
45function enforceNodeEngineOnPackages({ Yarn }) {
46 const nodeEngine = '>=22.12.0'
47 for (const workspace of Yarn.workspaces()) {
48 // only the published library packages under packages/*
49 if (!workspace.cwd.startsWith('packages/')) continue
50 workspace.set(['engines', 'node'], nodeEngine)
51 }
52}
53
54module.exports = defineConfig({
55 constraints: async (ctx) => {

Callers 1

yarn.config.cjsFile · 0.85

Calls 1

setMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…