Skip to content

Commit

Permalink
fix: fs.promises.stat replace with promisify(fs.stat)
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinKavik committed Oct 9, 2019
1 parent 872af9e commit 2d74352
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@ const {
spawn
} = require('child_process');
const fs = require('fs');
const util = require("util");
const path = require('path');
const commandExistsSync = require('command-exists').sync;
const chalk = require('chalk');
const Watchpack = require('watchpack');

const stat = util.promisify(fs.stat);

const error = msg => console.log(chalk.bold.red(msg));
const info = msg => console.log(chalk.bold.blue(msg));
// https://github.com/wasm-tool/wasm-pack-plugin/issues/58
Expand Down Expand Up @@ -117,7 +120,7 @@ class WasmPackPlugin {
_compile(watching) {
info(`ℹ️ Compiling your crate in ${this.isDebug ? 'development' : 'release'} mode...\n`);

return fs.promises.stat(this.crateDirectory).then(stats => {
return stat(this.crateDirectory).then(stats => {
if (!stats.isDirectory()) {
throw new Error(`${this.crateDirectory} is not a directory`);
}
Expand Down

0 comments on commit 2d74352

Please sign in to comment.