Use sed and a template for generating jquery.uls.data.js

Drop browserify.
This commit is contained in:
Santhosh Thottingal
2021-03-18 15:59:40 +05:30
committed by Niklas Laxström
parent 835947c36a
commit 990c5402f4
5 changed files with 22 additions and 30 deletions

View File

@@ -18,13 +18,9 @@ then (
git clone "$UPSTREAM" "$CLONEDIR"
fi
# This re-installs it every time, but guarantees we have the right version
echo "Installing browserify"
cd "$BASEDIR";
npm install --no-save browserify@v16.5.2
echo "Transforming language-data"
"$BASEDIR"/node_modules/browserify/bin/cmd.js "$CLONEDIR"/data/language-data.json -t "$BASEDIR"/scripts/transform.js -o "$DEST"/jquery.uls.data.js
JSONDATA="$CLONEDIR/data/language-data.json"
cat "$BASEDIR"/scripts/jquery.uls.data.template.js | sed -e "/languagedata/r $JSONDATA" -e "/languagedata/d" > "$DEST"/jquery.uls.data.js
echo "language-data written to $DEST/jquery.uls.data.js"

View File

@@ -0,0 +1,10 @@
( function () { function r( e, n, t ) { function o( i, f ) { if ( !n[ i ] ) { if ( !e[ i ] ) { var c = typeof require === 'function' && require; if ( !f && c ) { return c( i, !0 ); } if ( u ) { return u( i, !0 ); } var a = new Error( "Cannot find module '" + i + "'" ); throw a.code = 'MODULE_NOT_FOUND', a; } var p = n[ i ] = { exports: {} }; e[ i ][ 0 ].call( p.exports, function ( r ) { var n = e[ i ][ 1 ][ r ]; return o( n || r ); }, p, p.exports, r, e, n, t ); } return n[ i ].exports; } for ( var u = typeof require === 'function' && require, i = 0; i < t.length; i++ ) { o( t[ i ] ); } return o; } return r; }() )( {
1: [ function ( require, module, exports ) {
module.exports = ( function ( $ ) {
$.uls = $.uls || {};
$.uls.data =
languagedata;
}( jQuery ) );
}, {} ]
}, {}, [ 1 ] );

View File

@@ -1,18 +0,0 @@
const through = require( 'through' );
module.exports = function () {
let data = '( function ( $ ) {\n\t$.uls = $.uls || {};\n\t$.uls.data = ';
const write = function ( buf ) {
data += buf;
return data;
};
const end = function () {
data += '\n} ( jQuery ) );';
this.queue( data );
this.queue( null );
};
return through( write, end );
};