dprint 0.38.2 → 0.38.3
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/install.js +4 -0
- package/install_api.js +16 -3
- package/package.json +10 -7
package/install.js
ADDED
package/install_api.js
CHANGED
|
@@ -33,9 +33,10 @@ module.exports = {
|
|
|
33
33
|
throw new Error("Throwing for testing purposes.");
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
// in order to make things faster the next time we run
|
|
37
|
-
//
|
|
38
|
-
|
|
36
|
+
// in order to make things faster the next time we run and to allow the
|
|
37
|
+
// dprint vscode extension to easily pick this up, copy the executable
|
|
38
|
+
// into the dprint package folder
|
|
39
|
+
atomicCopyFileSync(sourceExecutablePath, targetExecutablePath);
|
|
39
40
|
if (os.platform() !== "win32") {
|
|
40
41
|
// chomd +x
|
|
41
42
|
chmodX(targetExecutablePath);
|
|
@@ -138,3 +139,15 @@ function getLinuxFamily() {
|
|
|
138
139
|
}
|
|
139
140
|
}
|
|
140
141
|
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* @param sourcePath {string}
|
|
145
|
+
* @param destinationPath {string}
|
|
146
|
+
*/
|
|
147
|
+
function atomicCopyFileSync(sourcePath, destinationPath) {
|
|
148
|
+
const crypto = require("crypto");
|
|
149
|
+
const rand = crypto.randomBytes(4).toString("hex");
|
|
150
|
+
const tempFilePath = destinationPath + "." + rand;
|
|
151
|
+
fs.copyFileSync(sourcePath, tempFilePath);
|
|
152
|
+
fs.renameSync(tempFilePath, destinationPath);
|
|
153
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dprint",
|
|
3
|
-
"version": "0.38.
|
|
3
|
+
"version": "0.38.3",
|
|
4
4
|
"description": "Pluggable and configurable code formatting platform written in Rust.",
|
|
5
5
|
"bin": "bin.js",
|
|
6
6
|
"repository": {
|
|
@@ -18,12 +18,15 @@
|
|
|
18
18
|
},
|
|
19
19
|
"homepage": "https://github.com/dprint/dprint#readme",
|
|
20
20
|
"preferUnplugged": true,
|
|
21
|
+
"scripts": {
|
|
22
|
+
"postinstall": "node ./install.js"
|
|
23
|
+
},
|
|
21
24
|
"optionalDependencies": {
|
|
22
|
-
"@dprint/win32-x64": "0.38.
|
|
23
|
-
"@dprint/darwin-x64": "0.38.
|
|
24
|
-
"@dprint/darwin-arm64": "0.38.
|
|
25
|
-
"@dprint/linux-x64-glibc": "0.38.
|
|
26
|
-
"@dprint/linux-x64-musl": "0.38.
|
|
27
|
-
"@dprint/linux-arm64-glibc": "0.38.
|
|
25
|
+
"@dprint/win32-x64": "0.38.3",
|
|
26
|
+
"@dprint/darwin-x64": "0.38.3",
|
|
27
|
+
"@dprint/darwin-arm64": "0.38.3",
|
|
28
|
+
"@dprint/linux-x64-glibc": "0.38.3",
|
|
29
|
+
"@dprint/linux-x64-musl": "0.38.3",
|
|
30
|
+
"@dprint/linux-arm64-glibc": "0.38.3"
|
|
28
31
|
}
|
|
29
32
|
}
|