chore(deps): use @faker-js/faker (#797) [skip ci]

This commit is contained in:
Simon Lecoq
2022-01-21 02:58:22 +01:00
committed by GitHub
parent 877a76be78
commit ce19ceb715
8 changed files with 18 additions and 18 deletions

View File

@@ -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. 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. Since tests are pretty long to run, it is advised to just let GitHub Actions do the testing.

View File

@@ -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.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.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, "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.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, "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")) fs.copyFile(paths.join(__node_modules, "vue/dist/vue.min.js"), paths.join(__preview_js, "vue.min.js"))

View File

@@ -111,7 +111,7 @@ Below is a list of used packages.
* To format, test and verify SVG validity * To format, test and verify SVG validity
* [facebook/jest](https://github.com/facebook/jest) and [nodeca/js-yaml](https://github.com/nodeca/js-yaml) * [facebook/jest](https://github.com/facebook/jest) and [nodeca/js-yaml](https://github.com/nodeca/js-yaml)
* For unit testing * For unit testing
* [marak/faker.js](https://github.com/marak/Faker.js) * [faker-js/faker](https://github.com/faker-js/faker)
* For mocking data * For mocking data
* [steveukx/git-js](https://github.com/steveukx/git-js) * [steveukx/git-js](https://github.com/steveukx/git-js)
* For simple git operations * For simple git operations

22
package-lock.json generated
View File

@@ -12,6 +12,7 @@
"dependencies": { "dependencies": {
"@actions/core": "^1.6.0", "@actions/core": "^1.6.0",
"@actions/github": "^4.0.0", "@actions/github": "^4.0.0",
"@faker-js/faker": "^6.0.0-alpha.3",
"@octokit/graphql": "^4.8.0", "@octokit/graphql": "^4.8.0",
"@octokit/rest": "^18.12.0", "@octokit/rest": "^18.12.0",
"@primer/css": "^19.2.0", "@primer/css": "^19.2.0",
@@ -23,7 +24,6 @@
"emoji-name-map": "^1.2.9", "emoji-name-map": "^1.2.9",
"express": "^4.17.1", "express": "^4.17.1",
"express-rate-limit": "^6.1.0", "express-rate-limit": "^6.1.0",
"faker": "^5.5.3",
"jimp": "^0.16.1", "jimp": "^0.16.1",
"js-yaml": "^4.1.0", "js-yaml": "^4.1.0",
"linguist-js": "^2.2.0", "linguist-js": "^2.2.0",
@@ -810,6 +810,11 @@
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
"dev": true "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": { "node_modules/@humanwhocodes/config-array": {
"version": "0.9.2", "version": "0.9.2",
"resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.9.2.tgz", "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.9.2.tgz",
@@ -4291,11 +4296,6 @@
"node >=0.6.0" "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": { "node_modules/falafel": {
"version": "2.2.4", "version": "2.2.4",
"resolved": "https://registry.npmjs.org/falafel/-/falafel-2.2.4.tgz", "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": { "@humanwhocodes/config-array": {
"version": "0.9.2", "version": "0.9.2",
"resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.9.2.tgz", "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", "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz",
"integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" "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": { "falafel": {
"version": "2.2.4", "version": "2.2.4",
"resolved": "https://registry.npmjs.org/falafel/-/falafel-2.2.4.tgz", "resolved": "https://registry.npmjs.org/falafel/-/falafel-2.2.4.tgz",

View File

@@ -29,6 +29,7 @@
"dependencies": { "dependencies": {
"@actions/core": "^1.6.0", "@actions/core": "^1.6.0",
"@actions/github": "^4.0.0", "@actions/github": "^4.0.0",
"@faker-js/faker": "^6.0.0-alpha.3",
"@octokit/graphql": "^4.8.0", "@octokit/graphql": "^4.8.0",
"@octokit/rest": "^18.12.0", "@octokit/rest": "^18.12.0",
"@primer/css": "^19.2.0", "@primer/css": "^19.2.0",
@@ -40,7 +41,6 @@
"emoji-name-map": "^1.2.9", "emoji-name-map": "^1.2.9",
"express": "^4.17.1", "express": "^4.17.1",
"express-rate-limit": "^6.1.0", "express-rate-limit": "^6.1.0",
"faker": "^5.5.3",
"jimp": "^0.16.1", "jimp": "^0.16.1",
"js-yaml": "^4.1.0", "js-yaml": "^4.1.0",
"linguist-js": "^2.2.0", "linguist-js": "^2.2.0",

View File

@@ -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.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/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/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.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/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`)) app.get("/.js/vue.min.js", limiter, (req, res) => res.sendFile(`${conf.paths.node_modules}/vue/dist/vue.min.js`))

View File

@@ -5,7 +5,7 @@ const fs = require("fs")
const path = require("path") const path = require("path")
const url = require("url") const url = require("url")
const axios = require("axios") const axios = require("axios")
const faker = require("faker") const faker = require("@faker-js/faker")
const ejs = require("ejs") const ejs = require("ejs")
//Github action //Github action

View File

@@ -1,7 +1,7 @@
//Imports //Imports
import fs from "fs/promises" import fs from "fs/promises"
import axios from "axios" import axios from "axios"
import faker from "faker" import faker from "@faker-js/faker"
import paths from "path" import paths from "path"
import rss from "rss-parser" import rss from "rss-parser"
import urls from "url" import urls from "url"