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

Update CI for v1 #968

Merged
merged 4 commits into from
Sep 19, 2018
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
118 changes: 92 additions & 26 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,54 @@
aliases:
- &restore-yarn-cache
- &root-yarn
|
yarn install --non-interactive --cache-folder ~/.cache/yarn

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

- &root-save-yarn-cache
paths:
- node_modules
- ~/.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 }}-

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

- &v2-yarn
|
cd v2
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 @@ -21,12 +58,6 @@ aliases:
branches:
ignore: gh-pages

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

defaults: &defaults
working_directory: ~/docusaurus
docker:
Expand All @@ -35,32 +66,62 @@ defaults: &defaults

version: 2
jobs:
tests:
prettier:
<<: *defaults
steps:
- checkout
- restore-cache: *restore-yarn-cache
- run: *yarn
- save-cache: *save-yarn-cache
- restore-cache: *root-restore-yarn-cache
- run: *root-yarn
- save-cache: *root-save-yarn-cache
- run:
name: Check Prettier & ESLint
command: cd v1 && yarn ci-check
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prettier is no longer being run. Is this intentional ?

name: Check Prettier
command: |
yarn install
yarn prettier:diff

v1-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
- run:
name: Run Test Suites
command: cd v1 && yarn test
- run:
name: Test Static Website Builds
command: cd v1/website && yarn run build

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 run build

# The CIRCLE_ variables are defined during the CircleCI build process
# https://circleci.com/docs/1.0/environment-variables/
deploy-website:
v1-deploy-website:
<<: *defaults
steps:
- checkout
- restore-cache: *restore-yarn-cache
- run: *yarn
- save-cache: *save-yarn-cache
- 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 Down Expand Up @@ -97,9 +158,9 @@ jobs:
<<: *defaults
steps:
- checkout
- restore-cache: *restore-yarn-cache
- run: *yarn
- save-cache: *save-yarn-cache
- restore-cache: *v1-restore-yarn-cache
- run: *v1-yarn
- save-cache: *v1-save-yarn-cache
- run:
name: Publish Docusaurus Package
command: |
Expand All @@ -114,13 +175,18 @@ jobs:
workflows:
version: 2

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

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

deploy:
Expand Down
69 changes: 33 additions & 36 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ Facebook has adopted a Code of Conduct that we expect project participants to ad

There are many ways to contribute to Docusaurus, and many of them do not involve writing any code. Here's a few ideas to get started:

