Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
atomicpages committed Sep 7, 2020
1 parent e502d18 commit 5b230d0
Show file tree
Hide file tree
Showing 7 changed files with 6,596 additions and 13 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/on_push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
on: [push, pull_request]
name: Build PR & Push
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x, 14.x]
steps:
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: npm install, lint, and build
run: |
npm i
npm run lint
npm run build
21 changes: 21 additions & 0 deletions .github/workflows/on_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Release
on:
release:
types: [released]
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: 12
registry-url: https://registry.npmjs.org/
- name: npm install
run: |
npm i
npm run build
- name: publish
run: npm publish pkg/
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,6 @@ dist

# TernJS port file
.tern-port

# Pika builds
pkg/
51 changes: 44 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,47 @@
# My Typescript Template
# Docusaurus Plugin Module Alias

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

## Stack
## Installation

* `typescript`
* `@pika/pack`
* `eslint`
* `prettier`
```sh
npm i --save-dev docusaurus-plugin-module-alias # or
yarn add docusaurus-plugin-module-alias --dev
```

## Why?

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.

## Usage

Inside your `docusaurus.config.js` add to the `plugins` field and configure with the `alias` option :+1:

```js
const path = require('path');

module.exports = {
// ...
plugins: [
[
'docusaurus-plugin-module-alias',
{
alias: {
'@local/component': path.resolve(__dirname, '../src/index.js'),
},
},
],
],
};
```

### Invalid Aliases

Docusaurus has special aliases that shouldn't be overridden: `@site`, `@generated`, `@docusaurus`, `~docs`, `~blog`, `~pages`, `~debug`

## Options

| Name | Type | Required | Description |
| --------------- | ------------------------ | -------- | -------------------------------------------------------------------- |
| `alias` | `Record<string, string>` | Yes | Aliases passes to webpack |
| `mergeStrategy` | `Record<string, string>` | No | Change the merge strategy used by `webpack-merge`. Use with caution! |
Loading

0 comments on commit 5b230d0

Please sign in to comment.