madlabsinc / teachcode

A tool to develop and improve a student’s programming skills by introducing the earliest lessons of coding.
https://teachcode.surge.sh
GNU General Public License v3.0
385 stars 64 forks source link

chore: replace didyoumean with leven #104

Closed saideepesh000 closed 3 years ago

saideepesh000 commented 3 years ago

What kind of change does this PR introduce? Dependency migration.

Did you add tests for your changes? No(If I need to add, where should be the first steps to start from).

If relevant, did you update the documentation? No

Summary

To give suggestions to unknown commands we used didyoumean.js, however, it seems like it's not maintained anymore, so we're using leven.

Issue: #101

Does this PR introduce a breaking change? This might work differently than the previous solution because each had their own implementations.

welcome[bot] commented 3 years ago

Thanks for opening this pull request! Please check out our contributing guidelines.

welcome[bot] commented 3 years ago

congrats Congrats on your very first contribution :clap: Looking forward to having more from your side

jamesgeorge007 commented 3 years ago

Feel free to add a test case here:-

test('suggests the closest match', async t => {
  const { stderr, stdout } = await run(['inti'], { reject: false });
  t.is(stderr.trim(), 'Unknown command inti.');
  t.true(stdout.includes('Did you mean init?'));
});