@onozaty/growi-uploader 1.8.0 → 1.8.1
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/index.mjs +10 -2
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { Command } from "commander";
|
|
3
|
+
import { existsSync, readFileSync, statSync } from "node:fs";
|
|
3
4
|
import { basename, dirname, join, relative, resolve } from "node:path";
|
|
4
|
-
import { existsSync, readFileSync } from "node:fs";
|
|
5
5
|
import * as axios$1 from "axios";
|
|
6
6
|
import axios from "axios";
|
|
7
7
|
import { lookup } from "mime-types";
|
|
8
8
|
import { glob } from "glob";
|
|
9
9
|
|
|
10
10
|
//#region package.json
|
|
11
|
-
var version = "1.8.
|
|
11
|
+
var version = "1.8.1";
|
|
12
12
|
|
|
13
13
|
//#endregion
|
|
14
14
|
//#region src/config.ts
|
|
@@ -708,6 +708,14 @@ const main = async (sourceDir, configPath, verboseOverride) => {
|
|
|
708
708
|
const config = loadConfig(configPath);
|
|
709
709
|
if (verboseOverride !== void 0) config.verbose = verboseOverride;
|
|
710
710
|
const sourceDirPath = resolve(sourceDir);
|
|
711
|
+
let sourceDirStat;
|
|
712
|
+
try {
|
|
713
|
+
sourceDirStat = statSync(sourceDirPath);
|
|
714
|
+
} catch (error) {
|
|
715
|
+
if (error.code === "ENOENT") throw new Error(`Source directory not found: ${sourceDirPath}`);
|
|
716
|
+
throw error;
|
|
717
|
+
}
|
|
718
|
+
if (!sourceDirStat.isDirectory()) throw new Error(`Source path is not a directory: ${sourceDirPath}`);
|
|
711
719
|
configureAxios(config.url, config.token);
|
|
712
720
|
const files = await scanMarkdownFiles(sourceDirPath, config.basePath);
|
|
713
721
|
const totalAttachments = files.reduce((sum, file) => sum + file.attachments.length, 0);
|