Skip to content

Commit

Permalink
Work on admin scripts gulp4
Browse files Browse the repository at this point in the history
  • Loading branch information
jlukic committed Oct 6, 2022
1 parent b19d2d3 commit 6f2a912
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 41 deletions.
31 changes: 16 additions & 15 deletions tasks/admin/distributions/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* update package.json file
*/

var
let
gulp = require('gulp'),

// node dependencies
Expand Down Expand Up @@ -43,22 +43,22 @@ var


module.exports = function(callback) {
var
let
stream,
index,
tasks = []
;

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),
Expand All @@ -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',
Expand All @@ -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)
Expand All @@ -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] + "'";
}
Expand All @@ -130,7 +131,7 @@ module.exports = function(callback) {


gulp.task(task.meteor, function() {
var
let
files = gatherFiles(outputDirectory),
filenames = createList(files)
;
Expand All @@ -146,7 +147,7 @@ module.exports = function(callback) {

if(distribution == 'CSS') {
gulp.task(task.repo, function() {
var
let
themes,
components,
releases
Expand All @@ -165,7 +166,7 @@ module.exports = function(callback) {
}
else if(distribution == 'LESS') {
gulp.task(task.repo, function() {
var
let
definitions,
themeImport,
themeConfig,
Expand Down Expand Up @@ -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))
;
Expand Down
6 changes: 3 additions & 3 deletions tasks/admin/distributions/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*/

var
let
gulp = require('gulp'),

// node dependencies
Expand Down Expand Up @@ -63,7 +63,7 @@ module.exports = function(callback) {
return;
}

var
let
component = release.distributions[index],
lowerCaseComponent = component.toLowerCase(),
outputDirectory = path.resolve(release.outputRoot + lowerCaseComponent),
Expand Down Expand Up @@ -147,7 +147,7 @@ module.exports = function(callback) {
// avoid rate throttling
global.clearTimeout(timer);
timer = global.setTimeout(function() {
stepRepo()
stepRepo();
}, 0);
}

Expand Down
24 changes: 16 additions & 8 deletions tasks/admin/publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 changes: 29 additions & 12 deletions tasks/admin/release.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 changes: 1 addition & 1 deletion tasks/collections/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@


module.exports = function(gulp) {
var
let
// less/css distributions
initComponents = require('../admin/components/init'),
createComponents = require('../admin/components/create'),
Expand Down
4 changes: 2 additions & 2 deletions tasks/collections/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 6f2a912

Please sign in to comment.