Skip to content

Commit 53cdf80

Browse files
committed
* Initial setup
1 parent 094a82d commit 53cdf80

File tree

24 files changed

+17385
-12255
lines changed

24 files changed

+17385
-12255
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,4 @@ yarn-error.log
6767
.pnp.js
6868
# Yarn Integrity file
6969
.yarn-integrity
70+
.idea/*

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
package.json
33
package-lock.json
44
public
5+
.yarn

.prettierrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"arrowParens": "avoid",
3-
"semi": false
3+
"semi": true
44
}
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
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+
};

.yarn/releases/yarn-berry.js

Lines changed: 86 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.yarnrc.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
plugins:
2+
- path: .yarn/plugins/yarn-up-all-plugin.cjs
3+
spec: "https://github.com/e5mode/yarn-up-all/releases/download/1.0.1/index.js"
4+
5+
yarnPath: .yarn/releases/yarn-berry.js
6+
7+
nodeLinker: node-modules

gatsby-config.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@
55
*/
66

77
module.exports = {
8+
polyfill: false,
89
/* Your site config here */
9-
plugins: [],
10-
}
10+
siteMetadata: {
11+
title: "CodeDead | Solving problems using code",
12+
description: "Download open-source applications, free of charge",
13+
siteUrl: "https://codedead.com"
14+
},
15+
plugins: [
16+
`gatsby-theme-material-ui`
17+
]
18+
};

package.json

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,27 @@
11
{
2-
"name": "gatsby-starter-hello-world",
2+
"name": "codedead.com",
33
"private": true,
4-
"description": "A simplified bare-bones starter for Gatsby",
5-
"version": "0.1.0",
4+
"description": "CodeDead Website",
5+
"version": "1.0.0",
66
"license": "0BSD",
77
"scripts": {
88
"build": "gatsby build",
99
"develop": "gatsby develop",
1010
"format": "prettier --write \"**/*.{js,jsx,ts,tsx,json,md}\"",
11-
"start": "npm run develop",
11+
"start": "yarn run develop",
1212
"serve": "gatsby serve",
1313
"clean": "gatsby clean",
1414
"test": "echo \"Write tests! -> https://gatsby.dev/unit-testing\" && exit 1"
1515
},
1616
"dependencies": {
17-
"gatsby": "^2.24.26",
18-
"react": "^16.12.0",
19-
"react-dom": "^16.12.0"
17+
"@material-ui/core": "^4.11.0",
18+
"gatsby": "^2.24.37",
19+
"gatsby-theme-material-ui": "^1.0.13",
20+
"react": "^16.13.1",
21+
"react-dom": "^16.13.1"
2022
},
2123
"devDependencies": {
22-
"prettier": "2.0.5"
24+
"prettier": "^2.0.5"
2325
},
2426
"repository": {
2527
"type": "git",

src/components/PageHeader/index.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import React from "react";
2+
import { makeStyles } from "@material-ui/core/styles";
3+
import Container from "@material-ui/core/Container";
4+
import Typography from "@material-ui/core/Typography";
5+
6+
const useStyles = makeStyles((theme) => ({
7+
heroContent: {
8+
backgroundColor: theme.palette.background.paper,
9+
padding: theme.spacing(4, 0, 2)
10+
}
11+
}));
12+
13+
const PageHeader = ({ title, subTitle }) => {
14+
15+
const classes = useStyles();
16+
17+
return (
18+
<div className={classes.heroContent}>
19+
<Container maxWidth="sm">
20+
<Typography variant="h4" align="center" color="textPrimary" gutterBottom>
21+
{title}
22+
</Typography>
23+
<Typography variant="h6" align="center" color="textSecondary" paragraph>
24+
{subTitle}
25+
</Typography>
26+
</Container>
27+
</div>
28+
);
29+
};
30+
31+
export default PageHeader;

src/pages/about/index.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import React from "react";
2+
3+
const AboutPage = () => {
4+
5+
return (
6+
<>
7+
Hi. I'm a programmer. Nice to meet you!
8+
</>
9+
);
10+
};
11+
12+
export default AboutPage;

0 commit comments

Comments
 (0)