Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

Commit

Permalink
Merge pull request #21 from CodeDead/feature/upgrades
Browse files Browse the repository at this point in the history
* Upgrades for Yarn 3.0.0
  • Loading branch information
CodeDead committed Aug 15, 2021
2 parents d4bf319 + 441a15f commit 77edf8d
Show file tree
Hide file tree
Showing 6 changed files with 1,402 additions and 782 deletions.
55 changes: 0 additions & 55 deletions .yarn/releases/yarn-2.4.2.cjs

This file was deleted.

631 changes: 631 additions & 0 deletions .yarn/releases/yarn-3.0.0.cjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ nodeLinker: node-modules
plugins:
- ./src/index.js

yarnPath: .yarn/releases/yarn-2.4.2.cjs
yarnPath: .yarn/releases/yarn-3.0.0.cjs
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@
"build": "minify src -d build"
},
"dependencies": {
"@yarnpkg/cli": "^3.0.0-rc.3",
"@yarnpkg/core": "^3.0.0-rc.3",
"@yarnpkg/plugin-essentials": "^3.0.0-rc.3"
"@yarnpkg/cli": "^3.0.1",
"@yarnpkg/core": "^3.1.0-rc.1",
"@yarnpkg/plugin-essentials": "^3.0.1-rc.1",
"clipanion": "^3.0.1",
"typanion": "^3.3.2"
},
"devDependencies": {
"babel-minify": "^0.5.1",
"clipanion": "^3.0.0-rc.12",
"eslint": "^7.27.0",
"eslint": "^7.32.0",
"eslint-config-airbnb-base": "^14.2.1",
"eslint-plugin-import": "^2.23.4",
"yup": "^0.32.9"
"eslint-plugin-import": "^2.24.0"
}
}
19 changes: 6 additions & 13 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@ module.exports = {
name: 'yarn-up-all-plugin',
factory: (require) => {
const { Configuration, Project } = require('@yarnpkg/core');
// eslint-disable-next-line import/no-extraneous-dependencies
const { Cli, Command } = require('clipanion');
// eslint-disable-next-line import/no-extraneous-dependencies
const yup = require('yup');
const { Cli, Command, Option } = require('clipanion');
const Essentials = require('@yarnpkg/plugin-essentials');
const typanion = require('typanion');

/**
* Resolve the name of a package
Expand Down Expand Up @@ -53,22 +51,17 @@ module.exports = {
];

const descriptors = getDescriptors(dependencies, this.exclude ? this.exclude.split(' ') : null);

const packageNames = descriptors.map((e) => resolveFullPackageName(e[1].scope, e[1].name));

const cli = Cli.from(Essentials.default.commands);
return cli.runExit(['up', ...packageNames], this.context);
}
}

UpAllCommand.addOption('exclude', Command.String('--exclude'));
UpAllCommand.addPath('up-all');

UpAllCommand.schema = yup.object().shape({
exclude: yup.string(),
});
UpAllCommand.exclude = Option.String('--exclude', { validator: typanion.isString() });
UpAllCommand.paths = [['up-all']];

UpAllCommand.usage = Command.Usage({
UpAllCommand.usage = {
description: 'Yarn 2 plugin that will upgrade all dependencies to their latest version with one simple command',
details: 'This command will upgrade all dependencies to their latest version',
examples: [
Expand All @@ -84,7 +77,7 @@ module.exports = {
'Upgrade all dependencies but exclude multiple dependencies',
'yarn up-all --exclude "package1 package2"',
]],
});
};

return {
commands: [
Expand Down
Loading

0 comments on commit 77edf8d

Please sign in to comment.