Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions packages/cli/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
#!/usr/bin/env node
import { resolve } from "path";
import { fileURLToPath } from "url";
import chalk from "chalk";
import { program } from "commander";
import { join } from "node:path";

import { registerAppCommands } from "./commands/apps.js";
import { registerAuthCommands } from "./commands/auth.js";
Expand Down Expand Up @@ -52,6 +51,9 @@ async function main() {
}

// Run the main function if this file is run directly and not imported
if (resolve(fileURLToPath(import.meta.url)) === resolve(process.argv[1])) {
if (
process.argv[1].endsWith(join("@bucketco", "cli", "dist", "index.js")) ||
process.argv[1].endsWith(join(".bin", "bucket"))
) {
void main();
}
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@bucketco/cli",
"version": "0.1.0",
"version": "0.1.1",
"packageManager": "yarn@4.1.1",
"description": "CLI for Bucket service",
"main": "./dist/index.js",
Expand Down
5 changes: 4 additions & 1 deletion packages/cli/stores/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ class ConfigStore {

protected async createValidator() {
try {
const schemaPath = await findUp("schema.json");
const schemaPath = await findUp("schema.json", {
cwd: import.meta.url,
stopAt: "cli",
});
if (!schemaPath) return;
const content = await readFile(schemaPath, "utf-8");
const parsed = JSON5.parse<Config>(content);
Expand Down