# umi-plugin-gh-pages

> umi plugin to publish to Github Pages. Support useJsdelivr.

Latest version **1.0.1** (published 2021-04-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install umi-plugin-gh-pages
pnpm add umi-plugin-gh-pages
yarn add umi-plugin-gh-pages
bun add umi-plugin-gh-pages
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2021-04-07 |
| First published | 2018-10-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 12.8 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 16 |
| Maintainers | sorrycc, ycjcl868 |

## Links

- npm: https://www.npmjs.com/package/umi-plugin-gh-pages
- Repository: https://github.com/umijs/umi-plugin-gh-pages
- Issues: https://github.com/umijs/umi-plugin-gh-pages/issues
- npm.io page: https://npm.io/package/umi-plugin-gh-pages

## Dependencies (4)

- [semver](https://npm.io/package/semver.md) ^7.3.4
- [gh-pages](https://npm.io/package/gh-pages.md) ^3.1.0
- [@umijs/utils](https://npm.io/package/@umijs/utils.md) ^3.4.0
- [hosted-git-info](https://npm.io/package/hosted-git-info.md) ^4.0.0

## Recent versions

- 1.0.1 (latest) — 2021-04-07
- 0.2.0 — 2019-08-05
- 0.1.0 — 2018-10-24

## README

# umi-plugin-gh-pages

[![NPM version](https://img.shields.io/npm/v/umi-plugin-gh-pages.svg?style=flat)](https://npmjs.org/package/umi-plugin-gh-pages)
[![NPM downloads](http://img.shields.io/npm/dm/umi-plugin-gh-pages.svg?style=flat)](https://npmjs.org/package/umi-plugin-gh-pages)

umi plugin to publish to Github Pages.

## Usage

Configure in `.umirc.js`,

```js
export default {
  ghPages:{
    dir:'dist',
    useCDN: false,
    getCDNUrl:(gitInfo)=>{return 'url'}
    ...gh-pages#PublishOptions
  }
}
```

## ghPages

### dir
exclude `dir` (default umi config `outputPath`), other options please checkout https://github.com/tschaub/gh-pages#options

### useCDN

use CDN in publicPath ,default use [jsdelivr](https://www.jsdelivr.com/) - A free CDN for Open Source.

### getCDNUrl

Custom CDN url.

### Deploy in GitHub pages

config/config.ts

```ts
{
  ghPages: {
    useCDN: true,
  },
}
```

```bash
umi build
```

or

```bash
$GH_PAGES_USE_CDN=true umi build
```

### Deploy in [vercel](https://vercel.com/) （now）

config/config.ts

```ts
{
  ghPages: {
    branch: 'gh-pages',
    silent: true,
    repo: `https://${process.env.GH_TOKEN}@github.com/alitajs/alita-docs.git`,
  },
}
```

set the [environment variables](https://vercel.com/docs/environment-variables) in vercel, with Production.

![image](https://user-images.githubusercontent.com/11746742/110885160-4f264680-8321-11eb-80f7-8cd6275643b8.png)

```
GH_TOKEN=[tokens]( 
https://github.com/settings/tokens)
GH_PAGES_USE_CDN=true
```

run the command

```bash
$ umi build
```

## Examples

* https://github.com/sorrycc/test-gh-pages
* https://sorrycc.github.io/test-gh-pages/
* https://github.com/alitajs/alita-docs

## LICENSE

MIT

---
_Source: https://npm.io/package/umi-plugin-gh-pages · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
