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

chore: move to monorepo #1297

Merged
merged 6 commits into from
Mar 23, 2019
Merged
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
132 changes: 24 additions & 108 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,40 +14,6 @@ aliases:
- ~/.cache/yarn
key: root-yarn-{{ .Branch }}-{{ checksum "yarn.lock" }}

- &v1-yarn |
cd v1
yarn install --non-interactive --cache-folder ~/.cache/yarn

- &v1-restore-yarn-cache
keys:
- v1-yarn-{{ .Branch }}-{{ checksum "yarn.lock" }}
# Fallback in case checksum fails
- v1-yarn-{{ .Branch }}-

- &v1-save-yarn-cache
paths:
- v1/node_modules
- ~/.cache/yarn
key: v1-yarn-{{ .Branch }}-{{ checksum "yarn.lock" }}

- &v2-yarn |
cd v2
yarn install --non-interactive --cache-folder ~/.cache/yarn
cd ../v2-website
yarn install --non-interactive --cache-folder ~/.cache/yarn

- &v2-restore-yarn-cache
keys:
- v2-yarn-{{ .Branch }}-{{ checksum "yarn.lock" }}
# Fallback in case checksum fails
- v2-yarn-{{ .Branch }}-

- &v2-save-yarn-cache
paths:
- v2/node_modules
- ~/.cache/yarn
key: v2-yarn-{{ .Branch }}-{{ checksum "yarn.lock" }}

- &filter-only-master
branches:
only:
Expand All @@ -65,45 +31,43 @@ defaults: &defaults

version: 2
jobs:
prettier:
lint-prettier:
<<: *defaults
steps:
- checkout
- restore-cache: *root-restore-yarn-cache
- run: *root-yarn
- save-cache: *root-save-yarn-cache
- run:
name: Check ESLint
command: yarn lint
- run:
name: Check Prettier
command: |
yarn install
yarn prettier:diff
command: yarn prettier:diff

v1-tests:
tests:
<<: *defaults
steps:
- checkout
- restore-cache: *v1-restore-yarn-cache
- run: *v1-yarn
- save-cache: *v1-save-yarn-cache
- run:
name: Check ESLint
command: cd v1 && yarn lint
- restore-cache: *root-restore-yarn-cache
- run: *root-yarn
- save-cache: *root-save-yarn-cache
- run:
name: Run Test Suites
command: cd v1 && yarn test
command: yarn test
- run:
name: Test v1 static website Builds
command: cd website-1.x && yarn build
- run:
name: Test Static Website Builds
command: cd v1/website && yarn build
name: Test v2 static website Builds
command: cd website && yarn build

# The CIRCLE_ variables are defined during the CircleCI build process
# https://circleci.com/docs/1.0/environment-variables/
v1-deploy-website:
deploy-website:
<<: *defaults
steps:
- checkout
- restore-cache: *v1-restore-yarn-cache
- run: *v1-yarn
- save-cache: *v1-save-yarn-cache
- run:
name: Configure GitHub Bot
# Do not do this if we don't have the right org (facebook), or if this is just a pull request
Expand All @@ -120,7 +84,7 @@ jobs:
if [[ $CIRCLE_PROJECT_USERNAME == "facebook" && -z $CI_PULL_REQUEST && -z $CIRCLE_PR_USERNAME ]]; then
echo "Deploying website..."
# install Docusaurus and generate file of English strings
cd v1 && yarn && cd website && yarn run write-translations
cd website-1.x && yarn run write-translations
# install Crowdin
sudo apt-get update
sudo apt-get install default-jre rsync
Expand All @@ -136,68 +100,20 @@ jobs:
echo "Skipping deploy."
fi

v2-tests:
<<: *defaults
steps:
- checkout
- restore-cache: *v2-restore-yarn-cache
- run: *v2-yarn
- save-cache: *v2-save-yarn-cache
- run:
name: Check ESLint
command: cd v2 && yarn lint
- run:
name: Run Test Suites
command: cd v2 && yarn test
- run:
name: Test Static Website Builds
command: cd v2-website && yarn build

