diff --git a/action.toml b/action.toml index f1450fa..7576924 100644 --- a/action.toml +++ b/action.toml @@ -1,5 +1,2 @@ -[hello] -cmd = "echo 'Hello, world!'" - -[build] -cmd = "bun -v" \ No newline at end of file +[dev] +cmd = "bunx concurrently -k -n test1,test2 -c magenta,blue \"echo 'Test 1 Works'\" \"echo 'Test 2 Works'\"" \ No newline at end of file diff --git a/bun.lockb b/bun.lockb index c378ae9..b537d94 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/index.ts b/index.ts index 63d8980..a13cb06 100644 --- a/index.ts +++ b/index.ts @@ -6,16 +6,11 @@ import child_process from 'child_process'; const CONFIG_FILE = 'action.toml'; -if (!fs.existsSync(CONFIG_FILE)) { - console.error(`failed to find config file: ${CONFIG_FILE}`); - process.exit(1); -} - const commandSchema = z.object({ cmd: z.string().min(1), }); -const cliCommands = ['list', 'version', 'help'] +const cliCommands = ['list', 'version', 'help']; let cmd; @@ -23,18 +18,12 @@ try { const commands = await import(`${process.cwd()}/${CONFIG_FILE}`); const commandToRun = process.argv[2]; - if (commandToRun && cliCommands.includes(commandToRun)) { - - switch (commandToRun) { case 'list': console.log('Available commands:'); Object.keys(commands.default).forEach((command) => { - console.log( - ` ${command}` - ) - + console.log(` ${command}`); }); break; case 'version': @@ -44,18 +33,17 @@ try { console.log('Usage: action '); console.log('Available commands:'); cliCommands.forEach((command) => { - console.log( - ` ${command}` - ) - - } - ); + console.log(` ${command}`); + }); } process.exit(0); } - + if (!fs.existsSync(CONFIG_FILE)) { + console.error(`failed to find config file: ${CONFIG_FILE}`); + process.exit(1); + } if (!commandToRun) { // Access the first command from the default export