nunta/scripts/render-scripts.js

26 lines
1.0 KiB
JavaScript
Raw Normal View History

2020-04-07 00:19:58 +02:00
'use strict';
const fs = require('fs');
const packageJSON = require('../package.json');
const upath = require('upath');
2020-04-07 00:19:58 +02:00
const sh = require('shelljs');
module.exports = function renderScripts() {
const sourcePath = upath.resolve(upath.dirname(__filename), '../src/js');
const destPath = upath.resolve(upath.dirname(__filename), '../dist/.');
sh.cp('-R', sourcePath, destPath)
const sourcePathScriptsJS = upath.resolve(upath.dirname(__filename), '../src/js/scripts.js');
const destPathScriptsJS = upath.resolve(upath.dirname(__filename), '../dist/js/scripts.js');
2020-04-07 00:19:58 +02:00
const copyright = `/*!
* Start Bootstrap - ${packageJSON.title} v${packageJSON.version} (${packageJSON.homepage})
* Copyright 2013-${new Date().getFullYear()} ${packageJSON.author}
2020-06-17 23:51:44 +02:00
* Licensed under ${packageJSON.license} (https://github.com/StartBootstrap/${packageJSON.name}/blob/master/LICENSE)
2020-04-07 00:19:58 +02:00
*/
`
const scriptsJS = fs.readFileSync(sourcePathScriptsJS);
2020-04-07 00:19:58 +02:00
fs.writeFileSync(destPathScriptsJS, copyright + scriptsJS);
2020-04-07 00:19:58 +02:00
};