1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-24 10:27:10 +02:00

Added version command

This commit is contained in:
Laurent Cozic 2021-01-18 15:12:21 +00:00
parent aa74d05b24
commit e91c94baca
3 changed files with 3169 additions and 237 deletions

View File

@ -262,6 +262,8 @@ async function processNpmPackage(npmPackage: NpmPackage, repoDir: string) {
}
async function commandBuild(args: CommandBuildArgs) {
console.info(new Date(), 'Building repository...');
const repoDir = args.pluginRepoDir;
await checkPluginRepository(repoDir);
@ -275,11 +277,17 @@ async function commandBuild(args: CommandBuildArgs) {
await execCommand2('git push');
}
async function commandVersion() {
const p = await readJsonFile(path.resolve(__dirname, 'package.json'));
console.info(`Version ${p.version}`);
}
async function main() {
const scriptName: string = 'plugin-repo-cli';
const commands: Record<string, Function> = {
build: commandBuild,
version: commandVersion,
};
let selectedCommand: string = '';
@ -293,12 +301,16 @@ async function main() {
require('yargs')
.scriptName(scriptName)
.usage('$0 <cmd> [args]')
.command('build <plugin-repo-dir>', 'Build the plugin repository', (yargs: any) => {
yargs.positional('plugin-repo-dir', {
type: 'string',
describe: 'Directory where the plugin repository is located',
});
}, (args: any) => setSelectedCommand('build', args))
.command('version', 'Gives version info', () => {}, (args: any) => setSelectedCommand('version', args))
.help()
.argv;

File diff suppressed because it is too large Load Diff

View File

@ -12,7 +12,6 @@
"scripts": {
"tsc": "tsc --project tsconfig.json",
"watch": "tsc --watch --project tsconfig.json",
"prepare": "npm run tsc",
"test": "jest",
"test-ci": "npm run test"
},