* Simply start using Docusaurus. Go through the [Getting Started](https://docusaurus.io/docs/en/installation.html) guide. Does everything work as expected? If not, we're always looking for improvements. Let us know by [opening an issue](#reporting-new-issues).
* Look through the [open issues](https://github.com/facebook/docusaurus/issues). Provide workarounds, ask for clarification, or suggest labels. Help [triage issues](#triaging-issues-and-pull-requests).
* If you find an issue you would like to fix, [open a pull request](#your-first-pull-request). Issues tagged as [_Good first issue_](https://github.com/facebook/docusaurus/labels/Good%20first%20issue) are a good place to get started.
* Read through the [Docusaurus docs](https://docusaurus.io/docs/en/installation.html). If you find anything that is confusing or can be improved, you can make edits by clicking "Edit" at the top of most docs.
* Take a look at the [features requested](https://github.com/facebook/docusaurus/labels/enhancement) by others in the community and consider opening a pull request if you see something you want to work on.
- Simply start using Docusaurus. Go through the [Getting Started](https://docusaurus.io/docs/en/installation.html) guide. Does everything work as expected? If not, we're always looking for improvements. Let us know by [opening an issue](#reporting-new-issues).
- Look through the [open issues](https://github.com/facebook/docusaurus/issues). Provide workarounds, ask for clarification, or suggest labels. Help [triage issues](#triaging-issues-and-pull-requests).
- If you find an issue you would like to fix, [open a pull request](#your-first-pull-request). Issues tagged as [_Good first issue_](https://github.com/facebook/docusaurus/labels/Good%20first%20issue) are a good place to get started.
- Read through the [Docusaurus docs](https://docusaurus.io/docs/en/installation.html). If you find anything that is confusing or can be improved, you can make edits by clicking "Edit" at the top of most docs.
- Take a look at the [features requested](https://github.com/facebook/docusaurus/labels/enhancement) by others in the community and consider opening a pull request if you see something you want to work on.

Contributions are very welcome. If you think you need help planning your contribution, please ping us on Twitter at [@docusaurus](https://twitter.com/docusaurus) and let us know you are looking for a bit of help.

Expand All @@ -26,10 +26,10 @@ We have `#docusaurus-dev` on [Discord](https://discord.gg/docusaurus) to discuss

One great way you can contribute to the project without writing any code is to help triage issues and pull requests as they come in.

* Ask for more information if you believe the issue does not provide all the details required to solve it.
* Suggest [labels](https://github.com/facebook/docusaurus/labels) that can help categorize issues.
* Flag issues that are stale or that should be closed.
* Ask for test plans and review code.
- Ask for more information if you believe the issue does not provide all the details required to solve it.
- Suggest [labels](https://github.com/facebook/docusaurus/labels) that can help categorize issues.
- Flag issues that are stale or that should be closed.
- Ask for test plans and review code.

## Our development process

Expand Down Expand Up @@ -57,13 +57,23 @@ You can also file issues as [feature requests or enhancements](https://github.co

When [opening a new issue](https://github.com/facebook/docusaurus/issues/new/choose), always make sure to fill out the issue template. **This step is very important!** Not doing so may result in your issue not managed in a timely fashion. Don't take this personally if this happens, and feel free to open a new issue once you've gathered all the information required by the template.

* **One issue, one bug:** Please report a single bug per issue.
* **Provide reproduction steps:** List all the steps necessary to reproduce the issue. The person reading your bug report should be able to follow these steps to reproduce your issue with minimal effort.
- **One issue, one bug:** Please report a single bug per issue.
- **Provide reproduction steps:** List all the steps necessary to reproduce the issue. The person reading your bug report should be able to follow these steps to reproduce your issue with minimal effort.

### Security bugs

Facebook has a [bounty program](https://www.facebook.com/whitehat/) for the safe disclosure of security bugs. With that in mind, please do not file public issues; go through the process outlined on that page.

## Installation

1. Ensure you have [Yarn](https://yarnpkg.com/) installed.
1. After cloning the repository, run `yarn install` in the root of the repository.

- For Docusaurus 1 development, go into the `v1` directory and do `yarn install`.
- For Docusaurus 2 development, go into the `v2` directory and do `yarn install`.

1. Run `yarn start` in the respective project directory to start a local development server serving the Docusaurus docs.

## Pull requests

### Your first pull request
Expand Down Expand Up @@ -93,8 +103,8 @@ Please make sure the following is done when submitting a pull request:
1. Fork [the repository](https://github.com/facebook/docusaurus) and create your branch from `master`.
1. Add the copyright notice to the top of any code new files you've added.
1. Describe your [**test plan**](#test-plan) in your pull request description. Make sure to [test your changes](https://github.com/facebook/Docusaurus/blob/master/admin/testing-changes-on-Docusaurus-itself.md)!
1. Make sure your code lints (`npm run prettier && npm run lint`).
1. Make sure our Jest tests pass (`npm run test`).
1. Make sure your code lints (`yarn prettier && yarn lint`).
1. Make sure your Jest tests pass (`yarn test`).
1. If you haven't already, [sign the CLA](https://code.facebook.com/cla).

All pull requests should be opened against the `master` branch.
Expand All @@ -103,7 +113,7 @@ All pull requests should be opened against the `master` branch.

A good test plan has the exact commands you ran and their output, provides screenshots or videos if the pull request changes UI.

* If you've changed APIs, update the documentation.
- If you've changed APIs, update the documentation.

#### Breaking changes

Expand All @@ -112,10 +122,10 @@ When adding a new breaking change, follow this template in your pull request:
```md
### New breaking change here

* **Who does this affect**:
* **How to migrate**:
* **Why make this breaking change**:
* **Severity (number of people affected x effort)**:
- **Who does this affect**:
- **How to migrate**:
- **Why make this breaking change**:
- **Severity (number of people affected x effort)**:
```

#### Copyright Notice for code files
Expand Down Expand Up @@ -149,30 +159,17 @@ However, there are still some styles that Prettier cannot pick up.

#### General

* **Most important: Look around.** Match the style you see used in the rest of the project. This includes formatting, naming things in code, naming things in documentation.
* Add trailing commas,
* 2 spaces for indentation (no tabs)
* "Attractive"
- **Most important: Look around.** Match the style you see used in the rest of the project. This includes formatting, naming files, naming things in code, naming things in documentation.
- "Attractive"

#### JavaScript

* Use semicolons;
* ES6 standards
* Prefer `'` over `"`
* Do not use the optional parameters of `setTimeout` and `setInterval`
* 80 character line length

#### JSX

* Prefer `"` over `'` for string literal props
* When wrapping opening tags over multiple lines, place one prop per line
* `{}` of props should hug their values (no spaces)
* Place the closing `>` of opening tags on the same line as the last prop
* Place the closing `/>` of self-closing tags on their own line and left-align them with the opening `<`
- ES6 standards. Prefer using modern language features where they make the code better.
- Do not use the optional parameters of `setTimeout` and `setInterval`

### Documentation

* Do not wrap lines at 80 characters - configure your editor to soft-wrap when editing documentation.
- Do not wrap lines at 80 characters - configure your editor to soft-wrap when editing documentation.

## License

Expand Down
16 changes: 5 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@

Docusaurus is a project for easily building, deploying, and maintaining open source project websites.

* **Simple to Start** Docusaurus is built to be easy to [get up and running](https://docusaurus.io/docs/en/installation.html) in as little time possible. We've built Docusaurus to handle the website build process so you can focus on your project.
* **Localizable** Docusaurus ships with [localization support](https://docusaurus.io/docs/en/translation.html) via CrowdIn. Empower and grow your international community by translating your documentation.
* **Customizable** While Docusaurus ships with the key pages and sections you need to get started, including a home page, a docs section, a [blog](https://docusaurus.io/docs/en/blog.html), and additional support pages, it is also [customizable](https://docusaurus.io/docs/en/custom-pages.html) as well to ensure you have a site that is [uniquely yours](https://docusaurus.io/docs/en/api-pages.html).
- **Simple to Start** Docusaurus is built to be easy to [get up and running](https://docusaurus.io/docs/en/installation.html) in as little time possible. We've built Docusaurus to handle the website build process so you can focus on your project.
- **Localizable** Docusaurus ships with [localization support](https://docusaurus.io/docs/en/translation.html) via CrowdIn. Empower and grow your international community by translating your documentation.
- **Customizable** While Docusaurus ships with the key pages and sections you need to get started, including a home page, a docs section, a [blog](https://docusaurus.io/docs/en/blog.html), and additional support pages, it is also [customizable](https://docusaurus.io/docs/en/custom-pages.html) as well to ensure you have a site that is [uniquely yours](https://docusaurus.io/docs/en/api-pages.html).

## Installation

Expand Down Expand Up @@ -54,25 +54,19 @@ We have a few channels for contact:

## Contributors

This project exists thanks to all the people who contribute. [[Contribute](CONTRIBUTING.md)].
<a href="https://github.com/facebook/Docusaurus/graphs/contributors"><img src="https://opencollective.com/Docusaurus/contributors.svg?width=890&button=false" /></a>

This project exists thanks to all the people who contribute. [[Contribute](CONTRIBUTING.md)]. <a href="https://github.com/facebook/Docusaurus/graphs/contributors"><img src="https://opencollective.com/Docusaurus/contributors.svg?width=890&button=false" /></a>

## Backers

Thank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/Docusaurus#backer)]

<a href="https://opencollective.com/Docusaurus#backers" target="_blank"><img src="https://opencollective.com/Docusaurus/backers.svg?width=890"></a>


## Sponsors

Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [[Become a sponsor](https://opencollective.com/Docusaurus#sponsor)]

<a href="https://opencollective.com/Docusaurus/sponsor/0/website" target="_blank"><img src="https://opencollective.com/Docusaurus/sponsor/0/avatar.svg"></a>
<a href="https://opencollective.com/Docusaurus/sponsor/1/website" target="_blank"><img src="https://opencollective.com/Docusaurus/sponsor/1/avatar.svg"></a>


<a href="https://opencollective.com/Docusaurus/sponsor/0/website" target="_blank"><img src="https://opencollective.com/Docusaurus/sponsor/0/avatar.svg"></a> <a href="https://opencollective.com/Docusaurus/sponsor/1/website" target="_blank"><img src="https://opencollective.com/Docusaurus/sponsor/1/avatar.svg"></a>

## License

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"url": "https://github.com/facebook/Docusaurus.git"
},
"scripts": {
"ci-check": "yarn prettier && cd v1 && yarn ci-check",
"precommit": "lint-staged",
"prettier": "prettier --config .prettierrc --write \"**/*.js\"",
"prettier:diff": "prettier --config .prettierrc --list-different \"**/*.js\"",
"start": "cd v1/website && yarn start"
Expand Down
1 change: 0 additions & 1 deletion v1/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
"url": "https://github.com/facebook/Docusaurus.git"
},
"scripts": {
"ci-check": "yarn lint",
"lint": "eslint --cache \"lib/**/*.js\" \"examples/**/*.js\" \"website/**/*.js\"",
"test": "jest",
"start": "cd website && yarn start"
Expand Down
1 change: 0 additions & 1 deletion v2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"munseo": "bin/munseo.js"
},
"scripts": {
"ci-check": "yarn lint",
"munseo": "node bin/munseo",
"start": "node bin/munseo start website",
"build": "node bin/munseo build website",
Expand Down