Skip to content

Commit 5b230d0

Browse files
committed
Initial commit
1 parent e502d18 commit 5b230d0

File tree

7 files changed

+6596
-13
lines changed

7 files changed

+6596
-13
lines changed

.github/workflows/on_push.yml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
on: [push, pull_request]
2+
name: Build PR & Push
3+
jobs:
4+
build:
5+
runs-on: ubuntu-latest
6+
strategy:
7+
matrix:
8+
node-version: [12.x, 14.x]
9+
steps:
10+
- uses: actions/checkout@v1
11+
- name: Use Node.js ${{ matrix.node-version }}
12+
uses: actions/setup-node@v1
13+
with:
14+
node-version: ${{ matrix.node-version }}
15+
- name: npm install, lint, and build
16+
run: |
17+
npm i
18+
npm run lint
19+
npm run build

.github/workflows/on_release.yml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Release
2+
on:
3+
release:
4+
types: [released]
5+
jobs:
6+
publish:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v1
10+
- uses: actions/setup-node@v1
11+
with:
12+
node-version: 12
13+
registry-url: https://registry.npmjs.org/
14+
- name: npm install
15+
run: |
16+
npm i
17+
npm run build
18+
- name: publish
19+
run: npm publish pkg/
20+
env:
21+
NODE_AUTH_TOKEN: ${{secrets.npm_token}}

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -102,3 +102,6 @@ dist
102102

103103
# TernJS port file
104104
.tern-port
105+
106+
# Pika builds
107+
pkg/

README.md

+44-7
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,47 @@
1-
# My Typescript Template
1+
# Docusaurus Plugin Module Alias
22

3-
A small template that I use to build node typescript-based projects.
3+
A small Docusaurus 2.x plugin that simplifies the addition of module aliases.
44

5-
## Stack
5+
## Installation
66

7-
* `typescript`
8-
* `@pika/pack`
9-
* `eslint`
10-
* `prettier`
7+
```sh
8+
npm i --save-dev docusaurus-plugin-module-alias # or
9+
yarn add docusaurus-plugin-module-alias --dev
10+
```
11+
12+
## Why?
13+
14+
Docusaurus 2.x uses webpack to build SSR and client bundles. Creating a plugin to add a module alias for every new docusaurus site can be easily modularized.
15+
16+
## Usage
17+
18+
Inside your `docusaurus.config.js` add to the `plugins` field and configure with the `alias` option :+1:
19+
20+
```js
21+
const path = require('path');
22+
23+
module.exports = {
24+
// ...
25+
plugins: [
26+
[
27+
'docusaurus-plugin-module-alias',
28+
{
29+
alias: {
30+
'@local/component': path.resolve(__dirname, '../src/index.js'),
31+
},
32+
},
33+
],
34+
],
35+
};
36+
```
37+
38+
### Invalid Aliases
39+
40+
Docusaurus has special aliases that shouldn't be overridden: `@site`, `@generated`, `@docusaurus`, `~docs`, `~blog`, `~pages`, `~debug`
41+
42+
## Options
43+
44+
| Name | Type | Required | Description |
45+
| --------------- | ------------------------ | -------- | -------------------------------------------------------------------- |
46+
| `alias` | `Record<string, string>` | Yes | Aliases passes to webpack |
47+
| `mergeStrategy` | `Record<string, string>` | No | Change the merge strategy used by `webpack-merge`. Use with caution! |

0 commit comments

Comments
 (0)