u3shit d141684b1a | 1 year ago | |
---|---|---|
generators | 1 year ago | |
.gitignore | 1 year ago | |
.rubocop.yml | 1 year ago | |
.solargraph.yml | 1 year ago | |
README.md | 1 year ago | |
fantasy.js | 1 year ago | |
package.json | 1 year ago | |
test.sh | 1 year ago | |
update_generators.rb | 1 year ago |
README.md
Offline Fantasy Name Generators
Generators from www.fantasynamegenerators.com in your CLI, without requiring an internet connection, or running bloated web browsers. It uses nodejs to run the javascript code, and emulates enough of the Browser APIs (and jQuery) to successfully run the generators.
Is this legal?
Probably not. From the site:
You're free to use names on this site to name anything in any of your own works, assuming they aren't already trademarked by others of course. All background images part of the generators are part of the public domain and thus free to be used by anybody, with the exception of user submitted backgrounds, images part of existing, copyrighted works, and the pet name generator images. All other original content is part of FantasyNameGenerators.com and cannot be copied, sold or redistributed without permission.
Copyright© 2012-2023 FantasyNameGenerators.com.
On the other hand, you also break the copyright by visiting the site, since your browser will copy the contents of the site into your local cache...
Install
You need nodejs and install the packages:
npm i
Usage
Run the script without args to get the available generators:
./fantasy.js
Then run it with the generator name as an argument:
./fantasy.js 'Other Names > Anime & Manga Names > English names'
./fantasy.js 'Other Names' 'Anime & Manga Names' 'English names'
If you have fzf or similar, you can have an interactive chooser:
./fantasy.js "$(./fantasy.js | fzf)"
Whoa, you just increased your productivity by 1000 times!
Update
If you're brave, you might try to update the generators from the website. If it
breaks, you keep both parts. Make sure you have no untracked files in
generators
directory, because it will be deleted.
First, you need js-beautify in path, ruby 3.2, and a few gems:
gem install async-http addressable nokogiri
Then run ./update_generators.rb
.
It's recommended to set the CACHE
environment to an empty directory, this way
it will cache downloaded files from the server, so if your network connection is
spotty or you try to debug the script, you can save yourself from having to
download the same files again and again.
Test
Run ./test.sh
.
Note that it will likely fail a few tests, the generators are generally poorly written, they use global variables sometimes without initializing, sometimes they use a non-existing variable, sometimes they get in infinite loop, etc. For example, with the above-mentioned anime manga names, open the developer console, and press French names a few times, and you'll get an exception in the console. I've fixed some of the most common and easily fixable problems, but there are still a bunch of flaky generators.
It's less a problem in the browser, because the error message is hidden, and you're less likely to get an uninitialized variable on subsequent generations, but this CLI tool is pretty noisy when it fails.
License
The files outside the generators
directory are licensed under the WTFPL.
This program is free software. It comes without any warranty, to the extent permitted by applicable law. You can redistribute it and/or modify it under the terms of the Do What The Fuck You Want To Public License, Version 2, as published by Sam Hocevar. See http://www.wtfpl.net/ for more details.