Skip to content

Commit

Permalink
Merge branch 'main' into prompts_for_native_transports
Browse files Browse the repository at this point in the history
  • Loading branch information
pelikhan authored Oct 30, 2023
2 parents bb0e813 + 25f9136 commit 1311418
Show file tree
Hide file tree
Showing 102 changed files with 1,940 additions and 2,336 deletions.
41 changes: 20 additions & 21 deletions cli/src/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -507,23 +507,20 @@ export async function saveLibFiles(
const customServices =
buildConfig.services.filter(srv => srv.catalog !== undefined) || []
// generate source files
await Promise.all(["ts", "c"].map(async (lang) => {
const converter = converters()[lang]
let constants = ""
for (const srv of customServices) {
constants += converter(srv) + "\n"
}
const dir = join(pref, GENDIR, lang)
if (!existsSync(dir))
await Promise.all(
["ts", "c"].map(async lang => {
const converter = converters()[lang]
let constants = ""
for (const srv of customServices) {
constants += converter(srv) + "\n"
}
const dir = join(pref, GENDIR, lang)
await mkdirp(dir)

if (existsSync(join(dir, `constants.${lang}`)))
return

await writeFile(join(dir, `constants.${lang}`), constants, {
encoding: "utf-8",
return writeFile(join(dir, `constants.${lang}`), constants, {
encoding: "utf-8",
})
})
}))
)
// json specs
{
const dir = join(pref, GENDIR)
Expand All @@ -544,13 +541,15 @@ export async function saveLibFiles(
}

export async function buildAll(options: BuildOptions) {
await Promise.all((await glob("src/main*.ts")).map((file) => {
log(`build ${file}`)
return build(file, {
...options,
outDir: BINDIR + "/" + file.slice(8, -3),
await Promise.all(
(await glob("src/main*.ts")).map(file => {
log(`build ${file}`)
return build(file, {
...options,
outDir: BINDIR + "/" + file.slice(8, -3),
})
})
}))
)
}

export async function build(file: string, options: BuildOptions) {
Expand Down
2 changes: 1 addition & 1 deletion cli/src/exitcodes.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export const EXIT_CODE_EADDRINUSE = 100
export const EXIT_CODE_COMPILATION_ERROR = 101
export const EXIT_CODE_COMPILATION_ERROR = 101
11 changes: 5 additions & 6 deletions cli/src/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -449,8 +449,7 @@ export async function init(dir: string | undefined, options: InitOptions) {
const pkg = readJSON5Sync("package.json") as PackageManifest

// name needed in worspace for install to work
if (!pkg.name)
pkg.name = dir || basename(process.cwd())
if (!pkg.name) pkg.name = dir || basename(process.cwd())

// ensure cli is added
addCliDependency(pkg)
Expand Down Expand Up @@ -502,12 +501,12 @@ export async function init(dir: string | undefined, options: InitOptions) {

return finishAdd(
`Your DeviceScript project is initialized.\n` +
`To get more help, https://microsoft.github.io/devicescript/getting-started/`,
`To get more help, https://microsoft.github.io/devicescript/getting-started/`,
["package.json", MAIN]
)
}

export interface AddSimOptions extends InitOptions { }
export interface AddSimOptions extends InitOptions {}

export async function addSim(options: AddSimOptions) {
log(`Adding simulator support`)
Expand Down Expand Up @@ -566,7 +565,7 @@ export interface AddNpmOptions extends InitOptions {
name?: string
}

export interface AddSettingsOptions extends InitOptions { }
export interface AddSettingsOptions extends InitOptions {}

export function execCmd(cmd: string) {
try {
Expand Down Expand Up @@ -726,7 +725,7 @@ export async function addTest(options: AddTestOptions) {
)
}

export interface AddTestOptions extends InitOptions { }
export interface AddTestOptions extends InitOptions {}

export function initAddCmds() {
addReqHandler<SideAddBoardReq, SideAddBoardResp>("addBoard", d =>
Expand Down
17 changes: 10 additions & 7 deletions cli/src/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,16 @@ export async function runTest(
error(...data)
process.exit(1)
}
setTimeout(() => {
if (resolve) {
inst.devsStop()
console.log("timeout")
reject(new Error("timeout"))
}
}, parseInt(options.testTimeout) || 5000)
setTimeout(
() => {
if (resolve) {
inst.devsStop()
console.log("timeout")
reject(new Error("timeout"))
}
},
parseInt(options.testTimeout) || 5000
)
})
}

Expand Down
2 changes: 1 addition & 1 deletion cli/src/sidedata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const msgHandlers: Record<

export function addReqHandler<
Req extends SideReq,
Resp extends SideResp<Req["req"]> = SideResp<Req["req"]>
Resp extends SideResp<Req["req"]> = SideResp<Req["req"]>,
>(
req: Req["req"],
cb: (msg: Req, sender: DevToolsClient) => Promise<Resp["data"]>
Expand Down
Loading

0 comments on commit 1311418

Please sign in to comment.