Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import {dynamicLibs} from '../../data/dynamicLibs';
import {findPlugins} from '../../tools/findPlugins';
import {makeConfig} from '../../tools/makeConfig';
const pkgJsonVersion = (basedir: string) => {
const pkgJson = require(`${basedir}/package.json`);
return JSON.stringify(pkgJson["version"]);
};
// eslint-disable-next-line arca/no-default-export
export default class BuildBundleCommand extends Command {
@Command.String(`--profile`)
profile: string = `standard`;
@Command.Array(`--plugin`)
plugins: Array = [];
@Command.Boolean(`--no-minify`)
noMinify: boolean = false;
static usage = Command.Usage({
description: `build the local bundle`,
});
@Command.Path(`build`, `bundle`)
async execute() {
const basedir = process.cwd();
const plugins = findPlugins({basedir, profile: this.profile, plugins: this.plugins});
const modules = Array.from(dynamicLibs).concat(plugins);
const output = `${basedir}/bundles/yarn.js`;
const BUILD_WORKFLOW = ({plugins}: {plugins: Array}) => [
[`yarn`, `build:cli`, ...new Array().concat(...plugins.map(plugin => [`--plugin`, plugin])), `|`],
];
// eslint-disable-next-line arca/no-default-export
export default class SetVersionCommand extends BaseCommand {
@Command.String(`--path`)
installPath?: string;
@Command.String(`--repository`)
repository: string = `https://github.com/yarnpkg/berry.git`;
@Command.String(`--branch`)
branch: string = `master`;
@Command.Array(`--plugin`)
plugins: Array = [];
@Command.Boolean(`-f,--force`)
force: boolean = false;
static usage = Command.Usage({
description: `build Yarn from master`,
details: `
This command will clone the Yarn repository into a temporary folder, then build it. The resulting bundle will then be copied into the local project.
`,
examples: [[
`Build Yarn from master`,
`$0 set version from sources`,
]],
});
} catch (error) {
if (error.name !== `ValidationError`) {
throw error;
}
}
}
return tail;
});
};
export class EntryCommand extends Command {
@Command.String()
issue!: string;
@Command.Array(`--require`)
requireList: string[] = [];
static schema = yup.object().shape({
issue: oneOfType([
yup.number().integer(),
yup.string().test(`exists`, `\${path} doesn't exist`, value => existsSync(value)),
yup.string().matches(GITHUB_REGEXP, `The parameter must be an URL pointing to a valid GitHub issue`),
]),
});
async execute() {
const pkgPath = await pkgUp();
if (pkgPath === null)
throw new UsageError(`This command must be run from within a package`);
let body: string;
@Command.Boolean(`-i,--interlaced`)
interlaced: boolean = false;
@Command.String(`-j,--jobs`)
jobs?: number;
@Command.Boolean(`-t,--topological`)
topological: boolean = false;
@Command.Boolean(`--topological-dev`)
topologicalDev: boolean = false;
@Command.Array(`--include`)
include: Array = [];
@Command.Array(`--exclude`)
exclude: Array = [];
@Command.Boolean(`--private`)
private: boolean = true;
static schema = yup.object().shape({
jobs: yup.number().min(2),
parallel: yup.boolean().when(`jobs`, {
is: (val: number) => val > 1,
then: yup.boolean().oneOf([true], `--parallel must be set when using --jobs`),
otherwise: yup.boolean(),
}),
});
static usage = Command.Usage({
category: `Workspace-related commands`,