Source structure refactoring

This commit is contained in:
Alexander Nozik 2020-08-24 14:46:46 +03:00
parent e2517c0ed0
commit cb54a6fe1a
189 changed files with 8849 additions and 18171 deletions

View File

@ -9,15 +9,15 @@ jobs:
name: build and deploy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions/checkout@v2
- name: Build Gatsby Site
uses: jzweifel/gatsby-cli-github-action@master
uses: jzweifel/gatsby-cli-github-action@v1.0.0
with:
gatsby-arg: build
- name: Deply via ssh
uses: appleboy/scp-action@master
uses: appleboy/scp-action@v0.1.1
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.WEBMASTER_USERNAME }}

5
.gitignore vendored
View File

@ -56,7 +56,9 @@ typings/
# gatsby files
.cache/
public
public/
static/files/
static/images/
# Mac files
.DS_Store
@ -69,3 +71,4 @@ yarn-error.log
.yarn-integrity
.idea/
schema.graphql

15
.graphqlconfig Normal file
View File

@ -0,0 +1,15 @@
{
"name": "Gatsby",
"schemaPath": "schema.graphql",
"extensions": {
"endpoints": {
"Default GraphQL Endpoint": {
"url": "http://localhost:8000/___graphql",
"headers": {
"user-agent": "JS GraphQL"
},
"introspect": false
}
}
}
}

View File

@ -1,2 +0,0 @@
xcopy "src/images" "static/images" /f /y /i /s
xcopy "src/files" "static/files" /f /y /i /s

View File

