lemmafit 0.2.3 → 0.3.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/cli/download-dafny2js.js +6 -3
- package/lib/daemon.js +6 -4
- package/lib/download-dafny.js +7 -2
- package/package.json +1 -1
package/cli/download-dafny2js.js
CHANGED
|
@@ -10,13 +10,14 @@ const path = require('path');
|
|
|
10
10
|
const { execSync } = require('child_process');
|
|
11
11
|
const os = require('os');
|
|
12
12
|
|
|
13
|
-
const DAFNY2JS_VERSION = '0.
|
|
13
|
+
const DAFNY2JS_VERSION = '0.10.0';
|
|
14
14
|
|
|
15
15
|
const PLATFORM_RIDS = {
|
|
16
16
|
'darwin-arm64': 'osx-arm64',
|
|
17
17
|
'darwin-x64': 'osx-x64',
|
|
18
18
|
'linux-x64': 'linux-x64',
|
|
19
19
|
'linux-arm64': 'linux-arm64',
|
|
20
|
+
'win32-x64': 'win-x64',
|
|
20
21
|
};
|
|
21
22
|
|
|
22
23
|
function getPlatformKey() {
|
|
@@ -35,8 +36,9 @@ function printBuildInstructions(rid) {
|
|
|
35
36
|
console.error(' cd dafny2js');
|
|
36
37
|
console.error(` dotnet publish -c Release -r ${rid} --self-contained /p:PublishSingleFile=true`);
|
|
37
38
|
console.error('');
|
|
39
|
+
const binaryName = os.platform() === 'win32' ? 'dafny2js.exe' : 'dafny2js';
|
|
38
40
|
console.error('Then copy the binary to:');
|
|
39
|
-
console.error(` ${path.join(installDir,
|
|
41
|
+
console.error(` ${path.join(installDir, binaryName)}`);
|
|
40
42
|
}
|
|
41
43
|
|
|
42
44
|
function download(url, dest) {
|
|
@@ -92,7 +94,8 @@ async function main() {
|
|
|
92
94
|
}
|
|
93
95
|
|
|
94
96
|
const installDir = path.join(os.homedir(), '.lemmafit', '.dafny2js');
|
|
95
|
-
const
|
|
97
|
+
const binaryName = os.platform() === 'win32' ? 'dafny2js.exe' : 'dafny2js';
|
|
98
|
+
const binaryPath = path.join(installDir, binaryName);
|
|
96
99
|
const versionFile = path.join(installDir, 'version');
|
|
97
100
|
|
|
98
101
|
// Check if correct version is already installed
|
package/lib/daemon.js
CHANGED
|
@@ -30,10 +30,11 @@ class Daemon {
|
|
|
30
30
|
|
|
31
31
|
// Shared cache paths (~/.lemmafit), with fallback to package-local
|
|
32
32
|
const cacheDir = path.join(os.homedir(), '.lemmafit');
|
|
33
|
-
const
|
|
33
|
+
const dafny2jsBinName = os.platform() === 'win32' ? 'dafny2js.exe' : 'dafny2js';
|
|
34
|
+
const cacheDafny2js = path.join(cacheDir, '.dafny2js', dafny2jsBinName);
|
|
34
35
|
this.dafny2jsBin = fs.existsSync(cacheDafny2js)
|
|
35
36
|
? cacheDafny2js
|
|
36
|
-
: path.join(__dirname, '..', '.dafny2js',
|
|
37
|
+
: path.join(__dirname, '..', '.dafny2js', dafny2jsBinName);
|
|
37
38
|
this.kernelPath = path.join(__dirname, '..', 'kernels', 'Replay.dfy');
|
|
38
39
|
|
|
39
40
|
// Load or create config
|
|
@@ -64,13 +65,14 @@ class Daemon {
|
|
|
64
65
|
}
|
|
65
66
|
|
|
66
67
|
findDafny() {
|
|
68
|
+
const dafnyBinName = os.platform() === 'win32' ? 'Dafny.exe' : 'dafny';
|
|
67
69
|
// Check shared cache directory first (~/.lemmafit)
|
|
68
|
-
const cacheDafny = path.join(os.homedir(), '.lemmafit', '.dafny', 'dafny',
|
|
70
|
+
const cacheDafny = path.join(os.homedir(), '.lemmafit', '.dafny', 'dafny', dafnyBinName);
|
|
69
71
|
if (fs.existsSync(cacheDafny)) {
|
|
70
72
|
return cacheDafny;
|
|
71
73
|
}
|
|
72
74
|
// Check lemmafit package directory (fallback)
|
|
73
|
-
const lemmafitDafny = path.join(__dirname, '..', '.dafny', 'dafny',
|
|
75
|
+
const lemmafitDafny = path.join(__dirname, '..', '.dafny', 'dafny', dafnyBinName);
|
|
74
76
|
if (fs.existsSync(lemmafitDafny)) {
|
|
75
77
|
return lemmafitDafny;
|
|
76
78
|
}
|
package/lib/download-dafny.js
CHANGED
|
@@ -83,7 +83,8 @@ async function main() {
|
|
|
83
83
|
const cacheDir = path.join(os.homedir(), '.lemmafit');
|
|
84
84
|
const installDir = path.join(cacheDir, '.dafny');
|
|
85
85
|
const dafnyDir = path.join(installDir, 'dafny');
|
|
86
|
-
const
|
|
86
|
+
const dafnyBinName = os.platform() === 'win32' ? 'Dafny.exe' : 'dafny';
|
|
87
|
+
const dafnyBin = path.join(dafnyDir, dafnyBinName);
|
|
87
88
|
const versionFile = path.join(installDir, 'version');
|
|
88
89
|
|
|
89
90
|
// Check if correct version is already installed
|
|
@@ -109,7 +110,11 @@ async function main() {
|
|
|
109
110
|
|
|
110
111
|
// Extract
|
|
111
112
|
console.log('Extracting...');
|
|
112
|
-
|
|
113
|
+
if (os.platform() === 'win32') {
|
|
114
|
+
execSync(`tar -xf "${zipPath}" -C "${installDir}"`, { stdio: 'inherit' });
|
|
115
|
+
} else {
|
|
116
|
+
execSync(`unzip -q -o "${zipPath}" -d "${installDir}"`, { stdio: 'inherit' });
|
|
117
|
+
}
|
|
113
118
|
|
|
114
119
|
// Clean up zip
|
|
115
120
|
fs.unlinkSync(zipPath);
|