Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export const getOwnDeps = (packageDir) => {
const node_modules = path.join(packageDir, 'node_modules')
return pfs.access(node_modules)
.then(() => getDirectories(node_modules))
// Map directories to their package.json
.then(dirs => Promise.all(dirs.map(dir => getPackageConfig(path.join(packageDir, 'node_modules', dir)))))
// Filter out anything that wasn't a package
.then(configs => configs.filter((v, k) => v))
.catch(err => {
// console.log(err)
return []
})
}
static resolveImport (sources, sourcePath, importPath, workspace) {
if (importPath in sources) {
// Fully qualified import path.
return importPath;
}
var importParts = importPath.split(path.sep);
var packagePath1 = path.join(
workspace.getPackageRoot(sourcePath),
workspace.getPackagesDir(sourcePath),
importParts[0]);
var packagePath2 = path.join(
workspace.getPackageRoot(sourcePath),
'dapple_packages',
importParts[0]);
// TODO - refactor this based on dappfile version
var testPackagePath = (packagePath) => {
var exists = (packagePath === workspace.getPackageRoot(packagePath));
if (!importPath.startsWith('./') && exists) {
var resolvedPath = path.join.apply(path,
[workspace.getSourcePath(packagePath)]
.concat(importParts.slice(1)));
private async createPackageJsonForPrimaryEntry(): Promise {
// Read package.json file
const packageJsonPath: string = path.join( this.angularPackage.root, 'package.json' );
const packageJson: any = await readFile( packageJsonPath );
// Add entry properties
const packageJsonWithEntryProperties: any = {
...packageJson,
...this.createEntryProperties()
};
// Write package.json file
const packageJsonPathOut: string = path.join( this.angularPackage.root, this.angularPackage.outDir, 'package.json' );
await writeFile( packageJsonPathOut, packageJsonWithEntryProperties );
}
it('should stop all tests after failing "after" hook', function(done) {
var fixture = path.join('options', 'bail-with-after');
runMochaJSON(fixture, args, function(err, res) {
if (err) {
return done(err);
}
expect(res, 'to have failed')
.and('to have failed test count', 1)
.and(
'to have failed test',
'"after all" hook: after suite1A for "test suite1A"'
)
.and('to have passed test count', 2)
.and('to have passed test order', 'test suite1', 'test suite1A');
done();
});
});
exports.createBuilder = config => {
const builder = new WebpackBaseBuilder(config);
builder.setBuildPath(path.join(__dirname, '../dist/loader'));
builder.setPublicPath('/public');
builder.setEntry({
include: path.join(__dirname, '../test')
});
return builder;
};
beforeEach(() => {
vol.fromJSON({
[posix.join(Filepathes.kubectlInstallPath, 'v1.12.1', 'kubectl')]: 'kubectl',
[posix.join(Filepathes.kubectlInstallPath, 'v1.12.2', 'kubectl')]: 'kubectl',
[posix.join(Filepathes.kubectlInstallPath, 'v1.10.0', 'kubectl')]: 'kubectl',
[posix.join(Filepathes.kubectlInstallPath, 'v1.8.4', 'kubectl')]: 'kubectl',
});
vol.mkdirpSync('/usr/local/bin/');
vol.symlinkSync(posix.join(Filepathes.kubectlInstallPath, 'v1.10.0', 'kubectl'), '/usr/local/bin/kubectl');
});
_getKey(path) {
path = posix.join(this.basePath, path);
return path[0] === "/" ? path.substr(1) : path;
}
...map_(DEFAULT_FILE_PATHS, dirOrFilePath =>
fs.ensureFile(path.join(siteRootPath, dirOrFilePath))
)
const vendorAssets = (modVendor, type) => {
if (isPlainObject(sourcemap[type])) {
if (Array.isArray(modVendor[type])) {
return modVendor[type]
.filter(k => typeof sourcemap[type][k] === 'string')
.map(k => posix.join(posix.sep, vendorDevFolder, sourcemap[type][k]))
}
return typeof sourcemap[type][modVendor[type]] === 'string'
? [
posix.join(
posix.sep,
vendorDevFolder,
sourcemap[type][modVendor[type]]
)
]
: []
}
return []
}
function generatePath(fileName: string) {
return outputOptions.dir
? posix.join(outputOptions.dir, fileName)
: fileName;
}