You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
60 lines
1.4 KiB
60 lines
1.4 KiB
/*
|
|
* SPDX-License-Identifier: EUPL-1.2
|
|
* Authors: see README.md
|
|
*/
|
|
|
|
// Extract files that we need from the node_modules folder
|
|
// The extracted files are integrated to the repository, so production server don't need to
|
|
// have node installed
|
|
|
|
// Include fs and path module
|
|
|
|
const fs = require('fs-extra')
|
|
const path = require('path')
|
|
|
|
const basePath = path.join(__dirname, '../')
|
|
|
|
function copySync(src, dest, opts) {
|
|
if (fs.existsSync(src)) {
|
|
fs.copySync(path.join(basePath, src), path.join(basePath, dest), opts)
|
|
} else {
|
|
console.log(`${src} is not existing !`)
|
|
}
|
|
}
|
|
|
|
// function mergeFilesSync(sources, dest) {
|
|
// const fullDest = path.join(basePath, dest)
|
|
// if (!fs.existsSync(fullDest)) {
|
|
// fs.mkdirSync(path.dirname(fullDest), { recursive: true })
|
|
// } else {
|
|
// fs.unlinkSync(fullDest)
|
|
// }
|
|
// sources.forEach((file) => {
|
|
// const fullSrc = path.join(basePath, file)
|
|
// if (!fs.existsSync(fullSrc)) {
|
|
// console.log(`${fullSrc} is not existing !`)
|
|
// } else {
|
|
// fs.appendFileSync(fullDest, fs.readFileSync(fullSrc))
|
|
// }
|
|
// })
|
|
// }
|
|
|
|
// vue
|
|
copySync(
|
|
'node_modules/vue/dist/vue.global.prod.js',
|
|
'js/vendor/vue/vue.min.js',
|
|
{ overwrite: true }
|
|
)
|
|
copySync(
|
|
'node_modules/vue/LICENSE',
|
|
'js/vendor/vue/LICENSE',
|
|
{ overwrite: true }
|
|
)
|
|
|
|
// example
|
|
// mergeFilesSync(
|
|
// [
|
|
// 'node_modules/file1.js',
|
|
// 'node_modules/file2.js',
|
|
// ],
|
|
// 'javascripts/vendor/output-file.js');
|
|
|