Files
orca/config/scripts/orcad-linear-sdk-package.mjs
T
Neilandthukabjj 7c9bb00622 fix(orcad): ship @linear/sdk with the managed server so Linear works on SSH hosts (#29388)
linear-sdk.ts loads the SDK through createRequire, which the orcad bundle
cannot follow, and nothing staged the package beside it. Bundle the SDK
into node_modules/@linear/sdk/index.js at build time and list it as an
orcad artifact so templates and installs carry it.

Co-authored-by: thukabjj <31043997+thukabjj@users.noreply.github.com>
2026-10-15 23:15:18 -07:00

26 lines
773 B
JavaScript

import { build } from 'esbuild'
import { join } from 'node:path'
import { ORCAD_LINEAR_SDK_ENTRY } from '../../src/shared/orcad-artifacts.ts'
/**
* @linear/sdk as one CommonJS file where orcad's lazy `require('@linear/sdk')` resolves it.
* Why bundled rather than copied: the package ships hashed chunk names that change every release.
*/
export async function stageOrcadLinearSdk(root, outputDir) {
await build({
stdin: {
contents: "module.exports = require('@linear/sdk')",
resolveDir: root,
sourcefile: 'orcad-linear-sdk-entry.js'
},
bundle: true,
platform: 'node',
target: 'node18',
format: 'cjs',
outfile: join(outputDir, ORCAD_LINEAR_SDK_ENTRY),
minify: true,
sourcemap: false,
logLevel: 'error'
})
}