Skip to content
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

Replace os-locale with inline code #1354

Closed
coreyfarrell opened this issue Jun 1, 2019 · 1 comment · Fixed by #1356
Closed

Replace os-locale with inline code #1354

coreyfarrell opened this issue Jun 1, 2019 · 1 comment · Fixed by #1356

Comments

@coreyfarrell
Copy link
Contributor

Due to yargs passing spawn: false to os-locale most of the functionality of that module is unused. The following could be used as a drop-in replacement for os-locale:

function osLocale() {
  const locale = env.LC_ALL || env.LC_MESSAGES || env.LANG || env.LANGUAGE || 'en_US';
  return locale.replace(/[.:].*/, '');
}

The benefit is a large drop of production dependencies. Currently a project with yargs as the only dependency installs 53 modules / 1.8MB to node_modules. Without os-locale this becomes 26 modules / 1.1MB. The size reduction is not my primary interest of this issue, the goal is cutting the number of modules that have to be audited in half.

@bcoe
Copy link
Member

bcoe commented Jun 7, 2019

@coreyfarrell I would happily accept a patch for this, good call.

coreyfarrell added a commit to coreyfarrell/yargs that referenced this issue Jun 8, 2019
This eliminates half the dependencies of yargs without any change in
functionality.  The extra dependencies were used by the os-locale module
to execute detection utilities, this execution functionality was always
disabled by yargs.

Fixes yargs#1354
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

Successfully merging a pull request may close this issue.

2 participants