Skip to content

Commit

Permalink
Grunt improvements (#42)
Browse files Browse the repository at this point in the history
* simple is better

* one more
  • Loading branch information
Dimitri Grammatikogianni authored Oct 6, 2016
1 parent 83a12e7 commit 87c2f84
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 36 deletions.
29 changes: 17 additions & 12 deletions dev/Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@
module.exports = function(grunt) {

var CmSettings = grunt.file.readYAML('codemirror.yaml');
var path = require('path');
var CmSettings = grunt.file.readYAML('codemirror.yaml'),
venVersions = grunt.file.readYAML('vendors_versions.yaml'),
path = require('path'),
preText = '{ "name": "joomla-assets", "version": "4.0.0", "description": "External assets that Joomla is using", "dependencies": { ',
postText = ' }, "license": "GPL-2.0+" }',
name,
vendorsTxt = '';

for (name in venVersions.vendors) {
vendorsTxt += '"' + name + '": "' + venVersions.vendors[name] + '",';
}

// Build the package.json for all 3rd Party assets
grunt.file.write('assets/package.json', preText + vendorsTxt.substring(0, vendorsTxt.length - 1) + postText);

// Project configuration.
grunt.initConfig({
Expand Down Expand Up @@ -49,8 +61,7 @@ module.exports = function(grunt) {
},
tmp: {
src: [
'assets/tmp/**',
'assets/node_modules/**',
'assets/**',
],
expand: true,
options: {
Expand All @@ -67,14 +78,14 @@ module.exports = function(grunt) {
// Get the latest codemirror
curl: {
'cmGet': {
src: 'https://github.com/codemirror/CodeMirror/archive/' + CmSettings.version + '.zip',
src: 'https://github.com/codemirror/CodeMirror/archive/' + venVersions.vendors.codemirror + '.zip',
dest: 'assets/tmp/cmzip.zip'
}
},
unzip: {
'cmUnzip': {
router: function (filepath) {
var re = new RegExp('CodeMirror-' + CmSettings.version + '/', 'g');
var re = new RegExp('CodeMirror-' + venVersions.vendors.codemirror + '/', 'g');
var newFilename = filepath.replace(re, '');
return newFilename;
},
Expand Down Expand Up @@ -180,12 +191,6 @@ module.exports = function(grunt) {
// expand: true,
// ext: '.min.js'
// }
{
src: ['<%= folder.chosenjs %>/j-chosen.js','!<%= folder.chosenjs %>/j-chosen.min.js'],
dest: '',
expand: true,
ext: '.min.js'
},
]
}
},
Expand Down
20 changes: 0 additions & 20 deletions dev/assets/package.json

This file was deleted.

2 changes: 0 additions & 2 deletions dev/codemirror.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: '5.19.0'

addons:
js:
- 'addon/display/fullscreen.js'
Expand Down
2 changes: 1 addition & 1 deletion dev/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ possible commands:
- `grunt uglify:allJs`.................minifies various javascripts
- `grunt cssmin:allCss`................minifies various stylesheets

Make sure that you have updated the assets/package.json in order to update the libraries!!!
Make sure that you have updated the vendors_versions.yaml file in order to update the libraries!!!

Will update the following external sourced static assets that Joomla is using.

Expand Down
15 changes: 15 additions & 0 deletions dev/vendors_versions.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
vendors:
'jquery': '3.1.0'
'jquery-migrate': '3.0.0'
'bootstrap': '~4.0.0-alpha.4'
'tether': '1.3.7'
'font-awesome': '4.6.3'
'chosenjs': '1.4.3'
'jquery-minicolors': '2.1.10'
'jquery-sortable': '0.9.13'
'jquery-ui': '1.12.1'
'mediaelement': '2.22.0'
'punycode': '1.4.1'
'tinymce': '4.4.3'
'codemirror': '5.19.0'

2 changes: 1 addition & 1 deletion media/vendor/codemirror/lib/codemirror.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 87c2f84

Please sign in to comment.