Skip to content

Commit 9263450

Browse files
authored
Rename library to use "addons" everywhere (#74)
Closes #4
1 parent 15e47b0 commit 9263450

15 files changed

+32
-32
lines changed

.readthedocs.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ build:
1919
- mkdir --parents $READTHEDOCS_OUTPUT/html/examples
2020

2121
# Copy our client into the output
22-
- cp --verbose dist/readthedocs-client.js $READTHEDOCS_OUTPUT/html/examples
22+
- cp --verbose dist/readthedocs-addons.js $READTHEDOCS_OUTPUT/html/examples
2323

2424
# Copy all the example sites (Sphinx and Pelican) into the output
2525
- cp --recursive --verbose public/* $READTHEDOCS_OUTPUT/html/examples/
2626

2727
# Copy a JSON file that acts as the response of the API
28-
- cp --verbose public/_/readthedocs-config.json $READTHEDOCS_OUTPUT/html/examples
28+
- cp --verbose public/_/readthedocs-addons.json $READTHEDOCS_OUTPUT/html/examples
2929

3030
# Show all the files served by Read the Docs
3131
- find $READTHEDOCS_OUTPUT/html

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.

docs/.inject-js.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
sed -i -e 's|</head>|<script src="../readthedocs-client.js"></script></head>|g' $READTHEDOCS_OUTPUT/html/examples/pelican/index.html
2-
sed -i -e 's|</head>|<script src="../readthedocs-client.js"></script></head>|g' $READTHEDOCS_OUTPUT/html/examples/sphinx/index.html
1+
sed -i -e 's|</head>|<script src="../readthedocs-addons.js"></script></head>|g' $READTHEDOCS_OUTPUT/html/examples/pelican/index.html
2+
sed -i -e 's|</head>|<script src="../readthedocs-addons.js"></script></head>|g' $READTHEDOCS_OUTPUT/html/examples/sphinx/index.html

docs/index.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
🦸 JavaScript Client: ``readthedocs-superpowers.js``
2-
====================================================
1+
🦸 JavaScript Client: ``readthedocs-addons.js``
2+
===============================================
33

44
JavaScript client injected into documentation pages served at Read the Docs.
55
This client allows projects to quickly integrate with all the nice features that Read the Docs offers.

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 & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ 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 () {
@@ -15,7 +15,7 @@ var injectReadTheDocsClient = interceptor(function (req, res) {
1515
send(
1616
body.replace(
1717
"</head>",
18-
'<script src="/readthedocs-client.js"></script></head>'
18+
'<script src="/readthedocs-addons.js"></script></head>'
1919
)
2020
);
2121
},
@@ -28,7 +28,7 @@ module.exports = (env, argv) => {
2828

2929
return {
3030
entry: {
31-
"readthedocs-client": ["./src/init.js"],
31+
"readthedocs-addons": ["./src/init.js"],
3232
},
3333
output: {
3434
filename: "[name].js?[fullhash]",
@@ -107,9 +107,9 @@ module.exports = (env, argv) => {
107107
// you want to hit.
108108
// https://docs.readthedocs.io/en/latest/development/install.html
109109
//
110-
// There is also a file at `public/_/readthedocs-config.json` that you can modify
110+
// There is also a file at `public/_/readthedocs-addons.json` that you can modify
111111
// to work locally without a development instance.
112-
// "/_/readthedocs-config.json": {
112+
// "/_/readthedocs-addons.json": {
113113
// target: "http://test-builds.devthedocs.org",
114114
// headers: {
115115
// host: "test-builds.devthedocs.org",
@@ -123,8 +123,8 @@ module.exports = (env, argv) => {
123123
);
124124

125125
middlewares.splice(index, 0, {
126-
name: "readthedocs-client",
127-
middleware: injectReadTheDocsClient,
126+
name: "readthedocs-addons",
127+
middleware: injectReadTheDocsAddons,
128128
});
129129
return middlewares;
130130
},

0 commit comments

Comments
 (0)