refactor(v2): move website dir out of v2 for cleaner separations

This commit is contained in:
Yangshun Tay 2019-02-24 14:13:08 -08:00
parent 63851a6f14
commit f559b1dc7c
36 changed files with 38 additions and 47 deletions

View file

@ -151,7 +151,7 @@ jobs:
command: cd v2 && yarn test
- run:
name: Test Static Website Builds
command: cd v2/website && yarn build
command: cd v2-website && yarn build
publish-npm:
<<: *defaults

2
.gitignore vendored
View file

@ -8,3 +8,5 @@ node_modules
.eslintcache
yarn-error.log
build
__generated__

View file

@ -11,7 +11,7 @@ module.exports = {
organizationName: 'facebook',
projectName: 'docusaurus',
baseUrl: '/',
customDocsPath: '../docs',
customDocsPath: './docs',
url: 'https://docusaurus.io',
headerLinks: [
{doc: 'installation', label: 'Docs'},

15
v2-website/package.json Normal file
View file

@ -0,0 +1,15 @@
{
"scripts": {
"start": "node ../v2/bin/docusaurus start",
"build": "node ../v2/bin/docusaurus build",
"eject": "node ../v2/bin/docusaurus eject",
"deploy": "node ../v2/bin/docusaurus deploy"
},
"dependencies": {
"classnames": "^2.2.6",
"docusaurus": "../v2",
"react": "^16.7.0-alpha.0",
"react-dom": "^16.7.0-alpha.0",
"react-youtube": "^7.6.0"
}
}

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: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 6.3 KiB

After

Width:  |  Height:  |  Size: 6.3 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 86 KiB

After

Width:  |  Height:  |  Size: 86 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

Before

Width:  |  Height:  |  Size: 224 KiB

After

Width:  |  Height:  |  Size: 224 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 219 KiB

After

Width:  |  Height:  |  Size: 219 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 61 KiB

After

Width:  |  Height:  |  Size: 61 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 85 KiB

After

Width:  |  Height:  |  Size: 85 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 59 KiB

After

Width:  |  Height:  |  Size: 59 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 7.4 KiB

After

Width:  |  Height:  |  Size: 7.4 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 796 B

After

Width:  |  Height:  |  Size: 796 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 7 KiB

After

Width:  |  Height:  |  Size: 7 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 32 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 804 B

After

Width:  |  Height:  |  Size: 804 B

Before After
Before After

View file

@ -2354,7 +2354,7 @@ docsearch.js@^2.5.2:
to-factory "^1.0.0"
zepto "^1.2.0"
docusaurus@../:
docusaurus@../v2:
version "2.0.0"
dependencies:
"@babel/core" "^7.0.0"
@ -2385,6 +2385,7 @@ docusaurus@../:
koa-range "^0.3.0"
koa-static "^5.0.0"
loader-utils "^1.1.0"
lodash "^4.17.11"
mini-css-extract-plugin "^0.4.1"
portfinder "^1.0.13"
prismjs "^1.15.0"

10
v2/.gitignore vendored
View file

@ -1,10 +0,0 @@
.DS_Store
.vscode
.idea
.eslintcache
node_modules
dist
yarn-error.log
__generated__
website/node_modules
build

View file

@ -36,10 +36,10 @@ async function getPort(reqPort) {
module.exports = async function start(siteDir, cliOptions = {}) {
console.log('Start command invoked ...');
// Process all related files as a prop
// Process all related files as a prop.
const props = await load(siteDir);
// Reload files processing
// Reload files processing.
if (!cliOptions.noWatch) {
const reload = () => {
load(siteDir).catch(err => {
@ -71,7 +71,7 @@ module.exports = async function start(siteDir, cliOptions = {}) {
const host = getHost(cliOptions.host);
const {baseUrl} = props;
// create compiler from generated webpack config
// Create compiler from generated webpack config.
let config = createClientConfig(props);
const {siteConfig} = props;
@ -86,7 +86,7 @@ module.exports = async function start(siteDir, cliOptions = {}) {
]);
config = config.toConfig();
// apply user webpack config
// Apply user webpack config.
const {
siteConfig: {configureWebpack},
} = props;
@ -94,7 +94,7 @@ module.exports = async function start(siteDir, cliOptions = {}) {
const compiler = webpack(config);
// webpack-serve
// Run webpack serve.
await serve(
{},
{
@ -111,16 +111,16 @@ module.exports = async function start(siteDir, cliOptions = {}) {
port,
host,
add: app => {
// serve static files
// Serve static files.
const staticDir = path.resolve(siteDir, 'static');
if (fs.existsSync(staticDir)) {
app.use(mount(baseUrl, serveStatic(staticDir)));
}
// enable HTTP range requests
// Enable HTTP range requests.
app.use(range);
// rewrite request to `/` since dev is only a SPA
// Rewrite request to `/` since dev is only a SPA.
app.use(
convert(
history({

View file

@ -21,12 +21,8 @@
},
"scripts": {
"docusaurus": "node bin/docusaurus",
"start": "node bin/docusaurus start website",
"build": "node bin/docusaurus build website",
"eject": "node bin/docusaurus eject website",
"deploy": "node bin/docusaurus deploy website",
"prettier": "prettier --config ../.prettierrc --write \"**/*.js\"",
"lint": "eslint --cache \"{lib,bin,test,website}/**/*.js\"",
"lint": "eslint --cache \"{lib,bin,test}/**/*.js\"",
"test": "jest --config test/jest.config.js"
},
"bugs": {

View file

@ -1,13 +0,0 @@
{
"scripts": {
"start": "node ../bin/docusaurus start",
"build": "node ../bin/docusaurus build"
},
"dependencies": {
"classnames": "^2.2.6",
"docusaurus": "../",
"react": "^16.7.0-alpha.0",
"react-dom": "^16.7.0-alpha.0",
"react-youtube": "^7.6.0"
}
}