From 8cdc7f91b1cd4af39fef0b3b529fec231838143c Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Fri, 15 Nov 2019 16:09:01 +0100 Subject: [PATCH] Fix ncp --- lib/main.js | 7 ++----- src/main.ts | 12 +++++++----- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/lib/main.js b/lib/main.js index 3f2bc9f..d2afdea 100644 --- a/lib/main.js +++ b/lib/main.js @@ -15,14 +15,11 @@ var __importStar = (this && this.__importStar) || function (mod) { result["default"] = mod; return result; }; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; Object.defineProperty(exports, "__esModule", { value: true }); const child_process = __importStar(require("child_process")); const core = __importStar(require("@actions/core")); const exec = __importStar(require("@actions/exec")); -const ncp_1 = __importDefault(require("ncp")); +const ncp_1 = require("ncp"); const fs = __importStar(require("fs")); const os = __importStar(require("os")); const path = __importStar(require("path")); @@ -63,7 +60,7 @@ function run() { const tmpdir = fs.mkdtempSync(path.join(os.tmpdir(), 'github-pages-')); process.chdir(tmpdir); core.info(`🏃 Copying ${path.resolve(build_dir)} contents to ${tmpdir}`); - ncp_1.default.ncp(path.resolve(build_dir), tmpdir, err => { + ncp_1.ncp.ncp(path.resolve(build_dir), tmpdir, err => { if (err !== null) { core.setFailed(`⛔️ Failed to copy ${path.resolve(build_dir)}`); } diff --git a/src/main.ts b/src/main.ts index e6d685b..d65eede 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,7 +1,7 @@ import * as child_process from 'child_process'; import * as core from '@actions/core'; import * as exec from '@actions/exec'; -import ncp from 'ncp'; +import {ncp} from 'ncp'; import * as fs from 'fs'; import * as os from 'os'; import * as path from 'path'; @@ -45,10 +45,12 @@ async function run() { process.chdir(tmpdir); core.info(`🏃 Copying ${path.resolve(build_dir)} contents to ${tmpdir}`); - ncp.ncp(path.resolve(build_dir), tmpdir, err => { - if (err !== null) { - core.setFailed(`⛔️ Failed to copy ${path.resolve(build_dir)}`); - } + await new Promise((resolve, reject) => { + ncp.ncp(path.resolve(build_dir), tmpdir, (err) => { + if (err) { + core.setFailed(`⛔️ Failed to copy ${path.resolve(build_dir)}`); + } + }); }); const remote_branch_exists =