git-vibe-setup 3.0.1 → 3.0.2
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 -2
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +28 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
Local initializer for GitVibe consumer repositories.
|
|
4
4
|
|
|
5
5
|
```bash
|
|
6
|
-
npx
|
|
6
|
+
npx git-vibe-setup setup
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
The command writes `.github` and `.git-vibe` starter files, pins reusable
|
|
9
|
+
The `setup` command writes `.github` and `.git-vibe` starter files, pins reusable
|
|
10
10
|
workflow refs to the latest stable `markhuangai/git-vibe` release, and fails
|
|
11
11
|
before writing if release lookup or target-file validation fails.
|
package/dist/cli.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
interface SetupCliRuntime {
|
|
3
|
+
argv?: string[];
|
|
3
4
|
cwd?: string;
|
|
4
5
|
error?: (message: string) => void;
|
|
5
6
|
fetchImpl?: typeof fetch;
|
|
@@ -8,4 +9,5 @@ interface SetupCliRuntime {
|
|
|
8
9
|
}
|
|
9
10
|
export declare function runSetup(runtime?: SetupCliRuntime): Promise<void>;
|
|
10
11
|
export declare function setupCli(runtime?: SetupCliRuntime): Promise<number>;
|
|
12
|
+
export declare function isDirectRun(moduleUrl: string, entrypoint?: string): boolean;
|
|
11
13
|
export {};
|
package/dist/cli.js
CHANGED
|
@@ -1,10 +1,20 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { realpathSync } from "node:fs";
|
|
2
3
|
import { resolve } from "node:path";
|
|
3
4
|
import { pathToFileURL } from "node:url";
|
|
4
5
|
import { fileURLToPath } from "node:url";
|
|
5
6
|
import { blockingInstallPaths, buildInstallFiles, existingFilesError, installFiles, } from "./install.js";
|
|
6
7
|
import { renderManualSetupInstructions } from "./instructions.js";
|
|
7
8
|
import { latestStableReleaseTag } from "./releases.js";
|
|
9
|
+
const usage = `Usage:
|
|
10
|
+
git-vibe-setup setup
|
|
11
|
+
git-vibe-setup
|
|
12
|
+
|
|
13
|
+
Commands:
|
|
14
|
+
setup Install GitVibe starter files into the current repository.
|
|
15
|
+
|
|
16
|
+
Options:
|
|
17
|
+
-h, --help Show this help message.`;
|
|
8
18
|
export async function runSetup(runtime = {}) {
|
|
9
19
|
const cwd = runtime.cwd || process.cwd();
|
|
10
20
|
const repositoryRoot = runtime.repositoryRoot || packageRoot();
|
|
@@ -17,6 +27,16 @@ export async function runSetup(runtime = {}) {
|
|
|
17
27
|
(runtime.log || console.log)(renderManualSetupInstructions(releaseTag));
|
|
18
28
|
}
|
|
19
29
|
export async function setupCli(runtime = {}) {
|
|
30
|
+
const argv = runtime.argv || process.argv.slice(2);
|
|
31
|
+
const command = argv[0] || "setup";
|
|
32
|
+
if (command === "--help" || command === "-h" || command === "help") {
|
|
33
|
+
(runtime.log || console.log)(usage);
|
|
34
|
+
return 0;
|
|
35
|
+
}
|
|
36
|
+
if (command !== "setup") {
|
|
37
|
+
(runtime.error || console.error)(`Unknown command: ${command}\n\n${usage}`);
|
|
38
|
+
return 1;
|
|
39
|
+
}
|
|
20
40
|
try {
|
|
21
41
|
await runSetup(runtime);
|
|
22
42
|
return 0;
|
|
@@ -36,6 +56,12 @@ if (isDirectRun(import.meta.url)) {
|
|
|
36
56
|
process.exitCode = exitCode;
|
|
37
57
|
}
|
|
38
58
|
/* c8 ignore stop */
|
|
39
|
-
function isDirectRun(moduleUrl, entrypoint = process.argv[1]) {
|
|
40
|
-
|
|
59
|
+
export function isDirectRun(moduleUrl, entrypoint = process.argv[1]) {
|
|
60
|
+
if (!entrypoint)
|
|
61
|
+
return false;
|
|
62
|
+
return (pathToFileURL(realpathSync(resolve(entrypoint))).href ===
|
|
63
|
+
pathToFileURL(modulePath(moduleUrl)).href);
|
|
64
|
+
}
|
|
65
|
+
function modulePath(moduleUrl) {
|
|
66
|
+
return realpathSync(fileURLToPath(moduleUrl));
|
|
41
67
|
}
|