Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
modules_dir = 'C:/xtreme/taracotjs_modules',
modules_dir_tmp = 'C:/xtreme/taracotjs_modules/temp',
min_dir = 'C:/xtreme/taracotjs_min',
fs = require('fs-extra'),
path = require('path'),
glob = require('glob'),
cleancss = require('clean-css'),
uglifyjs = require("uglify-js"),
htmlminify = require('html-minifier').minify,
compressor = require('node-minify'),
archiver = require('archiver'),
async = require('async'),
checksum = require('checksum'),
source_dir = path.join(__dirname, '..'),
dist_files = fs.readdirSync(source_dir),
modules = fs.readdirSync(source_dir + '/modules'),
// non_full_modules = ['billing_accounts', 'billing_conf', 'billing_frontend', 'billing_profiles'],
core_modules = ['settings', 'search', 'auth', 'cp', 'pages', 'parts', 'user', 'lang', 'menu'];
console.log("Removing and re-creating production, modules and min. version dirs...");
fs.removeSync(production_dir);
fs.ensureDir(production_dir);
fs.removeSync(modules_dir);
fs.ensureDir(modules_dir);
fs.ensureDir(modules_dir_tmp);
fs.removeSync(min_dir);
fs.ensureDir(min_dir);
// Copy all files to production folder
console.log("Copying files to production folder...");
export function getWordAlignmentProgressForGroupIndex(projectSaveLocation, bookId, groupIndex) {
let checked = 0;
let totalChecks = 0;
const pathToWordAlignmentData = path.join(projectSaveLocation, '.apps', 'translationCore', 'alignmentData', bookId);
if (!fs.existsSync(pathToWordAlignmentData)) {
return 0;
}
const chapterNum = groupIndex.id.split('_')[1];
let groupDataFileName = fs.readdirSync(pathToWordAlignmentData).find(file => // filter out .DS_Store
//This will break if we change the wordAlignment tool naming
//convention of chapter a like chapter_1.json...
path.parse(file).name === chapterNum
);
if (groupDataFileName) {
const groupIndexObject = fs.readJsonSync(path.join(pathToWordAlignmentData, groupDataFileName));
for (let verseNumber in groupIndexObject) {
if (parseInt(verseNumber)) {
const verseDone = isVerseAligned(groupIndexObject[verseNumber]);
if (verseDone) {
checked++;
}
}
const getDefaultTools = () => {
let defaultTools = [];
fs.ensureDirSync(PACKAGE_SUBMODULE_LOCATION);
let moduleBasePath = PACKAGE_SUBMODULE_LOCATION;
let folders = fs.readdirSync(moduleBasePath);
folders = folders.filter(folder => // filter the folder to not include .DS_Store.
folder !== '.DS_Store'
);
if (folders) {
for (let folder of folders) {
let manifestPath = path.join(moduleBasePath, folder, 'package.json');
if (fs.pathExists(manifestPath)) {
defaultTools.push(manifestPath);
}
}
}
return defaultTools;
};
`The directory ${chalk.green(name)} contains files that could conflict:`
);
error();
for (const file of conflicts) {
error(` ${file}`);
}
error();
error(
'Either try using a new directory name, or remove the files listed above.'
);
return false;
}
// Remove any remnant files from a previous installation
const currentFiles = fs.readdirSync(path.join(root));
currentFiles.forEach(file => {
errorLogFilePatterns.forEach(errorLogFilePattern => {
// This will catch `(npm-debug|yarn-error|yarn-debug).log*` files
if (file.indexOf(errorLogFilePattern) === 0) {
fs.removeSync(path.join(root, file));
}
});
});
return true;
};
var deleteFolderRecursive = (folderpath: string) => {
if (fs.existsSync(folderpath)) {
fs.readdirSync(folderpath).forEach((file: string, index: number) => {
var curPath = path.join(folderpath, file);
if (fs.lstatSync(curPath).isDirectory()) { // recurse
deleteFolderRecursive(curPath);
} else { // delete file
fs.unlinkSync(curPath);
}
});
fs.rmdirSync(path);
}
}
function build () {
// Copy library across
fs.emptyDirSync(PUBLIC);
var source_files = fs.readdirSync(SOURCE);
source_files.forEach(function(name){
if (name[0] === '.') return;
var from = join(SOURCE, name);
var to = join(PUBLIC, name);
if (extname(name) === '.css') return compress_css(from, to);
if (extname(name) === '.js') return compress_js(from, to);
if (name === 'index.html') return build_index(from, to);
fs.copy(from, to);
});
let groupsDir = resourceCategoryDir;
if (!fs.pathExistsSync(resourceCategoryDir)) {
groupsDir = altResourceCategoryDir;
}
let groupIndex;
const groupIndexPath = path.join(helpDir, category, 'index.json');
if (options.withCategoryName && fs.existsSync(groupIndexPath)) {
groupIndex = fs.readJsonSync(groupIndexPath);
}
// copy not loaded category group data into project
if (fs.pathExistsSync(groupsDir)) {
const files = fs.readdirSync(groupsDir);
for (const f of files) {
if (path.extname(f).toLowerCase() === '.json') {
const id = path.basename(f.toLowerCase(), '.json');
let subCategory = id;
// Use an object that includes id & name instead of just a string
if (options.withCategoryName) {
subCategory = { id };
if (groupIndex) {
subCategory = groupIndex.find(group => group.id === id);
}
}
subCategories.push(subCategory);
assertionFormat: assertionFormat
};
// pass list of paths targeted for load testing
if (loadTesting) {
if ((typeof loadTesting) !== 'boolean' && fs.existsSync(path.join(directory, loadTesting))) {
config.loadTest = parseJsonFile(directory, loadTesting).loadTargets;
} else if (fs.existsSync(path.join(directory, 'load-config.json'))){
config.loadTest = parseJsonFile(directory, 'load-config.json').loadTargets;
} else {
return cb(new Error('Config file not found. Please specify a load test config or add load-config.json file to your project directory.'));
}
}
var finalResult = template.testGen(result, config);
var existingFiles = fs.readdirSync(path.join(directory, 'test/api/client'));
var skipAll = false;
async.filterSeries(finalResult, function(file, cb) {
if (overwriteAll) {
cb(true);
} else if(skipAll){
cb(false);
} else {
if (_.includes(existingFiles, file.name)) {
var prompt = util.format('Conflict on %s. Overwrite? (answer \'h\' for help):', file.name);
var question = {type: 'expand', message: prompt, name: 'overwrite', choices: [
{
key: "y",
name: "Overwrite this one and show the next",
value: "overwrite"
},
fs.readdirSync(path.resolve(__dirname, './src/components/')).forEach(folder => {
fs.readdirSync(path.resolve(__dirname, './src/components/' + folder)).forEach(file => {
let filename = file.split(/(.vue)$|(.js)$/)[0].toLowerCase();
if (/\.vue$/.test(file)) {
console.log('Building ' + green(filename));
execSync(
`node ${vueCliServicePath} build src/components/${folder}/${file} --target lib --name ${filename} --dest components/${folder} --no-clean `
)
}
else if (/\.js$/.test(file)) {
console.log('Building ' + blue(filename));
execSync(
`node ${vueCliServicePath} build src/components/${folder}/${file} --target lib --name ${filename} --dest components/${folder} --no-clean `
)
execSync(
export function getFiles(folder, exts) {
if (isDirectory(folder)) {
return fs.readdirSync(folder)
.map(f => path.join(folder, f))
.filter(f => isFile(f) && exts.includes(path.extname(f)));
}
return [];
}