Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const getFileInfo = (file) => {
const existingFrontMatter = file.frontMatter;
let relativePath = path.relative(constants.dirs.CONTENT, file.dest);
let root = '';
let baseName;
if (relativePath.startsWith('docs')) {
relativePath = path.relative('docs', relativePath);
root = 'docs';
}
baseName = path.basename(relativePath, '.md');
baseName = baseName !== 'index' ? baseName : '';
const splittedPath = path.dirname(relativePath).split(path.sep);
const section = splittedPath[0];
const tocTitle = splittedPath[1];
const originalFile = normalize(path.join(root, relativePath)).toLowerCase();
const newFrontMatter = {
contentType: getContentType(originalFile),
description: getPredefinedDescription(file.dest) || getDescription(file.content),
isMultiHints: file.isMulti,
// Define witch ejs layout is going to be used for Hexo.
layout: getLayout(file.dest),
originalFile,
permalink: normalize(path.join(root, path.dirname(relativePath), baseName, 'index.html')).toLowerCase(),
/**
symbols(context: vscode.TextDocument): {[name: string] : SymbolDescriptor} {
const output: { [name: string]: SymbolDescriptor } = {};
// First, find all exported symbols in the entire workspace
for (const filename in this.files) {
if (this.files.hasOwnProperty(filename)) {
const globalFileBasename = path.basename(filename);
const globalFileDirname = path.dirname(filename);
this._seekSymbols(globalFileBasename, globalFileDirname, output, [], SearchMode.globals);
}
}
const contextFileBasename = path.basename(context.uri.fsPath);
const contextFileDirname = path.dirname(context.uri.fsPath);
// Next, grab all symbols for this file and included files
const searchedIncludes: string[] = []
this._seekSymbols(contextFileBasename, contextFileDirname, output, searchedIncludes, SearchMode.includes);
// Finally, grab files that include this file
this._seekSymbols(contextFileBasename, contextFileDirname, output, searchedIncludes, SearchMode.parents);
return output;
}
function tdb(path_, opts, gopts) {
EventEmitter.call(this);
this._gopts = gopts;
this._path = path.resolve(path_);
this._cols = Object.create(null);
this._name = opts.name || path.basename(path_);
this._stype = gopts.memStore?"mem":"fs";
if (this._stype=="mem")
mstore[path_] = this._mstore = mstore[path_] || Object.create(null);
// mongodb compat variables
this.openCalled = false;
}
function handleAAR(aarFile, finished) {
var basename = path.basename(aarFile, '.aar'),
extractedDir = path.join(hyperloopBuildDir, basename),
foundJars = [path.join(extractedDir, 'classes.jar')];
if (afs.exists(extractedDir)) {
wrench.rmdirSyncRecursive(extractedDir);
}
// Create destination dir
wrench.mkdirSyncRecursive(extractedDir);
async.series([
// Unzip aar file to destination
function (next) {
appc.zip.unzip(aarFile, extractedDir, {}, next);
},
// Then handle it's contents in parallel operations
function (next) {
required: false,
default: 'iPhone 6',
}, {
command: 'scheme',
description: 'Explicitly set Xcode scheme to use',
type: 'string',
required: false,
}], argv);
process.chdir('ios');
const xcodeProject = findXcodeProject(fs.readdirSync('.'));
if (!xcodeProject) {
throw new Error(`Could not find Xcode project files in ios folder`);
}
const inferredSchemeName = path.basename(xcodeProject.name, path.extname(xcodeProject.name));
const scheme = args.scheme || inferredSchemeName
console.log(`Found Xcode ${xcodeProject.isWorkspace ? 'workspace' : 'project'} ${xcodeProject.name}`);
const simulators = parseIOSSimulatorsList(
child_process.execFileSync('xcrun', ['simctl', 'list', 'devices'], {encoding: 'utf8'})
);
const selectedSimulator = matchingSimulator(simulators, args.simulator);
if (!selectedSimulator) {
throw new Error(`Cound't find ${args.simulator} simulator`);
}
const simulatorFullName = `${selectedSimulator.name} (${selectedSimulator.version})`;
console.log(`Launching ${simulatorFullName}...`);
try {
child_process.spawnSync('xcrun', ['instruments', '-w', simulatorFullName]);
} catch(e) {
function Tree(configFilePath, write) {
this.configFileNode = new TestSuiteNode(this, 1, null, path.basename(configFilePath), 'config', 'locationHint');
this.write = write;
this.nextId = 2;
}
function ensureEs6ModuleApiImport(t, modules, scope, importDeclarationPath, moduleName = null) {
let importDeclaration = importDeclarationPath.node;
if(!modules[importDeclaration.source.value]) {
let moduleIdentifierName = (moduleName || path.basename(importDeclaration.source.value, path.extname(importDeclaration.source.value))) + 'Module';
if(scope.getBinding(moduleIdentifierName)) {
moduleIdentifierName = scope.generateUidIdentifier(moduleIdentifierName).name
}
modules[importDeclaration.source.value] = moduleIdentifierName;
importDeclarationPath.insertBefore([
t.importDeclaration([t.importSpecifier(t.identifier(moduleIdentifierName), t.identifier('__ModuleAPI__'))], importDeclaration.source)
]);
}
}
return list.map((item) => path.basename(item, '.js'));
}
'use strict';
var fs = require('fs');
var path = require('path');
var Sequelize = require('sequelize');
var basename = path.basename(module.filename);
var env = require('../config').env;
var config = require(__dirname + '/../config/config.json')[env];
var sequelize = new Sequelize(config.database, config.username, config.password, config);
var db = {};
fs
.readdirSync(__dirname)
.filter(function(file) {
return (file.indexOf('.') !== 0) && (file !== basename);
})
.forEach(function(file) {
var model = sequelize['import'](path.join(__dirname, file));
db[model.name] = model;
});
Object.keys(db).forEach(function(modelName) {
[unzipLocalFile](localFileName, outputDirectoryPath, callback) {
this.debug(`unzipping completed package zip file: ${localFileName}`, {
outputDirectoryPath
});
const moduleName = path.basename(localFileName, ".zip").replace(/-\d*\.\d*\.\d*$/, "");
new Decompress({mode: "755"})
.src(localFileName)
.dest(`${outputDirectoryPath}/${moduleName}`)
.use(Decompress.zip({strip: 1}))
.run(() => {
this.debug("completed package zip file unzipped", {
localFileName,
outputDirectoryPath
});
callback();
});
}
}