@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 CHANGED
@@ -15,8 +15,9 @@ pnpm add -D @howells/boundaries
15
15
  Try without installing:
16
16
 
17
17
  ```sh
18
- npx @howells/boundaries --help
18
+ npx @howells/boundaries
19
19
  npx @howells/boundaries init --dry-run
20
+ npx @howells/boundaries --help
20
21
  ```
21
22
 
22
23
  Initialize boundary config:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@howells/boundaries",
3
- "version": "0.1.2",
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 <command>")) {
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 <command>
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 (!command || command === "help" || command === "--help" || command === "-h") {
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 (command === "init") {
47
- const result = await initRepository({ dryRun: hasFlag(args, "--dry-run") });
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 (command === "check") {
62
+ if (effectiveCommand === "check") {
59
63
  const result = await checkRepository({
60
- runTurbo: !args.includes("--no-turbo"),
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: !args.includes("--no-turbo"),
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 (command === "explain") {
92
- return explain(stripFlags(args, ["--json"]), { json });
95
+ if (effectiveCommand === "explain") {
96
+ return explain(stripFlags(effectiveArgs, ["--json"]), { json });
93
97
  }
94
98
 
95
99
  const error = {
package/src/schema.js CHANGED
@@ -1,6 +1,7 @@
1
1
  export const commandSchema = {
2
2
  name: "boundaries",
3
3
  description: "Opinionated Turborepo package boundary conventions.",
4
+ defaultCommand: "check",
4
5
  commands: [
5
6
  {
6
7
  name: "init",