Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.forEach(modulePath => {
const packageName = modulePath.split('/node_modules/')[1];
const esLessName = packageName.replace(/-es$/, '');
const esPath = new Path(modulePath, 'es');
const esmPath = new Path(modulePath, 'esm');
// airbnb-foo/lib -> airbnb-foo/esm
// optimal/lib -> optimal/esm
if (esPath.exists() || esmPath.exists()) {
const aliasPath = esPath.exists() ? `${packageName}/es` : `${packageName}/esm`;
const aliased = buildTargets.some(targetFolder => {
if (new Path(modulePath, targetFolder).exists()) {
aliases[`${packageName}/${targetFolder}`] = aliasPath;
return true;
}
return false;
});
({
dependencies = {},
devDependencies = {},
peerDependencies = {},
tsconfig = {},
workspace,
}) => {
const pkgPath = new Path(workspace.packagePath);
const srcPath = pkgPath.append(srcFolder);
const testsPath = pkgPath.append(testsFolder);
const references: ts.ProjectReference[] = [];
const promises: Promise[] = [];
// Extract and determine references
Object.keys({ ...dependencies, ...devDependencies, ...peerDependencies }).forEach(
depName => {
if (namesToPaths[depName]) {
references.push({
path: pkgPath.relativeTo(namesToPaths[depName]).path(),
});
}
},
);
this.tool.getWorkspacePackages({ root: workspaceRoot }).forEach(({ workspace }) => {
const pkgPath = new Path(workspace.packagePath);
const srcPath = pkgPath.append(srcFolder);
const testsPath = pkgPath.append(testsFolder);
// Reference a package *only* if it has a src folder
if (srcFolder && srcPath.exists()) {
config.references!.push({
path: workspaceRoot.relativeTo(pkgPath).path(),
});
// Reference a separate tests folder if it exists
if (testsFolder && testsPath.exists()) {
config.references!.push({
path: workspaceRoot.relativeTo(testsPath).path(),
});
}
}
workspacePrefixes.forEach(wsPrefix => {
context.addArgs([
new core_1.Path(wsPrefix, constants_1.DIR_PATTERN, `**/*.${exts}`).path(),
new core_1.Path(wsPrefix, '*.{md,json}').path(),
]);
});
}
this.tool.getWorkspacePackages().forEach(pkg => {
const srcPath = new core_1.Path(pkg.workspace.packagePath, 'src');
if (!srcPath.exists()) {
ignorePackages.push(pkg.name);
}
});
args.push(`--workspaces=${ignorePackages.length > 0 ? `!(${ignorePackages.join('|')})` : '*'}`);
function fromHere(filePath: string): string {
return `./${new Path(process.cwd()).relativeTo(
new Path(__dirname, '../lib', filePath).resolve(),
)}`;
}
function fromHere(filePath: string): string {
return `./${new Path(process.cwd()).relativeTo(
new Path(__dirname, '../lib', filePath).resolve(),
)}`;
}
function join(...parts: string[]): string {
return new Path(...parts).path();
}
function fromHere(filePath: string): string {
return `/${new Path(process.cwd()).relativeTo(
new Path(__dirname, '..', filePath).resolve(),
)}`;
}
workspaces.forEach(wsPath => {
roots.push(new Path('', wsPath.replace('/*', '')).path());
});
} else {