rspress-plugin-gh-pages 0.1.2 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,19 @@
1
+ # rspress-plugin-gh-pages
2
+
3
+ ## 0.1.4
4
+
5
+ ### Patch Changes
6
+
7
+ - 546dcf0: release beta
8
+ - 5e28903: fixup publish config
9
+ - Updated dependencies [546dcf0]
10
+ - Updated dependencies [5e28903]
11
+ - rspress-plugin-devkit@0.1.1
12
+
13
+ ## 0.1.4-beta.0
14
+
15
+ ### Patch Changes
16
+
17
+ - 546dcf0: release beta
18
+ - Updated dependencies [546dcf0]
19
+ - rspress-plugin-devkit@0.1.1-beta.0
package/README.md CHANGED
@@ -30,12 +30,11 @@ export default defineConfig({
30
30
 
31
31
  ## Configure
32
32
 
33
- ## repo
33
+ ## directory
34
34
 
35
- - Type: `string`
36
- - `Required`
35
+ Target directory to push to the `gh-pages` branch, `config.outDir` will be used if this configuration is not specified.
37
36
 
38
- The repository to deploy to, you can also specify another repository to deploy to.
37
+ - Type: `string`
39
38
 
40
39
  ## siteBase
41
40
 
@@ -43,4 +42,20 @@ The repository to deploy to, you can also specify another repository to deploy t
43
42
 
44
43
  Deploying to repositories other than the `<user>.github.io` repository requires specifying the `siteBase` option, as an example, deploying to repository `<user>/awesome-plugins` will require setting `siteBase` to `/awesome-plugins`, as the page will be hosted at `https://<user>.github.io/awesome-plugins`.
45
44
 
46
- By default, `rspress-plugin-gh-pages` will try to parse the `repo` option to get a `siteBase` value(if repo is a `github.io` repository, the `siteBase` will be `/`, otherwise, the `siteBase` will be `/<repo-name>`), you can also specify the `siteBase` option to override the default value.
45
+ By default, this plugin will try to parse the `repo` option to get a `siteBase` value(if repo is a `github.io` repository, the `siteBase` will be `/`, otherwise, the `siteBase` will be `/<repo-name>`), you can also specify the `siteBase` option to override the default value.
46
+
47
+ ## silent
48
+
49
+ Disable terminal log output from this plugin.
50
+
51
+ - Type: `boolean`
52
+ - Default: false
53
+
54
+ ## repo
55
+
56
+ - Type: `string`
57
+ - `Required`
58
+
59
+ The repository to deploy to, you can also specify another repository to deploy to.
60
+
61
+ More options can be found in documentation of [gh-pages](https://github.com/tschaub/gh-pages).
package/dist/index.js CHANGED
@@ -3,6 +3,11 @@ import ghpages from 'gh-pages';
3
3
  import { logger } from '@rspress/shared/logger';
4
4
  const DefaultDocBuildOutput = 'doc_build';
5
5
  const logPrefix = chalk.green('[gh-pages]');
6
+ function normalizeBase(base) {
7
+ return base === '/' || base === ''
8
+ ? '/'
9
+ : `/${base.replace(/^\/+|\/+$/g, '')}/`;
10
+ }
6
11
  export default function rspressPluginGHPages(options) {
7
12
  const { repo, directory, branch = 'gh-pages', silent = false, siteBase = '', ...publishOptions } = options;
8
13
  return {
@@ -18,7 +23,7 @@ export default function rspressPluginGHPages(options) {
18
23
  logger.warn(`${logPrefix} Failed to parse base from repo, site base path will not be updated.`);
19
24
  return config;
20
25
  }
21
- config.base = `/${base}/`;
26
+ config.base = normalizeBase(base);
22
27
  return config;
23
28
  },
24
29
  async afterBuild(config, isBuild) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rspress-plugin-gh-pages",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "Rspress plugin that add support for automatic deployment to GitHub Pages",
5
5
  "keywords": [
6
6
  "rspress",
@@ -20,11 +20,14 @@
20
20
  "author": "Linbudu <linbudu599@gmail.com> (https://github.com/linbudu599)",
21
21
  "main": "dist/index.js",
22
22
  "types": "dist/index.d.ts",
23
+ "publishConfig": {
24
+ "access": "public"
25
+ },
23
26
  "dependencies": {
24
27
  "@rspress/shared": "^1.17.1",
25
28
  "chalk": "^5.3.0",
26
29
  "gh-pages": "^6.1.1",
27
- "rspress-plugin-devkit": "^0.1.0"
30
+ "rspress-plugin-devkit": "^0.1.1"
28
31
  },
29
32
  "devDependencies": {
30
33
  "@types/gh-pages": "^6.1.0",
@@ -38,7 +41,6 @@
38
41
  "build": "tsc --declarationMap false",
39
42
  "dev": "tsc -w",
40
43
  "docs:build": "rspress build",
41
- "docs:dev": "rspress dev",
42
- "prepublish": "npm run build"
44
+ "docs:dev": "rspress dev"
43
45
  }
44
46
  }
package/src/index.ts CHANGED
@@ -16,6 +16,12 @@ interface RspressPluginGHPagesOptions
16
16
 
17
17
  const logPrefix = chalk.green('[gh-pages]');
18
18
 
19
+ function normalizeBase(base: string): string {
20
+ return base === '/' || base === ''
21
+ ? '/'
22
+ : `/${base.replace(/^\/+|\/+$/g, '')}/`;
23
+ }
24
+
19
25
  export default function rspressPluginGHPages(
20
26
  options: RspressPluginGHPagesOptions,
21
27
  ): RspressPlugin {
@@ -46,7 +52,7 @@ export default function rspressPluginGHPages(
46
52
  return config;
47
53
  }
48
54
 
49
- config.base = `/${base}/`;
55
+ config.base = normalizeBase(base);
50
56
 
51
57
  return config;
52
58
  },
package/tsconfig.json CHANGED
@@ -1,7 +1,9 @@
1
1
  {
2
2
  "compilerOptions": {
3
3
  "rootDir": "src",
4
- "outDir": "dist"
4
+ "outDir": "dist",
5
+ "module": "NodeNext",
6
+ "moduleResolution": "nodenext"
5
7
  },
6
8
  "include": ["src"],
7
9
  "extends": "../../tsconfig.base.json"