@tinycloud/cli 1.3.6-beta.1 → 1.3.6
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/dist/courier-entry.js +18 -6
- package/dist/courier-entry.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/legacy-entry.js +12 -0
- package/dist/legacy-entry.js.map +1 -1
- package/package.json +6 -6
package/dist/courier-entry.js
CHANGED
|
@@ -901,12 +901,24 @@ import fs from "fs";
|
|
|
901
901
|
import path from "path";
|
|
902
902
|
import { randomBytes } from "crypto";
|
|
903
903
|
function profileDir() {
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
904
|
+
let dir = process.env.COURIER_HOME;
|
|
905
|
+
if (!dir) {
|
|
906
|
+
const home = process.env.HOME;
|
|
907
|
+
if (!home)
|
|
908
|
+
throw new CourierError("home-unset", "HOME is not set. Set HOME or COURIER_HOME to choose where Courier stores its state.");
|
|
909
|
+
dir = path.join(home, ".courier");
|
|
910
|
+
}
|
|
911
|
+
assertTestHome(dir);
|
|
912
|
+
return dir;
|
|
913
|
+
}
|
|
914
|
+
function assertTestHome(dir) {
|
|
915
|
+
if (process.env.COURIER_TEST !== "1")
|
|
916
|
+
return;
|
|
917
|
+
const root = process.env.COURIER_TEST_HOME ? path.resolve(process.env.COURIER_TEST_HOME) : void 0;
|
|
918
|
+
const resolved = path.resolve(dir);
|
|
919
|
+
if (!root || resolved !== root && !resolved.startsWith(root + path.sep)) {
|
|
920
|
+
throw new CourierError("test-home-escape", `COURIER_TEST=1: ${resolved} is outside COURIER_TEST_HOME (${root ?? "unset"}).`);
|
|
921
|
+
}
|
|
910
922
|
}
|
|
911
923
|
function profilePath(name2, home = profileDir()) {
|
|
912
924
|
return path.join(home, name2);
|