Skip to content

Commit 80b05a5

Browse files
chore: update post install to use packaged bin
1 parent c5d768b commit 80b05a5

3 files changed

Lines changed: 20 additions & 22 deletions

File tree

bun.lock

Lines changed: 5 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@
3636
"@types/prismjs": "1.26.5",
3737
"@types/react": "19.2.10",
3838
"@types/react-dom": "19.2.3",
39-
"@vitejs/plugin-react": "5.1.2",
39+
"@vitejs/plugin-react": "6.0.1",
4040
"babel-plugin-react-compiler": "^1.0.0",
4141
"typescript": "^5.9.3",
4242
"vite": "npm:rolldown-vite@7.3.1"
4343
}
44-
}
44+
}

scripts/postinstall.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
#!/usr/bin/env node
22
'use strict';
33

4-
const { createWriteStream, chmodSync, mkdirSync } = require('fs');
4+
const { createWriteStream, chmodSync, existsSync, mkdirSync } = require('fs');
55
const { get } = require('https');
66
const { join } = require('path');
77
const { version } = require('../package.json');
88

9+
// Don't run when doing `bun i` / `npm i` inside this workspace
10+
if (!__dirname.includes('node_modules')) {
11+
process.exit(0);
12+
}
13+
914
const PLATFORM_MAP = {
1015
'linux-x64': 'x86_64-unknown-linux-gnu',
1116
};
@@ -24,6 +29,13 @@ const url = `https://github.com/freeCodeCamp/freeCodeCampOS/releases/download/v$
2429

2530
mkdirSync(binDir, { recursive: true });
2631

32+
// Binary was bundled with the published package — just ensure it's executable
33+
if (existsSync(binPath)) {
34+
chmodSync(binPath, 0o755);
35+
console.log('freecodecamp-os: binary already present at', binPath);
36+
process.exit(0);
37+
}
38+
2739
function download(url, dest, cb) {
2840
get(url, (res) => {
2941
if (res.statusCode === 301 || res.statusCode === 302) {

0 commit comments

Comments
 (0)