File tree Expand file tree Collapse file tree
extensions/ql-vscode/gulpfile.ts Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -46,13 +46,31 @@ async function copyPackage(
4646 ) ;
4747}
4848
49+ interface packageJson {
50+ name : string ;
51+ version : string ;
52+ }
53+
54+ async function readPackageJson ( packageJsonPath : string ) : Promise < packageJson > {
55+ const packageJson : packageJson = JSON . parse (
56+ await readFile ( packageJsonPath , "utf8" ) ,
57+ ) ;
58+
59+ if ( ! packageJson . name ) {
60+ throw new Error ( `${ packageJsonPath } is missing the 'name' field` ) ;
61+ }
62+ if ( ! packageJson . version ) {
63+ throw new Error ( `${ packageJsonPath } is missing the 'version' field` ) ;
64+ }
65+
66+ return packageJson ;
67+ }
68+
4969export async function deployPackage (
5070 packageJsonPath : string ,
5171) : Promise < DeployedPackage > {
5272 try {
53- const packageJson : any = JSON . parse (
54- await readFile ( packageJsonPath , "utf8" ) ,
55- ) ;
73+ const packageJson = await readPackageJson ( packageJsonPath ) ;
5674
5775 const distDir = join ( __dirname , "../../../dist" ) ;
5876 await mkdirs ( distDir ) ;
You can’t perform that action at this time.
0 commit comments