Skip to content

Commit

Permalink
feat: migrate to gatsby@3.0
Browse files Browse the repository at this point in the history
besides, using eslint to lint project and solve the css plug-in related issues that may be caused by
the import order.
  • Loading branch information
jctaoo committed Apr 5, 2021
1 parent 4e611c4 commit 20b5b2f
Show file tree
Hide file tree
Showing 47 changed files with 6,424 additions and 6,346 deletions.
63 changes: 63 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "./tsconfig.json"
},
"env": {
"es6": true
},
"ignorePatterns": [
"node_modules",
"build",
"coverage",
"fixtures",
"bin",
"docs",
"public",
"gatsby-config.js",
"gatsby-browser.js",
"gatsby-ssr.js"
],
"plugins": ["import", "eslint-comments"],
"extends": [
"eslint:recommended",
"plugin:eslint-comments/recommended",
"plugin:@typescript-eslint/recommended",
"plugin:import/typescript",
"prettier",
"prettier/@typescript-eslint"
],
"globals": {
"BigInt": true,
"console": true,
"WebAssembly": true
},
"rules": {
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-empty-function": "off",
"eslint-comments/disable-enable-pair": [
"error",
{
"allowWholeFile": true
}
],
"eslint-comments/no-unused-disable": "error",
"import/order": [
"error",
{
"newlines-between": "always",
"alphabetize": {
"order": "asc"
}
}
],
"sort-imports": [
"error",
{
"ignoreDeclarationSort": true,
"ignoreCase": true
}
]
}
}
174 changes: 92 additions & 82 deletions Configure Options.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
## Explanations

### (Optional) Config for [disqus](https://disqus.com/):

`config.disqus.shortName` string: Your short name of disqus.

`config.disqus.developmentShortName` string: Same as shortName but only for development.

### (Required) Experiments Features:

Note: If you don't need any experimental feature, just provide `{}` for `config.experiment`

`config.experiment.downloadWebPicture` optional: Stella will download Web Page in your content to ensure that pictures are always presented in the same way.
Expand All @@ -17,29 +19,35 @@ Note: If you don't need any experimental feature, just provide `{}` for `config.
`config.experiment.downloadWebPicture.excludeUrlRegx` string[]: The list of regular expression indicates links to ignore.

### (Optional) Copyright:

`copyright.author` string optional: Author of site.

