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 #24 from CodeDead/release/1.1.0
Browse files Browse the repository at this point in the history
Release/1.1.0
  • Loading branch information
CodeDead committed Aug 15, 2021
2 parents d4bf319 + 0e56c86 commit bf644f6
Show file tree
Hide file tree
Showing 7 changed files with 1,427 additions and 787 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
16 changes: 14 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

![GitHub package.json version](https://img.shields.io/github/package-json/v/e5mode/yarn-up-all)
![GitHub](https://img.shields.io/github/license/e5mode/yarn-up-all)
![GitHub Releases](https://img.shields.io/github/downloads/e5mode/yarn-up-all/1.0.5/total)
![GitHub Releases](https://img.shields.io/github/downloads/e5mode/yarn-up-all/1.1.0/total)

## Description

Expand All @@ -25,7 +25,7 @@ yarn set version berry
In order to install the plugin, you can run the following command in your terminal:

```Bash
yarn plugin import https://github.com/e5mode/yarn-up-all/releases/download/1.0.5/index.js
yarn plugin import https://github.com/e5mode/yarn-up-all/releases/download/1.1.0/index.js
```

### Usage
Expand All @@ -41,7 +41,19 @@ To exclude a single dependency, run:
yarn up-all --exclude package
```

Alternatively, you can use the shorter command:
```Bash
yarn up-all -e package
```

To exclude multiple dependencies:
```Bash
yarn up-all --exclude "package1 package2"
```

### Options

| Option | Description |
|-------------|--------------------------------------------------|
| `--exclude` | Exclude one or more packages from being upgraded |
| `-e` | Shorthand version of `--exclude` |
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "yarn-up-all",
"version": "1.0.5",
"version": "1.1.0",
"description": "Yarn 2 plugin that will upgrade all dependencies to their latest version with one simple command",
"main": "src/index.js",
"repository": "https://github.com/e5mode/yarn-up-all.git",
Expand All @@ -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"
}
}
31 changes: 16 additions & 15 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 @@ -35,6 +33,11 @@ module.exports = {
};

class UpAllCommand extends Command {
constructor() {
super();
this.exclude = Option.String('-e,--exclude', { validator: typanion.isString() });
}

/**
* Execute the command
* @returns {Promise<void>}
Expand All @@ -53,24 +56,18 @@ 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.usage = Command.Usage({
UpAllCommand.paths = [['up-all']];
UpAllCommand.usage = {
category: 'Utilities',
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',
details: 'This command will upgrade all dependencies to their latest version. You can exclude certain dependencies from being upgraded by using the `-e,--exclude` option.',
examples: [
[
'Upgrade all dependencies',
Expand All @@ -80,11 +77,15 @@ module.exports = {
'Upgrade all dependencies but exclude a single dependency',
'yarn up-all --exclude package',
],
[
'Upgrade all dependencies but exclude a single dependency',
'yarn up-all -e package',
],
[
'Upgrade all dependencies but exclude multiple dependencies',
'yarn up-all --exclude "package1 package2"',
]],
});
};

return {
commands: [
Expand Down
Loading

0 comments on commit bf644f6

Please sign in to comment.