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
|
@ -8,6 +8,7 @@ aliases:
|
||||||
- &save-yarn-cache
|
- &save-yarn-cache
|
||||||
paths:
|
paths:
|
||||||
- node_modules
|
- node_modules
|
||||||
|
- v1/node_modules
|
||||||
- ~/.cache/yarn
|
- ~/.cache/yarn
|
||||||
key: v1-yarn-{{ .Branch }}-{{ checksum "yarn.lock" }}
|
key: v1-yarn-{{ .Branch }}-{{ checksum "yarn.lock" }}
|
||||||
|
|
||||||
|
@ -23,6 +24,8 @@ aliases:
|
||||||
- &yarn
|
- &yarn
|
||||||
|
|
|
|
||||||
yarn install --non-interactive --cache-folder ~/.cache/yarn
|
yarn install --non-interactive --cache-folder ~/.cache/yarn
|
||||||
|
cd v1 &&
|
||||||
|
yarn install --non-interactive --cache-folder ~/.cache/yarn
|
||||||
|
|
||||||
defaults: &defaults
|
defaults: &defaults
|
||||||
working_directory: ~/docusaurus
|
working_directory: ~/docusaurus
|
||||||
|
@ -41,13 +44,13 @@ jobs:
|
||||||
- save-cache: *save-yarn-cache
|
- save-cache: *save-yarn-cache
|
||||||
- run:
|
- run:
|
||||||
name: Check Prettier & ESLint
|
name: Check Prettier & ESLint
|
||||||
command: yarn ci-check
|
command: cd v1 && yarn ci-check
|
||||||
- run:
|
- run:
|
||||||
name: Run Test Suites
|
name: Run Test Suites
|
||||||
command: yarn test
|
command: cd v1 && yarn test
|
||||||
- run:
|
- run:
|
||||||
name: Test Static Website Builds
|
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
|
# The CIRCLE_ variables are defined during the CircleCI build process
|
||||||
# https://circleci.com/docs/1.0/environment-variables/
|
# 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
|
if [[ $CIRCLE_PROJECT_USERNAME == "facebook" && -z $CI_PULL_REQUEST && -z $CIRCLE_PR_USERNAME ]]; then
|
||||||
echo "Deploying website..."
|
echo "Deploying website..."
|
||||||
# install Docusaurus and generate file of English strings
|
# 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
|
# install Crowdin
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get install default-jre rsync
|
sudo apt-get install default-jre rsync
|
||||||
|
|
10
.gitignore
vendored
|
@ -6,15 +6,5 @@
|
||||||
node_modules
|
node_modules
|
||||||
|
|
||||||
.eslintcache
|
.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
|
yarn-error.log
|
||||||
|
|
105
package.json
|
@ -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"],
|
"keywords": ["documentation", "websites", "open source", "docusaurus"],
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/facebook/Docusaurus.git"
|
"url": "https://github.com/facebook/Docusaurus.git"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"ci-check": "yarn lint && yarn prettier:diff",
|
"ci-check": "yarn prettier && cd v1 && yarn ci-check",
|
||||||
"lint": "eslint --cache \"lib/**/*.js\" \"examples/**/*.js\" \"website/**/*.js\"",
|
|
||||||
"precommit": "lint-staged",
|
|
||||||
"prettier": "prettier --config .prettierrc --write \"**/*.js\"",
|
"prettier": "prettier --config .prettierrc --write \"**/*.js\"",
|
||||||
"prettier:diff": "prettier --config .prettierrc --list-different \"**/*.js\"",
|
"prettier:diff": "prettier --config .prettierrc --list-different \"**/*.js\"",
|
||||||
"test": "jest",
|
"start": "cd v1/website && yarn start"
|
||||||
"start": "cd website && yarn start",
|
},
|
||||||
"postinstall": "opencollective postinstall"
|
"devDependencies": {
|
||||||
|
"husky": "^0.14.3",
|
||||||
|
"lint-staged": "^7.2.0",
|
||||||
|
"prettier": "^1.13.7"
|
||||||
},
|
},
|
||||||
"lint-staged": {
|
"lint-staged": {
|
||||||
"linters": {
|
"linters": {
|
||||||
"{lib,examples,website}/**/*.js": [
|
"{v1,v2}/**/*.js": ["yarn lint --fix", "yarn prettier", "git add"]
|
||||||
"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
|
@ -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
|
|
@ -1,9 +1,6 @@
|
||||||
node_modules
|
|
||||||
.DS_Store
|
|
||||||
lib/core/metadata.js
|
lib/core/metadata.js
|
||||||
lib/core/MetadataBlog.js
|
lib/core/MetadataBlog.js
|
||||||
|
yarn-error.log
|
||||||
yarn.lock
|
yarn.lock
|
||||||
website
|
website
|
||||||
docs
|
|
||||||
docusaurus-init
|
docusaurus-init
|
||||||
v2
|
|
Before Width: | Height: | Size: 76 KiB After Width: | Height: | Size: 76 KiB |
Before Width: | Height: | Size: 984 B After Width: | Height: | Size: 984 B |
Before Width: | Height: | Size: 9.4 KiB After Width: | Height: | Size: 9.4 KiB |
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 4.3 KiB |
|
@ -81,15 +81,18 @@ describe('mdToHtmlify', () => {
|
||||||
|
|
||||||
describe('getFile', () => {
|
describe('getFile', () => {
|
||||||
const fakeContent = {
|
const fakeContent = {
|
||||||
'website/translated_docs/ko/doc1.md': '이건 가짜 야',
|
'v1/website/translated_docs/ko/doc1.md': '이건 가짜 야',
|
||||||
'website/versioned_docs/version-1.0.0/doc2.md': 'Document 2 is not good',
|
'v1/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/version-1.0.0/doc1.md':
|
||||||
'이것은 오래된 가짜입니다.',
|
'이것은 오래된 가짜입니다.',
|
||||||
'docs/doc1.md': 'Just another document',
|
'docs/doc1.md': 'Just another document',
|
||||||
};
|
};
|
||||||
fs.existsSync = jest.fn().mockReturnValue(true);
|
fs.existsSync = jest.fn().mockReturnValue(true);
|
||||||
fs.readFileSync = jest.fn().mockImplementation(file => {
|
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, '/');
|
const normalizedPath = fakePath.replace(/\\/g, '/');
|
||||||
return fakeContent[normalizedPath];
|
return fakeContent[normalizedPath];
|
||||||
});
|
});
|
||||||
|
@ -108,21 +111,21 @@ describe('getFile', () => {
|
||||||
test('translated docs', () => {
|
test('translated docs', () => {
|
||||||
const metadata = Metadata['ko-doc1'];
|
const metadata = Metadata['ko-doc1'];
|
||||||
expect(docs.getFile(metadata)).toEqual(
|
expect(docs.getFile(metadata)).toEqual(
|
||||||
fakeContent['website/translated_docs/ko/doc1.md'],
|
fakeContent['v1/website/translated_docs/ko/doc1.md'],
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('versioned docs', () => {
|
test('versioned docs', () => {
|
||||||
const metadata = Metadata['en-version-1.0.0-doc2'];
|
const metadata = Metadata['en-version-1.0.0-doc2'];
|
||||||
expect(docs.getFile(metadata)).toEqual(
|
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', () => {
|
test('translated & versioned docs', () => {
|
||||||
const metadata = Metadata['ko-version-1.0.0-doc1'];
|
const metadata = Metadata['ko-version-1.0.0-doc1'];
|
||||||
expect(docs.getFile(metadata)).toEqual(
|
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'],
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|