Skip to content

Commit b741021

Browse files
authored
Create client function to setup server. [node_publish] (#476)
1 parent 78cb5c2 commit b741021

File tree

5 files changed

+22
-11
lines changed

5 files changed

+22
-11
lines changed

CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ cmake_minimum_required(VERSION 3.13)
1313

1414
# Project information
1515
project(omega_edit
16-
VERSION 0.9.29
16+
VERSION 0.9.30
1717
DESCRIPTION "Apache open source library for building editors"
1818
HOMEPAGE_URL "https://github.com/ctc-oss/omega-edit"
1919
LANGUAGES C CXX)

src/rpc/client/ts/package-lock.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/rpc/client/ts/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "omega-edit",
3-
"version": "0.9.29",
3+
"version": "0.9.30",
44
"description": "OmegaEdit gRPC Client TypeScript Types",
55
"publisher": "ctc-oss",
66
"repository": {

src/rpc/client/ts/src/server.d.ts

+4
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,8 @@ declare module 'omega-edit/server' {
2323
omegaEditVersion: string
2424
): Promise<number | undefined>
2525
export function stopServer(id: number | undefined): Promise<boolean>
26+
export function setupServer(
27+
rootPath: string,
28+
omegaEditVersion: string
29+
): Promise<[string, string]>
2630
}

src/rpc/client/ts/src/server.ts

+15-8
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ import * as unzip from 'unzip-stream'
2323
import * as os from 'os'
2424
import * as child_process from 'child_process'
2525

26-
// const xdgAppPaths = XDGAppPaths({ name: 'omega_edit' })
27-
const wait_port = require('wait-port')
28-
2926
class Artifact {
3027
name: string
3128
archive: string
@@ -45,6 +42,9 @@ class Artifact {
4542
}
4643
}
4744

45+
// const xdgAppPaths = XDGAppPaths({ name: 'omega_edit' })
46+
const wait_port = require('wait-port')
47+
4848
async function unzipFile(zipFilePath: string, extractPath: string) {
4949
return await new Promise((resolve, reject) => {
5050
let stream = fs
@@ -60,18 +60,16 @@ async function unzipFile(zipFilePath: string, extractPath: string) {
6060
})
6161
}
6262

63-
export async function startServer(
63+
export async function setupServer(
6464
rootPath: string,
6565
omegaEditVersion: string
66-
): Promise<number | undefined> {
66+
): Promise<[string, string]> {
6767
const artifact = new Artifact(
6868
'omega-edit-scala-server',
6969
omegaEditVersion,
7070
'omega-edit-grpc-server'
7171
)
7272

73-
// let rootPath = xdgAppPaths.data()
74-
7573
if (!fs.existsSync(rootPath)) {
7674
fs.mkdirSync(rootPath, { recursive: true })
7775
}
@@ -107,7 +105,16 @@ export async function startServer(
107105
)
108106
}
109107

110-
let server = child_process.spawn(artifact.scriptName, [], {
108+
return [artifact.scriptName, scriptPath]
109+
}
110+
111+
export async function startServer(
112+
rootPath: string,
113+
omegaEditVersion: string
114+
): Promise<number | undefined> {
115+
const [scriptName, scriptPath] = await setupServer(rootPath, omegaEditVersion)
116+
117+
let server = child_process.spawn(scriptName, [], {
111118
cwd: `${scriptPath}/bin`,
112119
detached: true,
113120
})

0 commit comments

Comments
 (0)