11const child_process = require ( 'child_process' )
22const cmd = require ( './cmd' )
33const fs = require ( 'fs' ) . promises
4+ const fse = require ( 'fs-extra' )
45const fss = require ( 'fs' )
6+ const unzipper = require ( 'unzipper' )
57const glob = require ( 'glob' )
68const ncp = require ( 'ncp' ) . ncp
79const os = require ( 'os' )
@@ -521,13 +523,11 @@ async function installJsDeps() {
521523
522524async function downloadJsAssets ( ) {
523525 const workdir = path . join ( paths . root , '.assets-temp' )
524- await cmd . with_cwd ( paths . root , async ( ) => {
525- await cmd . run ( 'mkdir' , [ '-p' , workdir ] )
526- } )
526+ await fs . mkdir ( workdir , { recursive :true } )
527527 const ideAssetsMainZip = 'ide-assets-main.zip'
528+ const ideAssetsUrl = `https://github.com/enso-org/ide-assets/archive/refs/heads/main.zip`
528529 const unzippedAssets = path . join ( workdir , 'ide-assets-main' , 'content' , 'assets' )
529530 const jsLibAssets = path . join ( paths . js . lib . content , 'assets' )
530-
531531 await cmd . with_cwd ( workdir , async ( ) => {
532532 await cmd . run ( 'curl' , [
533533 '--retry' ,
@@ -536,15 +536,14 @@ async function downloadJsAssets() {
536536 '-fsSL' ,
537537 '-o' ,
538538 ideAssetsMainZip ,
539- 'https://github.com/enso-org/ide-assets/archive/refs/heads/main.zip' ,
539+ ideAssetsUrl ,
540540 ] )
541- await cmd . run ( 'unzip' , [ ideAssetsMainZip ] )
542541 } )
543542
544- await cmd . with_cwd ( paths . root , async ( ) => {
545- await cmd . run ( 'cp' , [ '-r' , unzippedAssets , paths . js . lib . content ] )
546- await cmd . run ( 'rm' , [ '-r' , workdir ] )
547- } )
543+ const assetsArchive = await unzipper . Open . file ( path . join ( workdir , ideAssetsMainZip ) )
544+ await assetsArchive . extract ( { path : workdir } )
545+ await fse . copy ( unzippedAssets , jsLibAssets )
546+ await fse . remove ( workdir )
548547}
549548
550549async function runCommand ( command , argv ) {
0 commit comments