@k2works/claude-code-booster 1.6.0 → 1.8.0
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.
|
File without changes
|
|
@@ -3,27 +3,27 @@
|
|
|
3
3
|
import { execSync } from 'child_process';
|
|
4
4
|
import fs from 'fs';
|
|
5
5
|
import path from 'path';
|
|
6
|
-
|
|
7
|
-
const isWindows = process.platform === 'win32';
|
|
6
|
+
import { cleanDockerEnv, isDockerAvailable, openUrl } from './shared.js';
|
|
8
7
|
|
|
9
8
|
/**
|
|
10
|
-
*
|
|
11
|
-
* @
|
|
9
|
+
* docker compose コマンドを実行
|
|
10
|
+
* @param {string} args - docker compose に渡す引数
|
|
12
11
|
*/
|
|
13
|
-
function
|
|
14
|
-
|
|
15
|
-
if (isWindows && env.DOCKER_HOST === 'npipe://./pipe/docker_engine') {
|
|
16
|
-
env.DOCKER_HOST = 'npipe:////./pipe/docker_engine';
|
|
17
|
-
}
|
|
18
|
-
return env;
|
|
12
|
+
function dockerCompose(args) {
|
|
13
|
+
execSync(`docker compose ${args}`, { stdio: 'inherit', env: cleanDockerEnv() });
|
|
19
14
|
}
|
|
20
15
|
|
|
21
16
|
/**
|
|
22
|
-
*
|
|
23
|
-
* @
|
|
17
|
+
* Docker が利用可能か確認し、不可なら警告メッセージを表示して false を返す
|
|
18
|
+
* @returns {boolean} Docker が利用可能なら true
|
|
24
19
|
*/
|
|
25
|
-
function
|
|
26
|
-
|
|
20
|
+
function requireDocker() {
|
|
21
|
+
if (isDockerAvailable()) {
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
console.warn('Warning: Docker is not running. Skipping this task.');
|
|
25
|
+
console.warn('Please start Docker Desktop and try again.');
|
|
26
|
+
return false;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
/**
|
|
@@ -32,6 +32,7 @@ function dockerCompose(args) {
|
|
|
32
32
|
*/
|
|
33
33
|
export default function (gulp) {
|
|
34
34
|
gulp.task('mkdocs:serve', (done) => {
|
|
35
|
+
if (!requireDocker()) { done(); return; }
|
|
35
36
|
try {
|
|
36
37
|
console.log('Starting MkDocs server...');
|
|
37
38
|
dockerCompose('up -d mkdocs');
|
|
@@ -43,6 +44,7 @@ export default function (gulp) {
|
|
|
43
44
|
});
|
|
44
45
|
|
|
45
46
|
gulp.task('mkdocs:build', (done) => {
|
|
47
|
+
if (!requireDocker()) { done(); return; }
|
|
46
48
|
try {
|
|
47
49
|
console.log('Building MkDocs documentation...');
|
|
48
50
|
const siteDir = path.join(process.cwd(), 'site');
|
|
@@ -58,6 +60,7 @@ export default function (gulp) {
|
|
|
58
60
|
});
|
|
59
61
|
|
|
60
62
|
gulp.task('mkdocs:stop', (done) => {
|
|
63
|
+
if (!requireDocker()) { done(); return; }
|
|
61
64
|
try {
|
|
62
65
|
console.log('Stopping MkDocs server...');
|
|
63
66
|
dockerCompose('down');
|
|
@@ -70,8 +73,7 @@ export default function (gulp) {
|
|
|
70
73
|
|
|
71
74
|
gulp.task('mkdocs:open', (done) => {
|
|
72
75
|
try {
|
|
73
|
-
|
|
74
|
-
execSync(command, { stdio: 'inherit' });
|
|
76
|
+
openUrl('http://localhost:8000');
|
|
75
77
|
done();
|
|
76
78
|
} catch (error) {
|
|
77
79
|
done(error);
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
import { execSync } from 'child_process';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* DOCKER_HOST を除外した環境変数を返す
|
|
7
|
+
* Docker Desktop 使用時に DOCKER_HOST が設定されていると接続エラーが発生するため除外する
|
|
8
|
+
* @returns {Object} DOCKER_HOST を除外した環境変数
|
|
9
|
+
*/
|
|
10
|
+
export function cleanDockerEnv() {
|
|
11
|
+
const env = { ...process.env };
|
|
12
|
+
delete env.DOCKER_HOST;
|
|
13
|
+
return env;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Docker デーモンが利用可能か確認する
|
|
18
|
+
* @returns {boolean} Docker が利用可能なら true
|
|
19
|
+
*/
|
|
20
|
+
export function isDockerAvailable() {
|
|
21
|
+
try {
|
|
22
|
+
execSync('docker info', { stdio: 'ignore', env: cleanDockerEnv() });
|
|
23
|
+
return true;
|
|
24
|
+
} catch {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* URL をデフォルトブラウザで開く(クロスプラットフォーム対応)
|
|
31
|
+
* @param {string} url - 開く URL
|
|
32
|
+
*/
|
|
33
|
+
export function openUrl(url) {
|
|
34
|
+
const platform = process.platform;
|
|
35
|
+
const cmd =
|
|
36
|
+
platform === 'win32' ? `start "" "${url}"` :
|
|
37
|
+
platform === 'darwin' ? `open "${url}"` :
|
|
38
|
+
`xdg-open "${url}"`;
|
|
39
|
+
execSync(cmd, { stdio: 'ignore' });
|
|
40
|
+
}
|