Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: propose a framework for documentation #776

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 69 additions & 0 deletions doc/web-doc/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Typescript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# dotenv environment variable files
.env*

# gatsby files
.cache/
public

# Mac files
.DS_Store

# Yarn
yarn-error.log
.pnp/
.pnp.js
# Yarn Integrity file
.yarn-integrity
4 changes: 4 additions & 0 deletions doc/web-doc/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.cache
package.json
package-lock.json
public
4 changes: 4 additions & 0 deletions doc/web-doc/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"arrowParens": "avoid",
"semi": false
}
32 changes: 32 additions & 0 deletions doc/web-doc/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
## Prerequisites

- install Gatsby globally

```shell
npm install -g gatsby
```

## Quick start

- Navigate into the directory containing this README file.

- If it is the first time, install the required packages

```shell
npm install
```

- Run gatsby. When completed, look at localhost:8000

```shell
gatsby develop
```

## Notes

- This web framework was created using the Gatsby CLI ([install instructions](https://www.gatsbyjs.com/docs/tutorial/part-0/#gatsby-cli)) to create a new site, specifying the default starter.

```shell
# create a new Gatsby site using the default starter
gatsby new my-default-starter https://github.com/gatsbyjs/gatsby-starter-default
```
72 changes: 72 additions & 0 deletions doc/web-doc/gatsby-config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
module.exports = {
siteMetadata: {
title: `Theia Trace Extension`,
description: `Proof of concept for Trace Compass Cloud relate documentation.`,
author: `@frallax`,
siteUrl: `https://www.eclipse.org/tracecompass/`,
},
plugins: [
`gatsby-plugin-react-helmet`,
`gatsby-plugin-image`,
{
resolve: 'gatsby-transformer-remark',
options: {
plugins: [
// mermaid support, must be put before other syntax highlight plugins
'gatsby-remark-mermaid',
'gatsby-remark-prismjs',
'gatsby-remark-copy-linked-files',
{
resolve: 'gatsby-remark-images',
options: {
maxWidth: 800,
linkImagesToOriginal: false
},
}
]
}
},
{
resolve: `gatsby-source-filesystem`,
options: {
name: `images`,
path: `${__dirname}/src/images`,
},
},
{
// localize markdown files
resolve: `gatsby-source-filesystem`,
options: {
name: `docs`,
path: `${__dirname}/src/docs`,
},
},
{
// localize markdown files
resolve: `gatsby-source-filesystem`,
options: {
name: `adr`,
path: `${__dirname}/../adr`,
},
},
`gatsby-transformer-sharp`,
`gatsby-plugin-sharp`,
{
resolve: `gatsby-plugin-manifest`,
options: {
name: `gatsby-starter-default`,
short_name: `starter`,
start_url: `/`,
background_color: `#663399`,
// This will impact how browsers show your PWA/website
// https://css-tricks.com/meta-theme-color-and-trickery/
// theme_color: `#663399`,
display: `minimal-ui`,
icon: `src/images/tc_icon_256x256.png`, // This path is relative to the root of the site.
},
},
// this (optional) plugin enables Progressive Web App + Offline functionality
// To learn more, visit: https://gatsby.dev/offline
// `gatsby-plugin-offline`,
],
}
55 changes: 55 additions & 0 deletions doc/web-doc/gatsby-node.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
const path = require('path');
exports.createPages = async ({ graphql, actions }) => {
const { createPage } = actions;
const docTemplate = path.resolve(`src/templates/docs-template.js`);
return graphql(`{
allMarkdownRemark(
sort: { order: DESC, fields: [frontmatter___title] }
limit: 1000
) {
edges {
node {
excerpt(pruneLength: 250)
html
id
fileAbsolutePath
}
}
}
}`)
.then(result => {
if (result.errors) {
return Promise.reject(result.errors);
}
result.data.allMarkdownRemark.edges
.forEach(({ node }) => {
var pagePath = ""
var absPathAsString = path.parse(node.fileAbsolutePath).dir
const dirs = absPathAsString.split('theia-trace-extension/')
if (dirs.length > 1) {
pagePath = dirs[dirs.length-1] + "/" + path.parse(node.fileAbsolutePath).name
} else {
pagePath = path.parse(node.fileAbsolutePath).name
}
createPage({
path: pagePath,
component: docTemplate,
context: {
// used for Template.pageQuery
id: node.id,
fileName: path.parse(node.fileAbsolutePath).name,
}
});
});
});
}

exports.onCreateWebpackConfig = ({ actions }) => {
actions.setWebpackConfig({
resolve: {
fallback: {
path: require.resolve('path-browserify'),
},
},
})
}
Loading