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

@okeeffed/tennis-results-cli

v1.0.2

Published

## Quickstart

Downloads

5

Readme

Tennis Results CLI

Quickstart

# Install dependencies
$ yarn install

# Run application in dev mode
$ yarn dev

# Alternatively, run the application with debugging enabled
$ yarn dev --debug

# Run tests
$ yarn test

# Publish locally
$ yarn deploy

# Build package
$ yarn build

# Run built package
$  ./bin/cli.js

# Install from npm and run
$ npm i -g @okeeffed/tennis-results-cli
$ tennis-results-cli

Important notes

For this project, I focused mainly on demonstrating my process than the actual code implementation. My process:

  1. Write a technical doc on Notion.
  2. Add tasks to Linear project comprised of three milestones (see images below).
  3. Relied on my standard pull requests flow to demonstrate the process of getting from start to finish. See the repos closed PRs.
  4. Configure GitHub Actions to help enforce routine inspections. See the repos workflow runs.
  5. Enforced Node 18 TypeScript standards.
  6. Enforced recommended lint standards (with one ignored rule for a refactor).
  7. Enforced deduping packages, CVE security and git commit conventions with git hooks.
  8. Published to NPM through GitHub Actions.
  9. Debugging for some understanding was added under the --debug flag but is non-exhaustive.

Initially planned tasks

Lienar post-completion

Completed run-through with published package

Some noted improvements to this project

  • GitHub actions on CI isn't using the caching correctly. I deemed it out of scope.
  • I was a little confused by the provided example where games went on longer than possible (more 0s and 1s than the game length). The README noted that we need to handle empty lines, but it mentions nothing about extra scores. I may have misinterpreted the task here. Initially, I raised an error for an invalid state, but given that was the example input I changed course to effectively "halt" the game at the correct point. If you run in debug mode, it will let you know when state has been omitted because the game it complete. I committed my examples under tournaments/ for this reason.
  • This implementation assumes a lot of "valid" input (at least valid to what I grokked of the task). I raise errors on other invalid scenarios e.g. attempting to calculate results before the incomplete game etc. Normally I would clarify this further with the person in charge of outcomes.
  • I added standard config as a base for this example (since I initialized the repo for empty), but I did not extend some of the configuration to what I normally would (e.g. enforcing import rules etc.). I deemed this out of scope.
  • A lot of code implementation was TDD and then brute-force implementation. For the sake of timing, I did not look for alternative implementations and pressed forward with the initial approaches when pivots were required.
  • Publishing to NPM requires manually bumping the version. This could also be changed with the help of other libraries.

Other notes:

  • yarn dev uses Nodemon, so it does not pipe things in correctly. To work around this, I use a dev flag to run the defaults.

Debugging

Enabling debug mode will add some tables to demonstrate the flow of the calculations. They were inspired by the initial README.

Debug mode

I also log warnings when the scores seemed to go longer than the game in debug mode. As noted above, I did not grok the requirement for that one.

Debug mode with warnings

Lastly, debugging also shows some information on how I calculated the win-loss.

Debug mode calculating win-loss

Publishing

The package should publish in CI to the NPM registry under @okeeffed/tennis-results-cli.

npm i -g @okeeffed/tennis-results-cli should install the package, then, assuming you have a valid file at tournaments/full_tournament_valid.txt, you can run:

$ tennis-results-cli tournaments/full_tournament_valid.txt << EOF
Score Match 01
Score Match 02
Games Player Player A
Games Player Player B
Games Player Player C
EOF

Resources