You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
92 lines
3.6 KiB
Markdown
92 lines
3.6 KiB
Markdown
# 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][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.
|
|
|
|
[nodejs]: https://nodejs.org/
|
|
[fzf]: https://github.com/junegunn/fzf
|
|
[ruby]: https://www.ruby-lang.org/en/
|
|
[js-beautify]: https://github.com/beautify-web/js-beautify
|
|
[anime manga names]: https://web.archive.org/web/20230131174447/https://www.fantasynamegenerators.com/anime-manga-names.php
|