1- const fs = require ( 'fs' )
1+ const fs = require ( 'fs' )
2+ const path = require ( 'path' )
3+ const pkg = require ( path . resolve ( __dirname , '../package.json' ) )
4+ const year = new Date ( ) . getFullYear ( )
25
3- fs . readFile ( 'package.json' , ( err , data ) => {
4- if ( err ) {
5- throw err
6- }
7-
8- const pkg = JSON . parse ( data )
9- const year = new Date ( ) . getFullYear ( )
6+ const pathBoostrap = path . resolve ( __dirname , '../dist/js/bootstrap.js' )
7+ const pathBootstrapBundle = path . resolve ( __dirname , '../dist/js/bootstrap.bundle.js' )
8+ const contentFile = fs . readFileSync ( pathBoostrap , { encoding : 'UTF8' } )
9+ const contentBundleFile = fs . readFileSync ( pathBootstrapBundle , { encoding : 'UTF8' } )
1010
11- const stampTop =
11+ const stamp =
1212`/*!
1313 * Bootstrap v${ pkg . version } (${ pkg . homepage } )
1414 * Copyright 2011-${ year } ${ pkg . author }
@@ -25,17 +25,6 @@ if (typeof jQuery === 'undefined') {
2525 throw new Error('Bootstrap\\'s JavaScript requires at least jQuery v3.0.0 but less than v4.0.0')
2626 }
2727})(jQuery);
28-
29- (function () {
3028`
31- const stampEnd = `
32- })();`
33-
34- process . stdout . write ( stampTop )
35-
36- process . stdin . on ( 'end' , ( ) => {
37- process . stdout . write ( stampEnd )
38- } )
39-
40- process . stdin . pipe ( process . stdout )
41- } )
29+ fs . writeFileSync ( pathBoostrap , `${ stamp } ${ contentFile } ` , { encoding : 'UTF8' } )
30+ fs . writeFileSync ( pathBootstrapBundle , `${ stamp } ${ contentBundleFile } ` , { encoding : 'UTF8' } )
0 commit comments