nemar-cli 0.8.48-dev.1326 → 0.8.48-dev.1333
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/dist/index.js +157 -153
- package/package.json +4 -2
- package/scripts/postinstall-check.mjs +45 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nemar-cli",
|
|
3
|
-
"version": "0.8.48-dev.
|
|
3
|
+
"version": "0.8.48-dev.1333",
|
|
4
4
|
"description": "CLI for NEMAR (Neuroelectromagnetic Data Archive and Tools Resource) dataset management",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
"typecheck": "tsc --noEmit",
|
|
18
18
|
"prepublishOnly": "bun run build",
|
|
19
19
|
"prepare": "husky",
|
|
20
|
+
"postinstall": "bun scripts/postinstall-check.mjs",
|
|
20
21
|
"deploy": "wrangler deploy",
|
|
21
22
|
"preview": "wrangler dev"
|
|
22
23
|
},
|
|
@@ -38,12 +39,13 @@
|
|
|
38
39
|
"bugs": {
|
|
39
40
|
"url": "https://github.com/nemarOrg/nemar-cli/issues"
|
|
40
41
|
},
|
|
41
|
-
"homepage": "https://nemar
|
|
42
|
+
"homepage": "https://docs.nemar.org",
|
|
42
43
|
"engines": {
|
|
43
44
|
"bun": ">=1.0.0"
|
|
44
45
|
},
|
|
45
46
|
"files": [
|
|
46
47
|
"dist",
|
|
48
|
+
"scripts/postinstall-check.mjs",
|
|
47
49
|
"README.md",
|
|
48
50
|
"LICENSE"
|
|
49
51
|
],
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Install-time heads-up about missing external tools.
|
|
4
|
+
*
|
|
5
|
+
* NEMAR needs git, git-annex, gh, aws, and deno (none are bundled). This prints
|
|
6
|
+
* a concise warning at install time naming what's missing and pointing to
|
|
7
|
+
* `nemar doctor` for versions + platform-specific install commands. It NEVER
|
|
8
|
+
* fails the install (always exits 0) and stays quiet in CI.
|
|
9
|
+
*
|
|
10
|
+
* Note: Bun may skip dependency lifecycle scripts unless trusted, so this is a
|
|
11
|
+
* best-effort nudge; `nemar doctor` and the signup check are the reliable paths.
|
|
12
|
+
*/
|
|
13
|
+
import { spawnSync } from "node:child_process";
|
|
14
|
+
|
|
15
|
+
if (process.env.CI || process.env.NEMAR_SKIP_POSTINSTALL) process.exit(0);
|
|
16
|
+
|
|
17
|
+
const TOOLS = [
|
|
18
|
+
["git", ["--version"]],
|
|
19
|
+
["git-annex", ["version"]],
|
|
20
|
+
["gh", ["--version"]],
|
|
21
|
+
["aws", ["--version"]],
|
|
22
|
+
["deno", ["--version"]],
|
|
23
|
+
];
|
|
24
|
+
|
|
25
|
+
const isPresent = ([cmd, args]) => {
|
|
26
|
+
try {
|
|
27
|
+
const r = spawnSync(cmd, args, { stdio: "ignore", timeout: 8000 });
|
|
28
|
+
return !r.error; // ENOENT (not installed) surfaces as r.error
|
|
29
|
+
} catch {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const missing = TOOLS.filter((t) => !isPresent(t)).map(([cmd]) => cmd);
|
|
35
|
+
|
|
36
|
+
if (missing.length > 0) {
|
|
37
|
+
const y = (s) => (process.stdout.isTTY ? `\x1b[33m${s}\x1b[0m` : s);
|
|
38
|
+
console.warn("");
|
|
39
|
+
console.warn(y("NEMAR: some tools you'll need aren't installed yet:"));
|
|
40
|
+
console.warn(` ${missing.join(", ")}`);
|
|
41
|
+
console.warn(" Run `nemar doctor` for versions and platform-specific install commands.");
|
|
42
|
+
console.warn("");
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
process.exit(0);
|