Skip to content

Commit 87c2f84

Browse files
author
Dimitri Grammatikogianni
authored
Grunt improvements (#42)
* simple is better * one more
1 parent 83a12e7 commit 87c2f84

File tree

6 files changed

+34
-36
lines changed

6 files changed

+34
-36
lines changed

dev/Gruntfile.js

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,19 @@
11
module.exports = function(grunt) {
22

3-
var CmSettings = grunt.file.readYAML('codemirror.yaml');
4-
var path = require('path');
3+
var CmSettings = grunt.file.readYAML('codemirror.yaml'),
4+
venVersions = grunt.file.readYAML('vendors_versions.yaml'),
5+
path = require('path'),
6+
preText = '{ "name": "joomla-assets", "version": "4.0.0", "description": "External assets that Joomla is using", "dependencies": { ',
7+
postText = ' }, "license": "GPL-2.0+" }',
8+
name,
9+
vendorsTxt = '';
10+
11+
for (name in venVersions.vendors) {
12+
vendorsTxt += '"' + name + '": "' + venVersions.vendors[name] + '",';
13+
}
14+
15+
// Build the package.json for all 3rd Party assets
16+
grunt.file.write('assets/package.json', preText + vendorsTxt.substring(0, vendorsTxt.length - 1) + postText);
517

618
// Project configuration.
719
grunt.initConfig({
@@ -49,8 +61,7 @@ module.exports = function(grunt) {
4961
},
5062
tmp: {
5163
src: [
52-
'assets/tmp/**',
53-
'assets/node_modules/**',
64+
'assets/**',
5465
],
5566
expand: true,
5667
options: {
@@ -67,14 +78,14 @@ module.exports = function(grunt) {
6778
// Get the latest codemirror
6879
curl: {
6980
'cmGet': {
70-
src: 'https://github.com/codemirror/CodeMirror/archive/' + CmSettings.version + '.zip',
81+
src: 'https://github.com/codemirror/CodeMirror/archive/' + venVersions.vendors.codemirror + '.zip',
7182
dest: 'assets/tmp/cmzip.zip'
7283
}
7384
},
7485
unzip: {
7586
'cmUnzip': {
7687
router: function (filepath) {
77-
var re = new RegExp('CodeMirror-' + CmSettings.version + '/', 'g');
88+
var re = new RegExp('CodeMirror-' + venVersions.vendors.codemirror + '/', 'g');
7889
var newFilename = filepath.replace(re, '');
7990
return newFilename;
8091
},
@@ -180,12 +191,6 @@ module.exports = function(grunt) {
180191
// expand: true,
181192
// ext: '.min.js'
182193
// }
183-
{
184-
src: ['<%= folder.chosenjs %>/j-chosen.js','!<%= folder.chosenjs %>/j-chosen.min.js'],
185-
dest: '',
186-
expand: true,
187-
ext: '.min.js'
188-
},
189194
]
190195
}
191196
},

dev/assets/package.json

Lines changed: 0 additions & 20 deletions
This file was deleted.

dev/codemirror.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
version: '5.19.0'
2-
31
addons:
42
js:
53
- 'addon/display/fullscreen.js'

dev/readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ possible commands:
1919
- `grunt uglify:allJs`.................minifies various javascripts
2020
- `grunt cssmin:allCss`................minifies various stylesheets
2121

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

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

dev/vendors_versions.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
vendors:
2+
'jquery': '3.1.0'
3+
'jquery-migrate': '3.0.0'
4+
'bootstrap': '~4.0.0-alpha.4'
5+
'tether': '1.3.7'
6+
'font-awesome': '4.6.3'
7+
'chosenjs': '1.4.3'
8+
'jquery-minicolors': '2.1.10'
9+
'jquery-sortable': '0.9.13'
10+
'jquery-ui': '1.12.1'
11+
'mediaelement': '2.22.0'
12+
'punycode': '1.4.1'
13+
'tinymce': '4.4.3'
14+
'codemirror': '5.19.0'
15+

media/vendor/codemirror/lib/codemirror.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)