Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
let defaultGuides = Enumerable(fs.readdirSync(path.join(resources, common.defaultLang, 'guides'))).where(name => path.extname(name) === jsonExt).orderBy(element => path.basename(element, jsonExt), Enumerable.comparers.array([
"instance", "use", "config", "selector", "predicate", "comparer", "action", "setter", "iterator"
], true)).toArray();
let defaultApis = Enumerable(fs.readdirSync(path.join(resources, common.defaultLang, 'apis'))).where(name => path.extname(name) === jsonExt).orderBy(element => path.basename(element, jsonExt)).toArray();
// let defaultChanges = Enumerable(fs.readdirSync(path.join(resources, common.defaultLang, 'change'))).where(name => path.extname(name) === jsonExt).orderBy(element => path.basename(element, jsonExt), (element, other) => {
// if (element === other) {
// return 0;
// } else if (common.isNewer(element, other)) {
// return -1;
// } else {
// return 1;
// }
// }).toArray();
let defaultChanges = Enumerable(fs.readdirSync(path.join(resources, common.defaultLang, 'change'))).where(name => path.extname(name) === jsonExt).orderBy(element => path.basename(element, jsonExt), Enumerable.comparers.less(common.isNewer)).toArray();
common.versions = Enumerable.select(defaultChanges, change => path.basename(change, jsonExt)).toArray();
fs.writeFileSync(path.join(resources, 'versions.json'), JSON.stringify(common.versions));
let versions = [...common.versions];
if (!versions[versions.length - 1].endsWith('pre')) versions.push(common.preVersion(versions[versions.length - 1]));
fs.writeFileSync(path.join(scripts, 'histroy.js'), 'module.exports = (version, callback, pre, post) => { ' + versions.reverse().map(version => `if (version === '${ version }') return require.ensure([], function(require) { if (callback) { pre && pre(); callback(require('${ common.module(version) }')); post && post(); } }, '${ common.module(version) }');`).join(' else ') + ' };');
console.log('apis:' + defaultApis);
let langNames = fs.readdirSync(resources);
for (let langName of langNames) {
if (typeof refreshLangName !== 'undefined' && common.defaultLang !== refreshLangName && langName !== refreshLangName) {
continue;
}
let langPath = path.join(resources, langName);
if (fs.statSync(langPath).isDirectory()) {
let caption = defaultCaption;
let captionPath = path.join(langPath, captionFile);