-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
500,037 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
const fs = require('fs') | ||
|
||
const possibleDestinations = ['/4k-philips-monitor-99988213/p', '/aedle-vk1-headphone-99988211/p', '/echo-dot-smart-speaker-99988214/p'] | ||
|
||
function generateRandomString(prefix, length) { | ||
const characters = 'abcdefghijklmnopqrstuvwxyz'; | ||
const randomString = Array(length) | ||
.fill() | ||
.map(() => characters.charAt(Math.floor(Math.random() * characters.length))) | ||
.join('') | ||
return prefix + randomString | ||
} | ||
|
||
|
||
function generateRedirects(amount) { | ||
const redirects = [] | ||
for (let i = 0; i < amount; i++) { | ||
const source = generateRandomString('/produto/', 15) | ||
const destination = possibleDestinations[i % possibleDestinations.length] | ||
redirects.push({ source, destination, permanent: true }) | ||
} | ||
|
||
return redirects | ||
} | ||
|
||
(function main() { | ||
const redirects = generateRedirects(10000) | ||
console.log(redirects) | ||
fs.writeFileSync('./src/redirects.json', JSON.stringify(redirects, null, 2)) | ||
})() | ||
|
Oops, something went wrong.