Move Docusaurus 1 files into directory (#966)

* Move Docusaurus 1 into v1 directory

* Update Circle CI commands for new v1 dir

* Remove OC

* Fix tests
This commit is contained in:
Yangshun Tay 2018-09-18 00:58:07 +08:00 committed by GitHub
parent 9d4a5d5359
commit f2927a9fc4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
291 changed files with 7591 additions and 6532 deletions

View file

@ -8,6 +8,7 @@ aliases:
- &save-yarn-cache
paths:
- node_modules
- v1/node_modules
- ~/.cache/yarn
key: v1-yarn-{{ .Branch }}-{{ checksum "yarn.lock" }}
@ -23,6 +24,8 @@ aliases:
- &yarn
|
yarn install --non-interactive --cache-folder ~/.cache/yarn
cd v1 &&
yarn install --non-interactive --cache-folder ~/.cache/yarn
defaults: &defaults
working_directory: ~/docusaurus
@ -41,13 +44,13 @@ jobs:
- save-cache: *save-yarn-cache
- run:
name: Check Prettier & ESLint
command: yarn ci-check
command: cd v1 && yarn ci-check
- run:
name: Run Test Suites
command: yarn test
command: cd v1 && yarn test
- run:
name: Test Static Website Builds
command: cd website && yarn run build
command: cd v1/website && yarn run build
# The CIRCLE_ variables are defined during the CircleCI build process
# https://circleci.com/docs/1.0/environment-variables/
@ -74,7 +77,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
yarn && cd website && yarn run write-translations
cd v1 && yarn && cd website && yarn run write-translations
# install Crowdin
sudo apt-get update
sudo apt-get install default-jre rsync

10
.gitignore vendored
View file

@ -6,15 +6,5 @@
node_modules
.eslintcache
lib/core/metadata.js
lib/core/MetadataBlog.js
lib/pages/
website/build/
website/i18n/*
website/node_modules
website/package-lock.json
website/translated_docs
website/yarn.lock
yarn-error.log

View file

@ -1,112 +1,23 @@
{
"name": "docusaurus",
"description": "Easy to Maintain Open Source Documentation Websites",
"version": "1.4.0",
"license": "MIT",
"keywords": ["documentation", "websites", "open source", "docusaurus"],
"repository": {
"type": "git",
"url": "https://github.com/facebook/Docusaurus.git"
},
"scripts": {
"ci-check": "yarn lint && yarn prettier:diff",
"lint": "eslint --cache \"lib/**/*.js\" \"examples/**/*.js\" \"website/**/*.js\"",
"precommit": "lint-staged",
"ci-check": "yarn prettier && cd v1 && yarn ci-check",
"prettier": "prettier --config .prettierrc --write \"**/*.js\"",
"prettier:diff": "prettier --config .prettierrc --list-different \"**/*.js\"",
"test": "jest",
"start": "cd website && yarn start",
"postinstall": "opencollective postinstall"
"start": "cd v1/website && yarn start"
},
"devDependencies": {
"husky": "^0.14.3",
"lint-staged": "^7.2.0",
"prettier": "^1.13.7"
},
"lint-staged": {
"linters": {
"{lib,examples,website}/**/*.js": [
"yarn lint --fix",
"yarn prettier",
"git add"
]
"{v1,v2}/**/*.js": ["yarn lint --fix", "yarn prettier", "git add"]
}
},
"jest": {
"testPathIgnorePatterns": ["/node_modules/", "__fixtures__", "v2"],
"testURL": "http://localhost/"
},
"bin": {
"docusaurus-start": "./lib/start-server.js",
"docusaurus-build": "./lib/build-files.js",
"docusaurus-publish": "./lib/publish-gh-pages.js",
"docusaurus-examples": "./lib/copy-examples.js",
"docusaurus-write-translations": "./lib/write-translations.js",
"docusaurus-version": "./lib/version.js",
"docusaurus-rename-version": "./lib/rename-version.js"
},
"dependencies": {
"autoprefixer": "^9.1.5",
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-polyfill": "^6.26.0",
"babel-preset-env": "^1.7.0",
"babel-preset-react": "^6.24.1",
"babel-register": "^6.24.1",
"babel-traverse": "^6.25.0",
"babylon": "^6.17.4",
"chalk": "^2.1.0",
"classnames": "^2.2.6",
"color": "^2.0.1",
"commander": "^2.18.0",
"cross-spawn": "^6.0.5",
"crowdin-cli": "^0.3.0",
"cssnano": "^3.10.0",
"deepmerge": "^2.1.1",
"escape-string-regexp": "^1.0.5",
"express": "^4.15.3",
"feed": "^1.1.0",
"fs-extra": "^5.0.0",
"gaze": "^1.1.2",
"glob": "^7.1.3",
"highlight.js": "^9.12.0",
"imagemin": "^5.3.1",
"imagemin-gifsicle": "^5.2.0",
"imagemin-jpegtran": "^5.0.2",
"imagemin-optipng": "^5.2.1",
"imagemin-svgo": "^6.0.0",
"markdown-toc": "^1.2.0",
"mkdirp": "^0.5.1",
"opencollective": "^1.0.3",
"portfinder": "^1.0.17",
"postcss": "^7.0.1",
"prismjs": "^1.15.0",
"react": "^16.5.0",
"react-dev-utils": "^5.0.2",
"react-dom": "^16.5.0",
"remarkable": "^1.7.1",
"request": "^2.87.0",
"shelljs": "^0.7.8",
"sitemap": "^1.13.0",
"tcp-port-used": "^0.1.2",
"tiny-lr": "^1.1.1",
"tree-node-cli": "^1.2.5",
"truncate-html": "^1.0.1"
},
"devDependencies": {
"babel-eslint": "^8.2.5",
"eslint": "^4.19.1",
"eslint-config-airbnb": "17.0.0",
"eslint-config-prettier": "^2.9.0",
"eslint-plugin-import": "^2.12.0",
"eslint-plugin-jsx-a11y": "^6.0.3",
"eslint-plugin-react": "^7.9.1",
"filepath": "^1.1.0",
"front-matter": "^2.3.0",
"glob-promise": "^3.3.0",
"husky": "^0.14.3",
"jest": "^23.6.0",
"lint-staged": "^7.2.0",
"prettier": "^1.13.7",
"rimraf": "^2.6.2"
},
"collective": {
"type": "opencollective",
"url": "https://opencollective.com/Docusaurus"
}
}

