How to use has-yarn - 3 common examples

To help you get started, we’ve selected a few has-yarn examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pikapkg / pack / checkpoint / dist-src / commands / publish.js View on Github external
async init(options) {
        const { out, config, reporter } = this;
        const { manifest } = config;
        const repoUrl = manifest.repository &&
            githubUrlFromGit(manifest.repository.url, {
                extraBaseUrls: ['gitlab.com'],
            });
        if (!hasYarn() && options.yarn) {
            throw new Error('Could not use Yarn without yarn.lock file');
        }
        const runTests = !options.yolo;
        const runCleanup = options.cleanup && !options.yolo;
        const runPublish = options.publish;
        const pkgManager = options.yarn === true ? 'yarn' : 'npm';
        const isOnGitHub = repoUrl && hostedGitInfo.fromUrl(repoUrl).type === 'github';
        const steps = [];
        steps.push(async (curr, total) => {
            this.reporter.step(curr, total, 'Prerequisite checks', '✨');
            runPublish && (await prerequisiteTasks(manifest, options));
            // title: 'Check current branch',
            const { stdout: branch } = await execa('git', ['symbolic-ref', '--short', 'HEAD']);
            if (branch !== 'master' && !options.anyBranch) {
                throw new Error('Not on `master` branch. Use --any-branch to publish anyway.');
            }
github pikapkg / pack / checkpoint / dist-src / commands / publish.js View on Github external
export async function run(config, reporter, flags, args) {
    await config.loadPackageManifest();
    const options = args.length > 0
        ? Object.assign({ cleanup: true }, flags, { yarn: hasYarn(), version: args[0] }) : await ui(Object.assign({}, flags, { yarn: hasYarn() }), config.manifest);
    if (!options.confirm) {
        return;
    }
    const publish = new Publish(flags, config, reporter);
    await publish.init(options);
    const newManifest = await config.loadPackageManifest();
    console.log(chalk.bold(`\n🎉  ${newManifest.name} v${newManifest.version} published!`));
    console.log(`You can see it at: ${chalk.underline(`https://unpkg.com/${newManifest.name}@${newManifest.version}/`)}`);
}
github enriquecaballero / branchsite / src / defaults.js View on Github external
import hasYarn from "has-yarn";

export default {
  anyBranch: false,
  noYarn: !hasYarn (),
  noPublish: false,
  noCleanup: false,
  skipInstall: false,
  hook: null,
  directory: "dist",
  branch: "gh-pages"
};

has-yarn

Check if a project is using Yarn

MIT
Latest version published 3 years ago

Package Health Score

70 / 100
Full package analysis

Popular has-yarn functions