relmio 0.2.11 → 0.2.12

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/CHANGELOG.md CHANGED
@@ -7,6 +7,18 @@ checks the registry separately after publication.
7
7
 
8
8
  ## Unreleased
9
9
 
10
+ ## [0.2.12] - 2026-08-04
11
+
12
+ ### Fixed
13
+
14
+ - Install the pinned `openai-oauth@2.0.0` helper with its exact compatible
15
+ `zod@4.1.8` peer even when inherited npm settings omit peer dependencies,
16
+ preventing the Windows sign-in helper from exiting before it prints a URL.
17
+ - Accept the same strictly validated authorization line from either helper
18
+ output stream, including Windows terminal framing and final drained output.
19
+ - Run npm package builds through the current Node.js runtime on Windows instead
20
+ of executing `npm.cmd` directly with `shell: false`.
21
+
10
22
  ## [0.2.11] - 2026-08-04
11
23
 
12
24
  ### Fixed
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "relmio",
3
- "version": "0.2.11",
3
+ "version": "0.2.12",
4
4
  "description": "Turn a supported ChatGPT/Codex OAuth sign-in into a private OpenAI-compatible endpoint, starting with self-hosted n8n.",
5
5
  "keywords": [
6
6
  "relmio",
@@ -10,15 +10,48 @@ import {
10
10
  rm,
11
11
  } from "node:fs/promises";
12
12
  import { tmpdir } from "node:os";
13
- import { basename, join, resolve } from "node:path";
13
+ import { basename, dirname, join, resolve } from "node:path";
14
14
  import { fileURLToPath } from "node:url";
15
15
  import { promisify } from "node:util";
16
16
 
17
17
  const execFileAsync = promisify(execFile);
18
- const npmCommand = process.platform === "win32" ? "npm.cmd" : "npm";
19
18
  const sourceRoot = fileURLToPath(new URL("..", import.meta.url));
20
19
  const defaultOutputDirectory = join(sourceRoot, "dist", "npm");
21
20
 
21
+ export function resolveNpmInvocation({
22
+ env = process.env,
23
+ execPath = process.execPath,
24
+ platform = process.platform,
25
+ } = {}) {
26
+ if (platform !== "win32") {
27
+ return { command: "npm", prefixArgs: [] };
28
+ }
29
+
30
+ const npmExecPathKey = Object.keys(env ?? {}).find(
31
+ (key) => key.toLowerCase() === "npm_execpath",
32
+ );
33
+ const npmExecPath =
34
+ npmExecPathKey === undefined ? undefined : env[npmExecPathKey];
35
+ let npmCliPath;
36
+
37
+ if (typeof npmExecPath === "string") {
38
+ if (/(?:^|[\\/])npm-cli\.js$/iu.test(npmExecPath)) {
39
+ npmCliPath = resolve(npmExecPath);
40
+ } else if (/(?:^|[\\/])npx-cli\.js$/iu.test(npmExecPath)) {
41
+ npmCliPath = resolve(dirname(npmExecPath), "npm-cli.js");
42
+ }
43
+ }
44
+
45
+ return {
46
+ command: execPath,
47
+ // Windows cannot execute npm.cmd directly with shell:false.
48
+ prefixArgs: [
49
+ npmCliPath ??
50
+ resolve(dirname(execPath), "node_modules", "npm", "bin", "npm-cli.js"),
51
+ ],
52
+ };
53
+ }
54
+
22
55
  async function copyPublishEntry({ entry, stagingDirectory }) {
23
56
  const source = join(sourceRoot, entry);
24
57
  const target = join(stagingDirectory, entry);
@@ -61,9 +94,11 @@ export async function buildNpmPackage({
61
94
  const expectedPath = join(outputDirectory, expectedFilename);
62
95
  await rm(expectedPath, { force: true });
63
96
 
97
+ const npmInvocation = resolveNpmInvocation();
64
98
  const { stdout } = await execFileAsync(
65
- npmCommand,
99
+ npmInvocation.command,
66
100
  [
101
+ ...npmInvocation.prefixArgs,
67
102
  "pack",
68
103
  stagingDirectory,
69
104
  "--json",
@@ -214,7 +214,12 @@ export async function startOAuthLogin({
214
214
  const args = [
215
215
  "--yes",
216
216
  "--ignore-scripts",
217
- "openai-oauth@2.0.0",
217
+ "--legacy-peer-deps=false",
218
+ "--include=peer",
219
+ "--package=openai-oauth@2.0.0",
220
+ "--package=zod@4.1.8",
221
+ "--",
222
+ "openai-oauth",
218
223
  "login",
219
224
  "--no-open",
220
225
  "--login-timeout-ms",
@@ -279,11 +284,8 @@ export async function startOAuthLogin({
279
284
  return;
280
285
  }
281
286
  loginOutput[stream] += output;
282
- if (stream !== "stdout") {
283
- return;
284
- }
285
287
  try {
286
- const authorizationUrl = extractAuthorizationUrl(loginOutput.stdout);
288
+ const authorizationUrl = extractAuthorizationUrl(loginOutput[stream]);
287
289
  if (authorizationUrl) {
288
290
  settleAuthorizationUrl(null, authorizationUrl);
289
291
  }
@@ -325,9 +327,13 @@ export async function startOAuthLogin({
325
327
  child.once("close", (code) => {
326
328
  if (!authorizationUrlSettled) {
327
329
  try {
328
- const authorizationUrl = extractAuthorizationUrl(loginOutput.stdout, {
329
- includeFinalLine: true,
330
- });
330
+ const authorizationUrl =
331
+ extractAuthorizationUrl(loginOutput.stdout, {
332
+ includeFinalLine: true,
333
+ }) ??
334
+ extractAuthorizationUrl(loginOutput.stderr, {
335
+ includeFinalLine: true,
336
+ });
331
337
  if (authorizationUrl) {
332
338
  settleAuthorizationUrl(null, authorizationUrl);
333
339
  } else {