Skip to content

Commit

Permalink
Move Docusaurus 1 files into directory (#966)
Browse files Browse the repository at this point in the history
* Move Docusaurus 1 into v1 directory

* Update Circle CI commands for new v1 dir

* Remove OC

* Fix tests
  • Loading branch information
yangshun authored Sep 17, 2018
1 parent 9d4a5d5 commit f2927a9
Show file tree
Hide file tree
Showing 291 changed files with 8,163 additions and 7,104 deletions.
11 changes: 7 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ aliases:
- &save-yarn-cache
paths:
- node_modules
- v1/node_modules
- ~/.cache/yarn
key: v1-yarn-{{ .Branch }}-{{ checksum "yarn.lock" }}

Expand All @@ -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
Expand All @@ -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/
Expand All @@ -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
Expand Down
10 changes: 0 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
103 changes: 7 additions & 96 deletions package.json
Original file line number Diff line number Diff line change
@@ -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"
},
"lint-staged": {
"linters": {
"{lib,examples,website}/**/*.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"
"start": "cd v1/website && yarn start"
},
"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"
"prettier": "^1.13.7"
},
"collective": {
"type": "opencollective",
"url": "https://opencollective.com/Docusaurus"
"lint-staged": {
"linters": {
"{v1,v2}/**/*.js": ["yarn lint --fix", "yarn prettier", "git add"]
}
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 10 additions & 0 deletions v1/.gitignore
Original file line number Diff line number Diff line change
@@ -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
5 changes: 1 addition & 4 deletions .npmignore → v1/.npmignore
Original file line number Diff line number Diff line change
@@ -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
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.
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.
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.
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.
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.
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.
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.
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.
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.
Original file line number Diff line number Diff line change
Expand Up @@ -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];
});
Expand All @@ -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'],
);
});

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.
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.
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.
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.
File renamed without changes.
93 changes: 93 additions & 0 deletions v1/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
{
"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",
"lint": "eslint --cache \"lib/**/*.js\" \"examples/**/*.js\" \"website/**/*.js\"",
"test": "jest",
"start": "cd website && yarn start"
},
"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",
"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",
"rimraf": "^2.6.2"
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion website/package.json → v1/website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
},
"dependencies": {
"async": "^2.5.0",
"docusaurus": "../../Docusaurus/"
"docusaurus": "../"
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions website/siteConfig.js → v1/website/siteConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ const siteConfig = {
zIndex: 100,
},
enableUpdateTime: true,
customDocsPath: '../docs',
};

module.exports = siteConfig;
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
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
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
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
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
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
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
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit f2927a9

Please sign in to comment.