code for mtgjson
JavaScript HTML CSS Shell
Switch branches/tags
Latest commit 8eefe7b Oct 12, 2017 @petebeegle petebeegle committed with ZeldaZach update standard sets (#472)
Permalink
Failed to load latest commit information.
build strip control characters from card text (#432) Jul 27, 2017
cron fix the shared links to remove the need for symbolic links in node_mo… Jul 5, 2017
decks Origins clash packs Nov 30, 2015
deploy Visual spoilers for Gatherer sets Nov 17, 2015
json full program rebuild for IXN (#471) Oct 4, 2017
nginx Added nginx conf files to git repo Oct 8, 2015
node_modules Introduce editorconfig (#371) Jul 8, 2017
sample fix json handling for set.booster Oct 15, 2015
schema check json files and validate against schema (#431) Jul 27, 2017
shared update standard sets (#472) Oct 12, 2017
util Add a changelog update check to the build script (#381) Jul 12, 2017
verify fix the shared links to remove the need for symbolic links in node_mo… Jul 5, 2017
web full program rebuild for IXN (#471) Oct 4, 2017
.editorconfig Update Travis test environment (#380) Jul 9, 2017
.gitignore Replace cache with leveldb and refactor url fetching (#392) Jul 12, 2017
.jshintrc Added tests for unused variables and fixed the code accordingly. Dec 7, 2016
.travis.yml check json files and validate against schema (#431) Jul 27, 2017
LICENSE Updated license and copyright notices Oct 7, 2015
README.md Update instructions for new sets in readme (#440) Aug 16, 2017
card_links.txt Added a howto.txt file to learn how to update mtgjson Oct 8, 2015
clonekit.js Adding CloneKit for use with 'web'. Jun 6, 2016
compress_cache.sh Cache is now compressed locally, saving A LOT of space and possibly s… Oct 13, 2015
howto.txt Auto-calculating Standard-legal cards. Fixes #81 and #79. Oct 13, 2015
package.json Full rebuild (#434) Jul 28, 2017
uncompress_cache.sh Cache is now compressed locally, saving A LOT of space and possibly s… Oct 13, 2015

README.md

Intro

This is the code used to generate the JSON for mtgjson.com

I didn't plan on open-sourcing this, so there are rough edges. See 'Other' section below.

Requirements

  • Linux or MacOS (never tested under Windows)
  • Node.js v0.10.0 or later. It will NOT work with 0.9.9 or earlier.

Setup

npm install
# See 'Other' below

Usage

cd build
node buildSet.js <expansion code>

This creates the file:

json/<expansion code>.json

You will need to run this twice for any 'new' sets. First pass doesn't include foreign langauges.

Troubleshooting

If something doesn't work after doing a git pull update, make sure you also update NPM modules with

npm update

Including a new set

If you're building mtgjson data on your own, you should follow the following steps to be able to grab the new set data:

  • make sure the new set is already available on gatherer
  • add a file describing the set in shared/set_configs or an appropriate subdirectory
  • node build/buildSet NEWSETCODE
  • check your json files to see if everything is in order
  • node util/updatePrintingsFromSet NEWSETCODE -- This will update the printings on the previous sets, using the data from the new set.
  • node util/updateRulingsFromSet NEWSETCODE -- Same as above, but for rulings.
  • node util/updateLegalitiesFromSet NEWSETCODE -- Same as above, but for legalities.

Other

All gatherer page requests are cached to the cache directory and any future requests will use the cached version instead.

The 'verify' directory is a little private local webpage I use to verify that my JSON is correct by comparing it side by side with card images.

The 'web' directory is used to generate the mtgjson.com website.

Note that both verify and web have some symbolic links to files that only exist on my local dev workstation. Sorry.