Skip to content

Commit

Permalink
Merge pull request #87 from morganstanley/docs-update
Browse files Browse the repository at this point in the history
Update documentation static site generator
  • Loading branch information
aidanm3341 authored Aug 8, 2024
2 parents 5785c6d + 046a464 commit f603302
Show file tree
Hide file tree
Showing 28 changed files with 15,851 additions and 8,715 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module.exports = {
sourceType: 'module',
},
plugins: ['@typescript-eslint'],
ignorePatterns: ['dist/', 'reports/', 'docs/'],
ignorePatterns: ['dist/', 'reports/', 'docs/', 'site/'],
rules: {
'prettier/prettier': ['error', prettierConfig],
'@typescript-eslint/explicit-module-boundary-types': 'off',
Expand Down
2 changes: 1 addition & 1 deletion site/.vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"html.format.wrapAttributes": "force-aligned",
"eslint.format.enable": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
"source.fixAll.eslint": true
},
"eslint.validate": ["javascript"],
"editor.formatOnSave": true,
Expand Down
51 changes: 51 additions & 0 deletions site/__mocks__/documentation.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
export const versions = ['1.0', '2.0'];

export const slug = '/documentation/2.0/components/';

export const allDocs = [
{
id: '2a252835-849d-5e11-9b71-a4a18defc55b',
excerpt:
'Quick Start Install the latest version of Node.js, clone this repo and then:\n\nTo create a build locally:\n\nConfiguration\n\nThis static site…',
frontmatter: {
title: 'Development',
},
internal: {
contentFilePath:
'/Users/mimiflynn/Projects/MS/ms-gh-pages/site/content/documentation/intro-doc.mdx',
},
fields: {
slug: '/documentation/intro-doc/',
},
},
{
id: '9cbc3eec-d3ce-522a-b2fd-197c8407b252',
excerpt:
'This static site generator processes MDX in addition to traditional Markdown files. allows for the use of JSX components within Markdown.…',
frontmatter: {
title: 'Components 2.0',
},
internal: {
contentFilePath:
'/Users/mimiflynn/Projects/MS/ms-gh-pages/site/content/documentation/2.0/components.mdx',
},
fields: {
slug: '/documentation/2.0/components/',
},
},
{
id: '41748935-af24-51c3-8d32-458375e4246c',
excerpt:
'This static site generator processes MDX in addition to traditional Markdown files. allows for the use of JSX components within Markdown.…',
frontmatter: {
title: 'Components',
},
internal: {
contentFilePath:
'/Users/mimiflynn/Projects/MS/ms-gh-pages/site/content/documentation/1.0/components.mdx',
},
fields: {
slug: '/documentation/1.0/components/',
},
},
];
3 changes: 3 additions & 0 deletions site/__mocks__/file-mock.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// https://www.gatsbyjs.com/docs/how-to/testing/unit-testing/

module.exports = 'test-file-stub';
34 changes: 34 additions & 0 deletions site/__mocks__/gatsby.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// https://www.gatsbyjs.com/docs/how-to/testing/unit-testing/

const React = require('react');
const gatsby = jest.requireActual('gatsby');

module.exports = {
...gatsby,
graphql: jest.fn(),
Link: jest.fn().mockImplementation(
// these props are invalid for an `a` tag
({
activeClassName,
activeStyle,
getProps,
innerRef,
partiallyActive,
ref,
replace,
to,
...rest
}) =>
React.createElement('a', {
...rest,
href: to,
})
),
Slice: jest.fn().mockImplementation(({ alias, ...rest }) =>
React.createElement('div', {
...rest,
'data-test-slice-alias': alias,
})
),
useStaticQuery: jest.fn(),
};
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,17 @@ npm install reflect-metadata
And you should import this module at the root of your application.

```typescript
import "reflect-metadata";
import 'reflect-metadata';
```

## Quick Start

import GettingStarted from '../getting-started.mdx';
import GettingStarted from '../../getting-started.mdx';

<GettingStarted />

## Dependency Injection

The MessageBroker class is decorated with @Injectable from @morgan-stanley/needle.
This means that it can be constructed by different DI frameworks.
For more information please refer to the [documentation for the Needle framework](https://github.com/morganstanley/needle).
For more information please refer to the [documentation for the Needle framework](https://github.com/morganstanley/needle).
File renamed without changes.
8 changes: 4 additions & 4 deletions site/gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ const { plugins } = require('./src/config/base-gatsby-plugins');

module.exports = {
siteMetadata: {
title: `Message Broker`,
description: `The Message Broker is a Typescript library which aims to provide asynchronous communication between typescript components.`,
siteUrl: 'http://opensource.morganstanley.com/message-broker',
title: `Project GitHub Pages Template`,
description: `Morgan Stanley Open Source Software`,
siteUrl: 'http://opensource.morganstanley.com',
documentationUrl: false,
// documentationUrl: url-of.documentation.site,
},
pathPrefix: `/message-broker`, // include subdirectory
pathPrefix: `/`, // put GitHub project url slug here e.g. github.com/morganstanley/<project url slug>
plugins,
};
24 changes: 24 additions & 0 deletions site/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// https://www.gatsbyjs.com/docs/how-to/testing/unit-testing/

module.exports = {
transform: {
'^.+\\.jsx?$': `<rootDir>/tests/jest-preprocess.js`,
},
moduleNameMapper: {
'.+\\.(css|styl|less|sass|scss)$': `identity-obj-proxy`,
'.+\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': `<rootDir>/__mocks__/file-mock.js`,
},
testPathIgnorePatterns: [`node_modules`, `\\.cache`, `<rootDir>.*/public`],
transformIgnorePatterns: [
`node_modules/(?!(gatsby|gatsby-script|gatsby-link)/)`,
],
globals: {
__PATH_PREFIX__: ``,
},
testEnvironmentOptions: {
url: `http://localhost`,
},
setupFiles: [`<rootDir>/tests/loadershim.js`],
testEnvironment: `jsdom`,
setupFilesAfterEnv: ['<rootDir>/tests/setup-test-env.js'],
};
Loading

0 comments on commit f603302

Please sign in to comment.