Skip to content

Commit

Permalink
v2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
RDIL committed Dec 2, 2021
1 parent 1b3caea commit 8e76e4a
Show file tree
Hide file tree
Showing 16 changed files with 12,508 additions and 10,172 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,6 @@ dist
# TernJS port file
.tern-port
build

.yarn/cache
.yarn/install-state.gz
768 changes: 768 additions & 0 deletions .yarn/releases/yarn-3.1.1.cjs

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-3.1.1.cjs
30 changes: 23 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,30 @@
# Changelog

## v2.0.0 - 12/02/2021

Breaking changes:

- `docsIntegration` and `blogIntegration` have been removed in favor of just setting `outDir` (which is a lot more flexible).
- `outputDirectory` has been renamed to `outDir`.
- `name` is now a required option (dictates CLI command name).
- Documents now must have proper file extensions, `.md` is no longer added by default.

Other changes:

- Switch to yarn v3.1.1.
- Updated dependencies.
- Updated code style to use 4 spaces instead of 2.
- Bug fix: documents with subdirectories in their paths will now automatically ensure the subdirectories are created (reported by @fill-the-fill).

## v1.2.0 - 8/10/2021

- Update Axios to prevent security warnings
- Require Node.js v12
- Added `outputDirectory` option to control which folder the downloaded content is put in
- Updated TypeScript compiler target to reduce polyfill bloat
- Update Axios to prevent security warnings
- Require Node.js v12
- Added `outputDirectory` option to control which folder the downloaded content is put in
- Updated TypeScript compiler target to reduce polyfill bloat

## v1.1.0 - 2/3/2021

- Internal refactoring to simplify code
- Add more documentation and metadata
- Throw an error if both integrations are enabled at the same time
- Internal refactoring to simplify code
- Add more documentation and metadata
- Throw an error if both integrations are enabled at the same time
47 changes: 25 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

A Docusaurus v2 plugin that downloads content from remote sources.

With this plugin, you can write the Markdown for your **docs** and **blog** somewhere else, and use them on your Docusaurus site.
With this plugin, you can write the Markdown for your content somewhere else, and use them on your Docusaurus site, without copying and pasting.

## Installing

Expand All @@ -26,7 +26,7 @@ as every time you run `docusaurus build` or `docusaurus start`, the content is d
### CLI Sync

This is the secondary mode. You can use the Docusaurus CLI to update the content when needed.
All you need to do is run `docusaurus download-remote-X`, where X is either `blog` or `docs`.
All you need to do is run `docusaurus download-remote-X`, where X is the `name` option given to the plugin.
You can also use `docusaurus clear-remote-X` to remove the downloaded files.

## Alright, so how do I use this???
Expand All @@ -37,34 +37,37 @@ Okay. Assuming you want to use constant sync, follow these steps:

```javascript
module.exports = {
// ...
plugins: [
[
"docusaurus-plugin-remote-content",
{
// options here
},
// ...
plugins: [
[
"docusaurus-plugin-remote-content",
{
// options here
name: "some-content", // used by CLI, must be path safe
sourceBaseUrl: "https://my-site.com/content/", // the base url for the markdown (gets prepended to all of the documents when fetching)
outDir: "docs", // the base directory to output to.
documents: ["my-file.md", "README.md"], // the file names to download
},
],
],
],
}
```

2. Configure the plugin - see the list of options below.

## Options

- `sourceBaseUrl`: (_required_) `string` - The base URL that your remote docs are located.
All the IDs specified in the `documents` option will be resolved relative to this.
For example, if you have 2 docs located at https://example.com/content/hello.md and https://example.com/content/thing.md,
the `sourceBaseUrl` would need to be set to https://example.com/content/
- `documents`: (_required_) `string array or a function that returns a string array` - The documents to fetch.
Following the previous example, if you had set `sourceBaseUrl` to https://example.com/content/,
and wanted to fetch thing.md and hello.md, you would just set `documents` to `["hello", "thing"]`
- `blogIntegration`: (optional) `boolean` - If the documents specified should be downloaded to the blog directory.
- `docsIntegration`: (optional) `boolean` - If the documents specified should be downloaded to the docs directory.
- `performCleanup`: (optional) `boolean` - If the documents downloaded should be deleted after the build is completed. Defaults to true.
- `noRuntimeDownloads`: (optional) `boolean` - If you only want to use the CLI to download the remote content, you should change this to true.
- `outputDirectory`: (optional) `string` - The subfolder to emit the downloaded content to (e.g. `docs/<subfolder>/<downloaded file.md>` - the prefix is set based on if you have the docs or blog integrations active).
- `name`: (_required_) `string` - The name of this plugin instance. Set to `content` if you aren't sure what this does. (used by CLI)
- `sourceBaseUrl`: (_required_) `string` - The base URL that your remote docs are located.
All the IDs specified in the `documents` option will be resolved relative to this.
For example, if you have 2 docs located at https://example.com/content/hello.md and https://example.com/content/thing.md,
the `sourceBaseUrl` would need to be set to https://example.com/content/.
- `outDir`: (_required_) `string` - The subfolder to emit the downloaded content to.
- `documents`: (_required_) `string[]` or `Promise<string[]>` - The documents to fetch. Must be file names (e.g. end in `.md`)
Following the previous example, if you had set `sourceBaseUrl` to https://example.com/content/,
and wanted to fetch thing.md and hello.md, you would just set `documents` to `["hello", "thing"]`
- `performCleanup`: (optional) `boolean` - If the documents downloaded should be deleted after the build is completed. Defaults to true.
- `noRuntimeDownloads`: (optional) `boolean` - If you only want to use the CLI to download the remote content, you should change this to true.

