mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-20 16:42:56 +00:00
feat: add function and task to get version of used dependency
Fixes #20
This commit is contained in:
15
src/cli.ts
15
src/cli.ts
@@ -16,8 +16,10 @@ import {Api} from '@openstapps/gitlab-api';
|
||||
import {Logger} from '@openstapps/logger';
|
||||
import * as commander from 'commander';
|
||||
import {existsSync, readFileSync} from 'fs';
|
||||
import {join} from 'path';
|
||||
import {join, resolve} from 'path';
|
||||
import {cwd, stdout} from 'process';
|
||||
import {GITLAB_API_URL} from './configuration';
|
||||
import {getUsedVersionMajorMinor} from './tasks/get-used-version';
|
||||
import {remind} from './tasks/remind';
|
||||
import {tidy} from './tasks/tidy';
|
||||
import {unlabel} from './tasks/unlabel';
|
||||
@@ -63,6 +65,17 @@ commander
|
||||
Logger.ok('Done!');
|
||||
});
|
||||
|
||||
commander
|
||||
.command('get-used-version <dependency> [path]')
|
||||
.action(async (dependency, path) => {
|
||||
let fallbackPath = cwd();
|
||||
if (typeof path === 'string' && path.length > 0) {
|
||||
fallbackPath = resolve(path);
|
||||
}
|
||||
|
||||
stdout.write(await getUsedVersionMajorMinor(fallbackPath, dependency), process.exit);
|
||||
});
|
||||
|
||||
commander
|
||||
.parse(process.argv);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user