Skip to content

Commit

Permalink
feat: upgrade everything and add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
atomicpages committed Nov 12, 2023
1 parent f9f5201 commit 72fb7fe
Show file tree
Hide file tree
Showing 21 changed files with 9,849 additions and 6,599 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ root = true

[*]
indent_style = space
indent_size = 4
indent_size = 2
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
Expand Down
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package.json
tsconfig.*
commitlint.config.js
6 changes: 6 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": ["@djthoms/eslint-config", "@djthoms/eslint-config/typescript", "@djthoms/eslint-config/vitest"],
"parserOptions": {
"project": "./tsconfig.json"
}
}
19 changes: 0 additions & 19 deletions .github/workflows/on_push.yml

This file was deleted.

42 changes: 24 additions & 18 deletions .github/workflows/on_release.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,27 @@
name: Release
on:
release:
types: [released]
push:
branches:
- main
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}}
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 8
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 20
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: pnpm semantic-release
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx --no -- commitlint --edit "${1}"
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

pnpm lint-staged
7 changes: 7 additions & 0 deletions .lintstagedrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"*.{ts,tsx,js,json}": [
"prettier --write",
"eslint --fix"
],
"*.{md,yml,yaml}": "prettier --write"
}
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enable-pre-post-scripts=true
1 change: 1 addition & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"@djthoms/prettier-config"
33 changes: 33 additions & 0 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"branches": ["main"],
"plugins": [
"@semantic-release/commit-analyzer",
[
"@semantic-release/release-notes-generator",
{
"preset": "conventionalcommits",
"parserOpts": {
"noteKeywords": ["BREAKING CHANGE", "BREAKING CHANGES", "BREAKING"]
},
"writerOpts": {
"commitsSort": ["subject", "scope"]
}
}
],
[
"@semantic-release/changelog",
{
"changelogFile": "CHANGELOG.md"
}
],
"@semantic-release/github",
"@semantic-release/npm",
[
"@semantic-release/git",
{
"assets": ["package.json", "package-lock.json", "CHANGELOG.md"],
"message": "chore(release): ${nextRelease.version} [skip ci]"
}
]
]
}
31 changes: 17 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,33 +11,36 @@ 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.
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:
Inside your `docusaurus.config.js` add to the `plugins` field and configure with
the `alias` option :+1:

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

module.exports = {
// ...
plugins: [
[
'docusaurus-plugin-module-alias',
{
alias: {
'@local/component': path.resolve(__dirname, '../src/index.js'),
},
},
],
// ...
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`
Docusaurus has special aliases that shouldn't be overridden: `@site`,
`@generated`, `@docusaurus`, `~docs`, `~blog`, `~pages`, `~debug`

## Options

Expand Down
3 changes: 3 additions & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/* eslint-disable no-undef */
// eslint-disable-next-line id-denylist
module.exports = { extends: ["@commitlint/config-conventional"] };
Loading

0 comments on commit 72fb7fe

Please sign in to comment.