publish-npm:
<<: *defaults
steps:
- checkout
- restore-cache: *v1-restore-yarn-cache
- run: *v1-yarn
- save-cache: *v1-save-yarn-cache
- ? run
name: Publish Docusaurus Package
command: |
if [ -z "$CIRCLE_PULL_REQUEST" ]; then
echo "//registry.npmjs.org/:_authToken=${CIRCLE_NPM_TOKEN}" > ~/.npmrc
node ./scripts/publish-npm.js
else
echo "Skipping publication."
fi

# Workflows enables us to run multiple jobs in parallel
workflows:
version: 2

prettier:
lint-prettier:
jobs:
- prettier:
- lint-prettier:
filters: *filter-ignore-gh-pages

v1:
tests-and-deploy:
jobs:
- v1-tests:
- tests:
filters: *filter-ignore-gh-pages
- v1-deploy-website:
requires:
- v1-tests
filters: *filter-only-master

v2:
jobs:
- v2-tests:
filters: *filter-ignore-gh-pages

deploy:
jobs:
- hold:
type: approval
- publish-npm:
- deploy-website:
requires:
- hold
filters: *filter-only-master
- tests
filters: *filter-only-master
9 changes: 9 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
__fixtures__
dist
node_modules
build
jest.config.js
jest.transform.js
website-1.x/
website/
scripts
File renamed without changes.
4 changes: 4 additions & 0 deletions v2/babel.config.js → babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,8 @@

