@nubjs/nub 0.7.5 → 0.8.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/package.json +9 -9
- package/postinstall.js +29 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nubjs/nub",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "TypeScript-first developer supertool — a fast script runner and TS runtime powered by Node.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "https://github.com/nubjs/nub",
|
|
@@ -36,13 +36,13 @@
|
|
|
36
36
|
"LICENSE"
|
|
37
37
|
],
|
|
38
38
|
"optionalDependencies": {
|
|
39
|
-
"@nubjs/nub-darwin-arm64": "0.
|
|
40
|
-
"@nubjs/nub-darwin-x64": "0.
|
|
41
|
-
"@nubjs/nub-linux-x64": "0.
|
|
42
|
-
"@nubjs/nub-linux-x64-musl": "0.
|
|
43
|
-
"@nubjs/nub-linux-arm64": "0.
|
|
44
|
-
"@nubjs/nub-linux-arm64-musl": "0.
|
|
45
|
-
"@nubjs/nub-win32-x64": "0.
|
|
46
|
-
"@nubjs/nub-win32-arm64": "0.
|
|
39
|
+
"@nubjs/nub-darwin-arm64": "0.8.0",
|
|
40
|
+
"@nubjs/nub-darwin-x64": "0.8.0",
|
|
41
|
+
"@nubjs/nub-linux-x64": "0.8.0",
|
|
42
|
+
"@nubjs/nub-linux-x64-musl": "0.8.0",
|
|
43
|
+
"@nubjs/nub-linux-arm64": "0.8.0",
|
|
44
|
+
"@nubjs/nub-linux-arm64-musl": "0.8.0",
|
|
45
|
+
"@nubjs/nub-win32-x64": "0.8.0",
|
|
46
|
+
"@nubjs/nub-win32-arm64": "0.8.0"
|
|
47
47
|
}
|
|
48
48
|
}
|
package/postinstall.js
CHANGED
|
@@ -65,7 +65,7 @@ function chmodExecutable(pkg) {
|
|
|
65
65
|
// Re-link existing PM shims to the freshly-installed binary.
|
|
66
66
|
//
|
|
67
67
|
// `nub pm shim` populates ~/.nub/shims with HARDLINKS to the nub binary
|
|
68
|
-
// (crates/nub-core/src/pm/shim.rs; spec:
|
|
68
|
+
// (crates/nub-core/src/pm/shim.rs; spec: `package-manager-shims` (no such document)).
|
|
69
69
|
// An `npm i -g @nubjs/nub` upgrade extracts a NEW binary — new inode — so the
|
|
70
70
|
// shims keep executing the OLD bytes until re-linked. This is the installer-side
|
|
71
71
|
// re-link: if (and only if) a shims dir already exists, point every entry we own
|
|
@@ -91,7 +91,33 @@ function refreshShims(pkg) {
|
|
|
91
91
|
return;
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
-
|
|
94
|
+
// Resolution, matching resolve_shim_dir() in crates/nub-core/src/pm/shim.rs:
|
|
95
|
+
// an explicitly-set XDG_DATA_HOME wins on every platform, else %LOCALAPPDATA%
|
|
96
|
+
// on Windows, else ~/.local/share.
|
|
97
|
+
//
|
|
98
|
+
// `~/.nub/shims` is the PRE-MOVE location, refreshed only so an install that
|
|
99
|
+
// predates the move keeps working until the user's next `nub pm shim` migrates
|
|
100
|
+
// it. Missing a live dir is silent staleness — the shims keep executing the
|
|
101
|
+
// pre-upgrade inode with no error — so the transitional entry stays until the
|
|
102
|
+
// move is old news. Refreshing never CREATES: an absent dir is skipped.
|
|
103
|
+
const home = os.homedir();
|
|
104
|
+
const roots = [];
|
|
105
|
+
if (process.env.XDG_DATA_HOME) {
|
|
106
|
+
roots.push(process.env.XDG_DATA_HOME);
|
|
107
|
+
} else if (process.platform === "win32" && process.env.LOCALAPPDATA) {
|
|
108
|
+
roots.push(process.env.LOCALAPPDATA);
|
|
109
|
+
} else {
|
|
110
|
+
roots.push(path.join(home, ".local", "share"));
|
|
111
|
+
}
|
|
112
|
+
for (const dir of [
|
|
113
|
+
...roots.map((r) => path.join(r, "nub", "shims")),
|
|
114
|
+
path.join(home, ".nub", "shims"), // pre-move, transitional
|
|
115
|
+
]) {
|
|
116
|
+
refreshShimsIn(dir, binPath, binStat, ext);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function refreshShimsIn(shimDir, binPath, binStat, ext) {
|
|
95
121
|
let entries;
|
|
96
122
|
try {
|
|
97
123
|
entries = fs.readdirSync(shimDir); // ENOENT/ENOTDIR = no opt-in, do nothing
|
|
@@ -165,7 +191,7 @@ function refreshShims(pkg) {
|
|
|
165
191
|
}
|
|
166
192
|
|
|
167
193
|
if (refreshed > 0) {
|
|
168
|
-
console.log(`refreshed ${refreshed} nub shim${refreshed === 1 ? "" : "s"} in
|
|
194
|
+
console.log(`refreshed ${refreshed} nub shim${refreshed === 1 ? "" : "s"} in ${shimDir}`);
|
|
169
195
|
}
|
|
170
196
|
}
|
|
171
197
|
|