@package-pal/cli 0.0.25 → 0.0.26
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
CHANGED
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
import {
|
|
2
|
-
mkdirSync, rmSync,
|
|
3
|
-
} from 'fs';
|
|
4
|
-
import { linkExistingBinary } from './link-existing-binary.js';
|
|
5
|
-
import { loadMissingBinary } from './load-missing-binary.js';
|
|
6
|
-
import { validateBinaryVersion } from './validate-binary-version.js';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* @param {{ platform: Bun.Platform, binExecutableName: string, targetPackage: string, targetVersion: string, targetBinPath: string | null, outputBinDir: string, outputBinBasePath: string, outputBinPath: string }} options
|
|
10
|
-
*/
|
|
11
|
-
export const prepareBinary = ({
|
|
12
|
-
platform, binExecutableName, targetPackage, targetVersion, targetBinPath, outputBinDir, outputBinBasePath, outputBinPath,
|
|
13
|
-
}) => {
|
|
14
|
-
rmSync(outputBinBasePath, { force: true });
|
|
15
|
-
rmSync(outputBinPath, { force: true });
|
|
16
|
-
mkdirSync(outputBinDir, { recursive: true });
|
|
17
|
-
|
|
18
|
-
if (targetBinPath) {
|
|
19
|
-
console.info(`Expected CLI binary package is available in '${targetBinPath}'.`);
|
|
20
|
-
validateBinaryVersion(targetVersion,
|
|
21
|
-
|
|
22
|
-
// Windows can't be optimised to run the binary directly (.exe).
|
|
23
|
-
if (platform === 'win32') {
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
linkExistingBinary({
|
|
28
|
-
platform,
|
|
29
|
-
targetBinPath,
|
|
30
|
-
outputBinPath,
|
|
31
|
-
});
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
console.warn(`Expected CLI binary was not found for '${targetPackage}'.`);
|
|
36
|
-
return loadMissingBinary({
|
|
37
|
-
binExecutableName,
|
|
38
|
-
targetPackage,
|
|
39
|
-
outputBinDir,
|
|
40
|
-
});
|
|
41
|
-
};
|
|
1
|
+
import {
|
|
2
|
+
mkdirSync, rmSync,
|
|
3
|
+
} from 'fs';
|
|
4
|
+
import { linkExistingBinary } from './link-existing-binary.js';
|
|
5
|
+
import { loadMissingBinary } from './load-missing-binary.js';
|
|
6
|
+
import { validateBinaryVersion } from './validate-binary-version.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @param {{ platform: Bun.Platform, binExecutableName: string, targetPackage: string, targetVersion: string, targetBinPath: string | null, outputBinDir: string, outputBinBasePath: string, outputBinPath: string }} options
|
|
10
|
+
*/
|
|
11
|
+
export const prepareBinary = ({
|
|
12
|
+
platform, binExecutableName, targetPackage, targetVersion, targetBinPath, outputBinDir, outputBinBasePath, outputBinPath,
|
|
13
|
+
}) => {
|
|
14
|
+
rmSync(outputBinBasePath, { force: true });
|
|
15
|
+
rmSync(outputBinPath, { force: true });
|
|
16
|
+
mkdirSync(outputBinDir, { recursive: true });
|
|
17
|
+
|
|
18
|
+
if (targetBinPath) {
|
|
19
|
+
console.info(`Expected CLI binary package is available in '${targetBinPath}'.`);
|
|
20
|
+
validateBinaryVersion(targetVersion, targetBinPath);
|
|
21
|
+
|
|
22
|
+
// Windows can't be optimised to run the binary directly (.exe).
|
|
23
|
+
if (platform === 'win32') {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
linkExistingBinary({
|
|
28
|
+
platform,
|
|
29
|
+
targetBinPath,
|
|
30
|
+
outputBinPath,
|
|
31
|
+
});
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
console.warn(`Expected CLI binary was not found for '${targetPackage}'.`);
|
|
36
|
+
return loadMissingBinary({
|
|
37
|
+
binExecutableName,
|
|
38
|
+
targetPackage,
|
|
39
|
+
outputBinDir,
|
|
40
|
+
});
|
|
41
|
+
};
|