[no publish] fixes
This commit is contained in:
parent
7a29ad0e92
commit
e55aa6bb08
@ -14,6 +14,8 @@ const fs = require ('fs-extra');
|
||||
const path = require ('path');
|
||||
|
||||
/**
|
||||
* scan all files and execute a mutation on them
|
||||
*
|
||||
* @param {string} folder folder to scan
|
||||
* @param {Function} func function to execute on file contents
|
||||
*/
|
||||
@ -35,6 +37,8 @@ async function map_all_files (folder, func) {
|
||||
}
|
||||
|
||||
/**
|
||||
* returns a copyright notice
|
||||
*
|
||||
* @param {string} license license name
|
||||
* @param {string} software software name
|
||||
* @returns {string} copyright notice
|
||||
@ -63,15 +67,18 @@ function get_copyright_notice (license = '', software = '') {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param folder
|
||||
* @param license
|
||||
* scans a folder and fixes all copyright notices
|
||||
*
|
||||
* @param {string} folder folder to scan
|
||||
* @param {string} license license name
|
||||
* @param {string} software software name
|
||||
*/
|
||||
function fix_all_copy (folder, license) {
|
||||
async function fix_all_copy (folder, license = '', software = '') {
|
||||
const regex = /\/\*\s+\*\sCopyright[\s\S]*?\*\//g;
|
||||
map_all_files (folder, (data) => {
|
||||
await map_all_files (folder, (data) => {
|
||||
if (!regex.test (data))
|
||||
return null;
|
||||
return get_copyright_notice (license) + data.replace (regex, '');
|
||||
return get_copyright_notice (license, software) + data.replace (regex, '');
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user