-
-
Notifications
You must be signed in to change notification settings - Fork 8.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into refactor/docs-home-url
# Conflicts: # packages/docusaurus-plugin-content-docs/src/index.ts
- Loading branch information
Showing
70 changed files
with
2,231 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: E2E Test | ||
|
||
on: | ||
# Trigger the workflow on push or pull request, | ||
# but only for the master branch | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node-version: [10.x] | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- name: Installation | ||
run: yarn | ||
- name: Setup test-website project against master release | ||
run: yarn test:build:v2 | ||
- name: Build test-website project | ||
run: cd test-website && yarn build | ||
env: | ||
CI: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
presets: [require.resolve('@docusaurus/core/lib/babel/preset')], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
presets: [require.resolve('@docusaurus/core/lib/babel/preset')], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{ | ||
"name": "@docusaurus/plugin-client-redirects", | ||
"version": "2.0.0-alpha.56", | ||
"description": "Client redirects plugin for Docusaurus", | ||
"main": "lib/index.js", | ||
"scripts": { | ||
"tsc": "tsc" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"license": "MIT", | ||
"dependencies": { | ||
"@docusaurus/types": "^2.0.0-alpha.56", | ||
"@docusaurus/utils": "^2.0.0-alpha.56", | ||
"eta": "^1.1.1", | ||
"globby": "^10.0.1", | ||
"yup": "^0.29.0" | ||
}, | ||
"peerDependencies": { | ||
"@docusaurus/core": "^2.0.0", | ||
"react": "^16.8.4", | ||
"react-dom": "^16.8.4" | ||
}, | ||
"engines": { | ||
"node": ">=10.9.0" | ||
}, | ||
"devDependencies": { | ||
"@types/yup": "^0.29.0" | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
...usaurus-plugin-client-redirects/src/__tests__/__snapshots__/collectRedirects.test.ts.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`collectRedirects should throw if plugin option redirects contain invalid to paths 1`] = ` | ||
"You are trying to create client-side redirections to paths that do not exist: | ||
- /this/path/does/not/exist2 | ||
- /this/path/does/not/exist2 | ||
Valid paths you can redirect to: | ||
- / | ||
- /someExistingPath | ||
- /anotherExistingPath | ||
" | ||
`; | ||
|
||
exports[`collectRedirects should throw if redirect creator creates array of array redirect 1`] = ` | ||
"Some created redirects are invalid: | ||
- {\\"from\\":[\\"/fromPath\\"],\\"to\\":\\"/\\"} => Validation error: from must be a \`string\` type, but the final value was: \`[ | ||
\\"\\\\\\"/fromPath\\\\\\"\\" | ||
]\`. | ||
" | ||
`; | ||
|
||
exports[`collectRedirects should throw if redirect creator creates invalid redirects 1`] = ` | ||
"Some created redirects are invalid: | ||
- {\\"from\\":\\"https://google.com/\\",\\"to\\":\\"/\\"} => Validation error: from is not a valid pathname. Pathname should start with / and not contain any domain or query string | ||
- {\\"from\\":\\"//abc\\",\\"to\\":\\"/\\"} => Validation error: from is not a valid pathname. Pathname should start with / and not contain any domain or query string | ||
- {\\"from\\":\\"/def?queryString=toto\\",\\"to\\":\\"/\\"} => Validation error: from is not a valid pathname. Pathname should start with / and not contain any domain or query string | ||
" | ||
`; |
29 changes: 29 additions & 0 deletions
29
...lugin-client-redirects/src/__tests__/__snapshots__/createRedirectPageContent.test.ts.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`createRedirectPageContent should encode uri special chars 1`] = ` | ||
"<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset=\\"UTF-8\\"> | ||
<meta http-equiv=\\"refresh\\" content=\\"0; url=https://docusaurus.io/gr/%CF%83%CE%B5%CE%BB%CE%B9%CE%B4%CE%B1%CF%82/\\"> | ||
<link rel=\\"canonical\\" href=\\"https://docusaurus.io/gr/%CF%83%CE%B5%CE%BB%CE%B9%CE%B4%CE%B1%CF%82/\\" /> | ||
</head> | ||
<script> | ||
window.location.href = 'https://docusaurus.io/gr/%CF%83%CE%B5%CE%BB%CE%B9%CE%B4%CE%B1%CF%82/'; | ||
</script> | ||
</html>" | ||
`; | ||
|
||
exports[`createRedirectPageContent should match snapshot 1`] = ` | ||
"<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset=\\"UTF-8\\"> | ||
<meta http-equiv=\\"refresh\\" content=\\"0; url=https://docusaurus.io/\\"> | ||
<link rel=\\"canonical\\" href=\\"https://docusaurus.io/\\" /> | ||
</head> | ||
<script> | ||
window.location.href = 'https://docusaurus.io/'; | ||
</script> | ||
</html>" | ||
`; |
37 changes: 37 additions & 0 deletions
37
...s-plugin-client-redirects/src/__tests__/__snapshots__/normalizePluginOptions.test.ts.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`normalizePluginOptions should reject bad createRedirects user inputs 1`] = ` | ||
"Invalid @docusaurus/plugin-client-redirects options: createRedirects should be a function | ||
{ | ||
\\"createRedirects\\": [ | ||
\\"bad\\", | ||
\\"value\\" | ||
] | ||
}" | ||
`; | ||
|
||
exports[`normalizePluginOptions should reject bad fromExtensions user inputs 1`] = ` | ||
"Invalid @docusaurus/plugin-client-redirects options: fromExtensions[0] must be a \`string\` type, but the final value was: \`null\`. | ||
If \\"null\\" is intended as an empty value be sure to mark the schema as \`.nullable()\` | ||
{ | ||
\\"fromExtensions\\": [ | ||
null, | ||
null, | ||
123, | ||
true | ||
] | ||
}" | ||
`; | ||
|
||
exports[`normalizePluginOptions should reject bad toExtensions user inputs 1`] = ` | ||
"Invalid @docusaurus/plugin-client-redirects options: toExtensions[0] must be a \`string\` type, but the final value was: \`null\`. | ||
If \\"null\\" is intended as an empty value be sure to mark the schema as \`.nullable()\` | ||
{ | ||
\\"toExtensions\\": [ | ||
null, | ||
null, | ||
123, | ||
true | ||
] | ||
}" | ||
`; |
11 changes: 11 additions & 0 deletions
11
...aurus-plugin-client-redirects/src/__tests__/__snapshots__/redirectValidation.test.ts.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`validateRedirect throw for bad redirects 1`] = `"{\\"from\\":\\"https://fb.com/fromSomePath\\",\\"to\\":\\"/toSomePath\\"} => Validation error: from is not a valid pathname. Pathname should start with / and not contain any domain or query string"`; | ||
|
||
exports[`validateRedirect throw for bad redirects 2`] = `"{\\"from\\":\\"/fromSomePath\\",\\"to\\":\\"https://fb.com/toSomePath\\"} => Validation error: to is not a valid pathname. Pathname should start with / and not contain any domain or query string"`; | ||
|
||
exports[`validateRedirect throw for bad redirects 3`] = `"{\\"from\\":\\"/fromSomePath\\",\\"to\\":\\"/toSomePath?queryString=xyz\\"} => Validation error: to is not a valid pathname. Pathname should start with / and not contain any domain or query string"`; | ||
|
||
exports[`validateRedirect throw for bad redirects 4`] = `"{\\"from\\":null,\\"to\\":\\"/toSomePath?queryString=xyz\\"} => Validation error: to is not a valid pathname. Pathname should start with / and not contain any domain or query string"`; | ||
|
||
exports[`validateRedirect throw for bad redirects 5`] = `"{\\"from\\":[\\"heyho\\"],\\"to\\":\\"/toSomePath?queryString=xyz\\"} => Validation error: to is not a valid pathname. Pathname should start with / and not contain any domain or query string"`; |
71 changes: 71 additions & 0 deletions
71
...aurus-plugin-client-redirects/src/__tests__/__snapshots__/writeRedirectFiles.test.ts.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`toRedirectFilesMetadata should create appropriate metadatas for empty baseUrl: fileContent baseUrl=empty 1`] = ` | ||
Array [ | ||
"<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset=\\"UTF-8\\"> | ||
<meta http-equiv=\\"refresh\\" content=\\"0; url=/abc/\\"> | ||
<link rel=\\"canonical\\" href=\\"/abc/\\" /> | ||
</head> | ||
<script> | ||
window.location.href = '/abc/'; | ||
</script> | ||
</html>", | ||
] | ||
`; | ||
|
||
exports[`toRedirectFilesMetadata should create appropriate metadatas for root baseUrl: fileContent baseUrl=/ 1`] = ` | ||
Array [ | ||
"<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset=\\"UTF-8\\"> | ||
<meta http-equiv=\\"refresh\\" content=\\"0; url=/abc/\\"> | ||
<link rel=\\"canonical\\" href=\\"/abc/\\" /> | ||
</head> | ||
<script> | ||
window.location.href = '/abc/'; | ||
</script> | ||
</html>", | ||
] | ||
`; | ||
|
||
exports[`toRedirectFilesMetadata should create appropriate metadatas: fileContent 1`] = ` | ||
Array [ | ||
"<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset=\\"UTF-8\\"> | ||
<meta http-equiv=\\"refresh\\" content=\\"0; url=https://docusaurus.io/abc/\\"> | ||
<link rel=\\"canonical\\" href=\\"https://docusaurus.io/abc/\\" /> | ||
</head> | ||
<script> | ||
window.location.href = 'https://docusaurus.io/abc/'; | ||
</script> | ||
</html>", | ||
"<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset=\\"UTF-8\\"> | ||
<meta http-equiv=\\"refresh\\" content=\\"0; url=https://docusaurus.io/def.html/\\"> | ||
<link rel=\\"canonical\\" href=\\"https://docusaurus.io/def.html/\\" /> | ||
</head> | ||
<script> | ||
window.location.href = 'https://docusaurus.io/def.html/'; | ||
</script> | ||
</html>", | ||
"<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset=\\"UTF-8\\"> | ||
<meta http-equiv=\\"refresh\\" content=\\"0; url=https://docusaurus.io/\\"> | ||
<link rel=\\"canonical\\" href=\\"https://docusaurus.io/\\" /> | ||
</head> | ||
<script> | ||
window.location.href = 'https://docusaurus.io/'; | ||
</script> | ||
</html>", | ||
] | ||
`; |
Oops, something went wrong.