11module . 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 } ,
0 commit comments