Compare commits
159 Commits
Author | SHA1 | Date |
---|---|---|
Matthias Kretschmann | c2914069da | |
Matthias Kretschmann | e259bd237e | |
Matthias Kretschmann | a036be8087 | |
dependabot[bot] | 83e2ae1daa | |
dependabot[bot] | 88f0481ed3 | |
dependabot[bot] | 094ec24f08 | |
Matthias Kretschmann | 8ab2e492f0 | |
Matthias Kretschmann | 475679419f | |
Matthias Kretschmann | b885ec26f0 | |
Matthias Kretschmann | 42f9f19f6b | |
Matthias Kretschmann | 035274ad07 | |
Matthias Kretschmann | 61d669235c | |
Matthias Kretschmann | 54dd077e8d | |
Matthias Kretschmann | fb8d6cfd17 | |
dependabot[bot] | 0fcca0c398 | |
Matthias Kretschmann | 770350593e | |
Matthias Kretschmann | 1bec87e1b7 | |
dependabot[bot] | f4343016af | |
Matthias Kretschmann | 26bcf8db16 | |
Matthias Kretschmann | 3914619be7 | |
dependabot[bot] | d071785b87 | |
dependabot[bot] | 8da0f23aca | |
Matthias Kretschmann | e704f7e469 | |
Matthias Kretschmann | 6e7faed7ba | |
dependabot[bot] | 8a8fcc1b4a | |
dependabot[bot] | 73e090b867 | |
dependabot[bot] | 9f17483242 | |
dependabot[bot] | d9817be706 | |
Matthias Kretschmann | 454d0eecd6 | |
Matthias Kretschmann | 4a4cfa89b7 | |
dependabot[bot] | d76f8e6629 | |
dependabot[bot] | bac114d01a | |
dependabot[bot] | 7ebfb32888 | |
dependabot[bot] | fe5e6b9dbb | |
dependabot[bot] | d1f6851ad6 | |
dependabot[bot] | fa516c2f1c | |
dependabot[bot] | 76eba028a9 | |
dependabot[bot] | 32f67f4077 | |
dependabot[bot] | e3d4aa4d9f | |
dependabot[bot] | 890c7d752a | |
dependabot[bot] | 40191a2827 | |
dependabot[bot] | 805a568e99 | |
dependabot[bot] | 6973965368 | |
dependabot[bot] | 9305fdf759 | |
dependabot[bot] | 8d4cbf1025 | |
dependabot[bot] | 1439ca9d1a | |
dependabot[bot] | 8d9c9f3f18 | |
dependabot[bot] | 22e1b2cfc2 | |
dependabot[bot] | 3619e7a770 | |
dependabot[bot] | 26f02ad321 | |
dependabot[bot] | 38639f5e82 | |
dependabot[bot] | d6e7c85aed | |
dependabot[bot] | 8d836ff6fe | |
dependabot[bot] | 2f9e746155 | |
dependabot[bot] | 931cb2e5cd | |
dependabot[bot] | 4f8fd7ac57 | |
dependabot[bot] | afb80e630b | |
dependabot[bot] | 2d4cddcff3 | |
dependabot[bot] | e504d60e29 | |
Matthias Kretschmann | 112d72e671 | |
Matthias Kretschmann | b3f793356d | |
dependabot[bot] | a26f447091 | |
dependabot[bot] | f16c1c78e0 | |
dependabot[bot] | 30ce1e5ed3 | |
dependabot[bot] | f3d3ba40ee | |
dependabot[bot] | 3ea3cb8e30 | |
dependabot[bot] | 0db74594be | |
dependabot[bot] | 644508bcfa | |
dependabot[bot] | 4b52fea06b | |
dependabot[bot] | b5ac14a49d | |
dependabot[bot] | 825909ed8d | |
dependabot[bot] | 9ea83696cd | |
dependabot[bot] | 0a3c1451d7 | |
dependabot[bot] | 8374777a68 | |
dependabot[bot] | ef8c04fbd6 | |
dependabot[bot] | ce584f9c97 | |
dependabot[bot] | c0c37f60ff | |
dependabot[bot] | 2df75b381b | |
dependabot[bot] | f1e4ce9c53 | |
dependabot[bot] | a50eca6dfd | |
dependabot[bot] | 30e53fa632 | |
dependabot[bot] | 4761b42719 | |
dependabot[bot] | bb4a742e4f | |
dependabot[bot] | 01a9213f36 | |
dependabot[bot] | eec3c5d053 | |
dependabot[bot] | 4e4bf874c9 | |
dependabot[bot] | 8efcdf9d76 | |
dependabot[bot] | bc7c95a1a8 | |
dependabot[bot] | b91504c652 | |
dependabot[bot] | ebfc2b1cf7 | |
dependabot[bot] | f48bb8b8dd | |
dependabot[bot] | 5e043a936d | |
dependabot[bot] | 30e7316d5c | |
dependabot[bot] | c391507b3a | |
dependabot[bot] | 156760513c | |
dependabot[bot] | 9a34a633b2 | |
dependabot[bot] | f0b5839f4a | |
Matthias Kretschmann | 4a0c925263 | |
Matthias Kretschmann | e309c03937 | |
Matthias Kretschmann | 9419f7d18c | |
dependabot[bot] | 39181eb186 | |
dependabot[bot] | 9ffae6e02c | |
dependabot[bot] | d690a393fd | |
dependabot[bot] | e7447ad233 | |
dependabot[bot] | bb2f9ca887 | |
dependabot[bot] | 9d15d35eb6 | |
dependabot[bot] | 3cce2755e4 | |
dependabot[bot] | 33dfcf4676 | |
dependabot[bot] | a7170d3e03 | |
dependabot[bot] | 5db2702fcc | |
Matthias Kretschmann | 46528a5985 | |
Matthias Kretschmann | c9e537a128 | |
Matthias Kretschmann | c74c7f1960 | |
dependabot[bot] | cc391e7da4 | |
dependabot[bot] | e2c43d52c9 | |
dependabot[bot] | 32a0036be4 | |
dependabot[bot] | edc79f42af | |
dependabot[bot] | 00eb9d3a70 | |
dependabot[bot] | e5e1e09a41 | |
dependabot[bot] | 7b09617018 | |
dependabot[bot] | af02325c69 | |
dependabot[bot] | 426660db3b | |
dependabot[bot] | 27ac9812be | |
dependabot[bot] | 28cf248923 | |
dependabot[bot] | a0b5b59344 | |
dependabot[bot] | d45d135b86 | |
dependabot[bot] | b28da1e0b5 | |
dependabot[bot] | b2c9845912 | |
dependabot[bot] | 62eb16f57f | |
dependabot[bot] | 0143ff6036 | |
dependabot[bot] | 5322053e67 | |
dependabot[bot] | b6a33cd9e4 | |
dependabot[bot] | 2d22f09fde | |
dependabot[bot] | 62c62dbcee | |
dependabot[bot] | 653821a28f | |
dependabot[bot] | 09b77aab4a | |
dependabot[bot] | 06b28e2875 | |
dependabot[bot] | 5801803002 | |
dependabot[bot] | 4c83291b86 | |
dependabot[bot] | c91f0cbc58 | |
dependabot[bot] | 76c4929cd2 | |
dependabot[bot] | 3574709195 | |
dependabot[bot] | c6e113978e | |
dependabot[bot] | 74c9143509 | |
dependabot[bot] | d7bc51b47c | |
dependabot[bot] | 4cf833fbf7 | |
dependabot[bot] | a642de0575 | |
dependabot[bot] | 782fa8a2a4 | |
dependabot[bot] | 5b1fd6d475 | |
dependabot[bot] | 84c9349524 | |
dependabot[bot] | 1b6cd749d9 | |
Matthias Kretschmann | 2e14e0e464 | |
Matthias Kretschmann | 58eddd1691 | |
dependabot[bot] | f6aa6b20c6 | |
dependabot[bot] | cc1ce99a73 | |
dependabot[bot] | d445a0e86b | |
dependabot[bot] | 23c304bd20 | |
dependabot[bot] | 5b60eeb5d8 | |
dependabot[bot] | eee78c8723 |
|
@ -1,6 +1,5 @@
|
|||
{
|
||||
"extends": ["eslint:recommended", "plugin:prettier/recommended"],
|
||||
"plugins": ["prettier"],
|
||||
"extends": ["eslint:recommended", "prettier"],
|
||||
"parserOptions": {
|
||||
"sourceType": "module",
|
||||
"ecmaFeatures": {
|
||||
|
@ -11,6 +10,7 @@
|
|||
"env": {
|
||||
"browser": true,
|
||||
"node": true,
|
||||
"es2020": true
|
||||
"es2020": true,
|
||||
"jest": true
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
github: kremalicious
|
||||
patreon: kremalicious
|
||||
custom: ['https://kremalicious.com/thanks']
|
|
@ -18,25 +18,41 @@ jobs:
|
|||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||
node: ['14']
|
||||
node: ['18', '20']
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: ${{ matrix.node }}
|
||||
cache: npm
|
||||
|
||||
- run: npm ci
|
||||
- run: npm test
|
||||
- run: npm run build
|
||||
|
||||
coverage:
|
||||
if: ${{ github.actor != 'dependabot[bot]' }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
cache: npm
|
||||
- run: npm ci
|
||||
- uses: paambaati/codeclimate-action@v5.0.0
|
||||
env:
|
||||
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
|
||||
with:
|
||||
coverageCommand: npm test
|
||||
|
||||
publish:
|
||||
needs: test
|
||||
if: success() && startsWith(github.ref, 'refs/tags')
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
registry-url: 'https://registry.npmjs.org'
|
||||
|
||||
|
|
|
@ -0,0 +1,70 @@
|
|||
# For most projects, this workflow file will not need changing; you simply need
|
||||
# to commit it to your repository.
|
||||
#
|
||||
# You may wish to alter this file to override the set of languages analyzed,
|
||||
# or to provide custom queries or build logic.
|
||||
#
|
||||
# ******** NOTE ********
|
||||
# We have attempted to detect the languages in your repository. Please check
|
||||
# the `language` matrix defined below to confirm you have the correct set of
|
||||
# supported CodeQL languages.
|
||||
#
|
||||
name: "CodeQL"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main ]
|
||||
pull_request:
|
||||
# The branches below must be a subset of the branches above
|
||||
branches: [ main ]
|
||||
schedule:
|
||||
- cron: '24 22 * * 1'
|
||||
|
||||
jobs:
|
||||
analyze:
|
||||
name: Analyze
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
actions: read
|
||||
contents: read
|
||||
security-events: write
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
language: [ 'javascript' ]
|
||||
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
|
||||
# Learn more about CodeQL language support at https://git.io/codeql-language-support
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v1
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
# If you wish to specify custom queries, you can do so here or in a config file.
|
||||
# By default, queries listed here will override any specified in a config file.
|
||||
# Prefix the list here with "+" to use these queries and those in the config file.
|
||||
# queries: ./path/to/local/query, your-org/your-repo/queries@main
|
||||
|
||||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
||||
# If this step fails, then you should remove it and run the build manually (see below)
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@v1
|
||||
|
||||
# ℹ️ Command-line programs to run using the OS shell.
|
||||
# 📚 https://git.io/JvXDl
|
||||
|
||||
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
|
||||
# and modify them (or add more) to build your code if your project
|
||||
# uses a compiled language
|
||||
|
||||
#- run: |
|
||||
# make bootstrap
|
||||
# make release
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v1
|
|
@ -1,2 +1,3 @@
|
|||
node_modules
|
||||
/*.js
|
||||
coverage
|
|
@ -1,6 +1,6 @@
|
|||
node_modules
|
||||
src
|
||||
.babelrc
|
||||
test
|
||||
babel.config.json
|
||||
.editorconfig
|
||||
.eslintrc
|
||||
.travis.yml
|
||||
|
|
212
CHANGELOG.md
212
CHANGELOG.md
|
@ -4,8 +4,219 @@ All notable changes to this project will be documented in this file. Dates are d
|
|||
|
||||
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
||||
|
||||
#### [v1.1.0](https://github.com/kremalicious/gatsby-redirect-from/compare/v1.0.6...v1.1.0)
|
||||
|
||||
- refactor, more tests [`#444`](https://github.com/kremalicious/gatsby-redirect-from/pull/444)
|
||||
- Bump @babel/traverse from 7.23.0 to 7.23.2 [`#417`](https://github.com/kremalicious/gatsby-redirect-from/pull/417)
|
||||
- Bump postcss from 8.4.25 to 8.4.31 [`#413`](https://github.com/kremalicious/gatsby-redirect-from/pull/413)
|
||||
- Bump sharp from 0.32.1 to 0.32.6 [`#422`](https://github.com/kremalicious/gatsby-redirect-from/pull/422)
|
||||
- add unit test cases [`4756794`](https://github.com/kremalicious/gatsby-redirect-from/commit/475679419f284b6def8447daac64d34ce218c3da)
|
||||
- npm audit fix [`e259bd2`](https://github.com/kremalicious/gatsby-redirect-from/commit/e259bd237e6570c084e69878ad0e31cc82c91cc2)
|
||||
- test setup [`8ab2e49`](https://github.com/kremalicious/gatsby-redirect-from/commit/8ab2e492f0d79a39185686ddeca38d4b91d8727a)
|
||||
|
||||
#### [v1.0.6](https://github.com/kremalicious/gatsby-redirect-from/compare/v1.0.5...v1.0.6)
|
||||
|
||||
> 28 September 2023
|
||||
|
||||
- dependency updates, new package-lock [`61d6692`](https://github.com/kremalicious/gatsby-redirect-from/commit/61d669235c5387103be62384cd3f352710bae0f5)
|
||||
- Release 1.0.6 [`b885ec2`](https://github.com/kremalicious/gatsby-redirect-from/commit/b885ec26f096beccca491149bd7dd79316346ef6)
|
||||
- bump Node.js version in CI [`035274a`](https://github.com/kremalicious/gatsby-redirect-from/commit/035274ad07a2385b5bb86e45adf1fc8fdddfe12e)
|
||||
|
||||
#### [v1.0.5](https://github.com/kremalicious/gatsby-redirect-from/compare/v1.0.4...v1.0.5)
|
||||
|
||||
> 17 August 2023
|
||||
|
||||
- Bump release-it from 16.0.0 to 16.1.0 [`#389`](https://github.com/kremalicious/gatsby-redirect-from/pull/389)
|
||||
- dependency updates [`fb8d6cf`](https://github.com/kremalicious/gatsby-redirect-from/commit/fb8d6cfd1753ec793698b9302eaf2f113330c1a9)
|
||||
- Release 1.0.5 [`54dd077`](https://github.com/kremalicious/gatsby-redirect-from/commit/54dd077e8d4ffd791a914bc0f6c212839ca70c10)
|
||||
|
||||
#### [v1.0.4](https://github.com/kremalicious/gatsby-redirect-from/compare/v1.0.3...v1.0.4)
|
||||
|
||||
> 8 July 2023
|
||||
|
||||
- Bump eslint from 8.38.0 to 8.44.0 [`#387`](https://github.com/kremalicious/gatsby-redirect-from/pull/387)
|
||||
- package updates, remove eslint-plugin-prettier [`1bec87e`](https://github.com/kremalicious/gatsby-redirect-from/commit/1bec87e1b70b28011d8abb5b3f19dbf45dc31a3a)
|
||||
- Release 1.0.4 [`7703505`](https://github.com/kremalicious/gatsby-redirect-from/commit/770350593e3dbae1532f9b59cdcd3247450ba47b)
|
||||
|
||||
#### [v1.0.3](https://github.com/kremalicious/gatsby-redirect-from/compare/v1.0.2...v1.0.3)
|
||||
|
||||
> 27 April 2023
|
||||
|
||||
- Bump vm2 from 3.9.16 to 3.9.17 [`#364`](https://github.com/kremalicious/gatsby-redirect-from/pull/364)
|
||||
- Bump vm2 from 3.9.15 to 3.9.16 [`#363`](https://github.com/kremalicious/gatsby-redirect-from/pull/363)
|
||||
- Release 1.0.3 [`26bcf8d`](https://github.com/kremalicious/gatsby-redirect-from/commit/26bcf8db16f9e6c578e5e5694e4fda2471d4a071)
|
||||
- dependency security fix [`3914619`](https://github.com/kremalicious/gatsby-redirect-from/commit/3914619be74030cdfb5246e6c7528173eaa8fa8b)
|
||||
|
||||
#### [v1.0.2](https://github.com/kremalicious/gatsby-redirect-from/compare/v1.0.1...v1.0.2)
|
||||
|
||||
> 12 April 2023
|
||||
|
||||
- Bump release-it from 15.9.1 to 15.10.0 [`#358`](https://github.com/kremalicious/gatsby-redirect-from/pull/358)
|
||||
- Bump @babel/core from 7.21.3 to 7.21.4 [`#359`](https://github.com/kremalicious/gatsby-redirect-from/pull/359)
|
||||
- Bump @babel/preset-env from 7.20.2 to 7.21.4 [`#357`](https://github.com/kremalicious/gatsby-redirect-from/pull/357)
|
||||
- Bump vm2 from 3.9.11 to 3.9.15 [`#360`](https://github.com/kremalicious/gatsby-redirect-from/pull/360)
|
||||
- dependency updates [`6e7faed`](https://github.com/kremalicious/gatsby-redirect-from/commit/6e7faed7ba5891e4afe7b1f5312d125c6b9ba1a0)
|
||||
- Release 1.0.2 [`e704f7e`](https://github.com/kremalicious/gatsby-redirect-from/commit/e704f7e4695713a180fa3b5c930b5cad328a90ac)
|
||||
|
||||
#### [v1.0.1](https://github.com/kremalicious/gatsby-redirect-from/compare/v1.0.0...v1.0.1)
|
||||
|
||||
> 23 March 2023
|
||||
|
||||
- Bump eslint from 8.33.0 to 8.36.0 [`#350`](https://github.com/kremalicious/gatsby-redirect-from/pull/350)
|
||||
- Bump prettier from 2.8.3 to 2.8.4 [`#343`](https://github.com/kremalicious/gatsby-redirect-from/pull/343)
|
||||
- Bump release-it from 15.6.0 to 15.9.0 [`#352`](https://github.com/kremalicious/gatsby-redirect-from/pull/352)
|
||||
- Bump webpack from 5.75.0 to 5.76.1 [`#351`](https://github.com/kremalicious/gatsby-redirect-from/pull/351)
|
||||
- Bump @babel/core from 7.20.12 to 7.21.3 [`#353`](https://github.com/kremalicious/gatsby-redirect-from/pull/353)
|
||||
- Bump @babel/cli from 7.20.7 to 7.21.0 [`#346`](https://github.com/kremalicious/gatsby-redirect-from/pull/346)
|
||||
- Bump http-cache-semantics from 4.1.0 to 4.1.1 [`#342`](https://github.com/kremalicious/gatsby-redirect-from/pull/342)
|
||||
- Bump eslint from 8.32.0 to 8.33.0 [`#341`](https://github.com/kremalicious/gatsby-redirect-from/pull/341)
|
||||
- Bump ua-parser-js from 0.7.32 to 0.7.33 [`#340`](https://github.com/kremalicious/gatsby-redirect-from/pull/340)
|
||||
- Bump engine.io and gatsby [`#339`](https://github.com/kremalicious/gatsby-redirect-from/pull/339)
|
||||
- Bump eslint-config-prettier from 8.5.0 to 8.6.0 [`#338`](https://github.com/kremalicious/gatsby-redirect-from/pull/338)
|
||||
- Bump eslint from 8.31.0 to 8.32.0 [`#337`](https://github.com/kremalicious/gatsby-redirect-from/pull/337)
|
||||
- Bump prettier from 2.8.1 to 2.8.3 [`#336`](https://github.com/kremalicious/gatsby-redirect-from/pull/336)
|
||||
- Bump @babel/core from 7.20.5 to 7.20.12 [`#335`](https://github.com/kremalicious/gatsby-redirect-from/pull/335)
|
||||
- Bump @babel/cli from 7.19.3 to 7.20.7 [`#330`](https://github.com/kremalicious/gatsby-redirect-from/pull/330)
|
||||
- Bump release-it from 15.5.1 to 15.6.0 [`#333`](https://github.com/kremalicious/gatsby-redirect-from/pull/333)
|
||||
- Bump eslint from 8.29.0 to 8.31.0 [`#332`](https://github.com/kremalicious/gatsby-redirect-from/pull/332)
|
||||
- Bump json5 from 1.0.1 to 1.0.2 [`#334`](https://github.com/kremalicious/gatsby-redirect-from/pull/334)
|
||||
- Bump prettier from 2.8.0 to 2.8.1 [`#327`](https://github.com/kremalicious/gatsby-redirect-from/pull/327)
|
||||
- Bump chalk from 5.1.2 to 5.2.0 [`#328`](https://github.com/kremalicious/gatsby-redirect-from/pull/328)
|
||||
- Bump got and gatsby [`#326`](https://github.com/kremalicious/gatsby-redirect-from/pull/326)
|
||||
- Bump qs and express [`#325`](https://github.com/kremalicious/gatsby-redirect-from/pull/325)
|
||||
- Bump decode-uri-component from 0.2.0 to 0.2.2 [`#324`](https://github.com/kremalicious/gatsby-redirect-from/pull/324)
|
||||
- Bump @babel/core from 7.20.2 to 7.20.5 [`#323`](https://github.com/kremalicious/gatsby-redirect-from/pull/323)
|
||||
- Bump eslint from 8.27.0 to 8.29.0 [`#322`](https://github.com/kremalicious/gatsby-redirect-from/pull/322)
|
||||
- Bump release-it from 15.5.0 to 15.5.1 [`#321`](https://github.com/kremalicious/gatsby-redirect-from/pull/321)
|
||||
- Bump prettier from 2.7.1 to 2.8.0 [`#320`](https://github.com/kremalicious/gatsby-redirect-from/pull/320)
|
||||
- Bump loader-utils from 1.4.1 to 1.4.2 [`#318`](https://github.com/kremalicious/gatsby-redirect-from/pull/318)
|
||||
- Bump socket.io-parser from 4.0.4 to 4.0.5 [`#317`](https://github.com/kremalicious/gatsby-redirect-from/pull/317)
|
||||
- package updates [`4a4cfa8`](https://github.com/kremalicious/gatsby-redirect-from/commit/4a4cfa89b7e30960c4416681fb8c9dec2f47342e)
|
||||
- Release 1.0.1 [`454d0ee`](https://github.com/kremalicious/gatsby-redirect-from/commit/454d0eecd64e21dd9b14e9c1bcdb662feace63a2)
|
||||
|
||||
### [v1.0.0](https://github.com/kremalicious/gatsby-redirect-from/compare/v0.5.0...v1.0.0)
|
||||
|
||||
> 8 November 2022
|
||||
|
||||
- Bump loader-utils from 1.4.0 to 1.4.1 [`#316`](https://github.com/kremalicious/gatsby-redirect-from/pull/316)
|
||||
- Bump eslint from 8.26.0 to 8.27.0 [`#315`](https://github.com/kremalicious/gatsby-redirect-from/pull/315)
|
||||
- Bump chalk from 5.0.1 to 5.1.2 [`#314`](https://github.com/kremalicious/gatsby-redirect-from/pull/314)
|
||||
- Bump @babel/preset-env from 7.19.4 to 7.20.2 [`#313`](https://github.com/kremalicious/gatsby-redirect-from/pull/313)
|
||||
- Bump release-it from 15.4.2 to 15.5.0 [`#312`](https://github.com/kremalicious/gatsby-redirect-from/pull/312)
|
||||
- Bump @babel/core from 7.19.6 to 7.20.2 [`#311`](https://github.com/kremalicious/gatsby-redirect-from/pull/311)
|
||||
- Bump parse-url and gatsby-telemetry [`#310`](https://github.com/kremalicious/gatsby-redirect-from/pull/310)
|
||||
- Bump eslint from 8.23.1 to 8.26.0 [`#308`](https://github.com/kremalicious/gatsby-redirect-from/pull/308)
|
||||
- Bump @babel/core from 7.19.1 to 7.19.6 [`#309`](https://github.com/kremalicious/gatsby-redirect-from/pull/309)
|
||||
- Bump @babel/preset-env from 7.19.1 to 7.19.4 [`#307`](https://github.com/kremalicious/gatsby-redirect-from/pull/307)
|
||||
- Bump @babel/cli from 7.18.10 to 7.19.3 [`#305`](https://github.com/kremalicious/gatsby-redirect-from/pull/305)
|
||||
- Bump vm2 from 3.9.9 to 3.9.11 [`#302`](https://github.com/kremalicious/gatsby-redirect-from/pull/302)
|
||||
- Bump @babel/cli from 7.18.6 to 7.18.10 [`#297`](https://github.com/kremalicious/gatsby-redirect-from/pull/297)
|
||||
- Bump @babel/preset-env from 7.18.6 to 7.19.1 [`#298`](https://github.com/kremalicious/gatsby-redirect-from/pull/298)
|
||||
- Bump release-it from 15.4.1 to 15.4.2 [`#299`](https://github.com/kremalicious/gatsby-redirect-from/pull/299)
|
||||
- Bump @babel/core from 7.18.6 to 7.19.1 [`#300`](https://github.com/kremalicious/gatsby-redirect-from/pull/300)
|
||||
- Bump ws from 7.4.5 to 7.4.6 [`#296`](https://github.com/kremalicious/gatsby-redirect-from/pull/296)
|
||||
- Bump shell-quote from 1.7.2 to 1.7.3 [`#295`](https://github.com/kremalicious/gatsby-redirect-from/pull/295)
|
||||
- Bump eslint from 8.23.0 to 8.23.1 [`#294`](https://github.com/kremalicious/gatsby-redirect-from/pull/294)
|
||||
- Bump release-it from 15.1.1 to 15.4.1 [`#293`](https://github.com/kremalicious/gatsby-redirect-from/pull/293)
|
||||
- Bump eslint from 8.15.0 to 8.23.0 [`#291`](https://github.com/kremalicious/gatsby-redirect-from/pull/291)
|
||||
- Bump file-type from 16.5.3 to 16.5.4 [`#285`](https://github.com/kremalicious/gatsby-redirect-from/pull/285)
|
||||
- Bump terser from 5.12.1 to 5.14.2 [`#284`](https://github.com/kremalicious/gatsby-redirect-from/pull/284)
|
||||
- Bump eslint-plugin-prettier from 4.0.0 to 4.2.1 [`#279`](https://github.com/kremalicious/gatsby-redirect-from/pull/279)
|
||||
- Bump prettier from 2.6.2 to 2.7.1 [`#281`](https://github.com/kremalicious/gatsby-redirect-from/pull/281)
|
||||
- Bump moment from 2.29.2 to 2.29.4 [`#278`](https://github.com/kremalicious/gatsby-redirect-from/pull/278)
|
||||
- Bump release-it from 14.14.1 to 15.1.1 [`#274`](https://github.com/kremalicious/gatsby-redirect-from/pull/274)
|
||||
- Bump @babel/cli from 7.17.6 to 7.18.6 [`#276`](https://github.com/kremalicious/gatsby-redirect-from/pull/276)
|
||||
- Bump @babel/preset-env from 7.16.11 to 7.18.6 [`#275`](https://github.com/kremalicious/gatsby-redirect-from/pull/275)
|
||||
- Bump @babel/helper-define-map from 7.16.7 to 7.18.6 [`#273`](https://github.com/kremalicious/gatsby-redirect-from/pull/273)
|
||||
- Bump @babel/core from 7.17.9 to 7.18.6 [`#272`](https://github.com/kremalicious/gatsby-redirect-from/pull/272)
|
||||
- Bump devcert from 1.2.0 to 1.2.1 [`#269`](https://github.com/kremalicious/gatsby-redirect-from/pull/269)
|
||||
- Bump eventsource from 1.1.0 to 1.1.1 [`#267`](https://github.com/kremalicious/gatsby-redirect-from/pull/267)
|
||||
- Bump parse-url from 6.0.0 to 6.0.2 [`#277`](https://github.com/kremalicious/gatsby-redirect-from/pull/277)
|
||||
- Bump sharp from 0.30.3 to 0.30.6 [`#268`](https://github.com/kremalicious/gatsby-redirect-from/pull/268)
|
||||
- Bump eslint from 8.13.0 to 8.15.0 [`#261`](https://github.com/kremalicious/gatsby-redirect-from/pull/261)
|
||||
- Release 1.0.0 [`112d72e`](https://github.com/kremalicious/gatsby-redirect-from/commit/112d72e671db94a2e0028bd8f4e971c3b2b0bc69)
|
||||
- Gatsby v5 support [`b3f7933`](https://github.com/kremalicious/gatsby-redirect-from/commit/b3f793356d4254527d968efdfa694479880bcd97)
|
||||
|
||||
#### [v0.5.0](https://github.com/kremalicious/gatsby-redirect-from/compare/v0.4.4...v0.5.0)
|
||||
|
||||
> 10 April 2022
|
||||
|
||||
- Bump moment from 2.29.1 to 2.29.2 [`#254`](https://github.com/kremalicious/gatsby-redirect-from/pull/254)
|
||||
- Bump prettier from 2.6.1 to 2.6.2 [`#253`](https://github.com/kremalicious/gatsby-redirect-from/pull/253)
|
||||
- Bump release-it from 14.13.1 to 14.14.0 [`#252`](https://github.com/kremalicious/gatsby-redirect-from/pull/252)
|
||||
- Bump prettier from 2.6.0 to 2.6.1 [`#251`](https://github.com/kremalicious/gatsby-redirect-from/pull/251)
|
||||
- Bump eslint from 8.11.0 to 8.12.0 [`#250`](https://github.com/kremalicious/gatsby-redirect-from/pull/250)
|
||||
- Bump minimist from 1.2.5 to 1.2.6 [`#249`](https://github.com/kremalicious/gatsby-redirect-from/pull/249)
|
||||
- Bump @babel/core from 7.17.5 to 7.17.8 [`#247`](https://github.com/kremalicious/gatsby-redirect-from/pull/247)
|
||||
- Bump release-it from 14.12.5 to 14.13.1 [`#246`](https://github.com/kremalicious/gatsby-redirect-from/pull/246)
|
||||
- Bump prettier from 2.5.1 to 2.6.0 [`#248`](https://github.com/kremalicious/gatsby-redirect-from/pull/248)
|
||||
- Bump eslint from 8.10.0 to 8.11.0 [`#245`](https://github.com/kremalicious/gatsby-redirect-from/pull/245)
|
||||
- default to Gatsby v4 peer dependency [`e309c03`](https://github.com/kremalicious/gatsby-redirect-from/commit/e309c03937b6844e4593759ba59df809bfd3a200)
|
||||
- package updates [`9419f7d`](https://github.com/kremalicious/gatsby-redirect-from/commit/9419f7d18cc7cf561a63dd07453d7f2ff21724ef)
|
||||
- Create codeql-analysis.yml [`46528a5`](https://github.com/kremalicious/gatsby-redirect-from/commit/46528a59852ec50972e01311897cea23cb6f23fd)
|
||||
|
||||
#### [v0.4.4](https://github.com/kremalicious/gatsby-redirect-from/compare/v0.4.3...v0.4.4)
|
||||
|
||||
> 11 March 2022
|
||||
|
||||
- Bump release-it from 14.12.4 to 14.12.5 [`#242`](https://github.com/kremalicious/gatsby-redirect-from/pull/242)
|
||||
- Bump eslint-config-prettier from 8.4.0 to 8.5.0 [`#244`](https://github.com/kremalicious/gatsby-redirect-from/pull/244)
|
||||
- Bump url-parse from 1.5.7 to 1.5.10 [`#243`](https://github.com/kremalicious/gatsby-redirect-from/pull/243)
|
||||
- Bump eslint from 8.9.0 to 8.10.0 [`#241`](https://github.com/kremalicious/gatsby-redirect-from/pull/241)
|
||||
- Bump @babel/cli from 7.17.3 to 7.17.6 [`#240`](https://github.com/kremalicious/gatsby-redirect-from/pull/240)
|
||||
- Bump nanoid from 3.1.30 to 3.3.1 [`#239`](https://github.com/kremalicious/gatsby-redirect-from/pull/239)
|
||||
- Bump @babel/core from 7.17.2 to 7.17.5 [`#236`](https://github.com/kremalicious/gatsby-redirect-from/pull/236)
|
||||
- Bump eslint-config-prettier from 8.3.0 to 8.4.0 [`#237`](https://github.com/kremalicious/gatsby-redirect-from/pull/237)
|
||||
- Bump @babel/cli from 7.17.0 to 7.17.3 [`#238`](https://github.com/kremalicious/gatsby-redirect-from/pull/238)
|
||||
- Bump url-parse from 1.5.3 to 1.5.7 [`#235`](https://github.com/kremalicious/gatsby-redirect-from/pull/235)
|
||||
- Bump engine.io from 4.1.1 to 4.1.2 [`#234`](https://github.com/kremalicious/gatsby-redirect-from/pull/234)
|
||||
- Bump follow-redirects from 1.14.1 to 1.14.8 [`#233`](https://github.com/kremalicious/gatsby-redirect-from/pull/233)
|
||||
- Bump @babel/core from 7.17.0 to 7.17.2 [`#232`](https://github.com/kremalicious/gatsby-redirect-from/pull/232)
|
||||
- Bump eslint from 8.8.0 to 8.9.0 [`#231`](https://github.com/kremalicious/gatsby-redirect-from/pull/231)
|
||||
- Bump @babel/cli from 7.16.8 to 7.17.0 [`#228`](https://github.com/kremalicious/gatsby-redirect-from/pull/228)
|
||||
- Bump auto-changelog from 2.3.0 to 2.4.0 [`#229`](https://github.com/kremalicious/gatsby-redirect-from/pull/229)
|
||||
- Bump @babel/core from 7.16.12 to 7.17.0 [`#230`](https://github.com/kremalicious/gatsby-redirect-from/pull/230)
|
||||
- Bump eslint from 8.7.0 to 8.8.0 [`#227`](https://github.com/kremalicious/gatsby-redirect-from/pull/227)
|
||||
- Bump @babel/preset-env from 7.16.8 to 7.16.11 [`#224`](https://github.com/kremalicious/gatsby-redirect-from/pull/224)
|
||||
- Bump release-it from 14.12.3 to 14.12.4 [`#225`](https://github.com/kremalicious/gatsby-redirect-from/pull/225)
|
||||
- Bump @babel/core from 7.16.7 to 7.16.12 [`#226`](https://github.com/kremalicious/gatsby-redirect-from/pull/226)
|
||||
- Bump release-it from 14.12.1 to 14.12.3 [`#220`](https://github.com/kremalicious/gatsby-redirect-from/pull/220)
|
||||
- Bump @babel/preset-env from 7.16.7 to 7.16.8 [`#221`](https://github.com/kremalicious/gatsby-redirect-from/pull/221)
|
||||
- Bump @babel/cli from 7.16.7 to 7.16.8 [`#222`](https://github.com/kremalicious/gatsby-redirect-from/pull/222)
|
||||
- Bump eslint from 8.6.0 to 8.7.0 [`#223`](https://github.com/kremalicious/gatsby-redirect-from/pull/223)
|
||||
- Bump release-it from 14.11.8 to 14.12.1 [`#219`](https://github.com/kremalicious/gatsby-redirect-from/pull/219)
|
||||
- Bump @babel/cli from 7.16.0 to 7.16.7 [`#218`](https://github.com/kremalicious/gatsby-redirect-from/pull/218)
|
||||
- Bump eslint from 8.5.0 to 8.6.0 [`#217`](https://github.com/kremalicious/gatsby-redirect-from/pull/217)
|
||||
- Bump @babel/preset-env from 7.16.5 to 7.16.7 [`#216`](https://github.com/kremalicious/gatsby-redirect-from/pull/216)
|
||||
- Bump @babel/core from 7.16.5 to 7.16.7 [`#215`](https://github.com/kremalicious/gatsby-redirect-from/pull/215)
|
||||
- Bump @babel/helper-define-map from 7.16.5 to 7.16.7 [`#214`](https://github.com/kremalicious/gatsby-redirect-from/pull/214)
|
||||
- Bump @babel/helper-define-map from 7.16.0 to 7.16.5 [`#213`](https://github.com/kremalicious/gatsby-redirect-from/pull/213)
|
||||
- Bump @babel/preset-env from 7.16.4 to 7.16.5 [`#211`](https://github.com/kremalicious/gatsby-redirect-from/pull/211)
|
||||
- Bump @babel/core from 7.16.0 to 7.16.5 [`#210`](https://github.com/kremalicious/gatsby-redirect-from/pull/210)
|
||||
- Bump eslint from 8.4.1 to 8.5.0 [`#212`](https://github.com/kremalicious/gatsby-redirect-from/pull/212)
|
||||
- Bump eslint from 8.4.0 to 8.4.1 [`#209`](https://github.com/kremalicious/gatsby-redirect-from/pull/209)
|
||||
- Bump prettier from 2.5.0 to 2.5.1 [`#208`](https://github.com/kremalicious/gatsby-redirect-from/pull/208)
|
||||
- Bump eslint from 8.3.0 to 8.4.0 [`#207`](https://github.com/kremalicious/gatsby-redirect-from/pull/207)
|
||||
- package updates [`c74c7f1`](https://github.com/kremalicious/gatsby-redirect-from/commit/c74c7f1960abf86b1b43b6bb2963f429104508e2)
|
||||
- Release 0.4.4 [`c9e537a`](https://github.com/kremalicious/gatsby-redirect-from/commit/c9e537a128260fc41c1d2230e615c4c4cb46acd0)
|
||||
|
||||
#### [v0.4.3](https://github.com/kremalicious/gatsby-redirect-from/compare/v0.4.2...v0.4.3)
|
||||
|
||||
> 28 November 2021
|
||||
|
||||
- Bump eslint from 8.0.1 to 8.1.0 [`#199`](https://github.com/kremalicious/gatsby-redirect-from/pull/199)
|
||||
- Bump eslint from 8.0.0 to 8.0.1 [`#197`](https://github.com/kremalicious/gatsby-redirect-from/pull/197)
|
||||
- Bump @babel/core from 7.15.5 to 7.15.8 [`#195`](https://github.com/kremalicious/gatsby-redirect-from/pull/195)
|
||||
- Bump @babel/preset-env from 7.15.6 to 7.15.8 [`#194`](https://github.com/kremalicious/gatsby-redirect-from/pull/194)
|
||||
- Bump eslint from 7.32.0 to 8.0.0 [`#196`](https://github.com/kremalicious/gatsby-redirect-from/pull/196)
|
||||
- Bump release-it from 14.11.5 to 14.11.6 [`#193`](https://github.com/kremalicious/gatsby-redirect-from/pull/193)
|
||||
- package updates [`58eddd1`](https://github.com/kremalicious/gatsby-redirect-from/commit/58eddd169125b6bc98bbf7ba189eb0295d04a785)
|
||||
- Release 0.4.3 [`2e14e0e`](https://github.com/kremalicious/gatsby-redirect-from/commit/2e14e0e464648cba5752c92d913becc294060f5a)
|
||||
|
||||
#### [v0.4.2](https://github.com/kremalicious/gatsby-redirect-from/compare/v0.4.1...v0.4.2)
|
||||
|
||||
> 20 September 2021
|
||||
|
||||
- Bump prettier from 2.4.0 to 2.4.1 [`#192`](https://github.com/kremalicious/gatsby-redirect-from/pull/192)
|
||||
- Bump @babel/cli from 7.15.4 to 7.15.7 [`#191`](https://github.com/kremalicious/gatsby-redirect-from/pull/191)
|
||||
- Bump @babel/preset-env from 7.14.4 to 7.15.6 [`#189`](https://github.com/kremalicious/gatsby-redirect-from/pull/189)
|
||||
|
@ -23,6 +234,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|||
- Bump release-it from 14.6.2 to 14.7.0 [`#161`](https://github.com/kremalicious/gatsby-redirect-from/pull/161)
|
||||
- Bump @babel/preset-env from 7.14.2 to 7.14.4 [`#162`](https://github.com/kremalicious/gatsby-redirect-from/pull/162)
|
||||
- Bump auto-changelog from 2.2.1 to 2.3.0 [`#160`](https://github.com/kremalicious/gatsby-redirect-from/pull/160)
|
||||
- Release 0.4.2 [`b5d77a4`](https://github.com/kremalicious/gatsby-redirect-from/commit/b5d77a41c3e74ba2c8edad006056d765716f43c6)
|
||||
- Support Gatsby v4 [`65d1c40`](https://github.com/kremalicious/gatsby-redirect-from/commit/65d1c40c2768fc2f9155ebcad9fafce5279b9405)
|
||||
|
||||
#### [v0.4.1](https://github.com/kremalicious/gatsby-redirect-from/compare/v0.4.0...v0.4.1)
|
||||
|
|
15
README.md
15
README.md
|
@ -5,6 +5,7 @@
|
|||
[![npm package](https://img.shields.io/npm/v/gatsby-redirect-from.svg)](https://www.npmjs.com/package/gatsby-redirect-from)
|
||||
[![Build Status](https://github.com/kremalicious/gatsby-redirect-from/workflows/CI/badge.svg)](https://github.com/kremalicious/gatsby-redirect-from/actions)
|
||||
[![Maintainability](https://api.codeclimate.com/v1/badges/9643b2a038a7d338a73a/maintainability)](https://codeclimate.com/github/kremalicious/gatsby-redirect-from/maintainability)
|
||||
[![Test Coverage](https://api.codeclimate.com/v1/badges/9643b2a038a7d338a73a/test_coverage)](https://codeclimate.com/github/kremalicious/gatsby-redirect-from/test_coverage)
|
||||
|
||||
> 🎯 Set redirect urls in your YAML frontmatter within your [Gatsby](https://www.gatsbyjs.org) site's Markdown files. Mimics the behavior of [jekyll-redirect-from](https://github.com/jekyll/jekyll-redirect-from).
|
||||
> https://kremalicious.com/gatsby-redirect-from/
|
||||
|
@ -23,6 +24,7 @@ By combining this plugin with [gatsby-plugin-meta-redirect](https://github.com/g
|
|||
- [Documentation](#documentation)
|
||||
- [Plugin Development](#plugin-development)
|
||||
- [Changelog](#changelog)
|
||||
- [Sponsorship](#sponsorship)
|
||||
- [License](#license)
|
||||
|
||||
---
|
||||
|
@ -65,7 +67,6 @@ redirect_from:
|
|||
- /2008/04/aperture-file-types/
|
||||
# note: trailing slashes are required
|
||||
---
|
||||
|
||||
```
|
||||
|
||||
## [Documentation](https://kremalicious.com/gatsby-redirect-from/)
|
||||
|
@ -92,6 +93,12 @@ npm run release
|
|||
|
||||
See [CHANGELOG.md](CHANGELOG.md).
|
||||
|
||||
## Sponsorship
|
||||
|
||||
[![](https://img.shields.io/static/v1?label=Say%20Thanks%20With%20Web3&labelColor=%2343a699&message=%E2%9D%A4&logo=Ethereum&color=%23fe8e86&style=for-the-badge)](https://kremalicious.com/thanks)
|
||||
|
||||
[![](https://img.shields.io/static/v1?label=Say%20Thanks%20With%20GitHub&labelColor=%2343a699&message=%E2%9D%A4&logo=GitHub&color=%23fe8e86&style=for-the-badge)](https://github.com/sponsors/kremalicious)
|
||||
|
||||
## License
|
||||
|
||||
The MIT License
|
||||
|
@ -107,9 +114,3 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
|||
---
|
||||
|
||||
Made with ♥ by [Matthias Kretschmann](https://matthiaskretschmann.com) ([@kremalicious](https://github.com/kremalicious))
|
||||
|
||||
Say thanks with BTC:
|
||||
`35UUssHexVK48jbiSgTxa4QihEoCqrwCTG`
|
||||
|
||||
Say thanks with ETH:
|
||||
`0x04354F554536DA108726829207958d3E277f0210`
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"presets": ["@babel/preset-env"]
|
||||
}
|
File diff suppressed because it is too large
Load Diff
36
package.json
36
package.json
|
@ -1,16 +1,17 @@
|
|||
{
|
||||
"name": "gatsby-redirect-from",
|
||||
"version": "0.4.2",
|
||||
"version": "1.1.0",
|
||||
"author": "Matthias Kretschmann <m@kretschmann.io>",
|
||||
"description": "Set redirect urls in your YAML frontmatter within your Gatsby site's Markdown files. Mimics the behavior of jekyll-redirect-from.",
|
||||
"homepage": "https://kremalicious.com/gatsby-redirect-from/",
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"build": "cross-env NODE_ENV=production babel src --out-dir . --ignore __tests__",
|
||||
"start": "babel -w src --out-dir . --ignore __tests__",
|
||||
"test": "eslint src/**/*.js",
|
||||
"format": "prettier --write 'src/**/*.{js,jsx}'",
|
||||
"build": "cross-env NODE_ENV=production babel src --out-dir .",
|
||||
"start": "babel -w src --out-dir .",
|
||||
"test": "npm run lint && jest --coverage --config ./test/jest.config.json",
|
||||
"lint": "eslint ./{src,test}/**/*.js",
|
||||
"format": "prettier --write '{src,test}/**/*.{js,jsx}'",
|
||||
"release": "release-it --non-interactive",
|
||||
"changelog": "auto-changelog -p",
|
||||
"prepublishOnly": "npm run build"
|
||||
|
@ -19,25 +20,24 @@
|
|||
"maintained node versions"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.14.3",
|
||||
"@babel/core": "^7.14.3",
|
||||
"@babel/helper-define-map": "^7.13.12",
|
||||
"@babel/preset-env": "^7.14.2",
|
||||
"auto-changelog": "^2.2.1",
|
||||
"chalk": "^4.1.1",
|
||||
"@babel/cli": "^7.24.1",
|
||||
"@babel/core": "^7.24.4",
|
||||
"@babel/preset-env": "^7.24.4",
|
||||
"auto-changelog": "^2.4.0",
|
||||
"cross-env": "^7.0.3",
|
||||
"eslint": "^7.27.0",
|
||||
"eslint-config-prettier": "^8.3.0",
|
||||
"eslint-plugin-prettier": "^4.0.0",
|
||||
"prettier": "^2.3.0",
|
||||
"release-it": "^14.6.2"
|
||||
"eslint": "^8.50.0",
|
||||
"eslint-config-prettier": "^9.1.0",
|
||||
"jest": "^29.7.0",
|
||||
"jest-environment-jsdom": "^29.7.0",
|
||||
"prettier": "^3.2.5",
|
||||
"release-it": "^17.1.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"gatsby": "^2.0.0 || ^3.0.0 || ^4.0.0",
|
||||
"gatsby": "^4.0.0 || ^5.0.0",
|
||||
"gatsby-plugin-meta-redirect": ">=1.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
"node": ">=18"
|
||||
},
|
||||
"repository": "github:kremalicious/gatsby-redirect-from",
|
||||
"bugs": {
|
||||
|
|
|
@ -1,67 +1,100 @@
|
|||
import chalk from 'chalk'
|
||||
exports.createSchemaCustomization = ({ actions }) => {
|
||||
const { createTypes } = actions
|
||||
|
||||
export function createPages({ graphql, actions }, pluginOptions) {
|
||||
// Define the type definitions for the `MarkdownRemark` node
|
||||
const typeDefs = `
|
||||
type MarkdownRemark implements Node {
|
||||
fields: MarkdownRemarkFields
|
||||
frontmatter: MarkdownRemarkFrontmatter
|
||||
}
|
||||
|
||||
type MarkdownRemarkFields {
|
||||
slug: String
|
||||
}
|
||||
|
||||
type MarkdownRemarkFrontmatter {
|
||||
slug: String
|
||||
}
|
||||
`
|
||||
|
||||
// Create the type definitions
|
||||
createTypes(typeDefs)
|
||||
}
|
||||
|
||||
export async function createPages({ graphql, actions }, pluginOptions) {
|
||||
const { createRedirect } = actions
|
||||
|
||||
const markdownQuery = pluginOptions.query || 'allMarkdownRemark'
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(
|
||||
graphql(
|
||||
`
|
||||
{
|
||||
q: ${markdownQuery}(
|
||||
filter: { frontmatter: { redirect_from: { ne: null } } }
|
||||
) {
|
||||
edges {
|
||||
node {
|
||||
fields {
|
||||
slug
|
||||
}
|
||||
frontmatter {
|
||||
redirect_from
|
||||
}
|
||||
}
|
||||
try {
|
||||
const { data } = await graphql(`
|
||||
{
|
||||
q: ${markdownQuery}(filter: { frontmatter: { redirect_from: { ne: null } } }) {
|
||||
edges {
|
||||
node {
|
||||
fields {
|
||||
slug
|
||||
}
|
||||
frontmatter {
|
||||
slug
|
||||
redirect_from
|
||||
}
|
||||
}
|
||||
}
|
||||
`
|
||||
).then((result) => {
|
||||
if (result.errors) {
|
||||
console.log(result.errors) // eslint-disable-line no-console
|
||||
reject(result.errors)
|
||||
}
|
||||
}
|
||||
`)
|
||||
|
||||
const allPosts = result.data.q.edges
|
||||
const allPosts = data?.q?.edges
|
||||
|
||||
const redirects = []
|
||||
if (!allPosts || allPosts.length === 0) {
|
||||
console.log(
|
||||
'%c %s %c %s',
|
||||
'color:orange',
|
||||
'warning',
|
||||
'color:none',
|
||||
'no posts with redirect_from found'
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
// For all posts with redirect_from frontmatter,
|
||||
// extract all values and push to redirects array
|
||||
allPosts.forEach((post) => {
|
||||
redirects.push({
|
||||
from: post.node.frontmatter.redirect_from,
|
||||
to: post.node.fields.slug
|
||||
})
|
||||
})
|
||||
const redirects = []
|
||||
|
||||
// Create redirects from the just constructed array
|
||||
redirects.forEach(({ from, to }) => {
|
||||
// iterate through all `from` array items
|
||||
from.forEach((from) => {
|
||||
createRedirect({
|
||||
fromPath: from,
|
||||
toPath: to,
|
||||
isPermanent: true,
|
||||
redirectInBrowser: true
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
resolve(
|
||||
console.log(`${chalk.green('success')} create redirects`) // eslint-disable-line no-console
|
||||
allPosts.forEach(({ node }) => {
|
||||
let _slug
|
||||
const { redirect_from, slug } = node.frontmatter
|
||||
if (!slug) _slug = node.fields?.slug
|
||||
if (!_slug) {
|
||||
console.log(
|
||||
'%c %s %c %s',
|
||||
'color:orange',
|
||||
'warning',
|
||||
'color:none',
|
||||
'no slug found in frontmatter or fields'
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
redirect_from.forEach((from) => {
|
||||
redirects.push({ from, to: _slug })
|
||||
})
|
||||
})
|
||||
|
||||
redirects.forEach(({ from, to }) => {
|
||||
createRedirect({
|
||||
fromPath: from,
|
||||
toPath: to,
|
||||
isPermanent: true,
|
||||
redirectInBrowser: true
|
||||
})
|
||||
})
|
||||
console.log(
|
||||
'%c %s %c %s',
|
||||
'color:green',
|
||||
'success',
|
||||
'color:none',
|
||||
`created ${redirects.length} redirects`
|
||||
)
|
||||
})
|
||||
} catch (error) {
|
||||
console.error(error.message)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,130 @@
|
|||
/**
|
||||
* @jest-environment jsdom
|
||||
*/
|
||||
import { graphql } from 'gatsby'
|
||||
import { createPages } from '../src/gatsby-node.js'
|
||||
|
||||
jest.mock('gatsby', () => ({
|
||||
graphql: jest.fn(),
|
||||
actions: { createRedirect: jest.fn() }
|
||||
}))
|
||||
|
||||
describe('createPages', () => {
|
||||
let pluginOptions
|
||||
let actions
|
||||
let consoleLogSpy
|
||||
|
||||
const markdownQuery = 'allMarkdownRemark'
|
||||
const edges = [
|
||||
{
|
||||
node: {
|
||||
fields: { slug: '/post-1' },
|
||||
frontmatter: { redirect_from: ['/old-url-1', '/old-url-2'] }
|
||||
}
|
||||
},
|
||||
{
|
||||
node: {
|
||||
fields: { slug: '/post-2' },
|
||||
frontmatter: { redirect_from: ['/old-url-3'] }
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
beforeEach(() => {
|
||||
actions = { createRedirect: jest.fn() }
|
||||
pluginOptions = { query: 'allMarkdownRemark' }
|
||||
consoleLogSpy = jest.spyOn(console, 'log').mockImplementation(() => {})
|
||||
})
|
||||
|
||||
afterEach(() => {
|
||||
jest.resetAllMocks()
|
||||
consoleLogSpy.mockRestore()
|
||||
})
|
||||
|
||||
it('should create redirects for each post with a redirect_from field', async () => {
|
||||
const data = { q: { edges } }
|
||||
graphql.mockReturnValueOnce(Promise.resolve({ data }))
|
||||
const createRedirectSpy = jest.spyOn(actions, 'createRedirect')
|
||||
|
||||
await createPages({ graphql, actions }, { query: markdownQuery })
|
||||
|
||||
expect(createRedirectSpy).toHaveBeenCalledTimes(3)
|
||||
expect(createRedirectSpy).toHaveBeenCalledWith({
|
||||
fromPath: '/old-url-1',
|
||||
toPath: '/post-1',
|
||||
isPermanent: true,
|
||||
redirectInBrowser: true
|
||||
})
|
||||
expect(createRedirectSpy).toHaveBeenCalledWith({
|
||||
fromPath: '/old-url-2',
|
||||
toPath: '/post-1',
|
||||
isPermanent: true,
|
||||
redirectInBrowser: true
|
||||
})
|
||||
expect(createRedirectSpy).toHaveBeenCalledWith({
|
||||
fromPath: '/old-url-3',
|
||||
toPath: '/post-2',
|
||||
isPermanent: true,
|
||||
redirectInBrowser: true
|
||||
})
|
||||
|
||||
createRedirectSpy.mockRestore()
|
||||
})
|
||||
|
||||
it('should use pluginOptions.query when defined', async () => {
|
||||
const customQuery = 'someCustomQuery'
|
||||
pluginOptions.query = customQuery
|
||||
|
||||
graphql.mockImplementation((queryString) => {
|
||||
expect(queryString).toContain(customQuery)
|
||||
return Promise.resolve({ data: { q: { edges: [] } } })
|
||||
})
|
||||
|
||||
await createPages({ graphql, actions }, pluginOptions)
|
||||
})
|
||||
|
||||
it('should default to allMarkdownRemark when pluginOptions.query is undefined', async () => {
|
||||
pluginOptions.query = undefined
|
||||
|
||||
graphql.mockImplementation((queryString) => {
|
||||
expect(queryString).toContain('allMarkdownRemark')
|
||||
return Promise.resolve({ data: { q: { edges: [] } } })
|
||||
})
|
||||
|
||||
await createPages({ graphql, actions }, pluginOptions)
|
||||
})
|
||||
|
||||
it('should log a success message when redirects are created', async () => {
|
||||
const data = { q: { edges } }
|
||||
graphql.mockReturnValueOnce(Promise.resolve({ data }))
|
||||
const createRedirectSpy = jest.spyOn(actions, 'createRedirect')
|
||||
|
||||
await createPages({ graphql, actions }, { query: markdownQuery })
|
||||
|
||||
expect(createRedirectSpy).toHaveBeenCalledTimes(3)
|
||||
expect(console.log).toHaveBeenCalledWith(
|
||||
'%c %s %c %s',
|
||||
'color:green',
|
||||
'success',
|
||||
'color:none',
|
||||
'created 3 redirects'
|
||||
)
|
||||
})
|
||||
|
||||
it('should log an error message when an error occurs', async () => {
|
||||
const error = new Error('GraphQL query failed')
|
||||
graphql.mockImplementationOnce(() => {
|
||||
throw error
|
||||
})
|
||||
|
||||
const consoleSpy = jest.spyOn(console, 'error').mockImplementation(() => {})
|
||||
|
||||
try {
|
||||
await createPages({ graphql, actions }, pluginOptions)
|
||||
} catch (error) {
|
||||
expect(console.error).toHaveBeenCalledWith('GraphQL query failed')
|
||||
}
|
||||
|
||||
consoleSpy.mockRestore()
|
||||
})
|
||||
})
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"rootDir": "../",
|
||||
"coverageDirectory": "<rootDir>/coverage/"
|
||||
}
|
Loading…
Reference in New Issue