Skip to content
Permalink
Browse files

feat(generic): map the alias bin commands to the correct commander files

  • Loading branch information
MarshallOfSound committed Dec 29, 2016
1 parent 8896e82 commit f1cac7400ec70c44286dc4661d5f6ca8ecf6a918
Showing with 22 additions and 2 deletions.
  1. +21 −1 gulpfile.babel.js
  2. +1 −1 package.json
@@ -3,6 +3,8 @@
import gulp from 'gulp';

import babel from 'gulp-babel';
import fs from 'fs';
import path from 'path';

gulp.task('transpile', () =>
gulp.src('./src/**/*.js')
@@ -14,4 +16,22 @@ gulp.task('watch', ['build'], () => {
gulp.watch('./src/**/*.js', ['transpile']);
});

gulp.task('build', ['transpile']);
gulp.task('link', () => {
const files = fs.readdirSync(path.resolve(__dirname, './src'))
.filter(f => f.endsWith('.js'));
const packageJSON = require('./package.json');

if (!fs.existsSync(path.resolve(__dirname, './dist'))) fs.mkdirSync(path.resolve(__dirname, './dist'));

Object.keys(packageJSON.bin).forEach((binName) => {
if (binName === 'electron-forge') return;

if (packageJSON.bin[binName] === packageJSON.bin['electron-forge']) {
files.forEach((fileName) => {
fs.writeFileSync(path.resolve(__dirname, `./dist/${fileName.replace('electron-forge', binName)}`), `require('./${fileName}');`);
});
}
});
});

gulp.task('build', ['transpile', 'link']);
@@ -12,7 +12,7 @@
"build": "gulp build",
"precommit": "npm run lint",
"commit": "git-cz",
"lint": "eslint src test",
"lint": "eslint src test gulpfile.babel.js",
"prepublish": "gulp build",
"pretest": "gulp build",
"test": "npm run lint && mocha test --compilers js:babel-register --timeout=300000",

0 comments on commit f1cac74

Please sign in to comment.
You can’t perform that action at this time.