vimd 0.2.1 → 0.2.3
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.md +11 -1
- package/dist/cli/commands/reset.d.ts +6 -0
- package/dist/cli/commands/reset.d.ts.map +1 -0
- package/dist/cli/commands/reset.js +41 -0
- package/dist/cli/index.js +7 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -107,6 +107,8 @@ vimd config
|
|
|
107
107
|
| `vimd build <file>` | 静的HTMLを生成 |
|
|
108
108
|
| `vimd theme` | テーマを対話的に変更 |
|
|
109
109
|
| `vimd config` | 設定を対話的に編集 |
|
|
110
|
+
| `vimd kill` | 実行中のセッションを終了 |
|
|
111
|
+
| `vimd reset` | 設定をデフォルトにリセット |
|
|
110
112
|
|
|
111
113
|
### オプション
|
|
112
114
|
|
|
@@ -121,6 +123,14 @@ vimd dev draft.md --pandoc # pandocパーサーを使用
|
|
|
121
123
|
vimd build draft.md -o output.html # 出力先指定
|
|
122
124
|
vimd build draft.md --fast # markdown-itで高速ビルド
|
|
123
125
|
vimd build draft.md --theme dark # テーマ指定
|
|
126
|
+
|
|
127
|
+
# kill コマンド
|
|
128
|
+
vimd kill # 全セッションを終了
|
|
129
|
+
vimd kill --port 38080 # 特定ポートのセッションを終了
|
|
130
|
+
|
|
131
|
+
# reset コマンド
|
|
132
|
+
vimd reset # 設定をリセット(確認あり)
|
|
133
|
+
vimd reset --yes # 確認なしでリセット
|
|
124
134
|
```
|
|
125
135
|
|
|
126
136
|
---
|
|
@@ -132,7 +142,7 @@ vimd build draft.md --theme dark # テーマ指定
|
|
|
132
142
|
```javascript
|
|
133
143
|
export default {
|
|
134
144
|
theme: 'github',
|
|
135
|
-
port:
|
|
145
|
+
port: 38080, // デフォルト: 38080(v0.2.1で変更)
|
|
136
146
|
open: true,
|
|
137
147
|
devParser: 'markdown-it', // dev用パーサー(デフォルト: markdown-it)
|
|
138
148
|
buildParser: 'pandoc', // build用パーサー(デフォルト: pandoc)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reset.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/reset.ts"],"names":[],"mappings":"AAOA,UAAU,YAAY;IACpB,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAED,wBAAsB,YAAY,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAsCvE"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// src/cli/commands/reset.ts
|
|
2
|
+
import inquirer from 'inquirer';
|
|
3
|
+
import fs from 'fs-extra';
|
|
4
|
+
import { Logger } from '../../utils/logger.js';
|
|
5
|
+
import { PathResolver } from '../../utils/path-resolver.js';
|
|
6
|
+
import { DEFAULT_CONFIG } from '../../config/defaults.js';
|
|
7
|
+
export async function resetCommand(options) {
|
|
8
|
+
try {
|
|
9
|
+
const configPath = PathResolver.getConfigPath();
|
|
10
|
+
// Check if config file exists
|
|
11
|
+
if (!(await fs.pathExists(configPath))) {
|
|
12
|
+
Logger.info('No configuration file found. Already using default settings.');
|
|
13
|
+
Logger.info(` Default port: ${DEFAULT_CONFIG.port}`);
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
// Confirm deletion unless --yes is specified
|
|
17
|
+
if (!options.yes) {
|
|
18
|
+
const { confirmed } = await inquirer.prompt([
|
|
19
|
+
{
|
|
20
|
+
type: 'confirm',
|
|
21
|
+
name: 'confirmed',
|
|
22
|
+
message: 'Are you sure you want to reset the configuration?',
|
|
23
|
+
default: false,
|
|
24
|
+
},
|
|
25
|
+
]);
|
|
26
|
+
if (!confirmed) {
|
|
27
|
+
Logger.info('Configuration reset cancelled');
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
// Delete the config file
|
|
32
|
+
await fs.remove(configPath);
|
|
33
|
+
Logger.success('Configuration reset. Default settings will be used on next run.');
|
|
34
|
+
Logger.info(` Default port: ${DEFAULT_CONFIG.port}`);
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
38
|
+
Logger.error(`Failed to reset configuration: ${errorMessage}`);
|
|
39
|
+
process.exit(1);
|
|
40
|
+
}
|
|
41
|
+
}
|
package/dist/cli/index.js
CHANGED
|
@@ -6,6 +6,7 @@ import { buildCommand } from './commands/build.js';
|
|
|
6
6
|
import { themeCommand } from './commands/theme.js';
|
|
7
7
|
import { configCommand } from './commands/config.js';
|
|
8
8
|
import { killCommand } from './commands/kill.js';
|
|
9
|
+
import { resetCommand } from './commands/reset.js';
|
|
9
10
|
const require = createRequire(import.meta.url);
|
|
10
11
|
const packageJson = require('../../package.json');
|
|
11
12
|
const program = new Command();
|
|
@@ -48,4 +49,10 @@ program
|
|
|
48
49
|
.option('--all', 'Kill all sessions (default)')
|
|
49
50
|
.option('--port <port>', 'Kill session on specific port')
|
|
50
51
|
.action(killCommand);
|
|
52
|
+
// vimd reset
|
|
53
|
+
program
|
|
54
|
+
.command('reset')
|
|
55
|
+
.description('Reset configuration to defaults')
|
|
56
|
+
.option('-y, --yes', 'Skip confirmation prompt')
|
|
57
|
+
.action(resetCommand);
|
|
51
58
|
program.parse(process.argv);
|