Skip to content

Commit

Permalink
chore: fix windows paths
Browse files Browse the repository at this point in the history
  • Loading branch information
Julusian committed Sep 17, 2024
1 parent 2fa4ad9 commit a216318
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 8 deletions.
2 changes: 1 addition & 1 deletion companion/lib/Instance/Host.ts
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ export class ModuleHost {
await this.#startQueue
.add(async () => {
if (config && config.enabled !== false) {
this.#logger.info(`Starting connection: "${config.label}"(${connectionId})`)
this.#logger.info(`Starting connection: "${config.label}" (${connectionId})`)

// stop any existing child process
await this.#doStopConnectionInner(connectionId, false)
Expand Down
9 changes: 3 additions & 6 deletions companion/lib/Instance/NodePath.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,11 @@ export async function getNodeJsPath(runtimeType: string): Promise<string | null>
const versionNumber = nodeVersionsJson[runtimeType]
if (!versionNumber) return null

const pathToDir = fileURLToPath(
new URL(isPackaged() ? path.join(__dirname, '/node-runtimes') : '../../../.cache/node-runtime', import.meta.url)
)
const exeName = process.platform === 'win32' ? 'node.exe' : 'bin/node'
const pathToDir = isPackaged() ? path.join(__dirname, '/node-runtimes') : '../../../.cache/node-runtime'
const nodePath = path.join(
pathToDir,
isPackaged() ? pathToDir : fileURLToPath(new URL(pathToDir, import.meta.url)),
isPackaged() ? runtimeType : `${process.platform}-${process.arch}-${versionNumber}`,
exeName
process.platform === 'win32' ? 'node.exe' : 'bin/node'
)

// Make sure it exists
Expand Down
1 change: 1 addition & 0 deletions launcher/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"dependencies": {
"@companion-app/shared": "*",
"@sentry/electron": "^5.4.0",
"chokidar": "^3.6.0",
"debounce-fn": "^6.0.0",
"electron-store": "^10.0.0",
"file-stream-rotator": "^1.0.0",
Expand Down
2 changes: 2 additions & 0 deletions tools/build/dist.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import path from 'node:path'
import yaml from 'yaml'
import { determinePlatformInfo } from './util.mjs'

$.verbose = true

if (process.platform === 'win32') {
usePowerShell() // to enable powershell
}
Expand Down
2 changes: 2 additions & 0 deletions tools/build/package.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import { determinePlatformInfo } from './util.mjs'
import { generateVersionString } from '../lib.mjs'
import { fetchNodejs } from '../fetch_nodejs.mjs'

$.verbose = true

if (process.platform === 'win32') {
usePowerShell() // to enable powershell
}
Expand Down
5 changes: 4 additions & 1 deletion tools/fetch_nodejs.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ async function fetchSingleVersion(platformInfo, nodeVersion) {
const tmpDir = path.join(cacheRuntimeDir, 'tmp')
await fs.remove(tmpDir)
await $`Expand-Archive ${toPosix(tarPath)} -DestinationPath ${toPosix(tmpDir)}`
await fs.move(path.join(tmpDir,`node-v${nodeVersion}-${platformInfo.runtimePlatform}-${platformInfo.runtimeArch}`), runtimeDir)
await fs.move(
path.join(tmpDir, `node-v${nodeVersion}-${platformInfo.runtimePlatform}-${platformInfo.runtimeArch}`),
runtimeDir
)
await fs.remove(tmpDir)
// TODO - can this be simplified and combined into the extract step?
await fs.remove(path.join(runtimeDir, 'node_modules/npm'))
Expand Down
3 changes: 3 additions & 0 deletions tools/lib.mjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// suppress fnm reporting node version
process.env.FNM_LOGLEVEL = 'quiet'

export async function generateVersionString() {
return goSilent(async () => {
const headHashRaw = await $`git rev-parse --short HEAD`
Expand Down
1 change: 1 addition & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1416,6 +1416,7 @@ __metadata:
"@electron/notarize": "npm:^2.5.0"
"@sentry/electron": "npm:^5.4.0"
"@types/plist": "npm:^3.0.5"
chokidar: "npm:^3.6.0"
debounce-fn: "npm:^6.0.0"
electron: "npm:31.6.0"
electron-builder: "npm:24.13.3"
Expand Down

0 comments on commit a216318

Please sign in to comment.