Skip to content

Commit 57e4ecf

Browse files
authored
Merge pull request #1 from CodeDead/feature/setup
Feature/setup
2 parents 53cdf80 + 2416409 commit 57e4ecf

File tree

172 files changed

+14132
-4109
lines changed

Some content is hidden

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

172 files changed

+14132
-4109
lines changed

.eslintignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.yarn
2+
.cache
3+
public
4+
gatsby-browser.js
5+
gatsby-ssr.js

.eslintrc.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"env": {
3+
"browser": true,
4+
"es2020": true
5+
},
6+
"extends": [
7+
"plugin:react/recommended",
8+
"airbnb"
9+
],
10+
"parserOptions": {
11+
"ecmaFeatures": {
12+
"jsx": true
13+
},
14+
"ecmaVersion": 11,
15+
"sourceType": "module"
16+
},
17+
"plugins": [
18+
"react"
19+
],
20+
"rules": {
21+
"react/prop-types": 0
22+
}
23+
}

.gitignore

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,11 @@ public
6262
.DS_Store
6363

6464
# Yarn
65-
yarn-error.log
66-
.pnp/
67-
.pnp.js
68-
# Yarn Integrity file
6965
.yarn-integrity
7066
.idea/*
67+
.yarn/*
68+
!.yarn/releases
69+
!.yarn/plugins
70+
!.yarn/sdks
71+
!.yarn/versions
72+
.pnp.*

.prettierignore

Lines changed: 0 additions & 5 deletions
This file was deleted.

.prettierrc

Lines changed: 0 additions & 4 deletions
This file was deleted.
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]}}};

.yarn/releases/yarn-2.4.0.cjs

Lines changed: 55 additions & 0 deletions
Large diffs are not rendered by default.

.yarn/releases/yarn-berry.js

Lines changed: 0 additions & 86 deletions
This file was deleted.

.yarnrc.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
nodeLinker: node-modules
2+
13
plugins:
24
- path: .yarn/plugins/yarn-up-all-plugin.cjs
3-
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.3/index.js"
46

5-
yarnPath: .yarn/releases/yarn-berry.js
6-
7-
nodeLinker: node-modules
7+
yarnPath: .yarn/releases/yarn-2.4.0.cjs

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The BSD Zero Clause License (0BSD)
22

3-
Copyright (c) 2020 Gatsby Inc.
3+
Copyright (c) 2021 Gatsby Inc.
44

55
Permission to use, copy, modify, and/or distribute this software for any
66
purpose with or without fee is hereby granted.

0 commit comments

Comments
 (0)