Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const makeDir = name =>
new Promise((resolve, reject) => {
mkdirp(name, err => (err ? reject(err) : resolve()));
});
const isDirectory = source => fs.lstatSync(source).isDirectory();
const readDirs = dir =>
fs.existsSync(dir)
? R.compose(
R.filter(name => isDirectory(path.join(dir, name))),
fs.readdirSync
)(dir)
: [];
const getRootPackageJSON = R_.memoizeWithIdentity(() =>
fs.readJsonSync(path.join(process.cwd(), 'package.json'))
);
const readAllWorkspacesFlatten = R_.memoizeWithIdentity(() =>
R.o(R.flatten, R.map(glob.sync))(getWorkspacesPatterns())
);
const getWorkspacesPatterns = () => {
const rootPackage = getRootPackageJSON();
return rootPackage.private && rootPackage.workspaces;
};
const resolveWorkspacesPackagePattern = R.cond([
[R.is(RegExp), R.identity],
[R_.isString, pattern => R_.constructRegExp(pattern, 'i')],
[R_.isArray, pattern => R_.constructRegExp(`(${R.join('|', pattern)})`, 'i')],
const isDirectory = source => fs.lstatSync(source).isDirectory();
const readDirs = dir =>
fs.existsSync(dir)
? R.compose(
R.filter(name => isDirectory(path.join(dir, name))),
fs.readdirSync
)(dir)
: [];
const getRootPackageJSON = R_.memoizeWithIdentity(() =>
fs.readJsonSync(path.join(process.cwd(), 'package.json'))
);
const readAllWorkspacesFlatten = R_.memoizeWithIdentity(() =>
R.o(R.flatten, R.map(glob.sync))(getWorkspacesPatterns())
);
const getWorkspacesPatterns = () => {
const rootPackage = getRootPackageJSON();
return rootPackage.private && rootPackage.workspaces;
};
const resolveWorkspacesPackagePattern = R.cond([
[R.is(RegExp), R.identity],
[R_.isString, pattern => R_.constructRegExp(pattern, 'i')],
[R_.isArray, pattern => R_.constructRegExp(`(${R.join('|', pattern)})`, 'i')],
[
R.T,
() =>
invariant(