@goqoo/trunks 1.1.0 → 1.1.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
@@ -171,18 +171,10 @@ pfx: {
171
171
 
172
172
  ## CLI
173
173
 
174
- ### コマンド
175
-
176
- ```bash
177
- trunks init # 対話形式で trunks.config.ts を作成
178
- trunks generate # 型定義を生成(デフォルトコマンド)
179
- trunks # 'trunks generate' と同じ
180
- ```
181
-
182
174
  ### オプション
183
175
 
184
176
  ```bash
185
- trunks generate [options]
177
+ trunks [options]
186
178
 
187
179
  Options:
188
180
  -c, --config <path> 設定ファイルのパス
package/README.md CHANGED
@@ -171,18 +171,10 @@ pfx: {
171
171
 
172
172
  ## CLI
173
173
 
174
- ### Commands
175
-
176
- ```bash
177
- trunks init # Create trunks.config.ts interactively
178
- trunks generate # Generate type definitions (default command)
179
- trunks # Same as 'trunks generate'
180
- ```
181
-
182
174
  ### Options
183
175
 
184
176
  ```bash
185
- trunks generate [options]
177
+ trunks [options]
186
178
 
187
179
  Options:
188
180
  -c, --config <path> Path to config file
package/dist/cli.js CHANGED
@@ -72,28 +72,35 @@ function buildConfigFromOptions(options) {
72
72
  }
73
73
  return config;
74
74
  }
75
- const program = new Command();
76
- program
77
- .name('trunks')
78
- .description('Generate TypeScript type definitions for multiple Kintone apps')
79
- .version(version);
80
- // init コマンド
81
- program
82
- .command('init')
83
- .description('Create a new trunks.config.ts interactively')
84
- .action(async () => {
75
+ // 型定義生成のアクション
76
+ async function generateAction(options) {
85
77
  try {
86
- await init();
78
+ let config;
79
+ // --hostと--appが指定されている場合はCLIオプションから設定を構築
80
+ if (options.host && Object.keys(options.app).length > 0) {
81
+ config = buildConfigFromOptions(options);
82
+ }
83
+ else if (options.host || Object.keys(options.app).length > 0) {
84
+ // 片方だけ指定されている場合はエラー
85
+ throw new Error('Both --host and --app are required for CLI-only mode');
86
+ }
87
+ else {
88
+ // 設定ファイルから読み込み
89
+ config = await loadConfig(options.config ? undefined : process.cwd());
90
+ }
91
+ await generate(config);
87
92
  }
88
93
  catch (error) {
89
94
  console.error(chalk.red('Error:'), error instanceof Error ? error.message : error);
90
95
  process.exit(1);
91
96
  }
92
- });
93
- // generate コマンド(デフォルト)
97
+ }
98
+ const program = new Command();
94
99
  program
95
- .command('generate', { isDefault: true })
96
- .description('Generate type definitions for all configured apps')
100
+ .name('trunks')
101
+ .description('Generate TypeScript type definitions for multiple Kintone apps')
102
+ .version(version)
103
+ // 設定ファイル
97
104
  .option('-c, --config <path>', 'Path to config file')
98
105
  // ワンライナー実行用オプション
99
106
  .option('-H, --host <host>', 'Kintone host (e.g., example.cybozu.com)')
@@ -111,22 +118,14 @@ program
111
118
  .option('--proxy <host:port>', 'Proxy server')
112
119
  .option('--basic-auth-username <username>', 'Basic auth username')
113
120
  .option('--basic-auth-password <password>', 'Basic auth password')
114
- .action(async (options) => {
121
+ .action(generateAction);
122
+ // init コマンド
123
+ program
124
+ .command('init')
125
+ .description('Create a new trunks.config.ts interactively')
126
+ .action(async () => {
115
127
  try {
116
- let config;
117
- // --hostと--appが指定されている場合はCLIオプションから設定を構築
118
- if (options.host && Object.keys(options.app).length > 0) {
119
- config = buildConfigFromOptions(options);
120
- }
121
- else if (options.host || Object.keys(options.app).length > 0) {
122
- // 片方だけ指定されている場合はエラー
123
- throw new Error('Both --host and --app are required for CLI-only mode');
124
- }
125
- else {
126
- // 設定ファイルから読み込み
127
- config = await loadConfig(options.config ? undefined : process.cwd());
128
- }
129
- await generate(config);
128
+ await init();
130
129
  }
131
130
  catch (error) {
132
131
  console.error(chalk.red('Error:'), error instanceof Error ? error.message : error);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@goqoo/trunks",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "A CLI wrapper for @kintone/dts-gen that generates type definitions for multiple Kintone apps",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",