From f559b1dc7c300d23bd10b2eb52524dfe9ac94ca4 Mon Sep 17 00:00:00 2001 From: Yangshun Tay Date: Sun, 24 Feb 2019 14:13:08 -0800 Subject: [PATCH] refactor(v2): move website dir out of v2 for cleaner separations --- .circleci/config.yml | 2 +- .gitignore | 2 ++ docs/getting-started-installation.md | 16 ++++++++-------- .../blog/2017-12-14-introducing-docusaurus.md | 0 ...-30-How-I-Converted-Profilo-To-Docusaurus.md | 0 .../blog/2018-09-11-Towards-Docusaurus-2.md | 0 {v2/website => v2-website}/docusaurus.config.js | 2 +- v2-website/package.json | 15 +++++++++++++++ {v2/website => v2-website}/pages/index.js | 0 .../pages/styles.module.css | 0 {v2/website => v2-website}/pages/youtube.js | 0 {v2/website => v2-website}/sidebars.json | 0 .../static/img/christopher-chedeau.jpg | Bin .../static/img/docusaurus.ico | Bin .../static/img/docusaurus.svg | 0 .../static/img/hector-ramos.png | Bin .../static/img/markdown.png | Bin .../img/profilo_blog_post_android_ios.png | Bin ...o_blog_post_palette_website_color_picker.png | Bin ...profilo_blog_post_photoshop_color_picker.png | Bin .../img/profilo_blog_post_website_final.png | Bin .../profilo_blog_post_website_final_docs.png | Bin .../img/profilo_blog_post_website_initial.png | Bin {v2/website => v2-website}/static/img/react.svg | 0 .../static/img/ricky-vetter.jpg | Bin .../static/img/search.svg | 0 .../static/img/slash-birth.png | Bin .../static/img/slash-introducing.png | Bin .../static/img/slash-upandrunning.png | Bin .../static/img/translation.svg | 0 .../static/img/versioning.svg | 0 {v2/website => v2-website}/yarn.lock | 3 ++- v2/.gitignore | 10 ---------- v2/lib/commands/start.js | 16 ++++++++-------- v2/package.json | 6 +----- v2/website/package.json | 13 ------------- 36 files changed, 38 insertions(+), 47 deletions(-) rename {v2/website => v2-website}/blog/2017-12-14-introducing-docusaurus.md (100%) rename {v2/website => v2-website}/blog/2018-04-30-How-I-Converted-Profilo-To-Docusaurus.md (100%) rename {v2/website => v2-website}/blog/2018-09-11-Towards-Docusaurus-2.md (100%) rename {v2/website => v2-website}/docusaurus.config.js (96%) create mode 100644 v2-website/package.json rename {v2/website => v2-website}/pages/index.js (100%) rename {v2/website => v2-website}/pages/styles.module.css (100%) rename {v2/website => v2-website}/pages/youtube.js (100%) rename {v2/website => v2-website}/sidebars.json (100%) rename {v2/website => v2-website}/static/img/christopher-chedeau.jpg (100%) rename {v2/website => v2-website}/static/img/docusaurus.ico (100%) rename {v2/website => v2-website}/static/img/docusaurus.svg (100%) rename {v2/website => v2-website}/static/img/hector-ramos.png (100%) rename {v2/website => v2-website}/static/img/markdown.png (100%) rename {v2/website => v2-website}/static/img/profilo_blog_post_android_ios.png (100%) rename {v2/website => v2-website}/static/img/profilo_blog_post_palette_website_color_picker.png (100%) rename {v2/website => v2-website}/static/img/profilo_blog_post_photoshop_color_picker.png (100%) rename {v2/website => v2-website}/static/img/profilo_blog_post_website_final.png (100%) rename {v2/website => v2-website}/static/img/profilo_blog_post_website_final_docs.png (100%) rename {v2/website => v2-website}/static/img/profilo_blog_post_website_initial.png (100%) rename {v2/website => v2-website}/static/img/react.svg (100%) rename {v2/website => v2-website}/static/img/ricky-vetter.jpg (100%) rename {v2/website => v2-website}/static/img/search.svg (100%) rename {v2/website => v2-website}/static/img/slash-birth.png (100%) rename {v2/website => v2-website}/static/img/slash-introducing.png (100%) rename {v2/website => v2-website}/static/img/slash-upandrunning.png (100%) rename {v2/website => v2-website}/static/img/translation.svg (100%) rename {v2/website => v2-website}/static/img/versioning.svg (100%) rename {v2/website => v2-website}/yarn.lock (99%) delete mode 100644 v2/.gitignore delete mode 100644 v2/website/package.json diff --git a/.circleci/config.yml b/.circleci/config.yml index 60ce57e7c31a..85b5adb62292 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -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 diff --git a/.gitignore b/.gitignore index 588b45ab6089..cf65e31d09ae 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,5 @@ node_modules .eslintcache yarn-error.log +build +__generated__ diff --git a/docs/getting-started-installation.md b/docs/getting-started-installation.md index c41c851d0b2c..73aaf08cfc50 100644 --- a/docs/getting-started-installation.md +++ b/docs/getting-started-installation.md @@ -3,7 +3,7 @@ id: installation title: Installation --- -Docusaurus was designed from the ground up to be easily installed and used to get your website up and running quickly. +Docusaurus was designed from the ground up to be easily installed and used to get your website up and running quickly. ## Installing Docusaurus @@ -62,11 +62,11 @@ runnable, example website to use as your site's base. To run: 1. In your root, rename `docs-examples-from-docusaurus` to `docs`. 1. `cd website` 1. Rename `blog-examples-from-docusaurus` to `blog`. -1. From within the `website` directory, run the local webserver using +1. From within the `website` directory, run the local webserver using `yarn start` or `npm start`. 1. Load the example site at http://localhost:3000 if it did not already open automatically. - + You should see the example site loaded in your web browser. There's also a LiveReload server running and any changes made to the docs and files in the `website` directory will cause the page to refresh. ![](/img/getting-started-preparation-verify.png) @@ -82,7 +82,7 @@ yarn start (or npm run start) ## Updating Your Docusaurus Version -At any time after Docusaurus is installed, you can check your current version of Docusaurus by going into the `website` directory and typing `yarn outdated docusaurus` or `npm outdated docusaurus`. +At any time after Docusaurus is installed, you can check your current version of Docusaurus by going into the `website` directory and typing `yarn outdated docusaurus` or `npm outdated docusaurus`. You will see something like this: @@ -92,11 +92,11 @@ Using globally installed version of Yarn yarn outdated v1.5.1 warning package.json: No license field warning No license field -info Color legend : - "" : Major Update backward-incompatible updates - "" : Minor Update backward-compatible features +info Color legend : + "" : Major Update backward-incompatible updates + "" : Minor Update backward-compatible features "" : Patch Update backward-compatible bug fixes -Package Current Wanted Latest Package Type URL +Package Current Wanted Latest Package Type URL docusaurus 1.0.9 1.2.0 1.2.0 devDependencies https://github.com/facebook/Docusaurus#readme ✨ Done in 0.41s. ``` diff --git a/v2/website/blog/2017-12-14-introducing-docusaurus.md b/v2-website/blog/2017-12-14-introducing-docusaurus.md similarity index 100% rename from v2/website/blog/2017-12-14-introducing-docusaurus.md rename to v2-website/blog/2017-12-14-introducing-docusaurus.md diff --git a/v2/website/blog/2018-04-30-How-I-Converted-Profilo-To-Docusaurus.md b/v2-website/blog/2018-04-30-How-I-Converted-Profilo-To-Docusaurus.md similarity index 100% rename from v2/website/blog/2018-04-30-How-I-Converted-Profilo-To-Docusaurus.md rename to v2-website/blog/2018-04-30-How-I-Converted-Profilo-To-Docusaurus.md diff --git a/v2/website/blog/2018-09-11-Towards-Docusaurus-2.md b/v2-website/blog/2018-09-11-Towards-Docusaurus-2.md similarity index 100% rename from v2/website/blog/2018-09-11-Towards-Docusaurus-2.md rename to v2-website/blog/2018-09-11-Towards-Docusaurus-2.md diff --git a/v2/website/docusaurus.config.js b/v2-website/docusaurus.config.js similarity index 96% rename from v2/website/docusaurus.config.js rename to v2-website/docusaurus.config.js index 0fcc9fa65261..b2155d610c83 100644 --- a/v2/website/docusaurus.config.js +++ b/v2-website/docusaurus.config.js @@ -11,7 +11,7 @@ module.exports = { organizationName: 'facebook', projectName: 'docusaurus', baseUrl: '/', - customDocsPath: '../docs', + customDocsPath: './docs', url: 'https://docusaurus.io', headerLinks: [ {doc: 'installation', label: 'Docs'}, diff --git a/v2-website/package.json b/v2-website/package.json new file mode 100644 index 000000000000..b282b8fbebd8 --- /dev/null +++ b/v2-website/package.json @@ -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" + } +} diff --git a/v2/website/pages/index.js b/v2-website/pages/index.js similarity index 100% rename from v2/website/pages/index.js rename to v2-website/pages/index.js diff --git a/v2/website/pages/styles.module.css b/v2-website/pages/styles.module.css similarity index 100% rename from v2/website/pages/styles.module.css rename to v2-website/pages/styles.module.css diff --git a/v2/website/pages/youtube.js b/v2-website/pages/youtube.js similarity index 100% rename from v2/website/pages/youtube.js rename to v2-website/pages/youtube.js diff --git a/v2/website/sidebars.json b/v2-website/sidebars.json similarity index 100% rename from v2/website/sidebars.json rename to v2-website/sidebars.json diff --git a/v2/website/static/img/christopher-chedeau.jpg b/v2-website/static/img/christopher-chedeau.jpg similarity index 100% rename from v2/website/static/img/christopher-chedeau.jpg rename to v2-website/static/img/christopher-chedeau.jpg diff --git a/v2/website/static/img/docusaurus.ico b/v2-website/static/img/docusaurus.ico similarity index 100% rename from v2/website/static/img/docusaurus.ico rename to v2-website/static/img/docusaurus.ico diff --git a/v2/website/static/img/docusaurus.svg b/v2-website/static/img/docusaurus.svg similarity index 100% rename from v2/website/static/img/docusaurus.svg rename to v2-website/static/img/docusaurus.svg diff --git a/v2/website/static/img/hector-ramos.png b/v2-website/static/img/hector-ramos.png similarity index 100% rename from v2/website/static/img/hector-ramos.png rename to v2-website/static/img/hector-ramos.png diff --git a/v2/website/static/img/markdown.png b/v2-website/static/img/markdown.png similarity index 100% rename from v2/website/static/img/markdown.png rename to v2-website/static/img/markdown.png diff --git a/v2/website/static/img/profilo_blog_post_android_ios.png b/v2-website/static/img/profilo_blog_post_android_ios.png similarity index 100% rename from v2/website/static/img/profilo_blog_post_android_ios.png rename to v2-website/static/img/profilo_blog_post_android_ios.png diff --git a/v2/website/static/img/profilo_blog_post_palette_website_color_picker.png b/v2-website/static/img/profilo_blog_post_palette_website_color_picker.png similarity index 100% rename from v2/website/static/img/profilo_blog_post_palette_website_color_picker.png rename to v2-website/static/img/profilo_blog_post_palette_website_color_picker.png diff --git a/v2/website/static/img/profilo_blog_post_photoshop_color_picker.png b/v2-website/static/img/profilo_blog_post_photoshop_color_picker.png similarity index 100% rename from v2/website/static/img/profilo_blog_post_photoshop_color_picker.png rename to v2-website/static/img/profilo_blog_post_photoshop_color_picker.png diff --git a/v2/website/static/img/profilo_blog_post_website_final.png b/v2-website/static/img/profilo_blog_post_website_final.png similarity index 100% rename from v2/website/static/img/profilo_blog_post_website_final.png rename to v2-website/static/img/profilo_blog_post_website_final.png diff --git a/v2/website/static/img/profilo_blog_post_website_final_docs.png b/v2-website/static/img/profilo_blog_post_website_final_docs.png similarity index 100% rename from v2/website/static/img/profilo_blog_post_website_final_docs.png rename to v2-website/static/img/profilo_blog_post_website_final_docs.png diff --git a/v2/website/static/img/profilo_blog_post_website_initial.png b/v2-website/static/img/profilo_blog_post_website_initial.png similarity index 100% rename from v2/website/static/img/profilo_blog_post_website_initial.png rename to v2-website/static/img/profilo_blog_post_website_initial.png diff --git a/v2/website/static/img/react.svg b/v2-website/static/img/react.svg similarity index 100% rename from v2/website/static/img/react.svg rename to v2-website/static/img/react.svg diff --git a/v2/website/static/img/ricky-vetter.jpg b/v2-website/static/img/ricky-vetter.jpg similarity index 100% rename from v2/website/static/img/ricky-vetter.jpg rename to v2-website/static/img/ricky-vetter.jpg diff --git a/v2/website/static/img/search.svg b/v2-website/static/img/search.svg similarity index 100% rename from v2/website/static/img/search.svg rename to v2-website/static/img/search.svg diff --git a/v2/website/static/img/slash-birth.png b/v2-website/static/img/slash-birth.png similarity index 100% rename from v2/website/static/img/slash-birth.png rename to v2-website/static/img/slash-birth.png diff --git a/v2/website/static/img/slash-introducing.png b/v2-website/static/img/slash-introducing.png similarity index 100% rename from v2/website/static/img/slash-introducing.png rename to v2-website/static/img/slash-introducing.png diff --git a/v2/website/static/img/slash-upandrunning.png b/v2-website/static/img/slash-upandrunning.png similarity index 100% rename from v2/website/static/img/slash-upandrunning.png rename to v2-website/static/img/slash-upandrunning.png diff --git a/v2/website/static/img/translation.svg b/v2-website/static/img/translation.svg similarity index 100% rename from v2/website/static/img/translation.svg rename to v2-website/static/img/translation.svg diff --git a/v2/website/static/img/versioning.svg b/v2-website/static/img/versioning.svg similarity index 100% rename from v2/website/static/img/versioning.svg rename to v2-website/static/img/versioning.svg diff --git a/v2/website/yarn.lock b/v2-website/yarn.lock similarity index 99% rename from v2/website/yarn.lock rename to v2-website/yarn.lock index 46d17b968402..1dccdd792dd3 100644 --- a/v2/website/yarn.lock +++ b/v2-website/yarn.lock @@ -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" diff --git a/v2/.gitignore b/v2/.gitignore deleted file mode 100644 index b5ad799a9a7b..000000000000 --- a/v2/.gitignore +++ /dev/null @@ -1,10 +0,0 @@ -.DS_Store -.vscode -.idea -.eslintcache -node_modules -dist -yarn-error.log -__generated__ -website/node_modules -build diff --git a/v2/lib/commands/start.js b/v2/lib/commands/start.js index 41f170445be2..2e62b28aee59 100644 --- a/v2/lib/commands/start.js +++ b/v2/lib/commands/start.js @@ -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({ diff --git a/v2/package.json b/v2/package.json index c5379ba9a5c0..d4284bc31d2a 100644 --- a/v2/package.json +++ b/v2/package.json @@ -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": { diff --git a/v2/website/package.json b/v2/website/package.json deleted file mode 100644 index e776a7373b30..000000000000 --- a/v2/website/package.json +++ /dev/null @@ -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" - } -}