@elumixor/devkit 0.1.4 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/package.json +4 -4
- package/src/bin/devkit.ts +29 -5
package/README.md
CHANGED
|
@@ -15,8 +15,8 @@ Add a `devkit` block to your root `package.json`:
|
|
|
15
15
|
```jsonc
|
|
16
16
|
{
|
|
17
17
|
"scripts": {
|
|
18
|
-
"dev": "devkit
|
|
19
|
-
"dev:open": "devkit
|
|
18
|
+
"dev": "devkit",
|
|
19
|
+
"dev:open": "devkit --open"
|
|
20
20
|
},
|
|
21
21
|
"devkit": {
|
|
22
22
|
"apps": [
|
|
@@ -42,5 +42,5 @@ Each app runs `bun --filter <name> dev` by default. Override with:
|
|
|
42
42
|
|
|
43
43
|
## Bins
|
|
44
44
|
|
|
45
|
-
- `devkit
|
|
45
|
+
- `devkit [root] [--open] [--dry] [--version]` — the orchestrator above. `root` is an optional path to the folder holding the `devkit` config (defaults to the current directory); `--dry` prints the resolved commands and URLs without running anything.
|
|
46
46
|
- `free-port <port>` — kill whatever is listening on a port (handy in a `predev`).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elumixor/devkit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Dev orchestrator for bun monorepos — free ports, run apps side-by-side, open the browser when ready",
|
|
5
5
|
"author": "elumixor",
|
|
6
6
|
"license": "ISC",
|
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
"build": "tsc --noEmit",
|
|
21
21
|
"typecheck": "tsc --noEmit",
|
|
22
22
|
"lint": "biome lint src",
|
|
23
|
-
"release:patch": "npm version patch -m \"Release v%s\" && git push --tags",
|
|
24
|
-
"release:minor": "npm version minor -m \"Release v%s\" && git push --tags",
|
|
25
|
-
"release:major": "npm version major -m \"Release v%s\" && git push --tags"
|
|
23
|
+
"release:patch": "npm version patch -m \"Release v%s\" && git push --follow-tags",
|
|
24
|
+
"release:minor": "npm version minor -m \"Release v%s\" && git push --follow-tags",
|
|
25
|
+
"release:major": "npm version major -m \"Release v%s\" && git push --follow-tags"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"concurrently": "^10.0.3"
|
package/src/bin/devkit.ts
CHANGED
|
@@ -1,11 +1,35 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
|
+
import { parseArgs } from "node:util";
|
|
3
|
+
import { resolve } from "node:path";
|
|
2
4
|
import { runDev } from "../dev.ts";
|
|
5
|
+
import pkg from "../../package.json" with { type: "json" };
|
|
3
6
|
|
|
4
|
-
const
|
|
7
|
+
const { values, positionals } = parseArgs({
|
|
8
|
+
options: {
|
|
9
|
+
open: { type: "boolean", default: false },
|
|
10
|
+
dry: { type: "boolean", default: false },
|
|
11
|
+
version: { type: "boolean", short: "v", default: false },
|
|
12
|
+
help: { type: "boolean", short: "h", default: false },
|
|
13
|
+
},
|
|
14
|
+
allowPositionals: true,
|
|
15
|
+
});
|
|
5
16
|
|
|
6
|
-
if (
|
|
7
|
-
console.
|
|
8
|
-
process.exit(
|
|
17
|
+
if (values.version) {
|
|
18
|
+
console.log(pkg.version);
|
|
19
|
+
process.exit(0);
|
|
9
20
|
}
|
|
10
21
|
|
|
11
|
-
|
|
22
|
+
if (values.help) {
|
|
23
|
+
console.log("usage: devkit [root] [--open] [--dry] [--version]\n");
|
|
24
|
+
console.log(" root path to the folder holding the devkit config (default: cwd)");
|
|
25
|
+
console.log(" --open open each app's URL in the browser once its port is live");
|
|
26
|
+
console.log(" --dry print the resolved commands and URLs without running anything");
|
|
27
|
+
console.log(" --version print the devkit version");
|
|
28
|
+
process.exit(0);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Optional positional: the monorepo root. Operate as if launched from there.
|
|
32
|
+
const root = positionals[0];
|
|
33
|
+
if (root) process.chdir(resolve(root));
|
|
34
|
+
|
|
35
|
+
await runDev(values.open, values.dry);
|