Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(v2): simplify code by removing wip i18n & translation #1431

Merged
merged 3 commits into from
May 2, 2019

Conversation

endiliey
Copy link
Contributor

@endiliey endiliey commented May 2, 2019

Motivation

  • I removed i18n and translation from the codebase. It's better to not ship a WIP code when we release the first alpha public release.

  • I also did some refactoring with how we deal with some components like <Head> so that we don't retype the same thing over and over again

  • I also moved all the test to be co-located with its corresponding files.
    So the format will be like

src
  __tests__
    index.test.js
  index.js

Instead of

src
   index.js
test
   index.test.js

(Write your motivation here.)

Have you read the Contributing Guidelines on pull requests?

(Write your answer here.)

Test Plan

  • Locally, everything is still OK since we don't use translation and i18n yet.

refactoring

  • Netlify works

  • CI Test passes

@endiliey endiliey requested a review from yangshun as a code owner May 2, 2019 09:11
@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label May 2, 2019
@@ -15,7 +15,7 @@ module.exports = {
moduleNameMapper: {
'^@lib/(.*)$': '<rootDir>/packages/docusaurus/lib/$1',
},
testPathIgnorePatterns: ['/node_modules/', '__fixtures__'],
testPathIgnorePatterns: ['loadSetup.js', '/node_modules/', '__fixtures__'],
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

loadSetup is an utility test function to help me setup fixtures easily.

@@ -7,7 +7,7 @@

import '@babel/polyfill';
import path from 'path';
import loadSetup from '../../../docusaurus/test/loadSetup';
import loadSetup from '../../../docusaurus/lib/server/load/__tests__/loadSetup';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we'll create @docusaurus/test-utils in the future to easily load up fixtures. Not going to do it in this PR.

@endiliey endiliey changed the title refactor(v2): simplify code by removing wip i18n & translation WIP refactor(v2): simplify code by removing wip i18n & translation May 2, 2019
@endiliey endiliey added the status: don't merge yet This PR is completed, but we are still waiting for other things to be ready. label May 2, 2019
@docusaurus-bot
Copy link
Contributor

docusaurus-bot commented May 2, 2019

Deploy preview for docusaurus-2 ready!

Built with commit c51d902

https://deploy-preview-1431--docusaurus-2.netlify.com

Copy link
Contributor

@yangshun yangshun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also moved all the test to be co-located with its corresponding files.

Awesome! Great clean up :D

@@ -7,7 +7,7 @@

import '@babel/polyfill';
import path from 'path';
import loadSetup from '../../../docusaurus/test/loadSetup';
import loadSetup from '../../../docusaurus/lib/server/load/__tests__/loadSetup';
Copy link
Contributor

@yangshun yangshun May 2, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps we should create test utils as separate modules. It's quite fragile for packages to cross module boundaries like this and import from other modules via relative paths.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was thinking of that as well. Gonna do it soon, this PR is so big already. I haven't removed the logic on plugin-docs also. (doing it now)

Copy link
Contributor

@yangshun yangshun May 2, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I missed the comment above about @docusaurus/test-utils because this PR has 100+ changed files 🤣

Copy link
Contributor Author

@endiliey endiliey May 2, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Been working it for few hours too :| I'll double check again and again lol. ~4,000 lines of code deleted. gg

@docusaurus-bot
Copy link
Contributor

docusaurus-bot commented May 2, 2019

Deploy preview for docusaurus-preview ready!

Built with commit c51d902

https://deploy-preview-1431--docusaurus-preview.netlify.com

@endiliey endiliey changed the title WIP refactor(v2): simplify code by removing wip i18n & translation refactor(v2): simplify code by removing wip i18n & translation May 2, 2019
@endiliey endiliey merged commit 373d17e into master May 2, 2019
@endiliey endiliey deleted the clean branch May 2, 2019 10:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Signed Facebook CLA status: don't merge yet This PR is completed, but we are still waiting for other things to be ready.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants