Browse Source

Work on admin scripts gulp4

next
jlukic 2 years ago
parent
commit
6f2a912708
6 changed files with 67 additions and 41 deletions
  1. 31
      tasks/admin/distributions/create.js
  2. 6
      tasks/admin/distributions/init.js
  3. 24
      tasks/admin/publish.js
  4. 41
      tasks/admin/release.js
  5. 2
      tasks/collections/admin.js
  6. 4
      tasks/collections/build.js

31
tasks/admin/distributions/create.js

@ -9,7 +9,7 @@
* update package.json file
*/
var
let
gulp = require('gulp'),
// node dependencies
@ -43,7 +43,7 @@ var
module.exports = function(callback) {
var
let
stream,
index,
tasks = []
@ -51,14 +51,14 @@ module.exports = function(callback) {
for(index in release.distributions) {
var
let
distribution = release.distributions[index]
;
// streams... designed to save time and make coding fun...
(function(distribution) {
var
let
distLowerCase = distribution.toLowerCase(),
outputDirectory = path.join(release.outputRoot, distLowerCase),
packageFile = path.join(outputDirectory, release.files.npm),
@ -81,8 +81,9 @@ module.exports = function(callback) {
// get files for meteor
gatherFiles = function(dir) {
var
dir = dir || path.resolve('.'),
dir = dir || path.resolve('.');
let
list = fs.readdirSync(dir),
omitted = [
'.git',
@ -97,7 +98,7 @@ module.exports = function(callback) {
files = []
;
list.forEach(function(file) {
var
let
isOmitted = (omitted.indexOf(file) > -1),
filePath = path.join(dir, file),
stat = fs.statSync(filePath)
@ -116,8 +117,8 @@ module.exports = function(callback) {
// spaces out list correctly
createList = function(files) {
var filenames = '';
for(var file in files) {
let filenames = '';
for(let file in files) {
if(file == (files.length - 1) ) {
filenames += "'" + files[file] + "'";
}
@ -130,7 +131,7 @@ module.exports = function(callback) {
gulp.task(task.meteor, function() {
var
let
files = gatherFiles(outputDirectory),
filenames = createList(files)
;
@ -146,7 +147,7 @@ module.exports = function(callback) {
if(distribution == 'CSS') {
gulp.task(task.repo, function() {
var
let
themes,
components,
releases
@ -165,7 +166,7 @@ module.exports = function(callback) {
}
else if(distribution == 'LESS') {
gulp.task(task.repo, function() {
var
let
definitions,
themeImport,
themeConfig,
@ -198,11 +199,11 @@ module.exports = function(callback) {
gulp.task(task.package, function() {
return gulp.src(packageFile)
.pipe(plumber())
.pipe(jsonEditor(function(package) {
.pipe(jsonEditor(function(json) {
if(version) {
package.version = version;
json.version = version;
}
return package;
return json;
}))
.pipe(gulp.dest(outputDirectory))
;

6
tasks/admin/distributions/init.js

@ -12,7 +12,7 @@
*/
var
let
gulp = require('gulp'),
// node dependencies
@ -63,7 +63,7 @@ module.exports = function(callback) {
return;
}
var
let
component = release.distributions[index],
lowerCaseComponent = component.toLowerCase(),
outputDirectory = path.resolve(release.outputRoot + lowerCaseComponent),
@ -147,7 +147,7 @@ module.exports = function(callback) {
// avoid rate throttling
global.clearTimeout(timer);
timer = global.setTimeout(function() {
stepRepo()
stepRepo();
}, 0);
}

24
tasks/admin/publish.js

@ -8,15 +8,23 @@
* Commits changes from create components to GitHub and Tags
*/
let
gulp = require('gulp'),
{series, parallel} = gulp,
updateComponents = require('../admin/components/update'),
updateDistributions = require('../admin/distributions/update'),
/* Release All */
module.exports = function(callback) {
publish
;
gulp.series(
'update distributions', // commit less/css versions to github
'update components', // commit components to github
callback
);
/* Release All */
publish = series(
updateDistributions, // commit less/css versions to github
updateComponents // commit components to github
);
};
/* Export with Metadata */
publish.displayName = 'publish';
publish.description = 'Publish new versions of SUI across all repos';
module.exports = publish;

41
tasks/admin/release.js

@ -2,6 +2,23 @@
Release
*******************************/
let
gulp = require('gulp'),
{series, parallel} = gulp,
build = require('../build'),
// less/css distributions
initComponents = require('./components/init'),
createComponents = require('./components/create'),
// single component releases
initDistributions = require('./distributions/init'),
createDistributions = require('./distributions/create'),
release
;
/*
This task update all SUI individual component repos with new versions of components
@ -11,15 +28,15 @@
*/
/* Release All */
module.exports = function(callback) {
gulp.series(
//'build', // build Semantic
'init distributions', // sync with current github version
'create distributions', // update each repo with changes from master repo
'init components', // sync with current github version
'create components', // update each repo
callback
);
};
release = series(
build, // build Semantic
initDistributions, // sync with current github version
createDistributions, // update each repo with changes from master repo
initComponents, // sync with current github version
createComponents // update each repo
);
/* Export with Metadata */
release.displayName = 'release';
release.description = 'Release SUI across all repos';
module.exports = release;

2
tasks/collections/admin.js

@ -15,7 +15,7 @@
module.exports = function(gulp) {
var
let
// less/css distributions
initComponents = require('../admin/components/init'),
createComponents = require('../admin/components/create'),

4
tasks/collections/build.js

@ -4,14 +4,14 @@
module.exports = function(gulp) {
var
let
// build sub-tasks
buildJS = require('./../build/javascript'),
buildCSS = require('./../build/css'),
buildAssets = require('./../build/assets')
;
// in case these tasks are undefined during import, less make sure these are available in scope
// in case these tasks are undefined during import, lets make sure these are available in scope
gulp.task('build-javascript', buildJS);
gulp.task('build-css', buildCSS);
gulp.task('build-assets', buildAssets);

Loading…
Cancel
Save