Skip to content

Commit c2c3299

Browse files
committed
fix: schema path, runtime path and chmod binary
1 parent 925daa0 commit c2c3299

4 files changed

Lines changed: 91 additions & 20 deletions

File tree

packages/cli/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ async function main() {
5252

5353
// Run the main function if this file is run directly and not imported
5454
if (
55-
process.argv[1].endsWith(join("@bucketco", "cli", "dist", "index.js")) ||
55+
process.argv[1].endsWith(join("cli", "dist", "index.js")) ||
5656
process.argv[1].endsWith(join(".bin", "bucket"))
5757
) {
5858
void main();

packages/cli/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
".": "./dist/index.js"
3030
},
3131
"scripts": {
32-
"build": "tsc",
33-
"bucket": "yarn build && node dist/index.js",
32+
"build": "tsc && shx chmod +x dist/index.js",
33+
"bucket": "yarn build && ./dist/index.js",
3434
"lint": "eslint .",
3535
"lint:ci": "eslint --output-file eslint-report.json --format json .",
3636
"prettier": "prettier --check .",
@@ -53,6 +53,7 @@
5353
"@types/node": "^22.5.1",
5454
"eslint": "^9.21.0",
5555
"prettier": "^3.5.2",
56+
"shx": "^0.3.4",
5657
"typescript": "^5.5.4"
5758
}
5859
}

packages/cli/stores/config.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { findUp } from "find-up";
33
import JSON5 from "json5";
44
import { readFile, writeFile } from "node:fs/promises";
55
import { dirname, join } from "node:path";
6+
import { fileURLToPath } from "node:url";
67

