diff --git a/.eslintrc.js b/.eslintrc.js index 7a3bb2f789c8..eafe4f933edb 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -63,7 +63,10 @@ module.exports = { }, overrides: [ { - files: ['packages/docusaurus-init/templates/classic/**/*.js'], + files: [ + 'packages/docusaurus-init/templates/bootstrap/**/*.js', + 'packages/docusaurus-init/templates/classic/**/*.js', + ], rules: { 'header/header': 'off', }, diff --git a/packages/docusaurus-init/templates/bootstrap/.gitignore b/packages/docusaurus-init/templates/bootstrap/.gitignore new file mode 100644 index 000000000000..b2d6de30624f --- /dev/null +++ b/packages/docusaurus-init/templates/bootstrap/.gitignore @@ -0,0 +1,20 @@ +# Dependencies +/node_modules + +# Production +/build + +# Generated files +.docusaurus +.cache-loader + +# Misc +.DS_Store +.env.local +.env.development.local +.env.test.local +.env.production.local + +npm-debug.log* +yarn-debug.log* +yarn-error.log* diff --git a/packages/docusaurus-init/templates/bootstrap/README.md b/packages/docusaurus-init/templates/bootstrap/README.md new file mode 100644 index 000000000000..ee0ccc9d1821 --- /dev/null +++ b/packages/docusaurus-init/templates/bootstrap/README.md @@ -0,0 +1,33 @@ +# Website + +This website is built using [Docusaurus 2](https://v2.docusaurus.io/), a modern static website generator. + +### Installation + +``` +$ yarn +``` + +### Local Development + +``` +$ yarn start +``` + +This command starts a local development server and open up a browser window. Most changes are reflected live without having to restart the server. + +### Build + +``` +$ yarn build +``` + +This command generates static content into the `build` directory and can be served using any static contents hosting service. + +### Deployment + +``` +$ GIT_USER= USE_SSH=true yarn deploy +``` + +If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch. diff --git a/packages/docusaurus-init/templates/bootstrap/docusaurus.config.js b/packages/docusaurus-init/templates/bootstrap/docusaurus.config.js new file mode 100644 index 000000000000..51fe23e61b04 --- /dev/null +++ b/packages/docusaurus-init/templates/bootstrap/docusaurus.config.js @@ -0,0 +1,58 @@ +module.exports = { + title: 'My Site', + tagline: 'The tagline of my site', + url: 'https://your-docusaurus-test-site.com', + baseUrl: '/', + favicon: 'img/favicon.ico', + organizationName: 'facebook', // Usually your GitHub org/user name. + projectName: 'docusaurus', // Usually your repo name. + themeConfig: { + navbar: { + title: 'My Site', + logo: { + alt: 'My Site Logo', + src: 'img/logo.svg', + }, + links: [ + { + href: 'https://github.com/facebook/docusaurus', + label: 'GitHub', + position: 'right', + }, + ], + }, + footer: { + style: 'dark', + links: [ + { + title: 'Community', + items: [ + { + label: 'Stack Overflow', + href: 'https://stackoverflow.com/questions/tagged/docusaurus', + }, + { + label: 'Discord', + href: 'https://discordapp.com/invite/docusaurus', + }, + ], + }, + { + title: 'Social', + items: [ + { + label: 'GitHub', + href: 'https://github.com/facebook/docusaurus', + }, + { + label: 'Twitter', + href: 'https://twitter.com/docusaurus', + }, + ], + }, + ], + copyright: `Copyright © ${new Date().getFullYear()} My Project, Inc. Built with Docusaurus.`, + }, + }, + presets: [['@docusaurus/preset-bootstrap', {}]], +}; diff --git a/packages/docusaurus-init/templates/bootstrap/package.json b/packages/docusaurus-init/templates/bootstrap/package.json new file mode 100644 index 000000000000..568e983f77f0 --- /dev/null +++ b/packages/docusaurus-init/templates/bootstrap/package.json @@ -0,0 +1,30 @@ +{ + "name": "docusaurus-2-bootstrap-template", + "version": "2.0.0-alpha.50", + "private": true, + "scripts": { + "start": "docusaurus start", + "build": "docusaurus build", + "swizzle": "docusaurus swizzle", + "deploy": "docusaurus deploy" + }, + "dependencies": { + "@docusaurus/core": "^2.0.0-alpha.50", + "@docusaurus/preset-bootstrap": "^2.0.0-alpha.50", + "classnames": "^2.2.6", + "react": "^16.8.4", + "react-dom": "^16.8.4" + }, + "browserslist": { + "production": [ + ">0.2%", + "not dead", + "not op_mini all" + ], + "development": [ + "last 1 chrome version", + "last 1 firefox version", + "last 1 safari version" + ] + } +} diff --git a/packages/docusaurus-init/templates/bootstrap/src/pages/index.js b/packages/docusaurus-init/templates/bootstrap/src/pages/index.js new file mode 100644 index 000000000000..90cff1e1b10a --- /dev/null +++ b/packages/docusaurus-init/templates/bootstrap/src/pages/index.js @@ -0,0 +1,97 @@ +import React from 'react'; +import classnames from 'classnames'; +import Layout from '@theme/Layout'; +import Link from '@docusaurus/Link'; +import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; +import useBaseUrl from '@docusaurus/useBaseUrl'; +import styles from './styles.module.css'; + +const features = [ + { + title: <>Easy to Use, + imageUrl: 'img/undraw_docusaurus_mountain.svg', + description: ( + <> + Docusaurus was designed from the ground up to be easily installed and + used to get your website up and running quickly. + + ), + }, + { + title: <>Focus on What Matters, + imageUrl: 'img/undraw_docusaurus_tree.svg', + description: ( + <> + Docusaurus lets you focus on your docs, and we'll do the chores. Go + ahead and move your docs into the docs directory. + + ), + }, + { + title: <>Powered by React, + imageUrl: 'img/undraw_docusaurus_react.svg', + description: ( + <> + Extend or customize your website layout by reusing React. Docusaurus can + be extended while reusing the same header and footer. + + ), + }, +]; + +function Feature({imageUrl, title, description}) { + const imgUrl = useBaseUrl(imageUrl); + return ( +
+ {imgUrl && ( +
+ {title} +
+ )} +

{title}

+

{description}

+
+ ); +} + +function Home() { + const context = useDocusaurusContext(); + const {siteConfig = {}} = context; + return ( + +
+
+

{siteConfig.title}

+

{siteConfig.tagline}

+
+ + Get Started + +
+
+
+
+ {features && features.length && ( +
+
+
+ {features.map((props, idx) => ( + + ))} +
+
+
+ )} +
+
+ ); +} + +export default Home; diff --git a/packages/docusaurus-init/templates/bootstrap/src/pages/styles.module.css b/packages/docusaurus-init/templates/bootstrap/src/pages/styles.module.css new file mode 100644 index 000000000000..34f21992a2bf --- /dev/null +++ b/packages/docusaurus-init/templates/bootstrap/src/pages/styles.module.css @@ -0,0 +1,36 @@ +/* stylelint-disable docusaurus/copyright-header */ +/** + * CSS files with the .module.css suffix will be treated as CSS modules + * and scoped locally. + */ + +.heroBanner { + padding: 4rem 0; + text-align: center; + position: relative; + overflow: hidden; +} + +@media screen and (max-width: 966px) { + .heroBanner { + padding: 2rem; + } +} + +.buttons { + display: flex; + align-items: center; + justify-content: center; +} + +.features { + display: flex; + align-items: center; + padding: 2rem 0; + width: 100%; +} + +.featureImage { + height: 200px; + width: 200px; +} diff --git a/packages/docusaurus-init/templates/bootstrap/static/img/favicon.ico b/packages/docusaurus-init/templates/bootstrap/static/img/favicon.ico new file mode 100644 index 000000000000..be74abd69ad6 Binary files /dev/null and b/packages/docusaurus-init/templates/bootstrap/static/img/favicon.ico differ diff --git a/packages/docusaurus-init/templates/bootstrap/static/img/logo.svg b/packages/docusaurus-init/templates/bootstrap/static/img/logo.svg new file mode 100644 index 000000000000..9db6d0d066e3 --- /dev/null +++ b/packages/docusaurus-init/templates/bootstrap/static/img/logo.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/docusaurus-init/templates/bootstrap/static/img/undraw_docusaurus_mountain.svg b/packages/docusaurus-init/templates/bootstrap/static/img/undraw_docusaurus_mountain.svg new file mode 100644 index 000000000000..431cef2f7fec --- /dev/null +++ b/packages/docusaurus-init/templates/bootstrap/static/img/undraw_docusaurus_mountain.svg @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/docusaurus-init/templates/bootstrap/static/img/undraw_docusaurus_react.svg b/packages/docusaurus-init/templates/bootstrap/static/img/undraw_docusaurus_react.svg new file mode 100644 index 000000000000..e41705043338 --- /dev/null +++ b/packages/docusaurus-init/templates/bootstrap/static/img/undraw_docusaurus_react.svg @@ -0,0 +1,169 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/docusaurus-init/templates/bootstrap/static/img/undraw_docusaurus_tree.svg b/packages/docusaurus-init/templates/bootstrap/static/img/undraw_docusaurus_tree.svg new file mode 100644 index 000000000000..a05cc03dda90 --- /dev/null +++ b/packages/docusaurus-init/templates/bootstrap/static/img/undraw_docusaurus_tree.svg @@ -0,0 +1 @@ +docu_tree \ No newline at end of file diff --git a/packages/docusaurus-preset-bootstrap/package.json b/packages/docusaurus-preset-bootstrap/package.json new file mode 100644 index 000000000000..b3b2c0b40d96 --- /dev/null +++ b/packages/docusaurus-preset-bootstrap/package.json @@ -0,0 +1,19 @@ +{ + "name": "@docusaurus/preset-bootstrap", + "version": "2.0.0-alpha.50", + "description": "Preset for bootstrap Docusaurus", + "main": "src/index.js", + "license": "MIT", + "publishConfig": { + "access": "public" + }, + "dependencies": { + "@docusaurus/plugin-content-pages": "^2.0.0-alpha.50" + }, + "peerDependencies": { + "@docusaurus/core": "^2.0.0" + }, + "engines": { + "node": ">=10.9.0" + } +} diff --git a/packages/docusaurus-preset-bootstrap/src/index.js b/packages/docusaurus-preset-bootstrap/src/index.js new file mode 100644 index 000000000000..f0d18bed295f --- /dev/null +++ b/packages/docusaurus-preset-bootstrap/src/index.js @@ -0,0 +1,13 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +module.exports = function preset(context, opts = {}) { + return { + themes: [['@docusaurus/theme-bootstrap', opts.theme]], + plugins: [['@docusaurus/plugin-content-pages', opts.pages]], + }; +}; diff --git a/packages/docusaurus-preset-classic/src/index.js b/packages/docusaurus-preset-classic/src/index.js index 4bab01811101..ba7e92d39dbe 100644 --- a/packages/docusaurus-preset-classic/src/index.js +++ b/packages/docusaurus-preset-classic/src/index.js @@ -4,6 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ + const admonitions = require('remark-admonitions'); const addAdmonitions = (pluginOptions) => { diff --git a/packages/docusaurus-theme-bootstrap/package.json b/packages/docusaurus-theme-bootstrap/package.json new file mode 100644 index 000000000000..e783dbda9bda --- /dev/null +++ b/packages/docusaurus-theme-bootstrap/package.json @@ -0,0 +1,22 @@ +{ + "name": "@docusaurus/theme-bootstrap", + "version": "2.0.0-alpha.50", + "description": "Bootstrap theme for docusaurus", + "main": "src/index.js", + "license": "MIT", + "publishConfig": { + "access": "public" + }, + "dependencies": { + "bootstrap": "^4.4.1" + }, + "peerDependencies": { + "@docusaurus/core": "^2.0.0", + "react": "^16.8.4", + "react-dom": "^16.8.4", + "webpack": "^4.41.2" + }, + "engines": { + "node": ">=10.9.0" + } +} diff --git a/packages/docusaurus-theme-bootstrap/src/index.js b/packages/docusaurus-theme-bootstrap/src/index.js new file mode 100644 index 000000000000..81e9229420b2 --- /dev/null +++ b/packages/docusaurus-theme-bootstrap/src/index.js @@ -0,0 +1,20 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +const path = require('path'); + +module.exports = function () { + return { + name: 'docusaurus-theme-bootstrap', + getThemePath() { + return path.resolve(__dirname, './theme'); + }, + getClientModules() { + return ['bootstrap/dist/css/bootstrap.min.css']; + }, + }; +}; diff --git a/packages/docusaurus-theme-bootstrap/src/theme/NotFound.js b/packages/docusaurus-theme-bootstrap/src/theme/NotFound.js new file mode 100644 index 000000000000..649986ac9c46 --- /dev/null +++ b/packages/docusaurus-theme-bootstrap/src/theme/NotFound.js @@ -0,0 +1,30 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +import React from 'react'; +import Layout from '@theme/Layout'; + +function NotFound() { + return ( + +
+
+
+

Page Not Found

+

We could not find what you were looking for.

+

+ Please contact the owner of the site that linked you to the + original URL and let them know their link is broken. +

+
+
+
+
+ ); +} + +export default NotFound; diff --git a/yarn.lock b/yarn.lock index 74e2338a7cd3..236513bed4ea 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3926,6 +3926,11 @@ boolbase@^1.0.0, boolbase@~1.0.0: resolved "https://registry.yarnpkg.com/boolbase/-/boolbase-1.0.0.tgz#68dff5fbe60c51eb37725ea9e3ed310dcc1e776e" integrity sha1-aN/1++YMUes3cl6p4+0xDcwed24= +bootstrap@^4.4.1: + version "4.4.1" + resolved "https://registry.yarnpkg.com/bootstrap/-/bootstrap-4.4.1.tgz#8582960eea0c5cd2bede84d8b0baf3789c3e8b01" + integrity sha512-tbx5cHubwE6e2ZG7nqM3g/FZ5PQEDMWmMGNrCUBVRPHXTJaH7CBDdsLeu3eCh3B1tzAxTnAbtmrzvWEvT2NNEA== + brace-expansion@^1.1.7: version "1.1.11" resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd"