@ffflorian/icanhazdadjoke 2.4.3 → 2.4.5
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/dist/cli.js +8 -8
- package/package.json +3 -3
package/dist/cli.js
CHANGED
|
@@ -43,15 +43,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
43
43
|
});
|
|
44
44
|
};
|
|
45
45
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46
|
+
const path = __importStar(require("node:path"));
|
|
47
|
+
const node_fs_1 = require("node:fs");
|
|
46
48
|
const commander_1 = require("commander");
|
|
47
|
-
const
|
|
48
|
-
const path = __importStar(require("path"));
|
|
49
|
+
const package_json_1 = require("../package.json");
|
|
49
50
|
const _1 = require("./");
|
|
50
51
|
function init() {
|
|
51
52
|
return __awaiter(this, arguments, void 0, function* (dir = '.') {
|
|
52
53
|
const resolvedPath = path.resolve(dir);
|
|
53
54
|
try {
|
|
54
|
-
yield
|
|
55
|
+
yield node_fs_1.promises.access(resolvedPath, node_fs_1.constants.F_OK | node_fs_1.constants.R_OK);
|
|
55
56
|
const iCanHazDadJoke = new _1.ICanHazDadJoke();
|
|
56
57
|
return [resolvedPath, iCanHazDadJoke];
|
|
57
58
|
}
|
|
@@ -64,18 +65,17 @@ function save(filePath_1, imageResult_1) {
|
|
|
64
65
|
return __awaiter(this, arguments, void 0, function* (filePath, imageResult, silent = false) {
|
|
65
66
|
const { id, image } = imageResult;
|
|
66
67
|
const resolvedFilePath = path.resolve(filePath, `dad_joke_${id}.png`);
|
|
67
|
-
yield
|
|
68
|
+
yield node_fs_1.promises.writeFile(resolvedFilePath, image);
|
|
68
69
|
if (!silent) {
|
|
69
70
|
console.info(`Saved image to "${resolvedFilePath}".`);
|
|
70
71
|
}
|
|
71
72
|
});
|
|
72
73
|
}
|
|
73
|
-
const { description, name, version } = require('../package.json');
|
|
74
74
|
commander_1.program.on('command:*', () => commander_1.program.help());
|
|
75
75
|
commander_1.program
|
|
76
|
-
.name(name.replace(/^@[^/]+\//, ''))
|
|
77
|
-
.version(version, '-v, --version')
|
|
78
|
-
.description(description)
|
|
76
|
+
.name(package_json_1.name.replace(/^@[^/]+\//, ''))
|
|
77
|
+
.version(package_json_1.version, '-v, --version')
|
|
78
|
+
.description(package_json_1.description)
|
|
79
79
|
.option('-i, --image', 'Save the joke as image')
|
|
80
80
|
.option('-o, --output <dir>', 'Specify the output directory', path.resolve('.'))
|
|
81
81
|
.option('-s, --silent', `Don't output save messages`);
|
package/package.json
CHANGED
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
],
|
|
29
29
|
"license": "GPL-3.0",
|
|
30
30
|
"name": "@ffflorian/icanhazdadjoke",
|
|
31
|
-
"repository": "https://github.com/ffflorian/api-clients.git",
|
|
32
31
|
"readme": "https://github.com/ffflorian/api-clients#readme",
|
|
32
|
+
"repository": "https://github.com/ffflorian/api-clients.git",
|
|
33
33
|
"scripts": {
|
|
34
34
|
"build:ts": "tsc -p tsconfig.build.json",
|
|
35
35
|
"build:docs": "typedoc --tsconfig tsconfig.build.json --options ../../typedoc.json --out ../../docs/packages/icanhazdadjoke src/index.ts",
|
|
@@ -38,6 +38,6 @@
|
|
|
38
38
|
"start": "tsx src/cli.ts",
|
|
39
39
|
"test": "exit 0"
|
|
40
40
|
},
|
|
41
|
-
"version": "2.4.
|
|
42
|
-
"gitHead": "
|
|
41
|
+
"version": "2.4.5",
|
|
42
|
+
"gitHead": "8d7471cbe490305b3e441c27acbc81e36a4bd9df"
|
|
43
43
|
}
|