From 16d4de3846e8b2a5ba43bf38a1bb1a08659ba186 Mon Sep 17 00:00:00 2001 From: endiliey Date: Sun, 22 Jul 2018 15:57:18 +0800 Subject: [PATCH 1/2] Fix website i18n url & delete unused file --- .gitignore | 1 - website/i18n/en.json | 97 ------------------------------------ website/pages/en/versions.js | 9 ++-- website/publish-gh-pages.js | 64 ------------------------ 4 files changed, 6 insertions(+), 165 deletions(-) delete mode 100644 website/i18n/en.json delete mode 100755 website/publish-gh-pages.js diff --git a/.gitignore b/.gitignore index 4868ae0c7525..b04ea25d91b8 100644 --- a/.gitignore +++ b/.gitignore @@ -24,7 +24,6 @@ /website/yarn.lock /website/translated_docs /website/i18n/* -!/website/i18n/en.json coverage lerna-debug.log diff --git a/website/i18n/en.json b/website/i18n/en.json deleted file mode 100644 index 40703dd91e52..000000000000 --- a/website/i18n/en.json +++ /dev/null @@ -1,97 +0,0 @@ -{ - "_comment": "This file is auto-generated by write-translations.js", - "localized-strings": { - "next": "Next", - "previous": "Previous", - "tagline": "🃏 Delightful JavaScript Testing", - "cli": "Jest CLI Options", - "configuration": "Configuring Jest", - "es6-class-mocks": "ES6 Class Mocks", - "expect": "Expect", - "getting-started": "Getting Started", - "api": "Globals", - "jest-community": "Jest Community", - "jest-object": "The Jest Object", - "jest-platform": "Jest Platform", - "manual-mocks": "Manual Mocks", - "migration-guide": "Migrating to Jest", - "mock-function-api": "Mock Functions", - "mock-functions": "Mock Functions", - "mongodb": "Using with MongoDB", - "more-resources": "More Resources", - "puppeteer": "Using with puppeteer", - "setup-teardown": "Setup and Teardown", - "snapshot-testing": "Snapshot Testing", - "asynchronous": "Testing Asynchronous Code", - "testing-frameworks": "Testing Web Frameworks", - "timer-mocks": "Timer Mocks", - "troubleshooting": "Troubleshooting", - "tutorial-async": "An Async Example", - "tutorial-jquery": "DOM Manipulation", - "tutorial-react": "Testing React Apps", - "tutorial-react-native": "Testing React Native Apps", - "using-matchers": "Using Matchers", - "watch-plugins": "Watch Plugins", - "webpack": "Using with webpack", - "Docs": "Docs", - "API": "API", - "Help": "Help", - "Blog": "Blog", - "GitHub": "GitHub", - "Introduction": "Introduction", - "Guides": "Guides", - "Framework Guides": "Framework Guides", - "API Reference": "API Reference" - }, - "pages-strings": { - "Find what you're looking for in our detailed documentation and guides.\\n\\n- Learn how to [get started](/docs/en/getting-started.html) with Jest.\\n- [Troubleshoot](/docs/en/troubleshooting.html) problems with Jest.\\n- Learn how to [configure Jest](/docs/en/configuration.html).\\n- Look at the full [API Reference](/docs/en/api.html).|no description given": "Find what you're looking for in our detailed documentation and guides.\\n\\n- Learn how to [get started](/docs/en/getting-started.html) with Jest.\\n- [Troubleshoot](/docs/en/troubleshooting.html) problems with Jest.\\n- Learn how to [configure Jest](/docs/en/configuration.html).\\n- Look at the full [API Reference](/docs/en/api.html).", - "Browse the docs|no description given": "Browse the docs", - "Ask questions and find answers from other Jest users like you.\\n\\n- Join the [#jest](https://discord.gg/MWRhKCj) channel on [Reactiflux](http://www.reactiflux.com/), a Discord community.\\n- Many members of the community use Stack Overflow. Read through the [existing questions](https://stackoverflow.com/questions/tagged/jestjs) tagged with **jestjs** or [ask your own](https://stackoverflow.com/questions/ask)!|no description given": "Ask questions and find answers from other Jest users like you.\\n\\n- Join the [#jest](https://discord.gg/MWRhKCj) channel on [Reactiflux](http://www.reactiflux.com/), a Discord community.\\n- Many members of the community use Stack Overflow. Read through the [existing questions](https://stackoverflow.com/questions/tagged/jestjs) tagged with **jestjs** or [ask your own](https://stackoverflow.com/questions/ask)!", - "Join the community|no description given": "Join the community", - "Find out what's new with Jest.\\n\\n- Follow [Jest](https://twitter.com/fbjest) on Twitter.\\n- Subscribe to the [Jest blog](/blog/).\\n- Look at the [changelog](https://github.com/facebook/jest/blob/master/CHANGELOG.md).|no description given": "Find out what's new with Jest.\\n\\n- Follow [Jest](https://twitter.com/fbjest) on Twitter.\\n- Subscribe to the [Jest blog](/blog/).\\n- Look at the [changelog](https://github.com/facebook/jest/blob/master/CHANGELOG.md).", - "Stay up to date|no description given": "Stay up to date", - "Need help?|no description given": "Need help?", - "Jest is worked on full-time by Facebook's JavaScript Foundation team. Team members are often around and available for questions.|no description given": "Jest is worked on full-time by Facebook's JavaScript Foundation team. Team members are often around and available for questions.", - "Sponsors|no description given": "Sponsors", - "Sponsors are those who contribute $100 or more per month to Jest|no description given": "Sponsors are those who contribute $100 or more per month to Jest", - "Become a sponsor|no description given": "Become a sponsor", - "Backers|no description given": "Backers", - "Backers are those who contribute $2 or more per month to Jest|no description given": "Backers are those who contribute $2 or more per month to Jest", - "Become a backer|no description given": "Become a backer", - "Try Out Jest|no description given": "Try Out Jest", - "Get Started|no description given": "Get Started", - "Watch Talks|no description given": "Watch Talks", - "Learn More|no description given": "Learn More", - "Complete and ready to set-up JavaScript testing solution. Works out of the box for any React project.|no description given": "Complete and ready to set-up JavaScript testing solution. Works out of the box for any React project.", - "Developer Ready|no description given": "Developer Ready", - "Fast interactive watch mode runs only test files related to changed files and is optimized to give signal quickly.|no description given": "Fast interactive watch mode runs only test files related to changed files and is optimized to give signal quickly.", - "Instant Feedback|no description given": "Instant Feedback", - "Capture snapshots of React trees or other serializable values to simplify testing and to analyze how state changes over time.|no description given": "Capture snapshots of React trees or other serializable values to simplify testing and to analyze how state changes over time.", - "Snapshot Testing|no description given": "Snapshot Testing", - "Zero configuration testing platform|no description given": "Zero configuration testing platform", - "Jest is used by Facebook to test all JavaScript code including React applications. One of Jest's philosophies is to provide an integrated \\\"zero-configuration\\\" experience. We observed that when engineers are provided with ready-to-use tools, they end up writing more tests, which in turn results in more stable and healthy code bases.|no description given": "Jest is used by Facebook to test all JavaScript code including React applications. One of Jest's philosophies is to provide an integrated \\\"zero-configuration\\\" experience. We observed that when engineers are provided with ready-to-use tools, they end up writing more tests, which in turn results in more stable and healthy code bases.", - "Jest parallelizes test runs across workers to maximize performance. Console messages are buffered and printed together with test results. Sandboxed test files and automatic global state resets for every test so no two tests conflict with each other.|no description given": "Jest parallelizes test runs across workers to maximize performance. Console messages are buffered and printed together with test results. Sandboxed test files and automatic global state resets for every test so no two tests conflict with each other.", - "Fast and sandboxed|no description given": "Fast and sandboxed", - "Easily create code coverage reports using [`--coverage`](https://jestjs.io/docs/en/cli.html#coverage). No additional setup or libraries needed! Jest can collect code coverage information from entire projects, including untested files.|no description given": "Easily create code coverage reports using [`--coverage`](https://jestjs.io/docs/en/cli.html#coverage). No additional setup or libraries needed! Jest can collect code coverage information from entire projects, including untested files.", - "Built-in code coverage reports|no description given": "Built-in code coverage reports", - "Jest is already configured when you use [`create-react-app`](https://facebook.github.io/react/blog/2016/07/22/create-apps-with-no-configuration.html) or [`react-native init`](http://facebook.github.io/react-native/docs/getting-started.html) to create your React and React Native projects. Place your tests in a `__tests__` folder, or name your test files with a `.spec.js` or `.test.js` extension. Whatever you prefer, Jest will find and run your tests.|no description given": "Jest is already configured when you use [`create-react-app`](https://facebook.github.io/react/blog/2016/07/22/create-apps-with-no-configuration.html) or [`react-native init`](http://facebook.github.io/react-native/docs/getting-started.html) to create your React and React Native projects. Place your tests in a `__tests__` folder, or name your test files with a `.spec.js` or `.test.js` extension. Whatever you prefer, Jest will find and run your tests.", - "Zero configuration|no description given": "Zero configuration", - "Try it out!|no description given": "Try it out!", - "You can try out a real version of Jest using [repl.it](https://repl.it/languages/jest). Consider a function, `add()`, that adds two numbers. We can use a basic test in `add-test.js` to verify that 1 + 2 equals 3. Hit \\\"run\\\" to try it out!|no description given": "You can try out a real version of Jest using [repl.it](https://repl.it/languages/jest). Consider a function, `add()`, that adds two numbers. We can use a basic test in `add-test.js` to verify that 1 + 2 equals 3. Hit \\\"run\\\" to try it out!", - "Powerful [mocking library](/docs/en/mock-functions.html) for functions and modules. Mock React Native components using `jest-react-native`.|no description given": "Powerful [mocking library](/docs/en/mock-functions.html) for functions and modules. Mock React Native components using `jest-react-native`.", - "Powerful mocking library|no description given": "Powerful mocking library", - "Jest works with any compile-to-JavaScript language and integrates seamlessly with [Babel](https://babeljs.io) and with TypeScript through [ts-jest](https://github.com/kulshekhar/ts-jest).|no description given": "Jest works with any compile-to-JavaScript language and integrates seamlessly with [Babel](https://babeljs.io) and with TypeScript through [ts-jest](https://github.com/kulshekhar/ts-jest).", - "Works with TypeScript|no description given": "Works with TypeScript", - "Watch Talks about Jest|no description given": "Watch Talks about Jest", - "The Jest core team and contributors regularly speak about [Jest and Delightful JavaScript Testing](https://www.youtube.com/watch?v=cAKYQpTC7MA). Check out our talk about [Building High-Quality JavaScript Tools](https://www.youtube.com/watch?v=PvabBs_utr8) at jsconf.eu 2017 and our talk about [Jest as a Platform](https://www.youtube.com/watch?v=NtjyeojAOBs) at ReactiveConf 2017.|no description given": "The Jest core team and contributors regularly speak about [Jest and Delightful JavaScript Testing](https://www.youtube.com/watch?v=cAKYQpTC7MA). Check out our talk about [Building High-Quality JavaScript Tools](https://www.youtube.com/watch?v=PvabBs_utr8) at jsconf.eu 2017 and our talk about [Jest as a Platform](https://www.youtube.com/watch?v=NtjyeojAOBs) at ReactiveConf 2017.", - "Watch more videos|no description given": "Watch more videos", - "Who's using Jest?|no description given": "Who's using Jest?", - "Jest is used by teams of all sizes to test web applications, node.js services, mobile apps, and APIs.|no description given": "Jest is used by teams of all sizes to test web applications, node.js services, mobile apps, and APIs.", - "Talks & Videos|no description given": "Talks & Videos", - "We understand that reading through docs can be boring sometimes. Here is a community curated list of talks & videos around Jest.|no description given": "We understand that reading through docs can be boring sometimes. Here is a community curated list of talks & videos around Jest.", - "Add your favorite talk|no description given": "Add your favorite talk", - "Help Translate|recruit community translators for your project": "Help Translate", - "Edit this Doc|recruitment message asking to edit the doc source": "Edit", - "Translate this Doc|recruitment message asking to translate the docs": "Translate" - } -} diff --git a/website/pages/en/versions.js b/website/pages/en/versions.js index 726d4be16cff..b3948949e432 100644 --- a/website/pages/en/versions.js +++ b/website/pages/en/versions.js @@ -18,6 +18,7 @@ const versions = require(CWD + '/versions.json'); class Versions extends React.Component { render() { const latestVersion = versions[0]; + const {language} = this.props; return (
@@ -33,7 +34,9 @@ class Versions extends React.Component { {latestVersion} Documentation @@ -58,7 +61,7 @@ class Versions extends React.Component { Documentation @@ -84,7 +87,7 @@ class Versions extends React.Component { Documentation diff --git a/website/publish-gh-pages.js b/website/publish-gh-pages.js deleted file mode 100755 index b8ca4090cc76..000000000000 --- a/website/publish-gh-pages.js +++ /dev/null @@ -1,64 +0,0 @@ -/* eslint-disable */ - -require(`shelljs/global`); - -const GIT_USER = process.env.GIT_USER; -const CIRCLE_BRANCH = process.env.CIRCLE_BRANCH; -const CIRCLE_PROJECT_USERNAME = process.env.CIRCLE_PROJECT_USERNAME; -const CIRCLE_PROJECT_REPONAME = process.env.CIRCLE_PROJECT_REPONAME; -const CI_PULL_REQUEST = process.env.CI_PULL_REQUEST; -const remoteBranch = `https://${GIT_USER}@github.com/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}.git`; - -if (!which(`git`)) { - echo(`Sorry, this script requires git`); - exit(1); -} - -if (CI_PULL_REQUEST || CIRCLE_BRANCH !== `master` || CIRCLE_PROJECT_USERNAME !== `facebook`) { - echo(`Skipping deploy`); - exit(0); -} - -echo(`Building branch ${CIRCLE_BRANCH}, preparing to push to gh-pages`); - -// Clear out existing build folder -rm(`-rf`, `build`); -mkdir(`-p`, `build`); - -// Build site here -cd(`build`); - -if (exec(`git clone ${remoteBranch} ${CIRCLE_PROJECT_REPONAME}-gh-pages`).code !== 0) { - echo(`Error: Git clone failed`); - exit(1); -} - -cd(`${CIRCLE_PROJECT_REPONAME}-gh-pages`); - -if (exec(`git checkout origin/gh-pages`).code + - exec(`git checkout -b gh-pages`).code + - exec(`git branch --set-upstream-to=origin/gh-pages`).code !== 0 - ) { - echo(`Error: Git checkout gh-pages failed`); - exit(1); -} - -cd(`../..`); - -if (exec(`node server/generate.js`).code) { - echo(`Error: Generating HTML failed`); - exit(1); -} - -cp(`-R`, `build/${CIRCLE_PROJECT_REPONAME}/*`, `build/${CIRCLE_PROJECT_REPONAME}-gh-pages/`); -cd(`build/${CIRCLE_PROJECT_REPONAME}-gh-pages`); - -exec(`git add --all`); -exec(`git commit -m "update website"`); -if (exec(`git push origin gh-pages`).code !== 0) { - echo(`Error: Git push failed`); - exit(1); -} else { - echo(`Website is live at: https://${CIRCLE_PROJECT_USERNAME}.github.io/${CIRCLE_PROJECT_REPONAME}/`); - exit(0); -} From ed8785fc58590414c88dec18f1470d49dc062831 Mon Sep 17 00:00:00 2001 From: endiliey Date: Sun, 22 Jul 2018 16:55:46 +0800 Subject: [PATCH 2/2] add changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 45cf04e641ca..5687739574bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ - `[babel-jest]` Make `getCacheKey()` take into account `createTransformer` options ([#6699](https://github.com/facebook/jest/pull/6699)) - `[docs]` Fix contributors link ([#6711](https://github.com/facebook/jest/pull/6711)) +- `[website]` Fix website versions page to link to correct language ([#6734](https://github.com/facebook/jest/pull/6734)) ## 23.4.1