Skip to content

Commit 1ea4798

Browse files
committed
feat(cli): optimise and organise command usage, move to typescript
1 parent a748558 commit 1ea4798

26 files changed

Lines changed: 529 additions & 319 deletions

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,11 @@ yarn-error.log
88
lerna-debug.log
99
Dockerfile-dev
1010
coverage/
11+
12+
.pnp.*
13+
.yarn/*
14+
!.yarn/patches
15+
!.yarn/plugins
16+
!.yarn/releases
17+
!.yarn/sdks
18+
!.yarn/versions

.husky/pre-commit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/bin/sh
22
. "$(dirname "$0")/_/husky.sh"
33

4-
yarn exec biome check --staged --no-errors-on-unmatched
4+
yarn exec biome check --staged --write --no-errors-on-unmatched

.yarn/install-state.gz

-1.18 MB
Binary file not shown.

docker-start.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,4 @@ if [ ! -f "${FILE}" ]; then
4444
touch "${FILE}"
4545
fi
4646

47-
exec /bin/su droppy -s /bin/bash -c "node /droppy/packages/cli/lib/cli.js start"
47+
exec /bin/su droppy -s /bin/bash -c "node /droppy/packages/cli/dist/cli.js start"

package.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"scripts": {
1717
"build": "DROPPY_CACHE_PATH=$PWD/packages/cli/dist/cache.json lerna run --stream build --",
1818
"start": "lerna run --stream start --",
19+
"droppy": "yarn workspace @droppyjs/cli run droppy",
1920
"bootstrap": "",
2021
"lint": "yarn biome check .",
2122
"test": "jest",
@@ -36,24 +37,21 @@
3637
"chokidar": "3.5.2",
3738
"colorette": "1.3.0",
3839
"content-disposition": "0.5.3",
39-
"daemonize-process": "3.0.0",
4040
"escape-string-regexp": "5.0.0",
4141
"etag": "1.8.1",
4242
"image-size": "1.0.0",
4343
"json-buffer": "3.0.1",
4444
"lodash.debounce": "4.0.8",
4545
"lodash.throttle": "4.1.1",
4646
"mime-types": "2.1.32",
47-
"minimist": "1.2.6",
47+
"minimist": "1.2.8",
4848
"mv": "2.1.1",
4949
"original-url": "1.2.3",
5050
"ps-node": "0.1.6",
5151
"rfdc": "1.3.0",
5252
"rrdir": "8.2.2",
5353
"send": "0.17.1",
5454
"strip-ansi": "7.0.0",
55-
"untildify": "4.0.0",
56-
"which": "2.0.2",
5755
"ws": "8.2.1",
5856
"yazl": "2.5.1"
5957
},
@@ -62,6 +60,9 @@
6260
"@babel/plugin-syntax-import-assertions": "^7.25.6",
6361
"@babel/preset-env": "^7.28.5",
6462
"@biomejs/biome": "2.3.10",
63+
"@types/node": "^22.10.6",
64+
"@types/ps-node": "^0.1.3",
65+
"@types/which": "^3.0.4",
6566
"babel-jest": "^29.7.0",
6667
"clean-css": "5.1.5",
6768
"globals": "^15.9.0",
@@ -72,6 +73,7 @@
7273
"nx": "^16.2.2",
7374
"postcss": "8.3.6",
7475
"terser": "5.7.2",
76+
"typescript": "^5.6.3",
7577
"updates": "12.1.0",
7678
"uppie": "1.1.4"
7779
},

packages/cli/bin/droppy.mjs

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,20 @@ const __dirname = dirname(__filename);
1010

1111
// Check for DROPPY_CACHE_PATH, otherwise add default.
1212
if (!("DROPPY_CACHE_PATH" in process.env)) {
13-
const cachePath = realpathSync(join(__dirname, "..", "dist", "cache.json"));
14-
if (existsSync(cachePath)) {
15-
process.env.DROPPY_CACHE_PATH = cachePath;
13+
try {
14+
const cachePath = realpathSync(
15+
join(__dirname, "..", "dist", "cache.json"),
16+
);
17+
if (existsSync(cachePath)) {
18+
process.env.DROPPY_CACHE_PATH = cachePath;
19+
}
20+
} catch (error) {
21+
if (error instanceof Error && 'code' in error && error.code === 'ENOENT') {
22+
// ignore, no cache found, it will be created on first use
23+
} else {
24+
console.error(error);
25+
process.exit(1);
26+
}
1627
}
1728
}
1829

@@ -21,4 +32,4 @@ if (!("DROPPY_CACHE_SKIP_VALIDATIONS" in process.env)) {
2132
process.env.DROPPY_CACHE_SKIP_VALIDATIONS = true;
2233
}
2334

24-
import("../lib/cli.js");
35+
import("../dist/cli.js");

packages/cli/lib/cli.js

Lines changed: 0 additions & 265 deletions
This file was deleted.

0 commit comments

Comments
 (0)