-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.ts
More file actions
22 lines (18 loc) · 613 Bytes
/
index.ts
File metadata and controls
22 lines (18 loc) · 613 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#! /usr/bin/env node
import { join } from 'path';
import { checkArgs, checkCommand, runGhostScript, explore } from './lib/lib';
Promise.all([checkArgs(), checkCommand()])
.then(async ([targets, command]) => {
for (let target of targets) {
const targetPath = join(process.cwd(), target);
const files = explore(targetPath);
for (let file of files) {
await runGhostScript(command, file.toString());
}
}
console.log('\x1b[32m%s\x1b[0m', '✨ PDF has been compressed !');
})
.catch((err) => {
console.error(`\x1b[31m${err}\x1b[0m`);
process.exit(1);
});