Skip to content

Commit

Permalink
feat: dropping support for node 12 (#440)
Browse files Browse the repository at this point in the history
* feat: dropping support for node 12

* feat: adding optional chaining in a few other spots
  • Loading branch information
erunion authored Mar 1, 2022
1 parent 9602603 commit e1552db
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 8 deletions.
3 changes: 3 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{
"extends": ["@readme/eslint-config"],
"root": true,
"parserOptions": {
"ecmaVersion": 2020
},
"rules": {
/**
* Because our command classes have a `run` method that might not always call `this` we need to
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x, 14.x, 16.x]
node-version: [14.x, 16.x]

steps:
- uses: actions/[email protected]
Expand Down
2 changes: 1 addition & 1 deletion bin/rdme
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ require('../src')(process.argv.slice(2))
'[email protected]'
)}.`;

if (err && 'message' in err) {
if (err?.message) {
message = err.message;
}

Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

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

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"license": "MIT",
"author": "ReadMe <[email protected]> (https://readme.com)",
"engines": {
"node": "^12 || ^14 || ^16"
"node": "^14 || ^16"
},
"bin": {
"rdme": "bin/rdme"
Expand All @@ -23,7 +23,8 @@
"oas",
"apidoc",
"microservice",
"documentation"
"documentation",
"readme"
],
"repository": {
"type": "git",
Expand Down
4 changes: 2 additions & 2 deletions src/lib/apiError.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module.exports = class extends Error {

// Special handling to for fetch `res` arguments where `res.error` will contain our API error response.
if (typeof res === 'object') {
if ('error' in res && typeof res.error === 'object') {
if (typeof res?.error === 'object') {
err = res.error;
} else {
err = res;
Expand All @@ -20,7 +20,7 @@ module.exports = class extends Error {

// If we returned help info in the API, show it otherwise don't render out multiple empty lines as we sometimes
// throw `Error('non-api custom error message')` instances and catch them with this class.
if ('help' in err) {
if (err?.help) {
this.message = [err.message, '', err.help].join('\n');
} else {
this.message = err.message;
Expand Down
2 changes: 1 addition & 1 deletion src/lib/prompts.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ exports.createVersionPrompt = (versionList, opts, isUpdate) => [
name: 'is_stable',
message: 'Would you like to make this version the main version for this project?',
skip() {
return opts.main || (isUpdate && isUpdate.is_stable);
return opts.main || isUpdate?.is_stable;
},
},
{
Expand Down

0 comments on commit e1552db

Please sign in to comment.