From ce19ceb7151be18070592e662016f18d8a24967f Mon Sep 17 00:00:00 2001 From: Simon Lecoq <22963968+lowlighter@users.noreply.github.com> Date: Fri, 21 Jan 2022 02:58:22 +0100 Subject: [PATCH] chore(deps): use @faker-js/faker (#797) [skip ci] --- .../partials/documentation/setup/local.md | 2 +- .github/scripts/preview.mjs | 2 +- ARCHITECTURE.md | 2 +- package-lock.json | 22 +++++++++---------- package.json | 2 +- source/app/web/instance.mjs | 2 +- tests/metrics.test.js | 2 +- tests/mocks/index.mjs | 2 +- 8 files changed, 18 insertions(+), 18 deletions(-) diff --git a/.github/readme/partials/documentation/setup/local.md b/.github/readme/partials/documentation/setup/local.md index 95fe75b0..a530c1dc 100644 --- a/.github/readme/partials/documentation/setup/local.md +++ b/.github/readme/partials/documentation/setup/local.md @@ -41,7 +41,7 @@ https://localhost:{port}/username?base=0&newplugin=1&newplugin.option1=hello&new Testing is done through [jest](https://github.com/facebook/jest) framework. -To avoid consuming APIs requests and causing additional charges on external services, data are [mocked](/tests/mocks/index.mjs) using [JavaScript Proxies](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy) and [Faker.js](https://github.com/marak/Faker.js/) with randomly generated data. +To avoid consuming APIs requests and causing additional charges on external services, data are [mocked](/tests/mocks/index.mjs) using [JavaScript Proxies](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy) and [Faker.js](https://github.com/faker-js/faker) with randomly generated data. Since tests are pretty long to run, it is advised to just let GitHub Actions do the testing. diff --git a/.github/scripts/preview.mjs b/.github/scripts/preview.mjs index 303c7403..0d631596 100644 --- a/.github/scripts/preview.mjs +++ b/.github/scripts/preview.mjs @@ -60,7 +60,7 @@ fs.copyFile(paths.join(__node_modules, "prismjs/themes/prism-tomorrow.css"), pat fs.writeFile(paths.join(__preview_js, "app.js"), `${await fs.readFile(paths.join(__web, "app.js"))}`) fs.writeFile(paths.join(__preview_js, "app.placeholder.js"), `${await fs.readFile(paths.join(__web, "app.placeholder.js"))}`) fs.copyFile(paths.join(__node_modules, "ejs/ejs.min.js"), paths.join(__preview_js, "ejs.min.js")) -fs.copyFile(paths.join(__node_modules, "faker/dist/faker.min.js"), paths.join(__preview_js, "faker.min.js")) +fs.copyFile(paths.join(__node_modules, "@faker-js/faker/dist/faker.min.js"), paths.join(__preview_js, "faker.min.js")) fs.copyFile(paths.join(__node_modules, "axios/dist/axios.min.js"), paths.join(__preview_js, "axios.min.js")) fs.copyFile(paths.join(__node_modules, "axios/dist/axios.min.map"), paths.join(__preview_js, "axios.min.map")) fs.copyFile(paths.join(__node_modules, "vue/dist/vue.min.js"), paths.join(__preview_js, "vue.min.js")) diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md index 67c9491e..e79931c9 100644 --- a/ARCHITECTURE.md +++ b/ARCHITECTURE.md @@ -111,7 +111,7 @@ Below is a list of used packages. * To format, test and verify SVG validity * [facebook/jest](https://github.com/facebook/jest) and [nodeca/js-yaml](https://github.com/nodeca/js-yaml) * For unit testing -* [marak/faker.js](https://github.com/marak/Faker.js) +* [faker-js/faker](https://github.com/faker-js/faker) * For mocking data * [steveukx/git-js](https://github.com/steveukx/git-js) * For simple git operations diff --git a/package-lock.json b/package-lock.json index 05e5dd30..7e4b1477 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,6 +12,7 @@ "dependencies": { "@actions/core": "^1.6.0", "@actions/github": "^4.0.0", + "@faker-js/faker": "^6.0.0-alpha.3", "@octokit/graphql": "^4.8.0", "@octokit/rest": "^18.12.0", "@primer/css": "^19.2.0", @@ -23,7 +24,6 @@ "emoji-name-map": "^1.2.9", "express": "^4.17.1", "express-rate-limit": "^6.1.0", - "faker": "^5.5.3", "jimp": "^0.16.1", "js-yaml": "^4.1.0", "linguist-js": "^2.2.0", @@ -810,6 +810,11 @@ "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", "dev": true }, + "node_modules/@faker-js/faker": { + "version": "6.0.0-alpha.3", + "resolved": "https://registry.npmjs.org/@faker-js/faker/-/faker-6.0.0-alpha.3.tgz", + "integrity": "sha512-8B+7Jlwb9ogcoluzxB6AaSRZn2gnoewTA/WygAYhWNxkrFKjQL0TDXK6AW6uJlASMKl7qG/qbEVtpjLByuL0ZQ==" + }, "node_modules/@humanwhocodes/config-array": { "version": "0.9.2", "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.9.2.tgz", @@ -4291,11 +4296,6 @@ "node >=0.6.0" ] }, - "node_modules/faker": { - "version": "5.5.3", - "resolved": "https://registry.npmjs.org/faker/-/faker-5.5.3.tgz", - "integrity": "sha512-wLTv2a28wjUyWkbnX7u/ABZBkUkIF2fCd73V6P2oFqEGEktDfzWx4UxrSqtPRw0xPRAcjeAOIiJWqZm3pP4u3g==" - }, "node_modules/falafel": { "version": "2.2.4", "resolved": "https://registry.npmjs.org/falafel/-/falafel-2.2.4.tgz", @@ -10570,6 +10570,11 @@ } } }, + "@faker-js/faker": { + "version": "6.0.0-alpha.3", + "resolved": "https://registry.npmjs.org/@faker-js/faker/-/faker-6.0.0-alpha.3.tgz", + "integrity": "sha512-8B+7Jlwb9ogcoluzxB6AaSRZn2gnoewTA/WygAYhWNxkrFKjQL0TDXK6AW6uJlASMKl7qG/qbEVtpjLByuL0ZQ==" + }, "@humanwhocodes/config-array": { "version": "0.9.2", "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.9.2.tgz", @@ -13307,11 +13312,6 @@ "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" }, - "faker": { - "version": "5.5.3", - "resolved": "https://registry.npmjs.org/faker/-/faker-5.5.3.tgz", - "integrity": "sha512-wLTv2a28wjUyWkbnX7u/ABZBkUkIF2fCd73V6P2oFqEGEktDfzWx4UxrSqtPRw0xPRAcjeAOIiJWqZm3pP4u3g==" - }, "falafel": { "version": "2.2.4", "resolved": "https://registry.npmjs.org/falafel/-/falafel-2.2.4.tgz", diff --git a/package.json b/package.json index e44fbe35..f369c6b3 100644 --- a/package.json +++ b/package.json @@ -29,6 +29,7 @@ "dependencies": { "@actions/core": "^1.6.0", "@actions/github": "^4.0.0", + "@faker-js/faker": "^6.0.0-alpha.3", "@octokit/graphql": "^4.8.0", "@octokit/rest": "^18.12.0", "@primer/css": "^19.2.0", @@ -40,7 +41,6 @@ "emoji-name-map": "^1.2.9", "express": "^4.17.1", "express-rate-limit": "^6.1.0", - "faker": "^5.5.3", "jimp": "^0.16.1", "js-yaml": "^4.1.0", "linguist-js": "^2.2.0", diff --git a/source/app/web/instance.mjs b/source/app/web/instance.mjs index e3aa6fb0..d40e90f0 100644 --- a/source/app/web/instance.mjs +++ b/source/app/web/instance.mjs @@ -121,7 +121,7 @@ export default async function({mock, nosettings} = {}) { app.get("/.js/app.js", limiter, (req, res) => res.sendFile(`${conf.paths.statics}/app.js`)) app.get("/.js/app.placeholder.js", limiter, (req, res) => res.sendFile(`${conf.paths.statics}/app.placeholder.js`)) app.get("/.js/ejs.min.js", limiter, (req, res) => res.sendFile(`${conf.paths.node_modules}/ejs/ejs.min.js`)) - app.get("/.js/faker.min.js", limiter, (req, res) => res.sendFile(`${conf.paths.node_modules}/faker/dist/faker.min.js`)) + app.get("/.js/faker.min.js", limiter, (req, res) => res.sendFile(`${conf.paths.node_modules}/@faker-js/faker/dist/faker.min.js`)) app.get("/.js/axios.min.js", limiter, (req, res) => res.sendFile(`${conf.paths.node_modules}/axios/dist/axios.min.js`)) app.get("/.js/axios.min.map", limiter, (req, res) => res.sendFile(`${conf.paths.node_modules}/axios/dist/axios.min.map`)) app.get("/.js/vue.min.js", limiter, (req, res) => res.sendFile(`${conf.paths.node_modules}/vue/dist/vue.min.js`)) diff --git a/tests/metrics.test.js b/tests/metrics.test.js index 45a83dca..cd667e64 100644 --- a/tests/metrics.test.js +++ b/tests/metrics.test.js @@ -5,7 +5,7 @@ const fs = require("fs") const path = require("path") const url = require("url") const axios = require("axios") -const faker = require("faker") +const faker = require("@faker-js/faker") const ejs = require("ejs") //Github action diff --git a/tests/mocks/index.mjs b/tests/mocks/index.mjs index 07ec9cb0..5d650fe5 100644 --- a/tests/mocks/index.mjs +++ b/tests/mocks/index.mjs @@ -1,7 +1,7 @@ //Imports import fs from "fs/promises" import axios from "axios" -import faker from "faker" +import faker from "@faker-js/faker" import paths from "path" import rss from "rss-parser" import urls from "url"