Browse Source

Merge c8f42b3250 into 6f2a912708

pull/7142/merge
igABHINAV 10 months ago
committed by GitHub
parent
commit
84140f4217
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
22 changed files with 608 additions and 8274 deletions
  1. 2
      CONTRIBUTING.md
  2. 6
      README.md
  3. 8
      RELEASE-NOTES.md
  4. 26
      dist/components/button.css
  5. 2
      dist/components/button.min.css
  6. 2
      dist/components/dimmer.js
  7. 2
      dist/components/dimmer.min.js
  8. 2
      dist/components/icon.css
  9. 2
      dist/components/icon.min.css
  10. 35
      dist/semantic.css
  11. 2
      dist/semantic.js
  12. 4
      dist/semantic.min.css
  13. 2
      dist/semantic.min.js
  14. 7783
      package-lock.json
  15. 55
      package.json
  16. 23
      src/definitions/modules/dropdown.js
  17. 522
      tasks/admin/components/create.js
  18. 4
      tasks/admin/components/init.js
  19. 21
      tasks/admin/components/update.js
  20. 306
      tasks/admin/distributions/create.js
  21. 32
      tasks/admin/distributions/update.js
  22. 41
      tasks/admin/register.js

2
CONTRIBUTING.md

@ -5,7 +5,7 @@
Questions about usage should be asked in our [Gitter chatroom](https://gitter.im/Semantic-Org/Semantic-UI), on [Semantic UI forums](http://forums.semantic-ui.com) or [StackOverflow](http://stackoverflow.com/questions/tagged/semantic-ui).
Examples of usage questions
* *Why isnt my code working?*
* *Why isn't my code working?*
* *Can Semantic UI do this?*
Once you receive feedback through community channels you may find your question is actually a bug. At this point it's a good idea to submit it as a bug report. Just keep in mind the following suggestions.

6
README.md

@ -17,11 +17,9 @@ Key Features
Semantic allows developers to build beautiful websites fast, with **concise HTML**, **intuitive javascript**, and **simplified debugging**, helping make front-end development a delightful experience. Semantic is responsively designed allowing your website to scale on multiple devices. Semantic is production ready and partnered with frameworks such as **React**, **Angular**, **Meteor**, and **Ember**, which means you can integrate it with any of these frameworks to organize your UI layer alongside your application logic.
## 2.4.0 Release (Sep 17th, 2018)
## 2.5.0 Release (Oct 6, 2022)
Semantic UI `2.4` is now available. Read up on [what's new](http://www.semantic-ui.com/introduction/new.html) in the docs.
Migration info from `1.x` can be found in the [2.0 release notes](https://github.com/Semantic-Org/Semantic-UI/blob/master/RELEASE-NOTES.md#version-200---march-xx-2015)
Semantic UI is now compatible with Node 18 and Gulp 4.
## User Support

8
RELEASE-NOTES.md

@ -1,18 +1,18 @@
## RELEASE NOTES
### Version 2.5.0 - Oct 21, 2018
### Version 2.5.0 - Oct 6, 2022
**Note**
> Special Note: If you run into any breaking changes with Gulp 4. Please reach out to me at jack@semantic-ui.com with bug reports
**Critical Fix**
- **CSS** - Fix extra semicolon causing CSS build of Semantic UI to fail compilation with various systems
- **CSS** - Fix extra semicolon causing CSS build of Semantic UI to fail compilation with various systems #7065 [React Issue](https://github.com/Semantic-Org/Semantic-UI-React/issues/4287) [CSS Repo Issue #81](https://github.com/Semantic-Org/Semantic-UI-CSS/issues/81) [CSS Issue #75](https://github.com/Semantic-Org/Semantic-UI-CSS/issues/75)
**Breaking Changes**
- **Gulp** - Updated all tasks to work with Gulp 4. This should fix SUI to install correctly on Node 12 or greater (see [Gulp3 Issue](https://github.com/gulpjs/gulp/issues/2324) for more details)
- **Node** - Updated scripts to build in Node 18 via vanilla install.
- **Gulp 4** -All tasks have been rewritten to work with Gulp 4. This should fix SUI to install correctly on Node 12 or greater (see [Gulp3 Issue](https://github.com/gulpjs/gulp/issues/2324) for more details)
**Build**
- **Node** - Updated scripts to build in Node 18 via vanilla install.
- **Theme** - Allow site's global site theme to be missing #6876 **Thanks @cruzdanillo**
- **Meteor** - Fix issue with misuse of `api.addAssets` #6790 **Thanks @gimco**
- **Gulp** - Report errors in build #7005 **Thanks @bundyo**

26
dist/components/button.css

@ -856,6 +856,32 @@
text-align: center;
transform: translateY(-50%);
}
/* Loading */
.ui.labeled.icon.button > .icon.loading {
-webkit-animation: none;
animation: none;
}
.ui.labeled.icon.button > .icon.loading:before {
-webkit-animation: labeled-button-icon-loading 2s linear infinite;
animation: labeled-button-icon-loading 2s linear infinite;
}
@-webkit-keyframes labeled-button-icon-loading {
from {
transform: translateY(-50%) rotate(0deg);
}
to {
transform: translateY(-50%) rotate(360deg);
}
}
@keyframes labeled-button-icon-loading {
from {
transform: translateY(-50%) rotate(0deg);
}
to {
transform: translateY(-50%) rotate(360deg);
}
}
.ui.labeled.icon.buttons .button > .icon {
border-radius: 0em;
}

2
dist/components/button.min.css
File diff suppressed because it is too large
View File

2
dist/components/dimmer.js

@ -151,7 +151,7 @@ $.fn.dimmer = function(parameters) {
event: {
click: function(event) {
module.verbose('Determining if event occured on dimmer', event);
module.verbose('Determining if event occurred on dimmer', event);
if( $dimmer.find(event.target).length === 0 || $(event.target).is(selector.content) ) {
module.hide();
event.stopImmediatePropagation();

2
dist/components/dimmer.min.js
File diff suppressed because it is too large
View File

2
dist/components/icon.css

@ -58,6 +58,8 @@ i.icon:before {
i.icon.loading {
height: 1em;
line-height: 1;
}
i.icon.loading {
-webkit-animation: icon-loading 2s linear infinite;
animation: icon-loading 2s linear infinite;
}

2
dist/components/icon.min.css
File diff suppressed because it is too large
View File

35
dist/semantic.css

@ -1719,6 +1719,38 @@ body .ui.inverted::-webkit-scrollbar-thumb:hover {
transform: translateY(-50%);
}
/* Loading */
.ui.labeled.icon.button > .icon.loading {
-webkit-animation: none;
animation: none;
}
.ui.labeled.icon.button > .icon.loading:before {
-webkit-animation: labeled-button-icon-loading 2s linear infinite;
animation: labeled-button-icon-loading 2s linear infinite;
}
@-webkit-keyframes labeled-button-icon-loading {
from {
transform: translateY(-50%) rotate(0deg);
}
to {
transform: translateY(-50%) rotate(360deg);
}
}
@keyframes labeled-button-icon-loading {
from {
transform: translateY(-50%) rotate(0deg);
}
to {
transform: translateY(-50%) rotate(360deg);
}
}
.ui.labeled.icon.buttons .button > .icon {
border-radius: 0em;
}
@ -7399,6 +7431,9 @@ i.icon:before {
i.icon.loading {
height: 1em;
line-height: 1;
}
i.icon.loading {
-webkit-animation: icon-loading 2s linear infinite;
animation: icon-loading 2s linear infinite;
}

2
dist/semantic.js

@ -3802,7 +3802,7 @@ $.fn.dimmer = function(parameters) {
event: {
click: function(event) {
module.verbose('Determining if event occured on dimmer', event);
module.verbose('Determining if event occurred on dimmer', event);
if( $dimmer.find(event.target).length === 0 || $(event.target).is(selector.content) ) {
module.hide();
event.stopImmediatePropagation();

4
dist/semantic.min.css
File diff suppressed because it is too large
View File

2
dist/semantic.min.js
File diff suppressed because it is too large
View File

7783
package-lock.json
File diff suppressed because it is too large
View File

55
package.json

@ -47,41 +47,42 @@
},
"dependencies": {
"better-console": "*",
"del": "^3.0.0",
"extend": "^3.0.2",
"gulp": "^4.0.2",
"gulp-autoprefixer": "^6.1.0",
"gulp-chmod": "^2.0.0",
"gulp-clean-css": "^3.10.0",
"gulp-clone": "^2.0.1",
"gulp-concat": "^2.6.1",
"gulp-concat-css": "^3.1.0",
"gulp-copy": "4.0.1",
"gulp-dedupe": "0.0.2",
"gulp-flatten": "^0.4.0",
"gulp-header": "^2.0.9",
"gulp-if": "^2.0.2",
"del": "*",
"extend": "*",
"gulp": "*",
"gulp-autoprefixer": "*",
"gulp-chmod": "*",
"gulp-clean-css": "*",
"gulp-clone": "*",
"gulp-concat": "*",
"gulp-concat-css": "*",
"gulp-copy": "*",
"gulp-dedupe": "*",
"gulp-flatten": "*",
"gulp-header": "*",
"gulp-if": "*",
"gulp-json-editor": "^2.5.4",
"gulp-less": "^4.0.1",
"gulp-notify": "^3.2.0",
"gulp-plumber": "^1.2.1",
"gulp-print": "^5.0.2",
"gulp-rename": "^1.4.0",
"gulp-replace": "^1.0.0",
"gulp-rtlcss": "^1.4.1",
"gulp-uglify": "^3.0.2",
"gulp-less": "*",
"gulp-notify": "*",
"gulp-plumber": "*",
"gulp-print": "*",
"gulp-rename": "*",
"gulp-replace": "*",
"gulp-rtlcss": "*",
"gulp-uglify": "*",
"jquery": "^3.5.1",
"map-stream": "^0.1.0",
"map-stream": "*",
"merge-stream": "^1.0.0",
"mkdirp": "^1.0.4",
"prompt-sui": "^3.2.1",
"replace-ext": "^1.0.1",
"require-dot-file": "^0.4.0",
"replace-ext": "*",
"require-dot-file": "*",
"wrench-sui": "^0.0.3",
"yamljs": "^0.3.0"
"yamljs": "*"
},
"devDependencies": {
"@octokit/rest": "^17.9.2",
"@jsdevtools/npm-publish": "^1.4.3",
"@octokit/rest": "^19.0.4",
"gulp-concat-filenames": "*",
"gulp-debug": "^4.0.0",
"gulp-git": "^2.10.1",

23
src/definitions/modules/dropdown.js

@ -2259,28 +2259,25 @@ $.fn.dropdown = function(parameters) {
$text.addClass(className.placeholder);
},
tabbable: function() {
if( module.is.searchSelection() ) {
var selectTabIndex = $module.attr('tabindex'); // Capture the tabindex from the select element
if (module.is.searchSelection()) {
module.debug('Added tabindex to searchable dropdown');
$search
.val('')
.attr('tabindex', 0)
;
.attr('tabindex', selectTabIndex !== undefined ? selectTabIndex : 0); // Use the captured tabindex
$menu
.attr('tabindex', -1)
;
}
else {
.attr('tabindex', -1);
} else {
module.debug('Added tabindex to dropdown');
if( $module.attr('tabindex') === undefined) {
if ($module.attr('tabindex') === undefined) {
$module
.attr('tabindex', 0)
;
.attr('tabindex', selectTabIndex !== undefined ? selectTabIndex : 0); // Use the captured tabindex
$menu
.attr('tabindex', -1)
;
.attr('tabindex', -1);
}
}
},
}
,
initialLoad: function() {
module.verbose('Setting initial load');
initialLoad = true;

522
tasks/admin/components/create.js

@ -14,8 +14,9 @@
* create meteor.js file
*/
var
gulp = require('gulp'),
let
gulp = require('gulp'),
{series, parallel} = gulp,
// node dependencies
console = require('better-console'),
@ -46,285 +47,284 @@ var
;
module.exports = function(callback) {
var
stream,
index,
tasks = []
;
let
stream,
index,
tasks = []
;
for(index in release.components) {
for(index in release.components) {
var
component = release.components[index]
;
let
component = release.components[index]
;
// streams... designed to save time and make coding fun...
(function(component) {
// streams... designed to save time and make coding fun...
(function(component) {
var
outputDirectory = path.join(release.outputRoot, component),
isJavascript = fs.existsSync(output.compressed + component + '.js'),
isCSS = fs.existsSync(output.compressed + component + '.css'),
capitalizedComponent = component.charAt(0).toUpperCase() + component.slice(1),
packageName = release.packageRoot + component,
repoName = release.componentRepoRoot + capitalizedComponent,
gitURL = 'https://github.com/' + release.org + '/' + repoName + '.git',
repoURL = 'https://github.com/' + release.org + '/' + repoName + '/',
concatSettings = {
newline : '',
root : outputDirectory,
prepend : " '",
append : "',"
let
outputDirectory = path.join(release.outputRoot, component),
isJavascript = fs.existsSync(output.compressed + component + '.js'),
isCSS = fs.existsSync(output.compressed + component + '.css'),
capitalizedComponent = component.charAt(0).toUpperCase() + component.slice(1),
packageName = release.packageRoot + component,
repoName = release.componentRepoRoot + capitalizedComponent,
gitURL = 'https://github.com/' + release.org + '/' + repoName + '.git',
repoURL = 'https://github.com/' + release.org + '/' + repoName + '/',
concatSettings = {
newline : '',
root : outputDirectory,
prepend : " '",
append : "',"
},
regExp = {
match : {
// templated values
name : '{component}',
titleName : '{Component}',
version : '{version}',
files : '{files}',
// release notes
spacedVersions : /(###.*\n)\n+(?=###)/gm,
spacedLists : /(^- .*\n)\n+(?=^-)/gm,
trim : /^\s+|\s+$/g,
unrelatedNotes : new RegExp('^((?!(^.*(' + component + ').*$|###.*)).)*$', 'gmi'),
whitespace : /\n\s*\n\s*\n/gm,
// npm
componentExport : /(.*)\$\.fn\.\w+\s*=\s*function\(([^\)]*)\)\s*{/g,
componentReference: '$.fn.' + component,
settingsExport : /\$\.fn\.\w+\.settings\s*=/g,
settingsReference : /\$\.fn\.\w+\.settings/g,
trailingComma : /,(?=[^,]*$)/,
jQuery : /jQuery/g,
},
regExp = {
match : {
// templated values
name : '{component}',
titleName : '{Component}',
version : '{version}',
files : '{files}',
// release notes
spacedVersions : /(###.*\n)\n+(?=###)/gm,
spacedLists : /(^- .*\n)\n+(?=^-)/gm,
trim : /^\s+|\s+$/g,
unrelatedNotes : new RegExp('^((?!(^.*(' + component + ').*$|###.*)).)*$', 'gmi'),
whitespace : /\n\s*\n\s*\n/gm,
// npm
componentExport : /(.*)\$\.fn\.\w+\s*=\s*function\(([^\)]*)\)\s*{/g,
componentReference: '$.fn.' + component,
settingsExport : /\$\.fn\.\w+\.settings\s*=/g,
settingsReference : /\$\.fn\.\w+\.settings/g,
trailingComma : /,(?=[^,]*$)/,
jQuery : /jQuery/g,
},
replace : {
// readme
name : component,
titleName : capitalizedComponent,
// release notes
spacedVersions : '',
spacedLists : '$1',
trim : '',
unrelatedNotes : '',
whitespace : '\n\n',
// npm
componentExport : 'var _module = module;\n$1module.exports = function($2) {',
componentReference: '_module.exports',
settingsExport : 'module.exports.settings =',
settingsReference : '_module.exports.settings',
jQuery : 'require("jquery")'
}
},
task = {
all : component + ' creating',
repo : component + ' create repo',
bower : component + ' create bower.json',
readme : component + ' create README',
npm : component + ' create NPM Module',
notes : component + ' create release notes',
composer : component + ' create composer.json',
package : component + ' create package.json',
meteor : component + ' create meteor package.js',
},
// paths to includable assets
manifest = {
assets : outputDirectory + '/assets/**/' + component + '?(s).*',
component : outputDirectory + '/' + component + '+(.js|.css)'
replace : {
// readme
name : component,
titleName : capitalizedComponent,
// release notes
spacedVersions : '',
spacedLists : '$1',
trim : '',
unrelatedNotes : '',
whitespace : '\n\n',
// npm
componentExport : 'var _module = module;\n$1module.exports = function($2) {',
componentReference: '_module.exports',
settingsExport : 'module.exports.settings =',
settingsReference : '_module.exports.settings',
jQuery : 'require("jquery")'
}
;
},
task = {
all : component + ' creating',
repo : component + ' create repo',
bower : component + ' create bower.json',
readme : component + ' create README',
npm : component + ' create NPM Module',
notes : component + ' create release notes',
composer : component + ' create composer.json',
package : component + ' create package.json',
meteor : component + ' create meteor package.js',
},
// paths to includable assets
manifest = {
assets : outputDirectory + '/assets/**/' + component + '?(s).*',
component : outputDirectory + '/' + component + '+(.js|.css)'
}
;
// copy dist files into output folder adjusting asset paths
gulp.task(task.repo, false, function() {
return gulp.src(release.source + component + '.*')
.pipe(plumber())
.pipe(flatten())
.pipe(replace(release.paths.source, release.paths.output))
.pipe(gulp.dest(outputDirectory))
;
});
// copy dist files into output folder adjusting asset paths
let repoTask = function() {
console.info(component);
console.info('---------------------');
console.info('Copying dist files to component');
return gulp.src(release.source + component + '.*')
.pipe(plumber())
.pipe(flatten())
.pipe(replace(release.paths.source, release.paths.output))
.pipe(gulp.dest(outputDirectory))
;
};
// create npm module
gulp.task(task.npm, false, function() {
return gulp.src(release.source + component + '!(*.min|*.map).js')
.pipe(plumber())
.pipe(flatten())
.pipe(replace(regExp.match.componentExport, regExp.replace.componentExport))
.pipe(replace(regExp.match.componentReference, regExp.replace.componentReference))
.pipe(replace(regExp.match.settingsExport, regExp.replace.settingsExport))
.pipe(replace(regExp.match.settingsReference, regExp.replace.settingsReference))
.pipe(replace(regExp.match.jQuery, regExp.replace.jQuery))
.pipe(rename('index.js'))
.pipe(gulp.dest(outputDirectory))
;
});
// create npm module
let npmTask = function() {
console.info('Creating index.js for npm');
return gulp.src(release.source + component + '!(*.min|*.map).js')
.pipe(plumber())
.pipe(flatten())
.pipe(replace(regExp.match.componentExport, regExp.replace.componentExport))
.pipe(replace(regExp.match.componentReference, regExp.replace.componentReference))
.pipe(replace(regExp.match.settingsExport, regExp.replace.settingsExport))
.pipe(replace(regExp.match.settingsReference, regExp.replace.settingsReference))
.pipe(replace(regExp.match.jQuery, regExp.replace.jQuery))
.pipe(rename('index.js'))
.pipe(gulp.dest(outputDirectory))
;
};
// create readme
gulp.task(task.readme, false, function() {
return gulp.src(release.templates.readme)
.pipe(plumber())
.pipe(flatten())
.pipe(replace(regExp.match.name, regExp.replace.name))
.pipe(replace(regExp.match.titleName, regExp.replace.titleName))
.pipe(gulp.dest(outputDirectory))
;
});
// create readme
let readmeTask = function() {
console.info('Creating readme');
return gulp.src(release.templates.readme)
.pipe(plumber())
.pipe(flatten())
.pipe(replace(regExp.match.name, regExp.replace.name))
.pipe(replace(regExp.match.titleName, regExp.replace.titleName))
.pipe(gulp.dest(outputDirectory))
;
};
// extend bower.json
gulp.task(task.bower, false, function() {
return gulp.src(release.templates.bower)
.pipe(plumber())
.pipe(flatten())
.pipe(jsonEditor(function(bower) {
bower.name = packageName;
bower.description = capitalizedComponent + ' - Semantic UI';
if(isJavascript) {
if(isCSS) {
bower.main = [
component + '.js',
component + '.css'
];
}
else {
bower.main = [
component + '.js'
];
}
bower.dependencies = {
jquery: '>=1.8'
};
}
else {
// extend bower.json
let bowerTask = function() {
console.info('Extending bower.json');
return gulp.src(release.templates.bower)
.pipe(plumber())
.pipe(flatten())
.pipe(jsonEditor(function(bower) {
bower.name = packageName;
bower.description = capitalizedComponent + ' - Semantic UI';
if(isJavascript) {
if(isCSS) {
bower.main = [
component + '.js',
component + '.css'
];
}
return bower;
}))
.pipe(gulp.dest(outputDirectory))
;
});
// extend package.json
gulp.task(task.package, false, function() {
return gulp.src(release.templates.package)
.pipe(plumber())
.pipe(flatten())
.pipe(jsonEditor(function(npm) {
if(isJavascript) {
npm.dependencies = {
jquery: 'x.x.x'
};
npm.main = 'index.js';
}
npm.name = packageName;
if(version) {
npm.version = version;
else {
bower.main = [
component + '.js'
];
}
npm.title = 'Semantic UI - ' + capitalizedComponent;
npm.description = 'Single component release of ' + component;
npm.repository = {
type : 'git',
url : gitURL
bower.dependencies = {
jquery: '>=1.8'
};
return npm;
}))
.pipe(gulp.dest(outputDirectory))
;
});
// extend composer.json
gulp.task(task.composer, false, function() {
return gulp.src(release.templates.composer)
.pipe(plumber())
.pipe(flatten())
.pipe(jsonEditor(function(composer) {
if(isJavascript) {
composer.dependencies = {
jquery: 'x.x.x'
};
composer.main = component + '.js';
}
composer.name = 'semantic/' + component;
if(version) {
composer.version = version;
}
composer.description = 'Single component release of ' + component;
return composer;
}))
.pipe(gulp.dest(outputDirectory))
;
});
}
else {
bower.main = [
component + '.css'
];
}
return bower;
}))
.pipe(gulp.dest(outputDirectory))
;
};
// create release notes
gulp.task(task.notes, false, function() {
return gulp.src(release.templates.notes)
.pipe(plumber())
.pipe(flatten())
// Remove release notes for lines not mentioning component
.pipe(replace(regExp.match.unrelatedNotes, regExp.replace.unrelatedNotes))
.pipe(replace(regExp.match.whitespace, regExp.replace.whitespace))
.pipe(replace(regExp.match.spacedVersions, regExp.replace.spacedVersions))
.pipe(replace(regExp.match.spacedLists, regExp.replace.spacedLists))
.pipe(replace(regExp.match.trim, regExp.replace.trim))
.pipe(gulp.dest(outputDirectory))
;
});
// extend package.json
let packageTask = function() {
console.info('Extending package.json');
return gulp.src(release.templates.package)
.pipe(plumber())
.pipe(flatten())
.pipe(jsonEditor(function(npm) {
if(isJavascript) {
npm.dependencies = {
jquery: 'x.x.x'
};
npm.main = 'index.js';
}
npm.name = packageName;
if(version) {
npm.version = version;
}
npm.title = 'Semantic UI - ' + capitalizedComponent;
npm.description = 'Single component release of ' + component;
npm.repository = {
type : 'git',
url : gitURL
};
return npm;
}))
.pipe(gulp.dest(outputDirectory))
;
};
// Creates meteor package.js
gulp.task(task.meteor, function() {
var
filenames = ''
;
return gulp.src(manifest.component)
.pipe(concatFileNames('empty.txt', concatSettings))
.pipe(tap(function(file) {
filenames += file.contents;
}))
.on('end', function() {
gulp.src(manifest.assets)
.pipe(concatFileNames('empty.txt', concatSettings))
.pipe(tap(function(file) {
filenames += file.contents;
}))
.on('end', function() {
// remove trailing slash
filenames = filenames.replace(regExp.match.trailingComma, '').trim();
gulp.src(release.templates.meteor.component)
.pipe(plumber())
.pipe(flatten())
.pipe(replace(regExp.match.name, regExp.replace.name))
.pipe(replace(regExp.match.titleName, regExp.replace.titleName))
.pipe(replace(regExp.match.version, version))
.pipe(replace(regExp.match.files, filenames))
.pipe(rename(release.files.meteor))
.pipe(gulp.dest(outputDirectory))
;
})
;
})
;
});
// extend composer.json
let composeTask = function() {
console.info('Extending composer.json');
return gulp.src(release.templates.composer)
.pipe(plumber())
.pipe(flatten())
.pipe(jsonEditor(function(composer) {
if(isJavascript) {
composer.dependencies = {
jquery: 'x.x.x'
};
composer.main = component + '.js';
}
composer.name = 'semantic/' + component;
if(version) {
composer.version = version;
}
composer.description = 'Single component release of ' + component;
return composer;
}))
.pipe(gulp.dest(outputDirectory))
;
};
// create release notes
let releateNotesTask = function() {
return gulp.src(release.templates.notes)
.pipe(plumber())
.pipe(flatten())
// Remove release notes for lines not mentioning component
.pipe(replace(regExp.match.unrelatedNotes, regExp.replace.unrelatedNotes))
.pipe(replace(regExp.match.whitespace, regExp.replace.whitespace))
.pipe(replace(regExp.match.spacedVersions, regExp.replace.spacedVersions))
.pipe(replace(regExp.match.spacedLists, regExp.replace.spacedLists))
.pipe(replace(regExp.match.trim, regExp.replace.trim))
.pipe(gulp.dest(outputDirectory))
;
};
// synchronous tasks in orchestrator? I think not
gulp.task(task.all, false, function(callback) {
gulp.series([
task.repo,
task.npm,
task.bower,
task.readme,
task.package,
task.composer,
task.notes,
task.meteor
], callback);
});
// Creates meteor package.js
let meteorTask = function() {
console.info('Handling meteor release');
let
filenames = ''
;
return gulp.src(manifest.component)
.pipe(concatFileNames('empty.txt', concatSettings))
.pipe(tap(function(file) {
filenames += file.contents;
}))
.on('end', function() {
gulp.src(manifest.assets)
.pipe(concatFileNames('empty.txt', concatSettings))
.pipe(tap(function(file) {
filenames += file.contents;
}))
.on('end', function() {
// remove trailing slash
filenames = filenames.replace(regExp.match.trailingComma, '').trim();
gulp.src(release.templates.meteor.component)
.pipe(plumber())
.pipe(flatten())
.pipe(replace(regExp.match.name, regExp.replace.name))
.pipe(replace(regExp.match.titleName, regExp.replace.titleName))
.pipe(replace(regExp.match.version, version))
.pipe(replace(regExp.match.files, filenames))
.pipe(rename(release.files.meteor))
.pipe(gulp.dest(outputDirectory))
;
})
;
})
;
};
tasks.push(task.all);
tasks.push(repoTask);
tasks.push(npmTask);
tasks.push(readmeTask);
tasks.push(bowerTask);
tasks.push(packageTask);
tasks.push(composeTask);
tasks.push(releateNotesTask);
tasks.push(meteorTask);
})(component);
}
})(component);
}
gulp.series(tasks, callback);
};
module.exports = series(tasks);

4
tasks/admin/components/init.js

@ -53,6 +53,8 @@ module.exports = function(callback) {
return;
}
console.info('Init components');
// Do Git commands synchronously per component, to avoid issues
stepRepo = function() {
@ -148,6 +150,7 @@ module.exports = function(callback) {
// avoid rate throttling
global.clearTimeout(timer);
timer = global.setTimeout(function() {
console.info('Stepping to next repo');
stepRepo();
}, 0);
}
@ -165,5 +168,4 @@ module.exports = function(callback) {
stepRepo();
};

21
tasks/admin/components/update.js

@ -12,7 +12,7 @@
*/
var
let
gulp = require('gulp'),
// node dependencies
@ -39,7 +39,7 @@ var
module.exports = function(callback) {
var
let
index = -1,
total = release.components.length,
timer,
@ -61,7 +61,7 @@ module.exports = function(callback) {
return;
}
var
let
component = release.components[index],
outputDirectory = path.resolve(path.join(release.outputRoot, component)),
capitalizedComponent = component.charAt(0).toUpperCase() + component.slice(1),
@ -151,13 +151,20 @@ module.exports = function(callback) {
}
// create release on GitHub.com
function createRelease(version) {
async function createRelease(version) {
if(version) {
releaseOptions.target_commitish = version;
}
github.repos.createRelease(releaseOptions, function() {
nextRepo();
});
console.info('-----------------------------');
console.info(releaseOptions);
console.info('-----------------------------');
try {
await github.repos.createRelease(releaseOptions)
}
catch(e) {
console.error(`Release creation failed. Most likely already released "${releaseOptions.tag_name}"`);
};
nextRepo();
}
// Steps to next repository

306
tasks/admin/distributions/create.js

@ -10,14 +10,16 @@
*/
let
gulp = require('gulp'),
gulp = require('gulp'),
{series, parallel} = gulp,
mergeStream = require('merge-stream'),
// node dependencies
console = require('better-console'),
del = require('del'),
fs = require('fs'),
path = require('path'),
mergeStream = require('merge-stream'),
// admin dependencies
concatFileNames = require('gulp-concat-filenames'),
@ -42,178 +44,180 @@ let
;
module.exports = function(callback) {
let
stream,
index,
tasks = []
;
console.log('Creating distributions');
console.log(release.distributions);
for(index in release.distributions) {
let
stream,
index,
tasks = []
distribution = release.distributions[index]
;
for(index in release.distributions) {
(function(distribution) {
let
distribution = release.distributions[index]
distLowerCase = distribution.toLowerCase(),
outputDirectory = path.join(release.outputRoot, distLowerCase),
packageFile = path.join(outputDirectory, release.files.npm),
repoName = release.distRepoRoot + distribution,
regExp = {
match : {
files : '{files}',
version : '{version}'
}
},
task = {},
gatherFiles,
createList
;
// streams... designed to save time and make coding fun...
(function(distribution) {
// get files for meteor
gatherFiles = function(dir) {
dir = dir || path.resolve('.');
let
distLowerCase = distribution.toLowerCase(),
outputDirectory = path.join(release.outputRoot, distLowerCase),
packageFile = path.join(outputDirectory, release.files.npm),
repoName = release.distRepoRoot + distribution,
regExp = {
match : {
files : '{files}',
version : '{version}'
}
},
task = {
all : distribution + ' copying files',
repo : distribution + ' create repo',
meteor : distribution + ' create meteor package.js',
package : distribution + ' create package.json'
},
gatherFiles,
createList
list = fs.readdirSync(dir),
omitted = [
'.git',
'node_modules',
'package.js',
'LICENSE',
'README.md',
'package.json',
'bower.json',
'.gitignore'
],
files = []
;
// get files for meteor
gatherFiles = function(dir) {
dir = dir || path.resolve('.');
list.forEach(function(file) {
let
list = fs.readdirSync(dir),
omitted = [
'.git',
'node_modules',
'package.js',
'LICENSE',
'README.md',
'package.json',
'bower.json',
'.gitignore'
],
files = []
isOmitted = (omitted.indexOf(file) > -1),
filePath = path.join(dir, file),
stat = fs.statSync(filePath)
;
list.forEach(function(file) {
let
isOmitted = (omitted.indexOf(file) > -1),
filePath = path.join(dir, file),
stat = fs.statSync(filePath)
;
if(!isOmitted) {
if(stat && stat.isDirectory()) {
files = files.concat(gatherFiles(filePath));
}
else {
files.push(filePath.replace(outputDirectory + path.sep, ''));
}
}
});
return files;
};
// spaces out list correctly
createList = function(files) {
let filenames = '';
for(let file in files) {
if(file == (files.length - 1) ) {
filenames += "'" + files[file] + "'";
if(!isOmitted) {
if(stat && stat.isDirectory()) {
files = files.concat(gatherFiles(filePath));
}
else {
filenames += "'" + files[file] + "',\n ";
files.push(filePath.replace(outputDirectory + path.sep, ''));
}
}
return filenames;
};
});
return files;
};
// spaces out list correctly
createList = function(files) {
let filenames = '';
for(let file in files) {
if(file == (files.length - 1) ) {
filenames += "'" + files[file] + "'";
}
else {
filenames += "'" + files[file] + "',\n ";
}
}
return filenames;
};
let createMeteorRelease = function() {
console.info('Creating Meteor release');
let
files = gatherFiles(outputDirectory),
filenames = createList(files)
;
return gulp.src(release.templates.meteor[distLowerCase])
.pipe(plumber())
.pipe(flatten())
.pipe(replace(regExp.match.version, version))
.pipe(replace(regExp.match.files, filenames))
.pipe(rename(release.files.meteor))
.pipe(gulp.dest(outputDirectory))
;
};
let moveFiles;
if(distribution == 'CSS') {
gulp.task(task.meteor, function() {
moveFiles = function() {
let
files = gatherFiles(outputDirectory),
filenames = createList(files)
themes,
components,
releases
;
gulp.src(release.templates.meteor[distLowerCase])
.pipe(plumber())
.pipe(flatten())
.pipe(replace(regExp.match.version, version))
.pipe(replace(regExp.match.files, filenames))
.pipe(rename(release.files.meteor))
themes = gulp.src('dist/themes/default/**/*', { base: 'dist/' })
.pipe(gulp.dest(outputDirectory))
;
});
if(distribution == 'CSS') {
gulp.task(task.repo, function() {
let
themes,
components,
releases
;
themes = gulp.src('dist/themes/default/**/*', { base: 'dist/' })
.pipe(gulp.dest(outputDirectory))
;
components = gulp.src('dist/components/*', { base: 'dist/' })
.pipe(gulp.dest(outputDirectory))
;
releases = gulp.src('dist/*', { base: 'dist/' })
.pipe(gulp.dest(outputDirectory))
;
return mergeStream(themes, components, releases);
});
}
else if(distribution == 'LESS') {
gulp.task(task.repo, function() {
let
definitions,
themeImport,
themeConfig,
siteTheme,
themes
;
definitions = gulp.src('src/definitions/**/*', { base: 'src/' })
.pipe(gulp.dest(outputDirectory))
;
themeImport = gulp.src('src/semantic.less', { base: 'src/' })
.pipe(gulp.dest(outputDirectory))
;
themeImport = gulp.src('src/theme.less', { base: 'src/' })
.pipe(gulp.dest(outputDirectory))
;
themeConfig = gulp.src('src/theme.config.example', { base: 'src/' })
.pipe(gulp.dest(outputDirectory))
;
siteTheme = gulp.src('src/_site/**/*', { base: 'src/' })
.pipe(gulp.dest(outputDirectory))
;
themes = gulp.src('src/themes/**/*', { base: 'src/' })
.pipe(gulp.dest(outputDirectory))
;
return mergeStream(definitions, themeImport, themeConfig, siteTheme, themes);
});
}
components = gulp.src('dist/components/*', { base: 'dist/' })
.pipe(gulp.dest(outputDirectory))
;
releases = gulp.src('dist/*', { base: 'dist/' })
.pipe(gulp.dest(outputDirectory))
;
return mergeStream(themes, components, releases);
};
}
else if(distribution == 'LESS') {
// extend package.json
gulp.task(task.package, function() {
return gulp.src(packageFile)
.pipe(plumber())
.pipe(jsonEditor(function(json) {
if(version) {
json.version = version;
}
return json;
}))
moveFiles = function(callback) {
let
definitions,
themeImport,
themeConfig,
siteTheme,
themes
;
definitions = gulp.src('src/definitions/**/*', { base: 'src/' })
.pipe(gulp.dest(outputDirectory))
;
});
themeImport = gulp.src('src/semantic.less', { base: 'src/' })
.pipe(gulp.dest(outputDirectory))
;
themeImport = gulp.src('src/theme.less', { base: 'src/' })
.pipe(gulp.dest(outputDirectory))
;
themeConfig = gulp.src('src/theme.config.example', { base: 'src/' })
.pipe(gulp.dest(outputDirectory))
;
siteTheme = gulp.src('src/_site/**/*', { base: 'src/' })
.pipe(gulp.dest(outputDirectory))
;
themes = gulp.src('src/themes/**/*', { base: 'src/' })
.pipe(gulp.dest(outputDirectory))
;
return mergeStream(definitions, themeImport, themeConfig, siteTheme, themes);
};
}
// extend package.json
let updatePackageJSON = function() {
console.info('Updating package.json');
return gulp.src(packageFile)
.pipe(plumber())
.pipe(jsonEditor(function(json) {
if(version) {
json.version = version;
}
return json;
}))
.pipe(gulp.dest(outputDirectory))
;
};
tasks.push(createMeteorRelease);
tasks.push(moveFiles);
tasks.push(updatePackageJSON);
})(distribution);
tasks.push(task.meteor);
tasks.push(task.repo);
tasks.push(task.package);
}
})(distribution);
}
gulp.series(tasks, callback);
};
module.exports = series(tasks);

32
tasks/admin/distributions/update.js

@ -12,7 +12,7 @@
*/
var
let
gulp = require('gulp'),
// node dependencies
@ -39,7 +39,7 @@ var
module.exports = function(callback) {
var
let
index = -1,
total = release.distributions.length,
timer,
@ -61,7 +61,7 @@ module.exports = function(callback) {
return;
}
var
let
distribution = release.distributions[index],
outputDirectory = path.resolve(path.join(release.outputRoot, distribution.toLowerCase() )),
repoName = release.distRepoRoot + distribution,
@ -141,18 +141,29 @@ module.exports = function(callback) {
function getSHA() {
git.exec(versionOptions, function(error, version) {
version = version.trim();
createRelease(version);
try {
createRelease(version);
} catch(e) {
console.error('Failed to create release, most likely this release already exists');
}
});
}
// create release on GitHub.com
function createRelease(version) {
async function createRelease(version) {
if(version) {
releaseOptions.target_commitish = version;
}
github.repos.createRelease(releaseOptions, function() {
nextRepo();
});
console.info('-----------------------------');
console.info(releaseOptions);
console.info('-----------------------------');
try {
await github.repos.createRelease(releaseOptions)
}
catch(e) {
console.error(`Release creation failed. Most likely already released "${releaseOptions.tag_name}"`);
};
nextRepo();
}
// Steps to next repository
@ -160,7 +171,10 @@ module.exports = function(callback) {
console.log('Sleeping for 1 second...');
// avoid rate throttling
global.clearTimeout(timer);
timer = global.setTimeout(stepRepo, 100);
timer = global.setTimeout(function() {
console.log('Sleeping complete');
stepRepo();
}, 100);
}

41
tasks/admin/register.js

@ -11,10 +11,17 @@
let
// node dependencies
process = require('child_process'),
fs = require('fs'),
npmPublish = require('@jsdevtools/npm-publish'),
// config
release = require('../config/admin/release'),
config = fs.existsSync(__dirname + '/../config/admin/oauth.js')
? require('../config/admin/oauth')
: false,
// register components and distributions
repos = release.distributions.concat(release.components),
total = repos.length,
@ -24,26 +31,50 @@ let
stepRepo
;
module.exports = function(callback) {
module.exports = async function(callback) {
console.log('Registering repos with package managers');
console.log('Publishing main repo');
await npmPublish({
package: `./package.json`,
token: config.npmToken,
greaterVersionOnly: true,
debug: function(log) {
console.log(log);
}
});
// Do Git commands synchronously per component, to avoid issues
stepRepo = function() {
stepRepo = async function() {
index = index + 1;
if(index >= total) {
callback();
return;
}
let
repo = repos[index].toLowerCase(),
outputDirectory = release.outputRoot + repo + '/',
outputDirectory = `${release.outputRoot}${repo}/`,
exec = process.exec,
execSettings = {cwd: outputDirectory},
updateNPM = 'npm publish;meteor publish;'
updateNPM = 'meteor publish;'
;
/* Register with NPM */
console.info(`NPM Publish "${repo}"`);
console.info(outputDirectory);
await npmPublish({
package: `${outputDirectory}/package.json`,
token: config.npmToken,
greaterVersionOnly: true,
debug: function(log) {
console.log(log);
}
});
/* Register with NPM */
console.info(`Meteor publish "${repo}"`);
console.info(outputDirectory);
exec(updateNPM, execSettings, function(err, stdout, stderr) {
console.log(err, stdout, stderr);
stepRepo();

Loading…
Cancel
Save