Skip to content

Simple word guessing game. A basic template project for using Node, TypeScript, and Jest.

Notifications You must be signed in to change notification settings

klobetime/wordgame

Repository files navigation

Word Game

Simple word guessing game. A basic template project for using Node, TypeScript, and Jest.

Environment

Prerequisites

Check for proper versions of NodeJS (currently v16.x) and NPM (currently v8.x):

$ node --version

$ npm --v

A useful tool when moving between projects with different versions of node is nvm. A supporting .nvmrc file is a part of the project.

Dependencies

To download the modules needed to develop and build simply run the following from the main directory where the package.json file lives:

$ npm install

This normally only has to be done when dependencies are added or updated.

Development

Building

To translate the TypeScript code (*.ts) into executable JavaScript (*.js), use:

$ npm run build

When successful the resulting JavaScript will be in the build directory.

Cleaning

It is often useful to get rid of generated files during the development process. Normally, it's no big deal to partially recompile -- to only recompile the changed files -- but to be absolutely safe there is a set of npm targets that can remove intermediate files.

  • tidy Deletes the coverage directory (containing code coverage reports generated during testing) and the build/*.tsbuildinfo (cache used by TypeScript to speed up compiling) files.
  • clean Removes all generated files from building, but leaves the downloaded modules in place by deleting the coverage and build directories.
  • distclean Resets to a fresh checkout by deleting the coverage, build, and node_modules directories.
$ npm run clean

Testing

This template uses Jest, CSpell, Prettier, and ESLint to handle test and code quality tasks.

To execute all *.ts tests in the tests directory, as well as run a spell checker and lint the source:

$ npm test

To just run the tests and coverage report, skipping the other useful tools (which must all pass cleanly before committing anything!), use:

$ npm run test:unit

Test Coverage

Test coverage will be calculated with each run of the test suite. If coverage falls below 95% the test run will fail.

Linting

All projects should cleanly pass linting (both eslint and prettier) before a commit.

Spelling

A spell checker runs as a part of the normal testing target. When the tool flags words that are appropriate for the project but not a part of the configured dictionaries, they should be added to the src/project-dictionary.txt file.

Execution

After building the game may be executed by running:

$ npm start

About

Simple word guessing game. A basic template project for using Node, TypeScript, and Jest.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published