Skip to content

Commit

Permalink
fix rollup undefined error
Browse files Browse the repository at this point in the history
  • Loading branch information
leeluolee committed Aug 30, 2016
1 parent 4ddf49e commit 36c44f0
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 57 deletions.
2 changes: 0 additions & 2 deletions gulpfile.js
Expand Up @@ -15,7 +15,6 @@ var uglify = require('gulp-uglify');
var gutil = require('gulp-util');
var bump = require('gulp-bump');
var through = require('through2');
var rollup = require('rollup');
var pkg;


Expand Down Expand Up @@ -61,7 +60,6 @@ var testConfig = {
}


require('./scripts/release')(gulp);

gulp.task('default', ['watch'], function() {});

Expand Down
110 changes: 55 additions & 55 deletions scripts/release.js
@@ -1,67 +1,67 @@
// form https://github.com/lfender6445/gulp-release-tasks/blob/master/package.json
// but stateman also need release to component.json
module.exports = function (gulp) {
// // form https://github.com/lfender6445/gulp-release-tasks/blob/master/package.json
// // but stateman also need release to component.json
// module.exports = function (gulp) {

var argv = require('yargs').argv;
var bump = require('gulp-bump');
var fs = require('fs');
var git = require('gulp-git');
var runSequence = require('gulp-run-sequence');
var spawn = require('child_process').spawn;
var tag_version = require('gulp-tag-version');
var through = require('through2');
// var argv = require('yargs').argv;
// var bump = require('gulp-bump');
// var fs = require('fs');
// var git = require('gulp-git');
// var runSequence = require('gulp-run-sequence');
// var spawn = require('child_process').spawn;
// var tag_version = require('gulp-tag-version');
// var through = require('through2');

var branch = argv.branch || 'master';
var rootDir = require('path').resolve(argv.rootDir || './') + '/';
// var branch = argv.branch || 'master';
// var rootDir = require('path').resolve(argv.rootDir || './') + '/';

var commitIt = function (file, enc, cb) {
if (file.isNull()) return cb(null, file);
if (file.isStream()) return cb(new Error('Streaming not supported'));
// var commitIt = function (file, enc, cb) {
// if (file.isNull()) return cb(null, file);
// if (file.isStream()) return cb(new Error('Streaming not supported'));

var commitMessage = "Bumps version to " + require(file.path).version;
gulp.src('./*.json', {cwd: rootDir}).pipe(git.commit(commitMessage, {cwd: rootDir}));
};
// var commitMessage = "Bumps version to " + require(file.path).version;
// gulp.src('./*.json', {cwd: rootDir}).pipe(git.commit(commitMessage, {cwd: rootDir}));
// };

var paths = {
versionsToBump: ['package.json', 'bower.json', 'manifest.json', 'component.json'].map(function (fileName) {
return rootDir + fileName;
})
};
// var paths = {
// versionsToBump: ['package.json', 'bower.json', 'manifest.json', 'component.json'].map(function (fileName) {
// return rootDir + fileName;
// })
// };

// gulp.task('release', function (cb) {
// runSequence('tag-and-push', 'npm-publish', 'bump', cb);
// });
// // gulp.task('release', function (cb) {
// // runSequence('tag-and-push', 'npm-publish', 'bump', cb);
// // });

gulp.task('tag-and-push', function () {
var pkg = require(rootDir + 'package.json');
// gulp.task('tag-and-push', function () {
// var pkg = require(rootDir + 'package.json');

return gulp.src('./', {cwd: rootDir})
.pipe(tag_version({version: pkg.version, cwd: rootDir}))
.on('end', function () {
git.push('origin', branch, {args: '--tags', cwd: rootDir});
});
});
// return gulp.src('./', {cwd: rootDir})
// .pipe(tag_version({version: pkg.version, cwd: rootDir}))
// .on('end', function () {
// git.push('origin', branch, {args: '--tags', cwd: rootDir});
// });
// });

var versioning = function () {
if (argv.minor) {
return 'minor';
}
if (argv.major) {
return 'major';
}
return 'patch';
};
// var versioning = function () {
// if (argv.minor) {
// return 'minor';
// }
// if (argv.major) {
// return 'major';
// }
// return 'patch';
// };

gulp.task('bump', function () {
gulp.src(paths.versionsToBump, {cwd: rootDir})
.pipe(bump({type: versioning()}))
.pipe(gulp.dest('./', {cwd: rootDir}))
.pipe(through.obj(commitIt))
// .pipe(git.push('origin', branch, {cwd: rootDir}));
});
// gulp.task('bump', function () {
// gulp.src(paths.versionsToBump, {cwd: rootDir})
// .pipe(bump({type: versioning()}))
// .pipe(gulp.dest('./', {cwd: rootDir}))
// .pipe(through.obj(commitIt))
// // .pipe(git.push('origin', branch, {cwd: rootDir}));
// });

gulp.task('npm-publish', function (done) {
spawn('npm', ['publish', rootDir], {stdio: 'inherit'}).on('close', done);
});
// gulp.task('npm-publish', function (done) {
// spawn('npm', ['publish', rootDir], {stdio: 'inherit'}).on('close', done);
// });

};
// };

0 comments on commit 36c44f0

Please sign in to comment.