Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async execute() {
const configuration = await Configuration.find(this.context.cwd, this.context.plugins);
const {project, workspace, locator} = await Project.find(configuration, this.context.cwd);
const effectiveLocator = this.topLevel
? project.topLevelWorkspace.anchoredLocator
: locator;
// First we check to see whether a script exist inside the current package
// for the given name
if (!this.binariesOnly && await scriptUtils.hasPackageScript(effectiveLocator, this.scriptName, {project}))
return await scriptUtils.executePackageScript(effectiveLocator, this.scriptName, this.args, {project, stdin: this.context.stdin, stdout: this.context.stdout, stderr: this.context.stderr});
// If we can't find it, we then check whether one of the dependencies of the
// current package exports a binary with the requested name
const binaries = await scriptUtils.getPackageAccessibleBinaries(effectiveLocator, {project});
async function exec(cli: Cli): Promise {
// Since we only care about a few very specific settings (yarn-path and ignore-path) we tolerate extra configuration key.
// If we didn't, we wouldn't even be able to run `yarn config` (which is recommended in the invalid config error message)
const configuration = await Configuration.find(npath.toPortablePath(process.cwd()), pluginConfiguration, {
strict: false,
});
const yarnPath: PortablePath = configuration.get(`yarnPath`);
const ignorePath = configuration.get(`ignorePath`);
if (yarnPath !== null && !ignorePath) {
if (!xfs.existsSync(yarnPath)) {
process.stdout.write(cli.error(new Error(`The "yarn-path" option has been set (in ${configuration.sources.get(`yarnPath`)}), but the specified location doesn't exist (${yarnPath}).`)));
process.exitCode = 1;
} else {
try {
runBinary(yarnPath);
} catch (error) {
process.exitCode = error.code || 1;
}
async execute() {
const configuration = await Configuration.find(this.context.cwd, this.context.plugins);
let registry: string;
if (this.scope && this.publish)
registry = npmConfigUtils.getScopeRegistry(this.scope, {configuration, type: npmConfigUtils.RegistryType.PUBLISH_REGISTRY});
else if (this.scope)
registry = npmConfigUtils.getScopeRegistry(this.scope, {configuration});
else if (this.publish)
registry = npmConfigUtils.getPublishRegistry((await openWorkspace(configuration, this.context.cwd)).manifest, {configuration});
else
registry = npmConfigUtils.getDefaultRegistry({configuration});
const report = await StreamReport.start({
configuration,
stdout: this.context.stdout,
}, async report => {
try {
async execute() {
const configuration = await Configuration.find(this.context.cwd, this.context.plugins);
const {project, workspace} = await Project.find(configuration, this.context.cwd);
const cache = await Cache.find(configuration);
if (!workspace)
throw new WorkspaceRequiredError(this.context.cwd);
const topLevelWorkspace = project.topLevelWorkspace;
for (const pattern of this.patterns) {
const descriptor = structUtils.parseDescriptor(pattern);
const dependencyMeta = topLevelWorkspace.manifest.ensureDependencyMeta(descriptor);
dependencyMeta.unplugged = true;0;
}
await topLevelWorkspace.persistManifest();
async execute() {
for (let t = 0; t < 10; ++t) {
const configuration = await Configuration.find(this.context.cwd, this.context.plugins);
const {project} = await Project.find(configuration, this.context.cwd);
const constraints = await Constraints.find(project);
const toSave = new Set();
const report = await StreamReport.start({
configuration,
stdout: this.context.stdout,
}, async report => {
const result = await constraints.process();
await processDependencyConstraints(toSave, result.enforcedDependencies, {
fix: this.fix,
configuration,
report,
});
async execute() {
const configuration = await Configuration.find(this.context.cwd, this.context.plugins);
const {workspace} = await Project.find(configuration, this.context.cwd);
if (!workspace)
throw new WorkspaceRequiredError(this.context.cwd);
let deferred = configuration.get(`preferDeferredVersions`);
if (this.deferred)
deferred = true;
if (this.immediate)
deferred = false;
const isSemver = semver.valid(this.strategy);
const isDeclined = this.strategy === DECLINE;
let nextVersion: string | null;
if (isSemver) {
async executeInteractive() {
const configuration = await Configuration.find(this.context.cwd, this.context.plugins);
const {project, workspace} = await Project.find(configuration, this.context.cwd);
if (!workspace)
throw new WorkspaceRequiredError(this.context.cwd);
await project.resolveEverything({
lockfileOnly: true,
report: new ThrowReport(),
});
const root = await fetchRoot(this.context.cwd);
const base = await fetchBase(root);
const files = await fetchChangedFiles(root, {base: base.hash});
const workspaces = [...new Set(files.map(file => project.getWorkspaceByFilePath(file)))];
if (workspaces.length === 0)
async execute() {
const cwd = npath.toPortablePath(npath.resolve(this.cwd));
const configuration = await Configuration.find(cwd, null, {strict: false});
const allManifests = await findFiles(`**/package.json`, cwd);
const allManifestFolders = allManifests.map(p => ppath.dirname(p));
const allFiles = await findFiles(`**/*.{ts,tsx,js,jsx}`, cwd);
const pluginConfiguration = getPluginConfiguration();
const findStandaloneWorkspace = async (manifestCwd: PortablePath) => {
const configuration = await Configuration.find(manifestCwd, pluginConfiguration, {strict: false, lookup: ProjectLookup.NONE});
const {workspace} = await Project.find(configuration, manifestCwd);
return workspace;
};
const findLockfileWorkspace = async (manifestCwd: PortablePath) => {
async execute() {
const configuration = await Configuration.find(this.context.cwd, this.context.plugins);
const {project, workspace} = await Project.find(configuration, this.context.cwd);
if (!workspace)
throw new WorkspaceRequiredError(this.context.cwd);
const identHash = structUtils.parseIdent(this.package).identHash;
const whyTree = this.recursive
? whyRecursive(project, identHash, {configuration, peers: this.peers})
: whySimple(project, identHash, {configuration, peers: this.peers});
printTree(this.context.stdout, whyTree);
}
}
async execute() {
const configuration = await Configuration.find(this.context.cwd, this.context.plugins);
const {project, workspace} = await Project.find(configuration, this.context.cwd);
const cache = await Cache.find(configuration);
if (!workspace)
throw new WorkspaceRequiredError(this.context.cwd);
const applyReport = await StreamReport.start({
configuration,
json: this.json,
stdout: this.context.stdout,
}, async report => {
const allDependents: Map> = new Map();