diff --git a/package-lock.json b/package-lock.json index 679679b5e5..a8139bd824 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1826,6 +1826,24 @@ "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.8.0.tgz", "integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==" }, + "axios": { + "version": "0.19.0", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.19.0.tgz", + "integrity": "sha512-1uvKqKQta3KBxIz14F2v06AEHZ/dIoeKfbTRkK1E5oqjDnuEerLmYTgJB5AiQZHJcljpg1TuRzdjDR06qNk0DQ==", + "dev": true, + "requires": { + "follow-redirects": "1.5.10", + "is-buffer": "^2.0.2" + }, + "dependencies": { + "is-buffer": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.4.tgz", + "integrity": "sha512-Kq1rokWXOPXWuaMAqZiJW4XxsmD9zGx9q4aePabbn3qCRGedtH7Cm+zV8WETitMfu1wdh+Rvd6w5egwSngUX2A==", + "dev": true + } + } + }, "babel-code-frame": { "version": "6.26.0", "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", @@ -5607,6 +5625,32 @@ "readable-stream": "^2.3.6" } }, + "follow-redirects": { + "version": "1.5.10", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.5.10.tgz", + "integrity": "sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ==", + "dev": true, + "requires": { + "debug": "=3.1.0" + }, + "dependencies": { + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + } + } + }, "for-in": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", diff --git a/package.json b/package.json index 29125158e5..956dc46dbd 100644 --- a/package.json +++ b/package.json @@ -72,7 +72,7 @@ "npm": "^6" }, "scripts": { - "lint": "eslint --ext .js ./migrations --fix", + "lint": "eslint --ext .js ./scripts --fix", "test": "npm run lint && gulp test && gulp apidoc", "test:build": "gulp test:prepare:build", "test:api-v3": "gulp test:api-v3", @@ -98,6 +98,7 @@ "@babel/core": "^7.6.2", "@babel/preset-env": "^7.6.2", "@babel/register": "^7.6.2", + "axios": "^0.19.0", "chai": "^4.1.2", "chai-as-promised": "^7.1.1", "chalk": "^2.4.1", diff --git a/scripts/gdpr-delete-users.js b/scripts/gdpr-delete-users.js index 91dd5af506..bd9c21c9e3 100644 --- a/scripts/gdpr-delete-users.js +++ b/scripts/gdpr-delete-users.js @@ -1,5 +1,5 @@ /* eslint-disable no-console */ -import axios from 'axios'; +import axios from 'axios'; // eslint-disable-line import/no-extraneous-dependencies import nconf from 'nconf'; import { model as User } from '../website/server/models/user'; @@ -77,10 +77,10 @@ async function processEmailAddress (email) { if (users.length < 1) { console.log(`No users found with email address ${email}`); } else { - for (const user of users) { + Promise.all(users.map(user => (async () => { await deleteAmplitudeData(user._id, email); // eslint-disable-line no-await-in-loop await deleteHabiticaData(user, email); // eslint-disable-line no-await-in-loop - } + })())); } } diff --git a/scripts/paypalBillingSetup.js b/scripts/paypalBillingSetup.js index 2ef55af823..e60f272f72 100644 --- a/scripts/paypalBillingSetup.js +++ b/scripts/paypalBillingSetup.js @@ -1,8 +1,11 @@ -require('babel-register'); +require('@babel/register'); // eslint-disable-line import/no-extraneous-dependencies -// This file is used for creating paypal billing plans. PayPal doesn't have a web interface for setting up recurring -// payment plan definitions, instead you have to create it via their REST SDK and keep it updated the same way. So this -// file will be used once for initing your billing plan (then you get the resultant plan.id to store in config.json), +// This file is used for creating paypal billing plans. +// PayPal doesn't have a web interface for setting up recurring +// payment plan definitions, instead you have to create it +// via their REST SDK and keep it updated the same way. So this +// file will be used once for initing your billing plan +// (then you get the resultant plan.id to store in config.json), // and once for any time you need to edit the plan thereafter /* eslint-disable no-console, camelcase, no-case-declarations */ @@ -99,6 +102,8 @@ switch (OP) { paypal.billingPlan.update(plan.id, billingPlanUpdateAttributes, (err2, response) => { console.log({ err: err2, response, id: plan.id }); }); + + return null; }); break; case 'create-webprofile': @@ -113,4 +118,6 @@ switch (OP) { console.log(error, result); }); break; + default: + throw new Error('Invalid op'); }