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} = await Project.find(configuration, this.context.cwd);
if (!workspace)
throw new WorkspaceRequiredError(this.context.cwd);
if (workspace.manifest.private)
throw new UsageError(`Private workspaces cannot be published`);
if (workspace.manifest.name === null || workspace.manifest.version === null)
throw new UsageError(`Workspaces must have valid names and versions to be published on an external registry`);
await project.resolveEverything({
lockfileOnly: true,
report: new ThrowReport(),
});
// We store it so that TS knows that it's non-null
const ident = workspace.manifest.name;
const version = workspace.manifest.version;
const registry = npmConfigUtils.getPublishRegistry(workspace.manifest, {configuration});
}, async report => {
if (await autofixMergeConflicts(configuration, immutable)) {
report.reportInfo(MessageName.AUTOMERGE_SUCCESS, `Automatically fixed merge conflicts 👍`);
}
});
if (fixReport.hasErrors()) {
return fixReport.exitCode();
}
}
const {project, workspace} = await Project.find(configuration, this.context.cwd);
const cache = await Cache.find(configuration, {immutable: this.immutableCache, check: this.checkCache});
if (!workspace)
throw new WorkspaceRequiredError(this.context.cwd);
// Important: Because other commands also need to run installs, if you
// get in a situation where you need to change this file in order to
// customize the install it's very likely you're doing something wrong.
// This file should stay super super simple, and the configuration and
// install logic should be implemented elsewhere (probably in either of
// the Configuration and Install classes). Feel free to open an issue
// in order to ask for design feedback before writing features.
const report = await StreamReport.start({
configuration,
json: this.json,
stdout: this.context.stdout,
includeLogs: true,
}, async (report: StreamReport) => {
await project.install({cache, report, immutable});
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);
// @ts-ignore
const prompt = inquirer.createPromptModule({
input: this.context.stdin,
output: this.context.stdout,
});
const modifier = this.exact
? suggestUtils.Modifier.EXACT
: this.tilde
? suggestUtils.Modifier.TILDE
: suggestUtils.Modifier.CARET;
const strategies = this.interactive ? [
suggestUtils.Strategy.KEEP,
suggestUtils.Strategy.REUSE,
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 absoluteDestination = ppath.resolve(this.context.cwd, NodeFS.toPortablePath(this.destination));
const configuration2 = await Configuration.find(absoluteDestination, this.context.plugins);
const {project: project2, workspace: workspace2} = await Project.find(configuration2, absoluteDestination);
if (!workspace2)
throw new WorkspaceRequiredError(absoluteDestination);
const topLevelWorkspace = project.topLevelWorkspace;
const linkedWorkspaces = [];
if (this.all) {
for (const workspace of project2.workspaces)
if (workspace.manifest.name && (!workspace.manifest.private || this.private))
linkedWorkspaces.push(workspace);
if (linkedWorkspaces.length === 0) {
throw new UsageError(`No workspace found to be linked in the target project`);
}
} else {
if (!workspace2.manifest.name)
throw new UsageError(`The target workspace doesn't have a name and thus cannot be linked`);
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)
return;
const status = await fetchWorkspacesStatus(workspaces, {root, base: base.hash});
if (status.undecided.length === 0)
async execute() {
const configuration = await Configuration.find(this.context.cwd, this.context.plugins);
const {project, workspace: cwdWorkspace} = await Project.find(configuration, this.context.cwd);
if (!this.all && !cwdWorkspace)
throw new WorkspaceRequiredError(this.context.cwd);
const command = this.cli.process([this.commandName, ...this.args]) as {path: string[], scriptName?: string};
const scriptName = command.path.length === 1 && command.path[0] === `run` && typeof command.scriptName !== `undefined`
? command.scriptName
: null;
if (command.path.length === 0)
throw new UsageError(`Invalid subcommand name for iteration - use the 'run' keyword if you wish to execute a script`);
const rootWorkspace = this.all
? project.topLevelWorkspace
: cwdWorkspace!;
const candidates = [rootWorkspace, ...getWorkspaceChildrenRecursive(rootWorkspace, project)];
const workspaces: Array = [];
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);
const report = await StreamReport.start({
configuration,
stdout: this.context.stdout,
}, async report => {
const scripts = workspace!.manifest.scripts;
const keys = miscUtils.sortMap(scripts.keys(), key => key);
const inspectConfig = {
breakLength: Infinity,
colors: configuration.get(`enableColors`),
maxArrayLength: 2,
};
const maxKeyLength = keys.reduce((max, key) => {
return Math.max(max, key.length);
}, 0);
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 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();
const report = await StreamReport.start({
configuration,
stdout: this.context.stdout,
}, async 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) {
nextVersion = this.strategy;
} else {
let currentVersion = workspace.manifest.version;