Skip to content

Commit d0f964f

Browse files
committed
* Version bump
* Refactoring * Make use of eslint * Fixed an issue with the auto updater
1 parent 58c7409 commit d0f964f

File tree

73 files changed

+4732
-4188
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+4732
-4188
lines changed

.eslintignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.github
2+
.yarn
3+
node_modules
4+
build
5+
src/serviceWorker.js

.eslintrc.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"env": {
3+
"browser": true,
4+
"es2020": true,
5+
"node": true
6+
},
7+
"extends": [
8+
"plugin:react/recommended",
9+
"airbnb"
10+
],
11+
"parserOptions": {
12+
"ecmaFeatures": {
13+
"jsx": true
14+
},
15+
"ecmaVersion": 11,
16+
"sourceType": "module"
17+
},
18+
"plugins": [
19+
"react"
20+
],
21+
"rules": {
22+
"react/prop-types": 0
23+
}
24+
}
Lines changed: 1 addition & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -1,107 +1 @@
1-
module.exports = {
2-
name: 'yarn-up-all-plugin',
3-
factory: require => {
4-
5-
const {Configuration, Project} = require('@yarnpkg/core');
6-
const {Cli, Command} = require('clipanion');
7-
const yup = require('yup');
8-
const Essentials = require('@yarnpkg/plugin-essentials');
9-
10-
/**
11-
* Retrieve dependencies and devDependencies
12-
* @param workspace The current Workspace
13-
* @returns {*[]} an array of dependencies
14-
*/
15-
const getDependencies = (workspace) => {
16-
const dependencies = workspace.manifest.dependencies;
17-
const devDependencies = workspace.manifest.devDependencies;
18-
19-
return [...dependencies, ...devDependencies];
20-
};
21-
22-
/**
23-
* Resolve the name of a package
24-
* @param scope The scope of the descriptor
25-
* @param name The name of the descriptor
26-
* @returns {string|*} The full package name
27-
*/
28-
const resolveFullPackageName = (scope, name) => {
29-
return scope ? `@${scope}/${name}` : name;
30-
};
31-
32-
/**
33-
* Get the descriptor
34-
* @param dependencies The dependencies
35-
* @param exclude The list of full package names that should be excluded
36-
* @returns {*[]} The descriptors
37-
*/
38-
const getDescriptors = (dependencies, exclude) => {
39-
const descriptions = [...dependencies.values()];
40-
if (exclude) {
41-
return descriptions
42-
.filter(descriptor => {
43-
const data = resolveFullPackageName(descriptor[1].scope, descriptor[1].name);
44-
return !exclude.includes(data);
45-
});
46-
}
47-
return descriptions;
48-
};
49-
50-
class UpAllCommand extends Command {
51-
52-
/**
53-
* Execute the command
54-
* @returns {Promise<*>}
55-
*/
56-
async execute() {
57-
if (!Essentials.default.commands) {
58-
throw new Error('Yarn commands are not available!');
59-
}
60-
61-
const configuration = await Configuration.find(this.context.cwd, this.context.plugins);
62-
const {workspace} = await Project.find(configuration, this.context.cwd);
63-
64-
const dependencies = getDependencies(workspace);
65-
const descriptors = getDescriptors(dependencies, this.exclude ? this.exclude.split(" ") : null);
66-
67-
const packageNames = descriptors.map(e => {
68-
return resolveFullPackageName(e[1].scope, e[1].name);
69-
});
70-
71-
const cli = Cli.from(Essentials.default.commands);
72-
return await cli.runExit(['up', ...packageNames], this.context);
73-
}
74-
}
75-
76-
UpAllCommand.addOption('exclude', Command.String('--exclude'));
77-
UpAllCommand.addPath('up-all');
78-
79-
UpAllCommand.schema = yup.object().shape({
80-
exclude: yup.string()
81-
});
82-
83-
UpAllCommand.usage = Command.Usage({
84-
description: 'Yarn2 plugin that will upgrade all dependencies to their latest version with one simple command',
85-
details: 'This command will upgrade all dependencies to their latest version',
86-
examples: [
87-
[
88-
`Upgrade all dependencies`,
89-
`yarn up-all`
90-
],
91-
[
92-
`Upgrade all dependencies but exclude a single dependency`,
93-
`yarn up-all --exclude react-dom`
94-
],
95-
[
96-
`Upgrade all dependencies but exclude multiple dependencies`,
97-
`yarn up-all --exclude "react-dom react-router"`
98-
]]
99-
});
100-
101-
return {
102-
commands: [
103-
UpAllCommand,
104-
],
105-
};
106-
}
107-
};
1+
module.exports={name:"yarn-up-all-plugin",factory:a=>{const{Configuration:b,Project:c}=a("@yarnpkg/core"),{Cli:d,Command:e}=a("clipanion"),f=a("yup"),g=a("@yarnpkg/plugin-essentials"),h=(a,b)=>a?`@${a}/${b}`:b,i=(a,b)=>{const c=[...a.values()];return b?c.filter(a=>{const c=h(a[1].scope,a[1].name);return!b.includes(c)}):c};class j extends e{async execute(){if(!g.default.commands)throw new Error("Yarn commands are not available!");const a=await b.find(this.context.cwd,this.context.plugins),{workspace:e}=await c.find(a,this.context.cwd),f=[...e.manifest.dependencies,...e.manifest.devDependencies],j=i(f,this.exclude?this.exclude.split(" "):null),k=j.map(a=>h(a[1].scope,a[1].name)),l=d.from(g.default.commands);return l.runExit(["up",...k],this.context)}}return j.addOption("exclude",e.String("--exclude")),j.addPath("up-all"),j.schema=f.object().shape({exclude:f.string()}),j.usage=e.Usage({description:"Yarn2 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:[["Upgrade all dependencies","yarn up-all"],["Upgrade all dependencies but exclude a single dependency","yarn up-all --exclude react-dom"],["Upgrade all dependencies but exclude multiple dependencies","yarn up-all --exclude \"react-dom react-router\""]]}),{commands:[j]}}};

