codexport 0.1.0 → 0.1.1
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/index.js +9 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5,11 +5,13 @@ import { createHash, randomBytes } from "node:crypto";
|
|
|
5
5
|
import { createServer, request } from "node:http";
|
|
6
6
|
import { mkdir, readFile, readdir, readlink, rename, rm, stat, symlink, writeFile } from "node:fs/promises";
|
|
7
7
|
import { existsSync } from "node:fs";
|
|
8
|
+
import { realpathSync } from "node:fs";
|
|
9
|
+
import { fileURLToPath } from "node:url";
|
|
8
10
|
import { homedir, platform } from "node:os";
|
|
9
11
|
import path from "node:path";
|
|
10
12
|
import { spawn } from "node:child_process";
|
|
11
13
|
import { parse as parseToml, stringify as stringifyToml } from "smol-toml";
|
|
12
|
-
const VERSION = "0.1.
|
|
14
|
+
const VERSION = "0.1.1";
|
|
13
15
|
const DEFAULT_PORT = 17342;
|
|
14
16
|
const DEFAULT_TIMEOUT_MS = 5_000;
|
|
15
17
|
const CODEXPORT_DIR = ".codexport";
|
|
@@ -732,7 +734,12 @@ async function main(argv) {
|
|
|
732
734
|
.action(async (options, command) => commandStatus(contextFromCommand(command), options));
|
|
733
735
|
await program.parseAsync(argv);
|
|
734
736
|
}
|
|
735
|
-
|
|
737
|
+
function isCliEntrypoint() {
|
|
738
|
+
if (!process.argv[1])
|
|
739
|
+
return false;
|
|
740
|
+
return realpathSync(fileURLToPath(import.meta.url)) === realpathSync(process.argv[1]);
|
|
741
|
+
}
|
|
742
|
+
if (isCliEntrypoint()) {
|
|
736
743
|
main(process.argv).catch((error) => {
|
|
737
744
|
const err = asError(error);
|
|
738
745
|
const exitCode = error instanceof CliError ? error.exitCode : 1;
|