Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
walker.on('data', ({path: itemPath}) => {
itemPath = NodeFS.toPortablePath(itemPath);
const relativePath = ppath.relative(source, itemPath);
if (!filter || miscUtils.filePatternMatch(relativePath, filter)) {
paths.push(relative ? relativePath : itemPath);
}
// This item has been accepted only because it's a directory; it doesn't match the filter
return;
});
tmp.file({discardDescriptor: true}, (error, filePath) => {
if (error) {
reject(error);
} else {
resolve(NodeFS.toPortablePath(filePath));
}
});
});
map: header => {
header.name = NodeFS.toPortablePath(header.name);
if (true) {
header.name = ppath.resolve(PortablePath.root, header.name);
header.name = ppath.relative(PortablePath.root, header.name);
}
if (virtualPath) {
header.name = ppath.resolve(PortablePath.root, virtualPath, header.name);
header.name = ppath.relative(PortablePath.root, header.name);
}
return header;
},
});
}).then(async dirPath => {
dirPath = await xfs.realpathPromise(NodeFS.toPortablePath(dirPath));
if (name) {
dirPath = ppath.join(dirPath, name as PortablePath);
await exports.mkdirp(dirPath);
}
return dirPath;
});
};
function sdk() {
const {getPackageInformation, topLevel} = dynamicRequire(`pnpapi`);
const {packageLocation} = getPackageInformation(topLevel);
const projectRoot = NodeFS.toPortablePath(packageLocation);
generateSdk(projectRoot).catch(error => {
console.error(error.stack);
process.exitCode = 1;
});
}
export async function makeArchiveFromDirectory(source: PortablePath, {baseFs = new NodeFS(), prefixPath = PortablePath.root}: MakeArchiveFromDirectoryOptions = {}): Promise {
const zipFs = new ZipFS(NodeFS.toPortablePath(tmpNameSync()), {create: true});
const target = ppath.resolve(PortablePath.root, prefixPath!);
await zipFs.copyPromise(target, source, {baseFs});
return zipFs;
}
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) {
export async function convertToZip(tgz: Buffer, opts: ExtractBufferOptions) {
return await extractArchiveTo(tgz, new ZipFS(NodeFS.toPortablePath(tmpNameSync()), {create: true}), opts);
}
}, async report => {
const {project} = await Project.find(configuration, this.context.cwd);
const name = this.name!;
const candidatePath = ppath.resolve(this.context.cwd, NodeFS.toPortablePath(name));
let pluginBuffer;
if (await xfs.existsPromise(candidatePath)) {
report.reportInfo(MessageName.UNNAMED, `Reading ${configuration.format(candidatePath, `green`)}`);
pluginBuffer = await xfs.readFilePromise(candidatePath);
} else {
const ident = structUtils.tryParseIdent(name);
let pluginUrl;
if (ident) {
const key = structUtils.stringifyIdent(ident);
const data = await getAvailablePlugins(configuration);
if (!Object.prototype.hasOwnProperty.call(data, key))
throw new ReportError(MessageName.PLUGIN_NAME_NOT_FOUND, `Couldn't find a plugin named "${key}" on the remote registry. Note that only the plugins referenced on our website (https://github.com/yarnpkg/berry/blob/master/plugins.yml) can be referenced by their name; any other plugin will have to be referenced through its public url (for example https://github.com/yarnpkg/berry/raw/master/packages/plugin-typescript/bin/%40yarnpkg/plugin-typescript.js).`);