78
import {
89
CONFIG_FILE_NAME,
@@ -56,11 +57,12 @@ class ConfigStore {
5657

5758
protected async createValidator() {
5859
try {
59-
const schemaPath = await findUp("schema.json", {
60-
cwd: import.meta.url,
61-
stopAt: "cli",
62-
});
63-
if (!schemaPath) return;
60+
// Using current config store file, resolve the schema.json path
61+
const filePath = fileURLToPath(import.meta.url);
62+
const schemaPath = join(
63+
filePath.substring(0, filePath.indexOf("cli") + 3),
64+
"schema.json",
65+
);
6466
const content = await readFile(schemaPath, "utf-8");
6567
const parsed = JSON5.parse<Config>(content);
6668
const ajv = new Ajv();

yarn.lock

Lines changed: 80 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,7 @@ __metadata:
466466
open: "npm:^10.1.0"
467467
ora: "npm:^8.1.0"
468468
prettier: "npm:^3.5.2"
469+
shx: "npm:^0.3.4"
469470
typescript: "npm:^5.5.4"
470471
bin:
471472
bucket: ./dist/index.js
@@ -8456,31 +8457,31 @@ __metadata:
84568457
languageName: node
84578458
linkType: hard
84588459

8459-
"glob@npm:^7.1.3":
8460-
version: 7.2.0
8461-
resolution: "glob@npm:7.2.0"
8460+
"glob@npm:^7.0.0, glob@npm:^7.1.4":
8461+
version: 7.2.3
8462+
resolution: "glob@npm:7.2.3"
84628463
dependencies:
84638464
fs.realpath: "npm:^1.0.0"
84648465
inflight: "npm:^1.0.4"
84658466
inherits: "npm:2"
8466-
minimatch: "npm:^3.0.4"
8467+
minimatch: "npm:^3.1.1"
84678468
once: "npm:^1.3.0"
84688469
path-is-absolute: "npm:^1.0.0"
8469-
checksum: 10c0/478b40e38be5a3d514e64950e1e07e0ac120585add6a37c98d0ed24d72d9127d734d2a125786073c8deb687096e84ae82b641c441a869ada3a9cc91b68978632
8470+
checksum: 10c0/65676153e2b0c9095100fe7f25a778bf45608eeb32c6048cf307f579649bcc30353277b3b898a3792602c65764e5baa4f643714dfbdfd64ea271d210c7a425fe
84708471
languageName: node
84718472
linkType: hard
84728473

8473-
"glob@npm:^7.1.4":
8474-
version: 7.2.3
8475-
resolution: "glob@npm:7.2.3"
8474+
"glob@npm:^7.1.3":
8475+
version: 7.2.0
8476+
resolution: "glob@npm:7.2.0"
84768477
dependencies:
84778478
fs.realpath: "npm:^1.0.0"
84788479
inflight: "npm:^1.0.4"
84798480
inherits: "npm:2"
8480-
minimatch: "npm:^3.1.1"
8481+
minimatch: "npm:^3.0.4"
84818482
once: "npm:^1.3.0"
84828483
path-is-absolute: "npm:^1.0.0"
8483-
checksum: 10c0/65676153e2b0c9095100fe7f25a778bf45608eeb32c6048cf307f579649bcc30353277b3b898a3792602c65764e5baa4f643714dfbdfd64ea271d210c7a425fe
8484+
checksum: 10c0/478b40e38be5a3d514e64950e1e07e0ac120585add6a37c98d0ed24d72d9127d734d2a125786073c8deb687096e84ae82b641c441a869ada3a9cc91b68978632
84848485
languageName: node
84858486
linkType: hard
84868487

@@ -9156,6 +9157,13 @@ __metadata:
91569157
languageName: node
91579158
linkType: hard
91589159

9160+
"interpret@npm:^1.0.0":
9161+
version: 1.4.0
9162+
resolution: "interpret@npm:1.4.0"
9163+
checksum: 10c0/08c5ad30032edeec638485bc3f6db7d0094d9b3e85e0f950866600af3c52e9fd69715416d29564731c479d9f4d43ff3e4d302a178196bdc0e6837ec147640450
9164+
languageName: node
9165+
linkType: hard
9166+
91599167
"interpret@npm:^3.1.1":
91609168
version: 3.1.1
91619169
resolution: "interpret@npm:3.1.1"
@@ -9323,7 +9331,7 @@ __metadata:
93239331
languageName: node
93249332
linkType: hard
93259333

9326-
"is-core-module@npm:^2.15.1":
9334+
"is-core-module@npm:^2.15.1, is-core-module@npm:^2.16.0":
93279335
version: 2.16.1
93289336
resolution: "is-core-module@npm:2.16.1"
93299337
dependencies:
@@ -11008,7 +11016,7 @@ __metadata:
1100811016
languageName: node
1100911017
linkType: hard
1101011018

11011-
"minimist@npm:^1.2.0, minimist@npm:^1.2.5, minimist@npm:^1.2.6":
11019+
"minimist@npm:^1.2.0, minimist@npm:^1.2.3, minimist@npm:^1.2.5, minimist@npm:^1.2.6":
1101211020
version: 1.2.8
1101311021
resolution: "minimist@npm:1.2.8"
1101411022
checksum: 10c0/19d3fcdca050087b84c2029841a093691a91259a47def2f18222f41e7645a0b7c44ef4b40e88a1e58a40c84d2ef0ee6047c55594d298146d0eb3f6b737c20ce6
@@ -13575,6 +13583,15 @@ __metadata:
1357513583
languageName: node
1357613584
linkType: hard
1357713585

13586+
"rechoir@npm:^0.6.2":
13587+
version: 0.6.2
13588+
resolution: "rechoir@npm:0.6.2"
13589+
dependencies:
13590+
resolve: "npm:^1.1.6"
13591+
checksum: 10c0/22c4bb32f4934a9468468b608417194f7e3ceba9a508512125b16082c64f161915a28467562368eeb15dc16058eb5b7c13a20b9eb29ff9927d1ebb3b5aa83e84
13592+
languageName: node
13593+
linkType: hard
13594+
1357813595
"rechoir@npm:^0.8.0":
1357913596
version: 0.8.0
1358013597
resolution: "rechoir@npm:0.8.0"
@@ -13720,6 +13737,19 @@ __metadata:
1372013737
languageName: node
1372113738
linkType: hard
1372213739

13740+
"resolve@npm:^1.1.6":
13741+
version: 1.22.10
13742+
resolution: "resolve@npm:1.22.10"
13743+
dependencies:
13744+
is-core-module: "npm:^2.16.0"
13745+
path-parse: "npm:^1.0.7"
13746+
supports-preserve-symlinks-flag: "npm:^1.0.0"
13747+
bin:
13748+
resolve: bin/resolve
13749+
checksum: 10c0/8967e1f4e2cc40f79b7e080b4582b9a8c5ee36ffb46041dccb20e6461161adf69f843b43067b4a375de926a2cd669157e29a29578191def399dd5ef89a1b5203
13750+
languageName: node
13751+
linkType: hard
13752+
1372313753
"resolve@npm:^1.1.7, resolve@npm:^1.10.0, resolve@npm:^1.22.2, resolve@npm:~1.22.2":
1372413754
version: 1.22.8
1372513755
resolution: "resolve@npm:1.22.8"
@@ -13769,6 +13799,19 @@ __metadata:
1376913799
languageName: node
1377013800
linkType: hard
1377113801

13802+
"resolve@patch:resolve@npm%3A^1.1.6#optional!builtin<compat/resolve>":
13803+
version: 1.22.10
13804+
resolution: "resolve@patch:resolve@npm%3A1.22.10#optional!builtin<compat/resolve>::version=1.22.10&hash=c3c19d"
13805+
dependencies:
13806+
is-core-module: "npm:^2.16.0"
13807+
path-parse: "npm:^1.0.7"
13808+
supports-preserve-symlinks-flag: "npm:^1.0.0"
13809+
bin:
13810+
resolve: bin/resolve
13811+
checksum: 10c0/52a4e505bbfc7925ac8f4cd91fd8c4e096b6a89728b9f46861d3b405ac9a1ccf4dcbf8befb4e89a2e11370dacd0160918163885cbc669369590f2f31f4c58939
13812+
languageName: node
13813+
linkType: hard
13814+
1377213815
"resolve@patch:resolve@npm%3A^1.1.7#optional!builtin<compat/resolve>, resolve@patch:resolve@npm%3A^1.10.0#optional!builtin<compat/resolve>, resolve@patch:resolve@npm%3A^1.22.2#optional!builtin<compat/resolve>, resolve@patch:resolve@npm%3A~1.22.2#optional!builtin<compat/resolve>":
1377313816
version: 1.22.8
1377413817
resolution: "resolve@patch:resolve@npm%3A1.22.8#optional!builtin<compat/resolve>::version=1.22.8&hash=c3c19d"
@@ -14425,6 +14468,31 @@ __metadata:
1442514468
languageName: node
1442614469
linkType: hard
1442714470

14471+
"shelljs@npm:^0.8.5":
14472+
version: 0.8.5
14473+
resolution: "shelljs@npm:0.8.5"
14474+
dependencies:
14475+
glob: "npm:^7.0.0"
14476+
interpret: "npm:^1.0.0"
14477+
rechoir: "npm:^0.6.2"
14478+
bin:
14479+
shjs: bin/shjs
14480+
checksum: 10c0/feb25289a12e4bcd04c40ddfab51aff98a3729f5c2602d5b1a1b95f6819ec7804ac8147ebd8d9a85dfab69d501bcf92d7acef03247320f51c1552cec8d8e2382
14481+
languageName: node
14482+
linkType: hard
14483+
14484+
"shx@npm:^0.3.4":
14485+
version: 0.3.4
14486+
resolution: "shx@npm:0.3.4"
14487+
dependencies:
14488+
minimist: "npm:^1.2.3"
14489+
shelljs: "npm:^0.8.5"
14490+
bin:
14491+
shx: lib/cli.js
14492+
checksum: 10c0/83251fb09314682f5a192f0249a4be68c755933313a41b5152b11c19fc0a68311954d3ca971a0cbae05815786a893c59b82f356484d8eeb009c84f4066b3fa31
14493+
languageName: node
14494+
linkType: hard
14495+
1442814496
"side-channel-list@npm:^1.0.0":
1442914497
version: 1.0.0
1443014498
resolution: "side-channel-list@npm:1.0.0"

0 commit comments

Comments
 (0)