EightBittr development is managed using a few popular web technologies you'll want to be at least a little familiar with:
- Lerna: A tool for managing JavaScript projects with multiple packages.
- Mocha: The simple, fun, flexible JavaScript testing framework.
- TypeScript: Like JavaScript, but with glorious type declarations.
- Yarn: A package manager with great performance and project linking.
If you're on a MacOS M1/M2 chip, you'll likely need to install Chromium with Homebrew:
brew install homebrew xattr -cr /Applications/Chromium.app...and add the following in your
~/.zshrcor equivalent:export PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true export PUPPETEER_EXECUTABLE_PATH=/opt/homebrew/bin/chromium
After forking the repo from GitHub, you'll want to clone it, install dependencies, and prepare its packages for development:
git clone https://github.com/<your-name>/EightBittr
cd EightBittr
yarn
yarn lerna bootstrap
yarn run hydrateIn practical use, you'll generally want at least two terminals open:
- One running
yarn compile -wfrom this repository root to run TypeScript in watch mode. - One free for other commands, such as
cding into packages and runningyarn test:setupto regenerate test files.
The following common commands from package.json can be run from the repository root to work across all packages:
compile: Builds TypeScript source files insrc/into JavaScript files inlib/.format: Runs Prettier to flag incorrectly formatted source files.format:write: Fixes those source files for you.
lint: Runs ESLint on source files to find linting complaints.test: Rebuilds all packages' test infrastructures and runs their tests.
Once built, there will be up to three directories in this package containing code, in order of build process:
src/: The "source of truth" containing TypeScript source files.lib/: JavaScript source files, declaration files, and source maps generated by TypeScript fromsrc/.dist/: Bundled, minified versions of JavaScript files generated by Webpack fromlib/-- ifpackage.jsoncontains a"dist": trueunder"shenanigans".
You may notice some commands use the shenanigans-manager package, a utility package included in this monorepo.
It automates useful commands common to packages here, such as scaffolding package scripts and shared documentation.
See its docs in packages/shenanigans-manager.
If you're developing a game that uses EightBittr and would like to use your local EightBittr monorepo for its npm packages, you can do so in two steps: