Skip to content

Commit

Permalink
feat can now watch for changes in bbs source code.
Browse files Browse the repository at this point in the history
  • Loading branch information
ispyhumanfly committed Oct 12, 2023
1 parent 91b452c commit 3cef146
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions packages/iniquity/src/commands/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,16 @@ export class App implements yargs.CommandModule {

public builder = (yargs: yargs.Argv) => {
return yargs
.options("install_deps", {
type: "boolean",
default: false,
describe: "Install dependencies for the iniquity bbs app."
})
.options("watch", {
type: "boolean",
default: false,
describe: "Watch for changes in the iniquity bbs app."
})
.positional("start", {
type: "string",
description: "Starts the iniquity bbs app on this machine."
Expand All @@ -78,17 +88,21 @@ export class App implements yargs.CommandModule {
.pkgConf("iniquity", path.join(__dirname))
}
public handler(argv: yargs.Arguments) {
switch (argv.action) {
case "start":
if (fs.existsSync(".iniquity")) {
process.chdir(".iniquity")
if (argv.install_deps || argv.watch) {
if (fs.existsSync(".iniquity")) {
process.chdir(".iniquity")

if (argv.install_deps) {
exec("npm install", (err, stdout, stderr) => {
if (err) {
console.error(err)
return
}
console.log(stdout)
})
}

if (argv.watch) {
exec("npx rollup -c", (err, stdout, stderr) => {
if (err) {
console.error(err)
Expand All @@ -97,7 +111,11 @@ export class App implements yargs.CommandModule {
console.log(stdout)
})
}
}
}

switch (argv.action) {
case "start":
compose.upAll(composeOptions).then(
(response: compose.IDockerComposeResult) => {
if (response.out) console.log(response.out)
Expand Down

0 comments on commit 3cef146

Please sign in to comment.