Skip to content

Reduce lib size #120

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
icebob opened this issue Mar 29, 2018 · 15 comments
Closed

Reduce lib size #120

icebob opened this issue Mar 29, 2018 · 15 comments

Comments

@icebob
Copy link
Contributor

icebob commented Mar 29, 2018

Hi,

I checked your lib size because it is~300kB: https://arve0.github.io/npm-download-size/#args
But your code is very small (1kB), but you have "string-similarity" dependency which is 300kB. 86% of the whole size.

Do you plan to change it to other smaller lib?

Thanks!

@ntwcklng
Copy link
Collaborator

ntwcklng commented Apr 1, 2018

Hey @icebob,

args is a CLI which only runs on Desktops, so in my opinion the size does not matter that much as on mobile web apps. But in general i like smaller and lighter modules.
Do you know a smaller module like string-similarity?
string-similarity depends on several lodash functions (=99% of the size), so maybe we can create a PR without lodash.

@icebob
Copy link
Contributor Author

icebob commented Apr 3, 2018

I found leven. It's only 2.3kB, but it's a Levenshtein distance algorithm.

@ntwcklng
Copy link
Collaborator

ntwcklng commented Apr 3, 2018

Okay, do you want to create a PR?

@icebob
Copy link
Contributor Author

icebob commented Apr 3, 2018

Yes, I will.

@ntwcklng
Copy link
Collaborator

ntwcklng commented Apr 3, 2018

Thanks! Maybe we should wait until #116 is merged?!

@icebob
Copy link
Contributor Author

icebob commented Apr 3, 2018

When will it be merged?

@ntwcklng
Copy link
Collaborator

ntwcklng commented Apr 3, 2018

Done 👍

@icebob
Copy link
Contributor Author

icebob commented Apr 3, 2018

Great! I'm trying to change similarity lib...

@icebob
Copy link
Contributor Author

icebob commented Apr 3, 2018

I'm trying, but how can I test it? I see there is no test case for similarity and I don't know when this code is called. Could you help me?

My changes

@ntwcklng
Copy link
Collaborator

ntwcklng commented Apr 4, 2018

You can create a file, where you require your local args module like this:

similarity.js

#!/usr/bin/env node
const args = require('../args/lib/')

args
    .option('t', 'This is a test', 'foo')
    .option('verbose', 'verbose option', 'jep')

const flags = args.parse(process.argv, {
  version: false,
  mri: {
    string: 't'
  }
})
console.log(flags)

switch to that dir and run node similarity.js and test some typos: node similarity.js --ferbose, node similarity.js --vernose

@icebob
Copy link
Contributor Author

icebob commented Apr 4, 2018

I'm done. Could you check it? #121

@icebob
Copy link
Contributor Author

icebob commented Apr 6, 2018

@ntwcklng When can you check & merge it?

@ntwcklng
Copy link
Collaborator

ntwcklng commented Apr 6, 2018

I will look at it next week 👍

@ntwcklng
Copy link
Collaborator

ntwcklng commented Apr 9, 2018

Released in 4.0.0, thanks @icebob 😎

@ntwcklng ntwcklng closed this as completed Apr 9, 2018
@icebob
Copy link
Contributor Author

icebob commented Apr 9, 2018

Great! Me too! 😎

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants