@howells/boundaries 0.1.2 → 0.1.3
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 +2 -1
- package/package.json +2 -2
- package/scripts/smoke-install.mjs +1 -1
- package/src/cli.js +13 -9
- package/src/schema.js +1 -0
package/README.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@howells/boundaries",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Opinionated Turborepo package boundary conventions.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
],
|
|
17
17
|
"repository": {
|
|
18
18
|
"type": "git",
|
|
19
|
-
"url": "https://github.com/howells/boundaries.git"
|
|
19
|
+
"url": "git+https://github.com/howells/boundaries.git"
|
|
20
20
|
},
|
|
21
21
|
"bugs": {
|
|
22
22
|
"url": "https://github.com/howells/boundaries/issues"
|
|
@@ -24,7 +24,7 @@ await execFileAsync("npm", ["init", "-y"], { cwd: temp });
|
|
|
24
24
|
await execFileAsync("npm", ["install", tarball, "--ignore-scripts"], { cwd: temp });
|
|
25
25
|
|
|
26
26
|
const { stdout } = await execFileAsync("npx", ["boundaries", "--help"], { cwd: temp });
|
|
27
|
-
if (!stdout.includes("Usage: boundaries
|
|
27
|
+
if (!stdout.includes("Usage: boundaries [command]")) {
|
|
28
28
|
throw new Error("Installed boundaries binary did not print expected help.");
|
|
29
29
|
}
|
|
30
30
|
|
package/src/cli.js
CHANGED
|
@@ -15,7 +15,9 @@ import {
|
|
|
15
15
|
} from "./output.js";
|
|
16
16
|
import { commandSchema } from "./schema.js";
|
|
17
17
|
|
|
18
|
-
const HELP = `Usage: boundaries
|
|
18
|
+
const HELP = `Usage: boundaries [command]
|
|
19
|
+
|
|
20
|
+
Default command: check
|
|
19
21
|
|
|
20
22
|
Commands:
|
|
21
23
|
init Add Howells boundary conventions to a Turborepo workspace
|
|
@@ -28,13 +30,15 @@ async function main(argv) {
|
|
|
28
30
|
const [command, ...args] = argv;
|
|
29
31
|
const json = hasFlag(argv, "--json");
|
|
30
32
|
const schema = hasFlag(argv, "--schema");
|
|
33
|
+
const effectiveCommand = !command || command.startsWith("-") ? "check" : command;
|
|
34
|
+
const effectiveArgs = !command || command.startsWith("-") ? argv : args;
|
|
31
35
|
|
|
32
36
|
if (schema) {
|
|
33
37
|
writeJson(process.stdout, success(commandSchema));
|
|
34
38
|
return EXIT_CODES.OK;
|
|
35
39
|
}
|
|
36
40
|
|
|
37
|
-
if (
|
|
41
|
+
if (command === "help" || command === "--help" || command === "-h") {
|
|
38
42
|
if (json) {
|
|
39
43
|
writeJson(process.stdout, success(commandSchema));
|
|
40
44
|
return EXIT_CODES.OK;
|
|
@@ -43,8 +47,8 @@ async function main(argv) {
|
|
|
43
47
|
return EXIT_CODES.OK;
|
|
44
48
|
}
|
|
45
49
|
|
|
46
|
-
if (
|
|
47
|
-
const result = await initRepository({ dryRun: hasFlag(
|
|
50
|
+
if (effectiveCommand === "init") {
|
|
51
|
+
const result = await initRepository({ dryRun: hasFlag(effectiveArgs, "--dry-run") });
|
|
48
52
|
if (json) {
|
|
49
53
|
writeJson(process.stdout, success(summarizeInitResult(result)));
|
|
50
54
|
} else {
|
|
@@ -55,9 +59,9 @@ async function main(argv) {
|
|
|
55
59
|
return EXIT_CODES.OK;
|
|
56
60
|
}
|
|
57
61
|
|
|
58
|
-
if (
|
|
62
|
+
if (effectiveCommand === "check") {
|
|
59
63
|
const result = await checkRepository({
|
|
60
|
-
runTurbo: !
|
|
64
|
+
runTurbo: !effectiveArgs.includes("--no-turbo"),
|
|
61
65
|
quiet: json,
|
|
62
66
|
});
|
|
63
67
|
if (json) {
|
|
@@ -65,7 +69,7 @@ async function main(argv) {
|
|
|
65
69
|
writeJson(process.stdout, success({
|
|
66
70
|
ok: true,
|
|
67
71
|
workspaceCount: result.workspaces?.length ?? 0,
|
|
68
|
-
ranTurbo: !
|
|
72
|
+
ranTurbo: !effectiveArgs.includes("--no-turbo"),
|
|
69
73
|
turbo: result.turbo
|
|
70
74
|
? { exitCode: result.turbo.exitCode, stdout: result.turbo.stdout, stderr: result.turbo.stderr }
|
|
71
75
|
: undefined,
|
|
@@ -88,8 +92,8 @@ async function main(argv) {
|
|
|
88
92
|
return result.exitCode;
|
|
89
93
|
}
|
|
90
94
|
|
|
91
|
-
if (
|
|
92
|
-
return explain(stripFlags(
|
|
95
|
+
if (effectiveCommand === "explain") {
|
|
96
|
+
return explain(stripFlags(effectiveArgs, ["--json"]), { json });
|
|
93
97
|
}
|
|
94
98
|
|
|
95
99
|
const error = {
|