@@ -9,6 +9,7 @@ import fs = require('fs-extra')
99import path = require( 'path' )
1010import shell = require( 'shelljs' )
1111import folders = require( './scriptUtils' )
12+ import os = require( 'os' )
1213
1314const timeMessage = 'Packaged extension'
1415const manifestFile = 'vss-extension.json'
@@ -132,16 +133,21 @@ function packagePlugin(options: CommandLineOptions) {
132133 } )
133134
134135 console . log ( 'Creating deployment vsix' )
135- let tfxcmd = `tfx extension create --root ${ folders . packageRoot } --output-path ${
136- folders . packageRoot
137- } --manifests ${ path . join ( folders . packageRoot , manifestFile ) } `
136+
137+ const binName = os . platform ( ) === 'win32' ? `tfx.cmd` : 'tfx'
138+ const tfx = path . join ( process . cwd ( ) , 'node_modules' , '.bin' , binName )
139+ const args : string [ ] = [ 'extension' , 'create' , '--root' , folders . packageRoot ]
140+
141+ args . push ( '--output-path' , folders . packageRoot )
142+ args . push ( '--manifests' , path . join ( folders . packageRoot , manifestFile ) )
143+
138144 if ( options . publisher ) {
139- tfxcmd += ' --publisher ' + options . publisher
145+ args . push ( ' --publisher' , options . publisher )
140146 }
141147
142- console . log ( 'Packaging with:' + tfxcmd )
148+ console . log ( 'Packaging with:' + ` ${ tfx } ${ args . join ( ' ' ) } ` )
143149
144- ncp . execSync ( tfxcmd , { stdio : 'pipe' } )
150+ ncp . execFileSync ( tfx , args , { stdio : 'pipe' } )
145151
146152 console . log ( 'Packaging successful' )
147153}
0 commit comments