npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

wordle-clone

v1.3.0

Published

A clone of the popular Wordle game.

Downloads

6

Readme

wordle-clone

npm CI Gitpod ready-to-code

Click here to play on browser

Browser Game Screenshot

A clone of the worldwide phenomenon known as Wordle.

Can be played on either the browser or the command line.

Features

  • Base browser game
  • Also playable on the terminal
  • Share functionality
  • Countdown to next day's Wordle
  • Can be launched as PWA on mobile
  • Hard Mode
  • High Contrast Mode
  • Themes
    • Dark
    • Light
    • Snow
  • Tap and hold backspace to clear input

Setup

Browser

Click here to play on the browser

CLI

Assuming you have Node.js and npm installed, run the following command to install the game:

npm install -g wordle-clone

Now you can run it using the following command:

wordle
# or, alternatively:
# wordle-clone

CLI arguments

  -d, --difficulty <string>  change game difficulty (choices: "hard", "easy")
  -v, --verbose              print extra information
  -h, --help                 display help for command
  -V, --version              output the version number

Preferences

Preferences are stored in the following locations (depending on OS):

  • $HOME/.config/wordle-clone/preferences.json (Linux)
  • /Users/<username>/Library/Application Support/wordle-clone/preferences.json (macOS)
  • C:\Users\<username>\AppData\Roaming\wordle-clone\Config\preferences.json (Windows)

To find where it's located on your machine, you can use the Game Data Subcommand (see Game Data Subcommand Usage for full usage). You can output the preferences filepath by running wordle data -p.

In this file, you can specify the following options in JSON format: | Option | Type | Description | Default Value | | ------ | ---- | ----------- | ------------- | | hardMode | boolean | Whether to enable hard mode | false | | highContrast | boolean | Whether to turn on high contrast mode | false |

Example:

{
    "hardMode": true,
    "highContrast": false
}
Game Data Subcommand Usage
Usage: wordle-clone data [options]

outputs the filepath of game state and/or preferences

Options:
  -p, --preferences  output preferences filepath
  -s, --state        output game state filepath
  -h, --help         display help for command

Development

Clone this repository, then run the following:

npm install

It's also a good idea to scramble the words when working on the project, to prevent spoilers:

./scripts/gen_word_list.sh

(Note: If you're on Windows, run the script in WSL)

The following will make it so that git doesn't detect that words.txt changed:

git update-index --assume-unchanged words.txt

At this point, run the following to start a local dev server:

npm run dev

The game should render when navigating to http://localhost:5500.

HTTPS Local Development

The share feature uses the share sheet provided by the browser/OS and can also fall back to the browser's clipboard feature if the share sheet isn't available. Both of these features need a secure context to operate, requiring the use of a local HTTPS server when developing them. However, the game can still run on a HTTP server, where it will default to legacy clipboard functionality.

Using mkcert, run the following commands to setup local certificates to be used by local HTTPS server:

mkdir ssl
cd ssl

mkcert -install

mkcert localhost 127.0.0.1 ::1

Then run the following to start up the local HTTPS server:

npm run devs

The game should render when navigating to https://localhost:5501.

Testing

Run the following to launch unit tests:

npm run test

Cypress tests can be accessed by running the following:

npm run cypress open

This will launch the tests in the Cypress UI.

Alternatively, you can run the tests directly on CLI:

npm run cypress run

Future Additions

  • Player Statistics
  • Archive
  • Animations
  • Code cleanup