Skip to content

Commit 5b0f17f

Browse files
committed
Rename library to use "addons" everywhere
Closes #4
1 parent 15e47b0 commit 5b0f17f

12 files changed

+26
-29
lines changed

dist/readthedocs-client.js renamed to dist/readthedocs-addons.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/readthedocs-addons.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/readthedocs-client.js.map

Lines changed: 0 additions & 1 deletion
This file was deleted.

examples/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ This directory contains different doctool examples.
55
Each of the sub-directories have to be built with the specific doctool
66
and its output has to be saved into `public/<sub-directory>` so it can be tested.
77

8-
_There is no need to inject the `readthedocs-client.js` script into the HTML files.
8+
_There is no need to inject the `readthedocs-addons.js` script into the HTML files.
99
This will be done automatically by the dev server, emulating what CloudFlare will do for us._

examples/sphinx/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Example
22
=======
33

4-
Example page to show all ``readthedocs-client.js`` integrations.
4+
Example page to show all ``readthedocs-addons.js`` integrations.
55

66
hoverxref
77
---------

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
2-
"name": "readthedocs-client",
2+
"name": "@readthedocs/addons",
33
"version": "0.1.0",
4-
"description": "Read the Docs client embeded into documentation pages",
5-
"main": "dist/readthedocs-client.js",
4+
"description": "Read the Docs Addons to embed into documentation pages",
5+
"main": "dist/readthedocs-addons.js",
66
"scripts": {
77
"build": "webpack --mode=production --progress",
88
"clean": "rm -rfv dist/*; exit 0",

public/_/readthedocs-config.json renamed to public/_/readthedocs-addons.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"slug": "example",
66
"language": "en",
77
"repository": {
8-
"url": "https://github.com/readthedocs/readthedocs-client",
8+
"url": "https://github.com/readthedocs/addons",
99
"type": "git"
1010
},
1111
"programming_language": "words"
@@ -33,14 +33,14 @@
3333
"addons": {
3434
"search": {
3535
"enabled": true,
36-
"project": "readthedocs-client",
36+
"project": "addons",
3737
"version": "latest",
3838
"api_endpoint": "/_/api/v3/search/",
3939
"filters": [
40-
["Search only in this project", "project:readthedocs-client/latest"],
41-
["Search subprojects", "subprojects:readthedocs-client/latest"]
40+
["Search only in this project", "project:addons/latest"],
41+
["Search subprojects", "subprojects:addons/latest"]
4242
],
43-
"default_filter": "subprojects:readthedocs-client/latest"
43+
"default_filter": "subprojects:addons/latest"
4444
},
4545
"analytics": {
4646
"enabled": true,

public/sphinx/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272

7373
<section id="example">
7474
<h1>Example<a class="headerlink" href="#example" title="Permalink to this heading"></a></h1>
75-
<p>Example page to show all <code class="docutils literal notranslate"><span class="pre">readthedocs-client.js</span></code> integrations.</p>
75+
<p>Example page to show all <code class="docutils literal notranslate"><span class="pre">readthedocs-addons.js</span></code> integrations.</p>
7676
<section id="hoverxref">
7777
<h2>hoverxref<a class="headerlink" href="#hoverxref" title="Permalink to this heading"></a></h2>
7878
<p>Hover on the following link to see a tooltip: <a class="reference internal" href="page.html"><span class="doc">Page</span></a></p>

src/readthedocs-config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ import { CLIENT_VERSION } from "./utils";
66
*/
77
export function getReadTheDocsConfig() {
88
let url =
9-
"/_/readthedocs-config/?" +
9+
"/_/addons/?" +
1010
new URLSearchParams({
1111
url: window.location.href,
1212
});
1313

1414
// Retrieve a static JSON file when working in development mode
1515
if (window.location.href.startsWith("http://localhost")) {
16-
url = "/_/readthedocs-config.json";
16+
url = "/_/readthedocs-addons.json";
1717
}
1818

1919
return fetch(url, {

tests/__mocks__/readthedocs-config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"project": {
44
"slug": "example",
55
"language": "en",
6-
"repository_url": "https://github.com/humitos/readthedocs-client",
6+
"repository_url": "https://github.com/readthedocs/addons",
77
"programming_language": "words"
88
},
99
"version": {

webpack.config.js

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,15 @@ const webpack = require("webpack");
55

66
// Emulates what CloudFlare will do for us
77
// https://github.com/webpack/webpack-dev-server/issues/4508
8-
var injectReadTheDocsClient = interceptor(function (req, res) {
8+
var injectReadTheDocsAddons = interceptor(function (req, res) {
99
return {
1010
// Only HTML responses will be intercepted
1111
isInterceptable: function () {
1212
return /text\/html/.test(res.get("Content-Type"));
1313
},
1414
intercept: function (body, send) {
1515
send(
16-
body.replace(
17-
"</head>",
18-
'<script src="/readthedocs-client.js"></script></head>'
19-
)
16+
body.replace("</head>", '<script src="/readthedocs-addons.js"></script></head>')
2017
);
2118
},
2219
};
@@ -28,7 +25,7 @@ module.exports = (env, argv) => {
2825

2926
return {
3027
entry: {
31-
"readthedocs-client": ["./src/init.js"],
28+
"readthedocs-addons": ["./src/init.js"],
3229
},
3330
output: {
3431
filename: "[name].js?[fullhash]",
@@ -107,9 +104,9 @@ module.exports = (env, argv) => {
107104
// you want to hit.
108105
// https://docs.readthedocs.io/en/latest/development/install.html
109106
//
110-
// There is also a file at `public/_/readthedocs-config.json` that you can modify
107+
// There is also a file at `public/_/readthedocs-addons.json` that you can modify
111108
// to work locally without a development instance.
112-
// "/_/readthedocs-config.json": {
109+
// "/_/readthedocs-addons.json": {
113110
// target: "http://test-builds.devthedocs.org",
114111
// headers: {
115112
// host: "test-builds.devthedocs.org",
@@ -123,8 +120,8 @@ module.exports = (env, argv) => {
123120
);
124121

125122
middlewares.splice(index, 0, {
126-
name: "readthedocs-client",
127-
middleware: injectReadTheDocsClient,
123+
name: "readthedocs-addons",
124+
middleware: injectReadTheDocsAddons,
128125
});
129126
return middlewares;
130127
},

0 commit comments

Comments
 (0)