Skip to content

Commit 3e9fa07

Browse files
prathikrPrathik Rao
andauthored
impl (#428)
Co-authored-by: Prathik Rao <prathikrao@microsoft.com>
1 parent d50863e commit 3e9fa07

2 files changed

Lines changed: 16 additions & 1 deletion

File tree

sdk_v2/js/script/install.cjs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,21 @@ async function installPackage(artifact, tempDir) {
257257
console.warn(` ⚠ File ${fileName} not found for RID ${RID} in package.`);
258258
}
259259
}
260+
261+
// After extracting, update the packages/@foundry-local-core/RID/package.json version to match the downloaded artifact
262+
if (found && pkgName.startsWith('Microsoft.AI.Foundry.Local.Core')) {
263+
const pkgJsonPath = path.join(BIN_DIR, 'package.json');
264+
try {
265+
if (fs.existsSync(pkgJsonPath)) {
266+
const pkgJson = JSON.parse(fs.readFileSync(pkgJsonPath, 'utf8'));
267+
pkgJson.version = pkgVer;
268+
fs.writeFileSync(pkgJsonPath, JSON.stringify(pkgJson, null, 2));
269+
console.log(` Updated package.json version to ${pkgVer}`);
270+
}
271+
} catch (e) {
272+
console.warn(` Failed to update package.json version: ${e.message}`);
273+
}
274+
}
260275
}
261276

262277
async function main() {

sdk_v2/js/script/preinstall.cjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const pkgJsonPath = path.join(dir, 'package.json');
1818
if (!fs.existsSync(pkgJsonPath)) {
1919
const pkgContent = {
2020
name: `@foundry-local-core/${platformKey}`,
21-
version: "0.8.2",
21+
version: "0.0.0", // Placeholder version, will be replaced during install.cjs
2222
description: `Native binaries for Foundry Local SDK (${platformKey})`,
2323
os: [os.platform()],
2424
cpu: [os.arch()],

0 commit comments

Comments
 (0)