-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathversion.ts
28 lines (21 loc) · 940 Bytes
/
version.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import { Command, flags } from '@oclif/command';
import * as path from 'path';
import { packageJsonVersion } from '../../modules/shared/helpers/package-json-version';
export default class ProjectVersion extends Command {
static description = `Returns the current version of the project. This command starts from the current directory and moves up until it finds a package.json file.`;
static examples = [`entro-ci project:version`];
static flags = {
package: flags.string({
char: 'p',
default: './package.json',
description: `The path of the package.json file that holds the current version`,
}),
};
static args = [];
async run() {
const { flags } = this.parse(ProjectVersion);
const packageJsonPath = path.resolve(flags.package);
const mainVersion = await packageJsonVersion(packageJsonPath);
this.log(mainVersion);
}
}