Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
_l10nInit() {
const l10nData = [];
let l10nFiles;
try {
l10nFiles = lsSync(this.config.l10n, 0);
} catch (e) {
logger.fatal(`Unable to find the localization data file ${this.config.l10nFile}`);
return this;
}
l10nFiles.forEach(filepath => {
l10nData.push(loadYaml(filepath));
});
// Merge the objects in reverse order so that the first one loaded wins.
this._l10nData = deepExtend.apply(deepExtend, l10nData.reverse());
this._l10nFormatter = new MessageFormat(this.locale).compile(this._l10nData);
return this;
}
if (!sourceFilePaths.includes(sourcePath)) {
sourceFilePaths.push(sourcePath);
}
}
});
// update outdir if necessary, then create outdir
packageInfo = ( find({kind: 'package'}) || [] )[0];
if (packageInfo && packageInfo.name) {
outdir = path.join( outdir, packageInfo.name, (packageInfo.version || '') );
}
mkdirpSync(outdir);
// copy the template's static files to outdir
fromDir = path.join(templatePath, 'static');
staticFiles = lsSync(fromDir);
staticFiles.forEach(fileName => {
const toPath = sourceToDestination(fromDir, fileName, outdir);
mkdirpSync(path.dirname(toPath));
fs.copyFileSync(fileName, toPath);
});
// copy the fonts used by the template to outdir
staticFiles = lsSync(path.join(require.resolve('open-sans-fonts'), '..', 'open-sans'));
staticFiles.forEach(fileName => {
const toPath = path.join(outdir, 'fonts', path.basename(fileName));
if (FONT_NAMES.includes(path.parse(fileName).name)) {
mkdirpSync(path.dirname(toPath));
exports.load = filepath => {
let content;
let current;
const files = lsSync(filepath, {
depth: env.opts.recurse ? env.conf.recurseDepth : 0
});
let name;
let match;
let type;
// tutorials handling
files.forEach(file => {
match = file.match(finder);
// any filetype that can apply to tutorials
if (match) {
name = path.basename(match[1]);
content = fs.readFileSync(file, env.opts.encoding);
switch (match[2].toLowerCase()) {
}
mkdirpSync(outdir);
// copy the template's static files to outdir
fromDir = path.join(templatePath, 'static');
staticFiles = lsSync(fromDir);
staticFiles.forEach(fileName => {
const toPath = sourceToDestination(fromDir, fileName, outdir);
mkdirpSync(path.dirname(toPath));
fs.copyFileSync(fileName, toPath);
});
// copy the fonts used by the template to outdir
staticFiles = lsSync(path.join(require.resolve('open-sans-fonts'), '..', 'open-sans'));
staticFiles.forEach(fileName => {
const toPath = path.join(outdir, 'fonts', path.basename(fileName));
if (FONT_NAMES.includes(path.parse(fileName).name)) {
mkdirpSync(path.dirname(toPath));
fs.copyFileSync(fileName, toPath);
}
});
// copy the prettify script to outdir
PRETTIFIER_SCRIPT_FILES.forEach(fileName => {
const toPath = path.join(outdir, 'scripts', path.basename(fileName));
fs.copyFileSync(
path.join(require.resolve('code-prettify'), '..', fileName),
const filepath = path.resolve(process.cwd(), decodeURIComponent($));
try {
currentFile = statSync(filepath);
}
catch (e) {
logger.error('Unable to find the source file or directory %s', filepath);
return;
}
if ( currentFile.isFile() ) {
filePaths.push(filepath);
}
else {
filePaths = filePaths.concat(lsSync(filepath, depth));
}
});
this.config.views.partials.forEach(filepath => {
partials = partials.concat(lsSync(path.resolve(this.path, filepath), 0));
});
this._addPartials(partials.concat(layouts));