24 lines
664 B
JavaScript
24 lines
664 B
JavaScript
import { readdirSync } from 'node:fs';
|
|
import { ScriptError, onPath, packageVersion, promptsDir } from './lib.js';
|
|
|
|
/**
|
|
* 回報這一份 tea-sdlc 的版本、實際 executable 與可用流程;不連網、不改檔。
|
|
* @param {string[]} argv
|
|
* @returns {object}
|
|
*/
|
|
export function runVersion(argv) {
|
|
if (argv.length > 0) {
|
|
throw new ScriptError('UNKNOWN_FLAG', 'sdlc-version 不接受參數');
|
|
}
|
|
|
|
return {
|
|
name: 'tea-sdlc',
|
|
version: packageVersion(),
|
|
executable: onPath('tea-sdlc'),
|
|
commands: readdirSync(promptsDir())
|
|
.filter((entry) => entry.endsWith('.md'))
|
|
.map((entry) => entry.slice(0, -3))
|
|
.sort(),
|
|
};
|
|
}
|