Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lower node version #329

Merged
merged 1 commit into from
Jun 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 16.x
node-version: 14.x
- name: Upgrade npm
run: npm install -g npm@^7
- run: npm ci
- run: npm test
- run: npm run build
Expand Down
4 changes: 3 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@
},
"license": "MIT",
"engines": {
"node": ">=16"
"node": ">=14",
"npm": "^7"
},
"scripts": {
"start": "next start",
Expand Down
21 changes: 21 additions & 0 deletions src/api/wp.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,27 @@
import axios from 'axios';
import { shared, server } from '../config';

/**
* String.prototype.replaceAll() polyfill
* https://gomakethings.com/how-to-replace-a-section-of-a-string-with-another-one-with-vanilla-js/
* @author Chris Ferdinandi
* @license MIT
*/
if (!String.prototype.replaceAll) {
// eslint-disable-next-line
String.prototype.replaceAll = function (str, newStr) {
// If a regex pattern
if (
Object.prototype.toString.call(str).toLowerCase() === '[object regexp]'
) {
return this.replace(str, newStr);
}

// If a string
return this.replace(new RegExp(str, 'g'), newStr);
};
}

const deepReplaceDomain = value => {
// Ignore empty strings, null, undefined, functions, & numbers.
if (!value || typeof value === 'number' || typeof value === 'function') {
Expand Down