From 405a6b2f80be86c5aa977f2f69b2b357be4a04c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Wawrzyniec=20Urba=C5=84czyk?= Date: Mon, 9 Aug 2021 17:35:02 +0200 Subject: [PATCH] Fixed build script on Windows. (#1769) --- build/package.json | 2 ++ build/run.js | 19 +++++++++---------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/build/package.json b/build/package.json index 6f4aeb0224..b1a62c5a52 100644 --- a/build/package.json +++ b/build/package.json @@ -4,10 +4,12 @@ "description": "Build Scripts", "repository": "git@github.com:enso-org/ide.git", "dependencies": { + "fs-extra": "^10.0.0", "glob": "^7.1.6", "js-yaml": "4.0.0", "ncp": "^2.0.0", "semver": "7.3.4", + "unzipper": "^0.10.11", "yargs": "^15.3.0" }, "license": "MIT", diff --git a/build/run.js b/build/run.js index 8f69c70d27..3472ac5ca1 100755 --- a/build/run.js +++ b/build/run.js @@ -1,7 +1,9 @@ const child_process = require('child_process') const cmd = require('./cmd') const fs = require('fs').promises +const fse = require('fs-extra') const fss = require('fs') +const unzipper = require('unzipper') const glob = require('glob') const ncp = require('ncp').ncp const os = require('os') @@ -521,13 +523,11 @@ async function installJsDeps() { async function downloadJsAssets() { const workdir = path.join(paths.root, '.assets-temp') - await cmd.with_cwd(paths.root, async () => { - await cmd.run('mkdir', ['-p', workdir]) - }) + await fs.mkdir(workdir, {recursive:true}) const ideAssetsMainZip = 'ide-assets-main.zip' + const ideAssetsUrl = `https://github.com/enso-org/ide-assets/archive/refs/heads/main.zip` const unzippedAssets = path.join(workdir, 'ide-assets-main', 'content', 'assets') const jsLibAssets = path.join(paths.js.lib.content, 'assets') - await cmd.with_cwd(workdir, async () => { await cmd.run('curl', [ '--retry', @@ -536,15 +536,14 @@ async function downloadJsAssets() { '-fsSL', '-o', ideAssetsMainZip, - 'https://github.com/enso-org/ide-assets/archive/refs/heads/main.zip', + ideAssetsUrl, ]) - await cmd.run('unzip', [ideAssetsMainZip]) }) - await cmd.with_cwd(paths.root, async () => { - await cmd.run('cp', ['-r', unzippedAssets, paths.js.lib.content]) - await cmd.run('rm', ['-r', workdir]) - }) + const assetsArchive = await unzipper.Open.file(path.join(workdir,ideAssetsMainZip)) + await assetsArchive.extract({path: workdir}) + await fse.copy(unzippedAssets,jsLibAssets) + await fse.remove(workdir) } async function runCommand(command, argv) {