`copyright.creativeCommons` string optional: [Creative Commons](https://creativecommons.org/). You can choose your option in https://creativecommons.org/choose/.

### (Required) Routes Configure:

Note that `routeName` just can only be the value includes 'about', 'passages', 'snippets'

`routeConfigurations.${routeName}.title` string: title of `routeName` route.

### (Optional) Page Descriptions (to support SEO):

Note that `pageName` just can only be the value includes 'home', 'about', 'passages', 'snippets'

Here are following simple options need to be configured for the page:
- `pageDescription.${pageName}.title` string

- `pageDescription.${pageName}.title` string
- `pageDescription.${pageName}.keywords` string[]
- `pageDescription.${pageName}.description` string optional
- `pageDescription.${pageName}.largeImage` string optional
- `pageDescription.${pageName}.largeImageAlt` string optional

### (Required Array) Social Medias:

If you don't need show ant social media on your site, just provide `[]` value to `medias`.

Stella support following platforms:

- [BiliBili](https://www.bilibili.com/)
- [GitHub](https://github.com)
- Mail
Expand All @@ -57,6 +65,7 @@ Stella support following platforms:
`medias[n].imageName` string optional: A path relative to the `static` directory, when the user puts the mouse on the platform icon, the picture will be displayed. It's useful for QR Code.

### Other Configs & Options:

`config.lang` string: Language of your site.

`config.host` string: The host of your site.
Expand All @@ -68,91 +77,92 @@ Stella support following platforms:
`bannerText` string optional: To show a banner on your site. If you don't provide any value, Stella won't display the banner on your site.

## Example Config File:

```json
{
"config": {
"disqus": {
"shortName": "jctaoo",
"developmentShortName": "jctaoo-dev"
},
"lang": "zh",
"host": "http://localhost:5000",
"siteName": "Jctaoo.",
"homeLargeTitle": "Jctaoo.",
"experiment": {
"downloadWebPicture": {
"enable": true,
"excludeUrlRegx": ["juejin"]
}
{
"config": {
"disqus": {
"shortName": "jctaoo",
"developmentShortName": "jctaoo-dev"
},
"lang": "zh",
"host": "http://localhost:5000",
"siteName": "Jctaoo.",
"homeLargeTitle": "Jctaoo.",
"experiment": {
"downloadWebPicture": {
"enable": true,
"excludeUrlRegx": ["juejin"]
}
}
},
"bannerText": "Stella Demo Site",
"copyright": {
"author": "jctaoo",
"creativeCommons": "by"
},
"routeConfigurations": {
"about": {
"title": "关于"
},
"bannerText": "Stella Demo Site",
"copyright": {
"author": "jctaoo",
"creativeCommons": "by"
"passages": {
"title": "文章"
},
"routeConfigurations": {
"about": {
"title": "关于"
},
"passages": {
"title": "文章"
},
"snippets": {
"title": "片段"
}
"snippets": {
"title": "片段"
}
},
"pageDescription": {
"home": {
"title": "主页",
"keywords": [],
"description": "Jctaoo的个人网站"
},
"pageDescription": {
"home": {
"title": "主页",
"keywords": [],
"description": "Jctaoo的个人网站"
},
"passages": {
"title": "文章列表",
"keywords": ["文章列表"],
"description": "所有发布的文章列表"
},
"snippets": {
"title": "片段列表",
"keywords": ["片段列表", "vlog"],
"description": "所有发布的片段列表, 记录代码与日常片段"
},
"about": {
"title": "关于",
"keywords": [, "关于", "简介", "说明"],
"description": "关于Jctaoo的个人网站"
}
"passages": {
"title": "文章列表",
"keywords": ["文章列表"],
"description": "所有发布的文章列表"
},
"medias": [
{
"identifier": "1",
"iconName": "bilibili",
"title": "bilibili"
},
{
"identifier": "2",
"iconName": "github",
"title": "github",
"link": "https://github.com/jctaoo",
"imageName": "github_qr_code.png"
},
{
"identifier": "3",
"iconName": "mail",
"title": "mail",
"link": "mailto:jctaoo@outlook.com"
},
{
"identifier": "4",
"iconName": "twitter",
"title": "twitter"
},
{
"identifier": "5",
"iconName": "wechat",
"title": "wechat"
}
]
}
"snippets": {
"title": "片段列表",
"keywords": ["片段列表", "vlog"],
"description": "所有发布的片段列表, 记录代码与日常片段"
},
"about": {
"title": "关于",
"keywords": [, "关于", "简介", "说明"],
"description": "关于Jctaoo的个人网站"
}
},
"medias": [
{
"identifier": "1",
"iconName": "bilibili",
"title": "bilibili"
},
{
"identifier": "2",
"iconName": "github",
"title": "github",
"link": "https://github.com/jctaoo",
"imageName": "github_qr_code.png"
},
{
"identifier": "3",
"iconName": "mail",
"title": "mail",
"link": "mailto:jctaoo@outlook.com"
},
{
"identifier": "4",
"iconName": "twitter",
"title": "twitter"
},
{
"identifier": "5",
"iconName": "wechat",
"title": "wechat"
}
]
}
```
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,14 @@ Stella supports following meta data fields
- place a '-' behind your code line indicates the line will be removed.

Following code

```typescript
// adding codes
+console.log("🍔");
// removing codes
-console.log("💩")
-console.log("💩");
```

Will look like this
![code-diff](./static/code_diff.png)

Expand Down
1 change: 1 addition & 0 deletions content/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ updateDates:
- 2020-06-15
---

ss
## Hi there👋, I'm jctaoo. 💗
Welcome to my [GitHub homepage](https://github.com/jctaoo)

Expand Down
2 changes: 1 addition & 1 deletion gatsby-browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const onRouteUpdate = (args) => {
/**
* @param {RouteUpdateDelayedArgs} _args
*/
export const onRouteUpdateDelayed = (_args) => {
export const onRouteUpdateDelayed = (/*_args*/) => {
const enableLoadingAction = Actions.createChangeLoadingStateAction({
enable: true,
});
Expand Down
19 changes: 13 additions & 6 deletions gatsby-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,13 @@ export default {
},
],
},
flags: {
DEV_SSR: true,
PRESERVE_FILE_DOWNLOAD_CACHE: true,
PRESERVE_WEBPACK_CACHE: true,
FAST_DEV: true,
PARALLEL_SOURCING: true,
},
plugins: [
"gatsby-plugin-antd",
{
Expand All @@ -120,15 +127,15 @@ export default {
implementation: require("sass"),
},
},
"gatsby-plugin-typescript",
"gatsby-plugin-react-helmet",
"gatsby-plugin-offline",
{
resolve: "gatsby-plugin-webpack-bundle-analyser-v2",
resolve: `gatsby-source-filesystem`,
options: {
devMode: true,
openAnalyzer: false,
name: `content`,
path: `${__dirname}/content/`,
},
},
"gatsby-plugin-typescript",
"gatsby-plugin-react-helmet",
"gatsby-plugin-offline",
],
};
Loading

0 comments on commit 20b5b2f

Please sign in to comment.