import path from 'path';
import fs from 'node-promise-es6/fs';
import Project from '../lib/project';

async function run() {
  const project = new Project();
  const packageJson = await project.packageJson();

  await project.link('.');

  const {linkDependencies = {}} = packageJson;
  for (const name of Object.keys(linkDependencies)) {
    await project.link(path.resolve(linkDependencies[name]));
  }

  await project.directory.rm('dist');
  const distDirectory = await project.directory.mkdir('dist');
  const distPackageJson = Object.assign({}, packageJson, {
    main: packageJson.main && packageJson.main.replace(/^src\//, ''),
    private: undefined,
    files: undefined,
    bin: packageJson.bin && Object.keys(packageJson.bin)
      .reduce(
        (memo, binName) => Object.assign(memo, {
          [binName]: packageJson.bin[binName].replace(/^src\//, '')
        }),
        {}
      ),
    scripts: Object.assign({}, packageJson.scripts, {
      prepublish: undefined
    })
  });
  await distDirectory.writeFile('package.json', distPackageJson);
  await project.directory.execSh('babel src --out-dir dist');
  for (const fileName of packageJson.files || []) {
    if (fileName.indexOf('src') === 0) { continue; }
    await distDirectory.cp(fileName, fileName);
  }

  const {bin: distBins = {}} = distPackageJson;
  for (const binName of Object.keys(distBins)) {
    const binPath = distDirectory.join(distBins[binName]);
    const binContents = await fs.readFile(binPath);
    await fs.writeFile(binPath, '#!/usr/bin/env node\n' + binContents);
    await fs.chmod(binPath, '755');
  }
}

run().catch(e => process.stderr.write(e.stack + '\n'));

@@ -1094,14 +1094,53 @@
 cSh(
-'babel
+%0A    %60'$%7Brequire.resolve('babel/bin/babel')%7D'
  src
@@ -1150,25 +1150,28 @@
 out-dir dist
-'
+%60%0A  
 );%0A  for (co

Use absolute path to Babel CLI