@onozaty/growi-uploader 1.7.2 → 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/README.ja.md CHANGED
@@ -58,6 +58,20 @@ npm install -g @onozaty/growi-uploader
58
58
  growi-uploader <source-dir>
59
59
  ```
60
60
 
61
+ ### Dockerでの使用
62
+
63
+ GitHub Container Registry にビルド済みのDockerイメージを公開しています。Node.js が利用できない環境(CI/CDパイプラインなど)で便利です。
64
+
65
+ ```bash
66
+ docker run --rm \
67
+ -v "$(pwd):/work" \
68
+ ghcr.io/onozaty/growi-uploader:latest ./docs -c ./growi-uploader.json
69
+ ```
70
+
71
+ イメージの作業ディレクトリは `/work` です。プロジェクトディレクトリをそこにバインドマウントすることで、`./docs` や `./growi-uploader.json` をそのまま参照できます。
72
+
73
+ コンテナは非rootユーザ (uid 1000) で動作します。マウント元のファイルがそのユーザから読めることを確認してください。対応プラットフォーム: `linux/amd64`, `linux/arm64`。
74
+
61
75
  ## 使い方
62
76
 
63
77
  ### 基本コマンド
package/README.md CHANGED
@@ -58,6 +58,20 @@ npm install -g @onozaty/growi-uploader
58
58
  growi-uploader <source-dir>
59
59
  ```
60
60
 
61
+ ### Using Docker
62
+
63
+ A pre-built Docker image is available on GitHub Container Registry. This is useful in environments without Node.js (e.g., CI/CD pipelines).
64
+
65
+ ```bash
66
+ docker run --rm \
67
+ -v "$(pwd):/work" \
68
+ ghcr.io/onozaty/growi-uploader:latest ./docs -c ./growi-uploader.json
69
+ ```
70
+
71
+ The image's working directory is `/work`, so bind-mounting your project directory there lets you reference `./docs` and `./growi-uploader.json` directly.
72
+
73
+ The container runs as a non-root user (uid 1000); make sure mounted files are readable by that user. Supported platforms: `linux/amd64`, `linux/arm64`.
74
+
61
75
  ## Usage
62
76
 
63
77
  ### Basic Command
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.7.2";
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);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onozaty/growi-uploader",
3
- "version": "1.7.2",
3
+ "version": "1.8.1",
4
4
  "description": "A content uploader for GROWI",
5
5
  "type": "module",
6
6
  "bin": {