1- var path = require ( 'path ' ) ;
2- var fs = require ( 'fs ' ) ;
3- var util = require ( '../build-scripts/util' ) ;
4- var { downloadArchive } = require ( '../build-scripts/downloadArchive ' ) ;
5-
6- var buildPath = './_build'
7- var toolPath = './tools'
8- var zipUrl = 'https://vstsagenttools.blob.core.windows.net /tools/7zip/5/7zip.zip'
9-
10- const targetPath = downloadArchive ( zipUrl , path . join ( '../_download' , toolPath ) ) ;
11- if ( ! fs . existsSync ( toolPath ) ) {
12- util . mkdir ( '-p' , toolPath ) ;
13- }
1+ const { existsSync } = require ( 'node:fs ' ) ;
2+ const { join } = require ( 'node:path ' ) ;
3+
4+ const util = require ( '../build-scripts/util ' ) ;
5+ const { downloadArchive } = require ( '../build-scripts/downloadArchive' ) ;
6+
7+ const buildPath = './_build' ;
8+ const toolPath = '. /tools' ;
9+
10+ const zipUrls = {
11+ '7zip5' : 'https://vstsagenttools.blob.core.windows.net/tools/7zip/5/7zip.zip' ,
12+ '7zip24' : 'https://vstsagenttools.blob.core.windows.net/tools/7zip/24.09/7zip.zip'
13+ } ;
1414
15- util . cp ( '-rf' , path . join ( targetPath , '*' ) , toolPath ) ;
15+ for ( const [ version , url ] of Object . entries ( zipUrls ) ) {
16+ const targetPath = join ( toolPath , version ) ;
17+ const sourcePath = downloadArchive ( url , join ( '../_download' , targetPath ) ) ;
18+
19+ if ( ! existsSync ( targetPath ) ) {
20+ util . mkdir ( '-p' , targetPath ) ;
21+ }
22+
23+ util . cp ( '-rf' , join ( sourcePath , '*' ) , targetPath ) ;
24+ }
1625
1726util . rm ( '-rf' , buildPath )
18- util . run ( path . join ( __dirname , 'node_modules/.bin/tsc' ) + ' --outDir ' + buildPath ) ;
27+ util . run ( join ( __dirname , 'node_modules/.bin/tsc' ) + ' --outDir ' + buildPath ) ;
1928
20- util . cp ( path . join ( __dirname , 'package.json' ) , buildPath ) ;
21- util . cp ( path . join ( __dirname , 'package-lock.json' ) , buildPath ) ;
22- util . cp ( path . join ( __dirname , 'module.json' ) , buildPath ) ;
29+ util . cp ( join ( __dirname , 'package.json' ) , buildPath ) ;
30+ util . cp ( join ( __dirname , 'package-lock.json' ) , buildPath ) ;
31+ util . cp ( join ( __dirname , 'module.json' ) , buildPath ) ;
2332util . cp ( '-r' , 'tools' , buildPath ) ;
2433util . cp ( '-r' , 'Strings' , buildPath ) ;
2534util . cp ( '-r' , 'node_modules' , buildPath ) ;
0 commit comments