.yarnrc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ nodeLinker: node-modules
22

33
plugins:
44
- path: .yarn/plugins/yarn-up-all-plugin.cjs
5-
spec: "https://github.com/e5mode/yarn-up-all/releases/download/1.0.1/index.js"
5+
spec: "https://github.com/e5mode/yarn-up-all/releases/download/1.0.2/index.js"
66

77
yarnPath: .yarn/releases/yarn-2.1.1.cjs

package.json

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "deadhash",
3-
"version": "2.0.4",
3+
"version": "2.1.0",
44
"description": "File and text hash calculator",
55
"homepage": "./",
66
"private": true,
@@ -56,9 +56,6 @@
5656
"build": "yarn react-build && yarn electron-build -wl",
5757
"start": "concurrently \"cross-env BROWSER=none yarn react-start\" \"wait-on http://localhost:3000 && electron .\""
5858
},
59-
"eslintConfig": {
60-
"extends": "react-app"
61-
},
6259
"browserslist": {
6360
"production": [
6461
">0.2%",
@@ -73,8 +70,13 @@
7370
},
7471
"devDependencies": {
7572
"concurrently": "^5.3.0",
76-
"electron": "^9.2.0",
73+
"electron": "^9.2.1",
7774
"electron-builder": "^22.8.0",
75+
"eslint-config-airbnb": "^18.2.0",
76+
"eslint-plugin-import": "^2.22.0",
77+
"eslint-plugin-jsx-a11y": "^6.3.1",
78+
"eslint-plugin-react": "^7.20.6",
79+
"eslint-plugin-react-hooks": "^4.1.0",
7880
"wait-on": "^5.2.0"
7981
}
8082
}

0 commit comments

Comments
 (0)