Skip to content

Commit

Permalink
Add a webstone dev command (#78)
Browse files Browse the repository at this point in the history
* feat(cli): add a `webstone dev` command to start services

* docs(cli): add changelog for `ws dev`
  • Loading branch information
mikenikles authored Oct 5, 2021
1 parent e599c01 commit 7e5f53a
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 3 deletions.
6 changes: 6 additions & 0 deletions .changeset/quick-mirrors-smoke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@webstone/cli": minor
"create-webstone-app": minor
---

Add a `webstone dev` command to start services.
22 changes: 20 additions & 2 deletions packages/cli/src/commands/dev/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,27 @@ import { GluegunCommand } from "gluegun";

const command: GluegunCommand = {
run: async (toolbox) => {
const { print } = toolbox;
const { filesystem, parameters, print, system } = toolbox;

print.info("Welcome to the Webstone DEV CLI.");
const servicesToStart = filesystem
.subdirectories("./services/")
.filter((serviceDir) =>
parameters.first ? serviceDir.includes(parameters.first) : true
);

print.info(
`Starting services: ${servicesToStart
.map((service) => service.substring("services/".length))
.join(", ")}...`
);
await system.exec(
`pnpm run dev ${servicesToStart
.map((service) => `--filter ./${service}`)
.join(" ")}`,
{
stdout: "inherit",
}
);
},
};

Expand Down
2 changes: 1 addition & 1 deletion packages/create-webstone-app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pnpm init webstone-app [my-app]

# Start the dev servers
cd $_
pnpm dev
pnpm ws dev
```

## Access the web application
Expand Down

0 comments on commit 7e5f53a

Please sign in to comment.