@pleri/olam-cli 0.1.44 → 0.1.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/check-node.cjs +38 -0
- package/bin/olam.cjs +26 -0
- package/dist/image-digests.json +1 -1
- package/package.json +6 -2
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const REQUIRED_MAJOR = 22;
|
|
4
|
+
|
|
5
|
+
function checkNodeVersion(versionString) {
|
|
6
|
+
if (typeof versionString !== 'string' || versionString.length === 0) {
|
|
7
|
+
return { ok: false, detected: String(versionString), required: REQUIRED_MAJOR };
|
|
8
|
+
}
|
|
9
|
+
const major = parseInt(versionString.split('.')[0], 10);
|
|
10
|
+
if (Number.isNaN(major) || major < REQUIRED_MAJOR) {
|
|
11
|
+
return { ok: false, detected: versionString, required: REQUIRED_MAJOR };
|
|
12
|
+
}
|
|
13
|
+
return { ok: true, detected: versionString, required: REQUIRED_MAJOR };
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function formatBanner(detected) {
|
|
17
|
+
return [
|
|
18
|
+
'',
|
|
19
|
+
'[31molam: unsupported Node.js version[0m',
|
|
20
|
+
'',
|
|
21
|
+
` required: Node ${REQUIRED_MAJOR}+`,
|
|
22
|
+
` detected: Node ${detected}`,
|
|
23
|
+
'',
|
|
24
|
+
' Why: the CLI uses node:fs.globSync, which was added in Node 22.0.0.',
|
|
25
|
+
' Older runtimes fail at module-load before any error handler runs.',
|
|
26
|
+
'',
|
|
27
|
+
' Fix (pick one):',
|
|
28
|
+
' mise: mise use --global node@22',
|
|
29
|
+
' nvm: nvm install 22 && nvm use 22',
|
|
30
|
+
' asdf: asdf install nodejs 22.20.0 && asdf global nodejs 22.20.0',
|
|
31
|
+
' brew: brew install node@22 && brew link --overwrite --force node@22',
|
|
32
|
+
'',
|
|
33
|
+
' Then re-run: olam bootstrap',
|
|
34
|
+
'',
|
|
35
|
+
].join('\n');
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
module.exports = { checkNodeVersion, formatBanner, REQUIRED_MAJOR };
|
package/bin/olam.cjs
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// CJS shim that runs before the ESM bundle to fail fast on unsupported Node.
|
|
3
|
+
// Kept in CJS so the parse step uses only Node ≥0.x APIs — this file must
|
|
4
|
+
// load cleanly even on the Node versions we are about to reject.
|
|
5
|
+
'use strict';
|
|
6
|
+
|
|
7
|
+
const { checkNodeVersion, formatBanner } = require('./check-node.cjs');
|
|
8
|
+
|
|
9
|
+
const result = checkNodeVersion(process.versions.node);
|
|
10
|
+
|
|
11
|
+
if (!result.ok) {
|
|
12
|
+
process.stderr.write(formatBanner(result.detected));
|
|
13
|
+
// 64 = EX_USAGE per BSD sysexits — "the command was used incorrectly".
|
|
14
|
+
// Distinct from 1 (generic), 2 (pleri-not-configured), 3 (pull failed),
|
|
15
|
+
// 4 (protocol mismatch), 5 (auth); see packages/cli/src/exit-codes.ts.
|
|
16
|
+
process.exit(64);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const { join } = require('node:path');
|
|
20
|
+
const { pathToFileURL } = require('node:url');
|
|
21
|
+
const bundlePath = join(__dirname, '..', 'dist', 'index.js');
|
|
22
|
+
|
|
23
|
+
import(pathToFileURL(bundlePath).href).catch((err) => {
|
|
24
|
+
process.stderr.write(`olam: failed to load CLI bundle (${bundlePath})\n ${err && err.message ? err.message : err}\n`);
|
|
25
|
+
process.exit(1);
|
|
26
|
+
});
|
package/dist/image-digests.json
CHANGED
|
@@ -3,6 +3,6 @@
|
|
|
3
3
|
"devbox": "sha256:9363a1979d7df0ed2b2c964c183ba3e739383c146416f27b1ceb976f64648fd9",
|
|
4
4
|
"host-cp": "sha256:29d2e544db7fabae259a0311a76ff367ee5e2ca5f48e9640ebefaf3c5997bda3",
|
|
5
5
|
"$schema_version": 1,
|
|
6
|
-
"$published_version": "0.1.
|
|
6
|
+
"$published_version": "0.1.45",
|
|
7
7
|
"$registry": "ghcr.io/pleri"
|
|
8
8
|
}
|
package/package.json
CHANGED
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pleri/olam-cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.45",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
|
-
"olam": "./
|
|
6
|
+
"olam": "./bin/olam.cjs"
|
|
7
7
|
},
|
|
8
8
|
"files": [
|
|
9
|
+
"bin",
|
|
9
10
|
"dist",
|
|
10
11
|
"host-cp",
|
|
11
12
|
"plugin",
|
|
12
13
|
"README.md"
|
|
13
14
|
],
|
|
15
|
+
"engines": {
|
|
16
|
+
"node": ">=22.0.0"
|
|
17
|
+
},
|
|
14
18
|
"repository": {
|
|
15
19
|
"type": "git",
|
|
16
20
|
"url": "https://github.com/pleri/olam.git",
|