10
v1/.gitignore vendored Normal file
View file

@ -0,0 +1,10 @@
lib/core/metadata.js
lib/core/MetadataBlog.js
lib/pages/
website/build/
website/i18n/*
website/node_modules
website/package-lock.json
website/translated_docs
website/yarn.lock

View file

@ -1,9 +1,6 @@
node_modules
.DS_Store
lib/core/metadata.js
lib/core/MetadataBlog.js
yarn-error.log
yarn.lock
website
docs
docusaurus-init
v2

View file

Before

Width:  |  Height:  |  Size: 76 KiB

After

Width:  |  Height:  |  Size: 76 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 984 B

After

Width:  |  Height:  |  Size: 984 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 9.4 KiB

After

Width:  |  Height:  |  Size: 9.4 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

Before After
Before After

View file

@ -81,15 +81,18 @@ describe('mdToHtmlify', () => {
describe('getFile', () => {
const fakeContent = {
'website/translated_docs/ko/doc1.md': '이건 가짜 야',
'website/versioned_docs/version-1.0.0/doc2.md': 'Document 2 is not good',
'website/translated_docs/ko/version-1.0.0/doc1.md':
'v1/website/translated_docs/ko/doc1.md': '이건 가짜 야',
'v1/website/versioned_docs/version-1.0.0/doc2.md': 'Document 2 is not good',
'v1/website/translated_docs/ko/version-1.0.0/doc1.md':
'이것은 오래된 가짜입니다.',
'docs/doc1.md': 'Just another document',
};
fs.existsSync = jest.fn().mockReturnValue(true);
fs.readFileSync = jest.fn().mockImplementation(file => {
const fakePath = file.replace(process.cwd().replace(/website$/, ''), '');
const fakePath = file.replace(
process.cwd().replace(/v1\/website\/?$/, ''),
'',
);
const normalizedPath = fakePath.replace(/\\/g, '/');
return fakeContent[normalizedPath];
});
@ -108,21 +111,21 @@ describe('getFile', () => {
test('translated docs', () => {
const metadata = Metadata['ko-doc1'];
expect(docs.getFile(metadata)).toEqual(
fakeContent['website/translated_docs/ko/doc1.md'],
fakeContent['v1/website/translated_docs/ko/doc1.md'],
);
});
test('versioned docs', () => {
const metadata = Metadata['en-version-1.0.0-doc2'];
expect(docs.getFile(metadata)).toEqual(
fakeContent['website/versioned_docs/version-1.0.0/doc2.md'],
fakeContent['v1/website/versioned_docs/version-1.0.0/doc2.md'],
);
});
test('translated & versioned docs', () => {
const metadata = Metadata['ko-version-1.0.0-doc1'];
expect(docs.getFile(metadata)).toEqual(
fakeContent['website/translated_docs/ko/version-1.0.0/doc1.md'],
fakeContent['v1/website/translated_docs/ko/version-1.0.0/doc1.md'],
);
});

Some files were not shown because too many files have changed in this diff Show more