@@ -18,6 +18,7 @@ const SYS_COMMANDS = {
1818 brew : 'brew install' ,
1919 port : 'sudo port install' ,
2020 pkgin : 'sudo pkgin install' ,
21+ winget : 'winget install' ,
2122 choco : 'choco install' ,
2223 powershell : "powershell 'Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))'" ,
2324 'apt-get' : 'sudo apt-get install' ,
@@ -37,7 +38,7 @@ const SYS_COMMANDS = {
3738 */
3839const SYS_MANAGERS = {
3940 darwin : [ 'brew' , 'port' , 'pkgin' ] ,
40- win32 : [ 'choco' , 'powershell' ] ,
41+ win32 : [ 'winget' , ' choco', 'powershell' ] ,
4142 linux : [ 'apt-get' , 'yum' , 'dnf' , 'nix' , 'zypper' , 'emerge' , 'pacman' , 'crew' ] ,
4243 freebsd : [ 'pkg' , 'pkg_add' ] ,
4344 sunos : [ 'pkg' ] ,
@@ -118,15 +119,16 @@ export const installer = Sys.installer = function (application, progress) {
118119 if ( manager [ 2 ] )
119120 install = [ manager [ 2 ] ] ;
120121
121- let whatToInstall = isArray ( application ) ? [ ] . concat ( application ) . concat ( [ '-y' ] ) : [ ] . concat ( [ application ] ) . concat ( [ '-y' ] ) ;
122+ let silentCmd = isWindows ( ) ? [ '--accept-package-agreements' , '--accept-source-agreements' , '-h' ] : [ '-y' ] ;
123+ let whatToInstall = isArray ( application ) ? [ ] . concat ( application ) . concat ( silentCmd ) : [ ] . concat ( [ application ] ) . concat ( silentCmd ) ;
122124 let system = whatToInstall ;
123125 if ( ( args ) && ( ! install ) )
124126 system = args . concat ( whatToInstall ) ;
125127 else if ( ( args ) && ( install ) )
126128 system = args . concat ( install ) . concat ( whatToInstall ) ;
127129
128130 if ( cmd != 'powershell' ) {
129- if ( cmd . includes ( 'choco' ) && process . platform == 'win32' ) {
131+ if ( cmd . includes ( 'choco' ) && isWindows ( ) ) {
130132 cmd = where ( 'choco' ) ;
131133 system = [ cmd ] . concat ( system ) ;
132134 cmd = join ( __dirname , 'bin' , 'sudo.bat' ) ;
@@ -161,7 +163,7 @@ export const where = Sys.where = function (executable) {
161163 * @param {String } command - platform command
162164 * @param {Array } argument - command arguments
163165 * @param {Function|Object } progressOptions - either callback for `stdout.on('data')` event or `options`.
164- * - the callback will received an object:
166+ * - the callback will receive an object:
165167 *```js
166168 * spawn: object, // child process **spawn** `instance`.
167169 * output: string, // any **output** data.
@@ -212,7 +214,7 @@ export const spawning = Sys.spawning = function (command, argument, progressOpti
212214
213215 if ( sudo ) {
214216 argument = [ command ] . concat ( argument ) ;
215- command = ( isWindows ( ) ) ? join ( __dirname , 'bin' , 'sudo.bat' ) : 'sudo' ;
217+ command = isWindows ( ) ? join ( __dirname , 'bin' , 'sudo.bat' ) : 'sudo' ;
216218 } ;
217219
218220 const spawned = spawn ( command , argument , options ) ;
0 commit comments