Skip to content

Commit

Permalink
Switch back to regular JS
Browse files Browse the repository at this point in the history
  • Loading branch information
depau committed Oct 8, 2024
1 parent d30c8a6 commit 8468d97
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 16 deletions.
4 changes: 2 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
"request": "launch",
"name": "Run proxy",
"skipFiles": ["<node_internals>/**"],
"program": "${workspaceFolder}/index.mjs",
"program": "${workspaceFolder}/index.js",
"args": ["-M", "-d", "/tmp/podman.sock"],
"preLaunchTask": "Remove old socket",
"outFiles": ["${workspaceFolder}/**/*.js", "${workspaceFolder}/**/*.mjs"]
"outFiles": ["${workspaceFolder}/**/*.js", "${workspaceFolder}/**/*.js"]
}
]
}
20 changes: 11 additions & 9 deletions index.mjs → index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import fs from 'fs';
import http from 'http';
import net from 'net';
import path from 'path';
import systemdSocket from 'systemd-socket';
import url from 'url';
import { execFileSync } from 'child_process';
import { program } from 'commander';
const fs = require('fs');
const http = require('http');
const net = require('net');
const path = require('path');
const systemdSocket = require('systemd-socket');
const url = require('url');
const { execFileSync } = require('child_process');
const { program } = require('commander');

const defaultUpstreamSocketPath = '/mnt/wsl/podman-sockets/podman-machine-default/podman-root.sock';
const defaultDownstreamSocketPath = '/run/podman/podman.sock';
Expand Down Expand Up @@ -150,7 +150,9 @@ function translateHostPath(hostPath) {
// noinspection ExceptionCaughtLocallyJS
throw new Error(`PODMAN WSL SERVICE BUG: unexpected path format, expected absolute path: '${hostPath}'`);
}
return path.join(sharedRoot, hostPath.slice(1));
const res = path.join(sharedRoot, hostPath.slice(1));
console.debug(`Translating host path: ${hostPath} -> ${res}`);
return res;
}
return winPath;
} catch (err) {
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
"name": "podman-wsl-service",
"version": "1.0.0",
"description": "",
"main": "index.mjs",
"main": "index.js",
"scripts": {
"start": "node --disable-warning=DEP0060 index.mjs",
"watch": "node --disable-warning=DEP0060 --watch index.mjs",
"start": "node --disable-warning=DEP0060 index.js",
"watch": "node --disable-warning=DEP0060 --watch index.js",
"test": "echo \"Error: no test specified\" && exit 1",
"pkg": "npm run pkg-x86_64 && npm run pkg-arm64",
"pkg-x86_64": "pkg -o dist/podman-wsl-service-x86_64 -t node22-linux-x64 --options \"disable-warning=DEP0060\" --public -C brotli -c package.json index.mjs",
"pkg-arm64": "pkg -o dist/podman-wsl-service-arm64 -t node22-linux-arm64 --options \"disable-warning=DEP0060\" --public -C brotli -c package.json index.mjs",
"pkg-x86_64": "pkg -o dist/podman-wsl-service-x86_64 -t node22-linux-x64 --options \"disable-warning=DEP0060\" --public -C brotli -c package.json index.js",
"pkg-arm64": "pkg -o dist/podman-wsl-service-arm64 -t node22-linux-arm64 --options \"disable-warning=DEP0060\" --public -C brotli -c package.json index.js",
"clean": "rm -rf dist"
},
"private": true,
Expand Down

0 comments on commit 8468d97

Please sign in to comment.