13
13
//===----------------------------------------------------------------------===//
14
14
/* eslint-disable no-console */
15
15
16
- import * as path from "path" ;
17
- import * as semver from "semver" ;
18
- import { readFile } from "fs/promises" ;
19
- import { exec , main } from "./lib/utilities" ;
16
+ import { exec , getExtensionVersion , getRootDirectory , main } from "./lib/utilities" ;
20
17
21
18
/**
22
19
* Formats the given date as a string in the form "YYYYMMddhhmm".
@@ -34,18 +31,8 @@ function formatDate(date: Date): string {
34
31
}
35
32
36
33
main ( async ( ) => {
37
- const rootDirectory = path . join ( __dirname , ".." ) ;
38
- // Grab the existing version number from the package.json
39
- const packageJSON = JSON . parse (
40
- await readFile ( path . join ( rootDirectory , "package.json" ) , "utf-8" )
41
- ) ;
42
- if ( typeof packageJSON . version !== "string" ) {
43
- throw new Error ( "Version number in package.json is not a string" ) ;
44
- }
45
- const version = semver . parse ( packageJSON . version ) ;
46
- if ( version === null ) {
47
- throw new Error ( "Unable to parse version number in package.json" ) ;
48
- }
34
+ const rootDirectory = getRootDirectory ( ) ;
35
+ const version = await getExtensionVersion ( ) ;
49
36
// Increment the minor version and set the patch version to today's date
50
37
const minor = version . minor + 1 ;
51
38
const patch = formatDate ( new Date ( ) ) ;
0 commit comments