wasm-pack-plugin icon indicating copy to clipboard operation
wasm-pack-plugin copied to clipboard

Install wasm-pack via installer if available for platform

Open fitzgen opened this issue 7 years ago • 1 comments
trafficstars

It will be a lot faster to install if we don't force users to compile it from scratch :laughing:

It would be something like this:

  _checkWasmPack() {
    info('🧐  Checking for wasm-pack...\n');

    if (commandExistsSync('wasm-pack')) {
      info('✅  wasm-pack is installed. \n');

      return Promise.resolve();
    } else {
      info('ℹ️  Installing wasm-pack \n');

      switch (process.platform) {
        case 'darwin':
        case 'freebsd':
        case 'linux':
        case 'openbsd':
          // TODO: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
        case 'win32':
          // TODO: Download + execute https://github.com/rustwasm/wasm-pack/releases/download/v0.5.1/wasm-pack-init.exe
        default:
          return runProcess('cargo', ['install', 'wasm-pack'], {});
      }
    }
  }

fitzgen avatar Oct 23 '18 14:10 fitzgen

We could use GitHub's API to download the latest binary for the OS and if it doesn't exist build it.

xtuc avatar Oct 24 '18 19:10 xtuc