diff --git a/tasks/admin/components/init.js b/tasks/admin/components/init.js index 1f8b7cf8c..7fee6dca3 100644 --- a/tasks/admin/components/init.js +++ b/tasks/admin/components/init.js @@ -21,7 +21,6 @@ var fs = require('fs'), path = require('path'), git = require('gulp-git'), - githubAPI = require('@octokit/rest'), mkdirp = require('mkdirp'), // admin files @@ -149,7 +148,7 @@ module.exports = function(callback) { // avoid rate throttling global.clearTimeout(timer); timer = global.setTimeout(function() { - stepRepo() + stepRepo(); }, 0); } diff --git a/tasks/admin/components/update.js b/tasks/admin/components/update.js index 0c6ff696a..ac04c6433 100644 --- a/tasks/admin/components/update.js +++ b/tasks/admin/components/update.js @@ -20,7 +20,6 @@ var fs = require('fs'), path = require('path'), git = require('gulp-git'), - githubAPI = require('@octokit/rest'), requireDotFile = require('require-dot-file'), // admin files diff --git a/tasks/admin/distributions/init.js b/tasks/admin/distributions/init.js index 12b51802e..124e13167 100644 --- a/tasks/admin/distributions/init.js +++ b/tasks/admin/distributions/init.js @@ -21,7 +21,6 @@ var fs = require('fs'), path = require('path'), git = require('gulp-git'), - githubAPI = require('@octokit/rest'), mkdirp = require('mkdirp'), // admin files diff --git a/tasks/admin/distributions/update.js b/tasks/admin/distributions/update.js index fc9150096..efc56ea71 100644 --- a/tasks/admin/distributions/update.js +++ b/tasks/admin/distributions/update.js @@ -20,7 +20,6 @@ var fs = require('fs'), path = require('path'), git = require('gulp-git'), - githubAPI = require('@octokit/rest'), requireDotFile = require('require-dot-file'), // admin files diff --git a/tasks/config/admin/github.js b/tasks/config/admin/github.js index a2c9e20bf..c94e21386 100644 --- a/tasks/config/admin/github.js +++ b/tasks/config/admin/github.js @@ -8,7 +8,7 @@ var fs = require('fs'), path = require('path'), - githubAPI = require('@octokit/rest'), + { Octokit } = require('@octokit/rest'), // stores oauth info for GitHub API oAuthConfig = path.join(__dirname, 'oauth.js'), @@ -22,16 +22,11 @@ if(!oAuth) { console.error('Must add oauth token for GitHub in tasks/config/admin/oauth.js'); } -github = new githubAPI({ - version : '3.0.0', - debug : true, - protocol : 'https', +github = new Octokit({ + version : '3.0.0', + auth : oAuth.token, + userAgent : 'Semantic-Org-Pusher-Bot', timeout : 5000 }); -github.authenticate({ - type: 'oauth', - token: oAuth.token -}); - module.exports = github; diff --git a/tasks/docs/serve.js b/tasks/docs/serve.js index e77f8e916..48cc493da 100644 --- a/tasks/docs/serve.js +++ b/tasks/docs/serve.js @@ -85,9 +85,9 @@ serveDocs = function () { 'src/**/*.*' ]) ; - watchSRCCallback = function(file) { + watchSRCCallback = function(filePath) { console.clear(); - return gulp.src(file.path, { + return gulp.src(filePath, { base: 'src/' }) .pipe(gulp.dest(output.less)) @@ -109,9 +109,9 @@ serveDocs = function () { ]) ; - watchExamplesCallback = function(file) { + watchExamplesCallback = function(filePath) { console.clear(); - return gulp.src(file.path, { + return gulp.src(filePath, { base: 'examples/' }) .pipe(gulp.dest(output.examples)) @@ -136,7 +136,7 @@ serveDocs = function () { source.themes + '/**/*.{overrides,variables}' ]) ; - watchCSSCallback = function(file) { + watchCSSCallback = function(filePath) { let lessPath, @@ -151,7 +151,7 @@ serveDocs = function () { ; // log modified file - gulp.src(file.path) + gulp.src(filePath) .pipe(print(log.modified)) ; @@ -160,10 +160,10 @@ serveDocs = function () { ---------------*/ // recompile on *.override , *.variable change - isConfig = (file.path.indexOf('theme.config') !== -1 || file.path.indexOf('site.variables') !== -1); - isPackagedTheme = (file.path.indexOf(source.themes) !== -1); - isSiteTheme = (file.path.indexOf(source.site) !== -1); - isDefinition = (file.path.indexOf(source.definitions) !== -1); + isConfig = (filePath.indexOf('theme.config') !== -1 || filePath.indexOf('site.variables') !== -1); + isPackagedTheme = (filePath.indexOf(source.themes) !== -1); + isSiteTheme = (filePath.indexOf(source.site) !== -1); + isDefinition = (filePath.indexOf(source.definitions) !== -1); if(isConfig) { // console.info('Rebuilding all files'); @@ -173,17 +173,17 @@ serveDocs = function () { } else if(isPackagedTheme) { console.log('Change detected in packaged theme'); - lessPath = replaceExt(file.path, '.less'); + lessPath = replaceExt(filePath, '.less'); lessPath = lessPath.replace(tasks.regExp.theme, source.definitions); } else if(isSiteTheme) { console.log('Change detected in site theme'); - lessPath = replaceExt(file.path, '.less'); + lessPath = replaceExt(filePath, '.less'); lessPath = lessPath.replace(source.site, source.definitions); } else { console.log('Change detected in definition'); - lessPath = file.path; + lessPath = filePath; } /*-------------- @@ -249,24 +249,26 @@ serveDocs = function () { watchJS = gulp .watch([ source.definitions + '/**/*.js' - ], function(file) { - gulp.src(file.path) - .pipe(plumber()) - .pipe(gulpif(config.hasPermission, chmod(config.permission))) - .pipe(gulp.dest(output.uncompressed)) - .pipe(print(log.created)) - .pipe(uglify(settings.uglify)) - .pipe(rename(settings.rename.minJS)) - .pipe(gulp.dest(output.compressed)) - .pipe(print(log.created)) - .on('end', function() { - gulp.start('package compressed docs js'); - gulp.start('package uncompressed docs js'); - }) - ; - }) + ]) ; + watchJSCallback = function(filePath) { + gulp.src(filePath) + .pipe(plumber()) + .pipe(gulpif(config.hasPermission, chmod(config.permission))) + .pipe(gulp.dest(output.uncompressed)) + .pipe(print(log.created)) + .pipe(uglify(settings.uglify)) + .pipe(rename(settings.rename.minJS)) + .pipe(gulp.dest(output.compressed)) + .pipe(print(log.created)) + .on('end', function() { + gulp.start('package compressed docs js'); + gulp.start('package uncompressed docs js'); + }) + ; + }; + watchJS .on('add', watchJSCallback) .on('change', watchJSCallback) @@ -283,8 +285,8 @@ serveDocs = function () { ]) ; // copy assets - watchAssetsCallback = function(file) { - gulp.src(file.path, { base: source.themes }) + watchAssetsCallback = function(filePath) { + gulp.src(filePath, { base: source.themes }) .pipe(gulpif(config.hasPermission, chmod(config.permission))) .pipe(gulp.dest(output.themes)) .pipe(print(log.created))