## Contributing

Expand Down
113 changes: 62 additions & 51 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,53 +1,64 @@
{
"name": "docusaurus-plugin-remote-content",
"version": "1.2.0",
"description": "A Docusaurus v2 plugin that allows you to fetch content from remote sources!",
"main": "build/index.js",
"repository": "https://github.com/rdilweb/docusaurus-plugin-remote-content.git",
"author": "Reece Dunham <me@rdil.rocks>",
"license": "MIT",
"types": "build/index.d.ts",
"scripts": {
"build": "tsc",
"prettier": "prettier --write **/*.{js,jsx,ts,tsx,md,yml,json}"
},
"prettier": {
"semi": false
},
"devDependencies": {
"@docusaurus/types": "^2.0.0-beta.6",
"@types/react": "^17.0.0",
"@types/react-dom": "^17.0.0",
"@types/react-helmet": "^6.1.0",
"@types/rimraf": "^3.0.0",
"commander": "^7.0.0",
"prettier": "^2.2.1",
"typescript": "^4.4.2"
},
"peerDependencies": {
"@docusaurus/core": "2.x"
},
"bugs": {
"url": "https://github.com/rdilweb/docusaurus-plugin-remote-content/issues"
},
"dependencies": {
"axios": "^0.21.4",
"chalk": "^4.1.0",
"pretty-ms": "^7.0.1",
"rimraf": "^3.0.2"
},
"files": [
"build",
"src",
"CHANGELOG.md"
],
"directories": {
"example": "testsite",
"lib": "src"
},
"homepage": "https://github.com/rdilweb/docusaurus-plugin-remote-content",
"keywords": ["docusaurus", "v2", "plugin", "remote", "content"],
"engines": {
"node": ">=12"
}
"name": "docusaurus-plugin-remote-content",
"version": "2.0.0",
"description": "A Docusaurus v2 plugin that allows you to fetch content from remote sources!",
"main": "build/index.js",
"repository": "https://github.com/rdilweb/docusaurus-plugin-remote-content.git",
"author": "Reece Dunham <me@rdil.rocks>",
"license": "MIT",
"types": "build/index.d.ts",
"scripts": {
"build": "tsc",
"prettier": "prettier --write \"**/*.{js,ts,md,json}\""
},
"prettier": {
"semi": false,
"tabWidth": 4
},
"devDependencies": {
"@docusaurus/types": "^2.0.0-beta.9",
"@types/react": "^17.0.37",
"@types/react-dom": "^17.0.11",
"@types/react-helmet": "^6.1.4",
"@types/rimraf": "^3.0.2",
"commander": "^8.3.0",
"prettier": "^2.2.1",
"typescript": "^4.5.2"
},
"peerDependencies": {
"@docusaurus/core": "2.x"
},
"bugs": {
"url": "https://github.com/rdilweb/docusaurus-plugin-remote-content/issues"
},
"dependencies": {
"axios": "^0.21.4",
"chalk": "^4.1.0",
"pretty-ms": "^7.0.1",
"rimraf": "^3.0.2"
},
"files": [
"build",
"src",
"CHANGELOG.md"
],
"directories": {
"example": "testsite",
"lib": "src"
},
"homepage": "https://github.com/rdilweb/docusaurus-plugin-remote-content",
"keywords": [
"docusaurus",
"v2",
"plugin",
"remote",
"content"
],
"engines": {
"node": ">=12"
},
"workspaces": [
"testsite"
],
"packageManager": "yarn@3.1.1"
}
Loading

0 comments on commit 8e76e4a

Please sign in to comment.