@ -22,6 +22,7 @@ module.exports = {
],
},
},
`gatsby-plugin-catch-links`,
`gatsby-plugin-react-helmet`,
{
resolve: 'gatsby-source-filesystem',
@ -34,7 +35,7 @@ module.exports = {
resolve: `gatsby-source-filesystem`,
options: {
name: `content`,
path: `${__dirname}/src/pages/content`,
path: `${__dirname}/src/content`,
},
},
{

View File

@ -1,14 +1,32 @@
const path = require('path')
const ncp = require('ncp').ncp;
exports.createPages = async ({ actions, graphql }) => {
const filesSource = "./src/files"
const imagesSource = "./src/images"
exports.onPreBootstrap = () => {
ncp(filesSource, "./static/files", function (err) {
if (err) {
return console.error(err);
}
console.log('Files copied');
});
ncp(imagesSource, "./static/images", function (err) {
if (err) {
return console.error(err);
}
console.log('Images copied');
});
}
exports.createPages = async ({actions, graphql}) => {
const {createPage} = actions;
// language=GraphQL
const result = await graphql(`
{
courses: allMarkdownRemark(
filter: {frontmatter: {
content_type: {eq: "page_education"},
published: {eq: true}}}
{
courses: allMarkdownRemark(
filter: {frontmatter: {content_type: {eq: "page_education"}, published: {eq: true}}}
){
edges{
node{
@ -21,24 +39,26 @@ exports.createPages = async ({ actions, graphql }) => {
}
}
news: allMarkdownRemark(
filter: {frontmatter: {content_type: {eq: "post"}, published: {eq: true}}},
sort: {fields: [frontmatter___date], order: DESC}
) {
edges{
node{
frontmatter{
title
slug
date(formatString: "DD.MM.YYYY")
news: allMarkdownRemark(
filter: {frontmatter: {content_type: {eq: "post"}, published: {eq: true}}},
sort: {fields: [frontmatter___date], order: DESC}
) {
edges{
node{
frontmatter{
title
slug
date(formatString: "DD.MM.YYYY")
}
html
}
html
}
}
}
}`)
}`)
if( result.errors ){ throw result.errors; }
if (result.errors) {
throw result.errors;
}
const courseTemplate = path.resolve(`./src/components/templates/courseTemplate.js`);
const courses = result.data.courses.edges;
@ -61,30 +81,30 @@ exports.createPages = async ({ actions, graphql }) => {
for (let pageIndex = 0; pageIndex < numberOfNewsPages; pageIndex++) {
const pageNumber = pageIndex + 1;
const path = pageIndex === 0 ? '/news' : `/news/${pageNumber}`;
const skip = pageIndex * postsPerPage;
const pageNumber = pageIndex + 1;
const path = pageIndex === 0 ? '/news' : `/news/${pageNumber}`;
const skip = pageIndex * postsPerPage;
function getPreviousPageLink() {
if (!pageIndex) return null
if (pageIndex === 1) return '/news'
return `/news/${pageIndex}`
}
function getPreviousPageLink() {
if (!pageIndex) return null
if (pageIndex === 1) return '/news'
return `/news/${pageIndex}`
}
function getNextPageLink() {
if (pageNumber < numberOfNewsPages) return `news/${pageNumber + 1}`
return null
}
function getNextPageLink() {
if (pageNumber < numberOfNewsPages) return `news/${pageNumber + 1}`
return null
}
createPage({
path,
component: newsTemplate,
context: {
limit: postsPerPage,
skip,
next: getNextPageLink(),
prev: getPreviousPageLink(),
},
})
createPage({
path,
component: newsTemplate,
context: {
limit: postsPerPage,
skip,
next: getNextPageLink(),
prev: getPreviousPageLink(),
},
})
}
}

13381
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -4,45 +4,50 @@
"description": "Nuclear Physics Methods laboratory",
"version": "0.1.0",
"dependencies": {
"@types/bootstrap": "^4.3.1",
"bootstrap": "^4.4.1",
"gatsby": "^2.18.12",
"gatsby-awesome-pagination": "^0.3.5",
"gatsby-cli": "^2.8.22",
"gatsby-plugin-intl": "^0.3.2",
"gatsby-plugin-manifest": "^2.2.31",
"gatsby-plugin-netlify-cms": "^4.1.33",
"gatsby-plugin-react-helmet": "^3.2.0",
"gatsby-plugin-sharp": "^2.3.10",
"gatsby-remark-images": "^3.1.39",
"gatsby-remark-katex": "^3.1.20",
"@types/bootstrap": "^4.5.0",
"bootstrap": "^4.5.2",
"gatsby": "^2.24.47",
"gatsby-awesome-pagination": "^0.3.6",
"gatsby-cli": "^2.12.87",
"gatsby-plugin-catch-links": "^2.3.11",
"gatsby-plugin-intl": "^0.3.3",
"gatsby-plugin-manifest": "^2.4.23",
"gatsby-plugin-netlify-cms": "^4.3.11",
"gatsby-plugin-react-helmet": "^3.3.10",
"gatsby-plugin-sharp": "^2.6.27",
"gatsby-remark-images": "^3.3.25",
"gatsby-remark-katex": "^3.3.10",
"gatsby-remark-relative-images": "^0.2.3",
"gatsby-source-filesystem": "^2.1.43",
"gatsby-source-graphql": "^2.1.29",
"gatsby-transformer-remark": "^2.6.45",
"gatsby-transformer-sharp": "^2.3.7",
"html-react-parser": "^0.10.2",
"katex": "^0.10.0",
"gatsby-source-filesystem": "^2.3.24",
"gatsby-source-graphql": "^2.7.1",
"gatsby-transformer-remark": "^2.8.28",
"gatsby-transformer-sharp": "^2.5.13",
"html-react-parser": "^0.10.5",
"jquery": "^3.5.1",
"katex": "^0.10.2",
"mini-css-extract-plugin": "^0.9.0",
"netlify-cms-app": "^2.10.1",
"ncp": "^2.0.0",
"netlify-cms-app": "^2.12.19",
"prop-types": "^15.7.2",
"react": "^16.12.0",
"react-bootstrap": "^1.0.0-beta.16",
"react": "^16.13.1",
"react-bootstrap": "^1.3.0",
"react-helmet": "^5.2.1",
"vertical-timeline-component-for-react": "^1.0.6"
"redux": "^3.7.2",
"typescript": "^4.0.2",
"vertical-timeline-component-for-react": "^1.0.7"
},
"devDependencies": {
"autoprefixer": "^9.7.3",
"autoprefixer": "^9.8.6",
"clean-webpack-plugin": "^3.0.0",
"copy-webpack-plugin": "^5.1.1",
"file-loader": "^5.0.2",
"file-loader": "^5.1.0",
"html-webpack-plugin": "^3.2.0",
"imagemin-webpack-plugin": "^2.4.2",
"img-loader": "^3.0.1",
"uglifyjs-webpack-plugin": "^2.2.0",
"webpack": "^4.42.0",
"webpack-cli": "^3.3.10",
"webpack-dev-server": "^3.10.1"
"webpack": "^4.44.1",
"webpack-cli": "^3.3.12",
"webpack-dev-server": "^3.11.0"
},
"keywords": [
"gatsby"

View File

@ -1,6 +1,6 @@
import React from "react"
import { graphql } from "gatsby"
import { Link, useIntl, injectIntl } from "gatsby-plugin-intl"
import {graphql} from "gatsby"
import {injectIntl, Link, useIntl} from "gatsby-plugin-intl"
import Parser from "html-react-parser"
import SEO from "../seo"
@ -12,7 +12,7 @@ const Template = (props) => {
const course = props.data.course
let par = 'Физика'
if (lang === "ru"){
if (lang === "ru") {
switch (course.frontmatter.parent) {
case 'education':
par = 'Образование';
@ -25,8 +25,8 @@ const Template = (props) => {
break;
default:
par = 'Физика';
}}
else {
}
} else {
switch (course.frontmatter.parent) {
case 'education':
par = 'Education';
@ -41,16 +41,16 @@ const Template = (props) => {
par = 'Physics';
}
}
return(
<Layout>
<SEO lang={lang} title={intl.formatMessage({ id: "title" })} />
return (
<Layout>
<SEO lang={lang} title={intl.formatMessage({id: "title"})}/>
<nav aria-label="breadcrumb">
<ol className="breadcrumb" style={{margin: 0}}>
<li className="breadcrumb-item">
<Link to={`/projects/${course.frontmatter.parent}`}>{par}</Link>
</li>
<li className="breadcrumb-item active" aria-current="page">{course.frontmatter.shortTitle}</li>
</ol>
<ol className="breadcrumb" style={{margin: 0}}>
<li className="breadcrumb-item">
<Link to={`/projects/${course.frontmatter.parent}`}>{par}</Link>
</li>
<li className="breadcrumb-item active" aria-current="page">{course.frontmatter.shortTitle}</li>
</ol>
</nav>
<h1 style={{marginTop: `15px`, textAlign: `center`}}>{course.frontmatter.title}</h1>
@ -64,12 +64,12 @@ export default injectIntl(Template)
export const CourseQuery = graphql`
query CourseByPath($path: String){
course: markdownRemark(frontmatter: {slug: {eq: $path}}){
html
frontmatter{
title
shortTitle
path
parent
slug
}}
html
frontmatter{
title
shortTitle
path
parent
slug
}}
}`

View File

@ -0,0 +1,13 @@
---
content_type: project_software
id: plotly
shortTitle: Plotly.kt
title: Plotly.kt wrapper library for kotlin-multiplatform
order: 5
published: true
language: en
------------
[Plotly.kt](https://github.com/mipt-npm/plotly.kt) library wraps popular [Plotly](https://plotly.com/javascript/) frontend library and allows access to it from Kotlin-multiplatform (both from front-end and back-end) as well as kotlin jupyter kernel support and other nice things.
More detailed description is available in the [project repository](https://github.com/mipt-npm/plotly.kt) and on the [special page](/files/plotly.html) prepared by Ekaterina Samorodova.

View File

@ -3,7 +3,7 @@ content_type: project_software
id: prog-seminar
shortTitle: Programming workshop
title: Programming in experimental physics
order: 3
order: 300
published: true
language: en
---

Some files were not shown because too many files have changed in this diff Show More