@meridiona/meridian 1.9.1 → 1.10.0
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/meridian.js +43 -1
- package/package.json +2 -2
package/bin/meridian.js
CHANGED
|
@@ -35,14 +35,56 @@ function run(file, args) {
|
|
|
35
35
|
process.exit(r.status == null ? 1 : r.status);
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
+
// Is the global npm prefix writable without root? `npm i -g` installs into
|
|
39
|
+
// <prefix>/lib/node_modules; on a /usr/local prefix that needs sudo, on a
|
|
40
|
+
// Homebrew/user prefix it doesn't.
|
|
41
|
+
function npmGlobalWritable() {
|
|
42
|
+
const r = spawnSync('npm', ['config', 'get', 'prefix'], { encoding: 'utf8' });
|
|
43
|
+
const prefix = (r.stdout || '').trim();
|
|
44
|
+
if (!prefix) return true; // unknown — let npm decide
|
|
45
|
+
try {
|
|
46
|
+
fs.accessSync(path.join(prefix, 'lib', 'node_modules'), fs.constants.W_OK);
|
|
47
|
+
return true;
|
|
48
|
+
} catch {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// Update the global package, elevating ONLY this step when the prefix needs
|
|
54
|
+
// root. The rest of `update` (setup: per-user launchd agents, venv) must NOT run
|
|
55
|
+
// as root, so we never sudo the whole command — just this one install.
|
|
56
|
+
function npmInstallLatest() {
|
|
57
|
+
const args = ['install', '-g', '@meridiona/meridian@latest'];
|
|
58
|
+
if (npmGlobalWritable()) {
|
|
59
|
+
return spawnSync('npm', args, { stdio: 'inherit' });
|
|
60
|
+
}
|
|
61
|
+
console.error('meridian update: the global npm prefix needs root — elevating just the');
|
|
62
|
+
console.error(' package install (you may be prompted for your password)…');
|
|
63
|
+
return spawnSync('sudo', ['npm', ...args], { stdio: 'inherit' });
|
|
64
|
+
}
|
|
65
|
+
|
|
38
66
|
const cmd = process.argv[2];
|
|
39
67
|
const rest = process.argv.slice(3);
|
|
40
68
|
|
|
69
|
+
// Every Meridian command is per-user: launchd agents live under gui/$UID and
|
|
70
|
+
// state under ~/.meridian. Running as root (e.g. `sudo meridian update`) makes
|
|
71
|
+
// launchd bootstrap fail ("Domain does not support specified action") and leaves
|
|
72
|
+
// root-owned files behind. Refuse up front — the one step that genuinely needs
|
|
73
|
+
// root (`npm install -g` during `update`) is elevated on its own below.
|
|
74
|
+
if (typeof process.getuid === 'function' && process.getuid() === 0) {
|
|
75
|
+
console.error('meridian: do not run as root / with sudo.');
|
|
76
|
+
console.error(' Meridian runs per-user (launchd agents under gui/$UID, files in ~/.meridian);');
|
|
77
|
+
console.error(' as root, launchd fails and ~/.meridian fills with root-owned files.');
|
|
78
|
+
console.error(` Run it as your normal user: meridian ${cmd || '<command>'}`);
|
|
79
|
+
console.error(' (`meridian update` elevates just the npm install step if your prefix needs root.)');
|
|
80
|
+
process.exit(1);
|
|
81
|
+
}
|
|
82
|
+
|
|
41
83
|
if (cmd === 'setup' || cmd === 'install') {
|
|
42
84
|
const bundle = resolveBundle();
|
|
43
85
|
run('bash', [path.join(bundle, 'scripts', 'meridian-npm-setup.sh'), bundle, ...rest]);
|
|
44
86
|
} else if (cmd === 'update') {
|
|
45
|
-
const up =
|
|
87
|
+
const up = npmInstallLatest();
|
|
46
88
|
if (up.status) process.exit(up.status);
|
|
47
89
|
const bundle = resolveBundle();
|
|
48
90
|
run('bash', [path.join(bundle, 'scripts', 'meridian-npm-setup.sh'), bundle, '--skip-permissions']);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@meridiona/meridian",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.10.0",
|
|
4
4
|
"description": "Your project management, written by your work — local-first PM automation from real dev activity (macOS, Apple Silicon).",
|
|
5
5
|
"homepage": "https://github.com/Meridiona/meridian",
|
|
6
6
|
"repository": {
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"node": ">=18"
|
|
25
25
|
},
|
|
26
26
|
"optionalDependencies": {
|
|
27
|
-
"@meridiona/meridian-darwin-arm64": "1.
|
|
27
|
+
"@meridiona/meridian-darwin-arm64": "1.10.0"
|
|
28
28
|
},
|
|
29
29
|
"publishConfig": {
|
|
30
30
|
"access": "public"
|