module.exports = {
presets: ['@babel/env', '@babel/react'],
plugins: [
'@babel/plugin-proposal-class-properties',
'@babel/plugin-proposal-object-rest-spread',
],
};
22 changes: 22 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/**
* Copyright (c) 2017-present, Facebook, Inc.
*
* 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 = {
rootDir: path.resolve(__dirname),
verbose: true,
testURL: 'http://localhost/',
testEnvironment: 'node',
moduleNameMapper: {
'^@lib/(.*)$': '<rootDir>/packages/docusaurus/lib/$1',
},
testPathIgnorePatterns: ['/node_modules/', '__fixtures__'],
transform: {
'^.+\\.js$': '<rootDir>/jest.transform.js',
},
};
File renamed without changes.
6 changes: 6 additions & 0 deletions lerna.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"lerna": "3.13.1",
"version": "independent",
"npmClient": "yarn",
"useWorkspaces": true
}
43 changes: 29 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,27 +1,42 @@
{
"keywords": ["documentation", "websites", "open source", "docusaurus"],
"repository": {
"type": "git",
"url": "https://github.com/facebook/Docusaurus.git"
},
"private": true,
"workspaces": [
"packages/*",
"website",
"website-1.x"
],
"scripts": {
"lint:v1": "cd v1 && yarn lint",
"lint:v2": "cd v2 && yarn lint",
"prettier:v1": "cd v1 && yarn prettier",
"prettier:v2": "cd v2 && yarn prettier",
"prettier": "yarn prettier:v1 && yarn prettier:v2",
"prettier": "prettier --config .prettierrc --write \"**/*.js\"",
"prettier:diff": "prettier --config .prettierrc --list-different \"**/*.js\"",
"start": "cd v1/website && yarn start"
"lint": "eslint --cache \"**/*.js\"",
"lerna": "lerna",
"test": "jest"
},
"devDependencies": {
"lerna": "^3.13.1",
"husky": "^1.3.1",
"lint-staged": "^7.2.0",
"prettier": "^1.13.7"
"prettier": "^1.13.7",
"babel-core": "^7.0.0-bridge.0",
"babel-eslint": "8",
"eslint": "4.x",
"eslint-config-airbnb": "17.1.0",
"eslint-config-prettier": "^2.9.0",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-jsx-a11y": "^6.0.3",
"eslint-plugin-react": "^7.11.1",
"eslint-plugin-react-hooks": "^0.0.0",
"jest": "^24.1.0",
"react": "^16.8.4",
"react-dom": "^16.8.4",
"filepath": "^1.1.0",
"front-matter": "^2.3.0",
"rimraf": "^2.6.2",
"glob-promise": "^3.3.0"
},
"lint-staged": {
"linters": {
"v1/**/*.js": ["yarn lint:v1 --fix", "yarn prettier:v1", "git add"],
"v2/**/*.js": ["yarn lint:v2 --fix", "yarn prettier:v2", "git add"]
"*.js": ["yarn lint --fix", "yarn prettier", "git add"]
}
},
"husky": {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
21 changes: 20 additions & 1 deletion v1/README.md → packages/docusaurus-1.x/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@
</h1>

<p align="center">
<a href="https://www.npmjs.com/package/docusaurus"><a href="#backers" alt="sponsors on Open Collective"><img src="https://opencollective.com/Docusaurus/backers/badge.svg" /></a> <a href="#sponsors" alt="Sponsors on Open Collective"><img src="https://opencollective.com/Docusaurus/sponsors/badge.svg" /></a> <img src="https://img.shields.io/npm/v/docusaurus.svg?style=flat" alt="npm version"></a>
<a href="#backers" alt="sponsors on Open Collective"><img src="https://opencollective.com/Docusaurus/backers/badge.svg" /></a>
<a href="#sponsors" alt="Sponsors on Open Collective"><img src="https://opencollective.com/Docusaurus/sponsors/badge.svg" /></a>
<a href="https://www.npmjs.com/package/docusaurus"><img src="https://img.shields.io/npm/v/docusaurus.svg?style=flat" alt="npm version"></a>
<a href="https://circleci.com/gh/facebook/Docusaurus"><img src="https://circleci.com/gh/facebook/Docusaurus.svg?style=shield" alt="CircleCI Status"></a>
<a href="CONTRIBUTING.md#pull-requests"><img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg" alt="PRs Welcome"></a>
<a href="https://discord.gg/docusaurus"><img src="https://img.shields.io/badge/chat-on%20discord-7289da.svg" alt="Chat"></a>
<a href="https://github.com/prettier/prettier"><img alt="code style: prettier" src="https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square"></a>
<a href="https://github.com/facebook/jest"><img src="https://img.shields.io/badge/tested_with-jest-99424f.svg" alt="Tested with Jest"></a>
<a href="https://app.netlify.com/sites/docusaurus-preview/deploys"><img src="https://api.netlify.com/api/v1/badges/57ebb454-c937-4c1d-a228-d9dccb494f49/deploy-status" alt="Netlify Status"></a>
</p>

## Introduction
Expand All @@ -26,6 +29,22 @@ Docusaurus is available as the [`docusaurus` package](https://www.npmjs.com/pack

We have also released the [`docusaurus-init` package](https://www.npmjs.com/package/docusaurus-init) to make [getting started](https://docusaurus.io/docs/en/installation.html) with Docusaurus even easier.

## Contributing

We've released Docusaurus because it helps us better scale and support the many OSS projects at Facebook. We hope that other organizations can benefit from the project. We are thankful for any contributions from the community.

### [Code of Conduct](https://code.fb.com/codeofconduct)

Facebook has adopted a Code of Conduct that we expect project participants to adhere to. Please read [the full text](https://code.fb.com/codeofconduct) so that you can understand what actions will and will not be tolerated.

### Contributing Guide

Read our [contributing guide](https://github.com/facebook/Docusaurus/blob/master/CONTRIBUTING.md) to learn about our development process, how to propose bugfixes and improvements, and how to build and test your changes to Docusaurus.

### Beginner Friendly Bugs

To help you get your feet wet and get you familiar with our contribution process, we have a list of [beginner friendly bugs](https://github.com/facebook/Docusaurus/labels/good%20first%20issue) that contain bugs which are fairly easy to fix. This is a great place to get started.

## Contact

We have a few channels for contact:
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ const CWD = process.cwd();

const loadConfig = require('../server/config');

const siteConfig = loadConfig(`${CWD}/website/siteConfig.js`);
const buildDir = `${CWD}/website/build`;
const siteConfig = loadConfig(`${CWD}/website-1.x/siteConfig.js`);
const buildDir = `${CWD}/website-1.x/build`;
const docsDir = `${CWD}/docs`;

let inputMarkdownFiles = [];
Expand All @@ -27,7 +27,7 @@ let outputHTMLFiles = [];
let outputAssetsFiles = [];

function generateSite() {
shell.cd('website');
shell.cd('website-1.x');
shell.exec('yarn build', {silent: true});
}

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading