https://github.com/kitschpatrol/es-check-min
A CLI tool and library to find the minimum compatible ECMAScript version of a JavaScript file.
https://github.com/kitschpatrol/es-check-min
cli ecmascript es-check npm-package version-detection
Last synced: 3 months ago
JSON representation
A CLI tool and library to find the minimum compatible ECMAScript version of a JavaScript file.
- Host: GitHub
- URL: https://github.com/kitschpatrol/es-check-min
- Owner: kitschpatrol
- License: mit
- Created: 2024-06-08T20:32:09.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2025-11-05T01:51:22.000Z (7 months ago)
- Last Synced: 2025-11-05T03:22:05.889Z (7 months ago)
- Topics: cli, ecmascript, es-check, npm-package, version-detection
- Language: JavaScript
- Homepage:
- Size: 999 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license.txt
Awesome Lists containing this project
README
# es-check-min
[](https://npmjs.com/package/es-check-min)
[](https://opensource.org/licenses/MIT)
**A CLI tool and library to find the minimum compatible ECMAScript version of a JavaScript file.**
## Overview
A simple tool built on [`es-check`](https://github.com/yowainwright/es-check) to find the lowest supported [ECMAScript version](https://en.wikipedia.org/wiki/ECMAScript_version_history) of a JavaScript file.
The `es-check-min` tool does not require any arguments, and simply runs a loop to determine the file's lowest compatible ECMAScript version. This is in slight contrast to `es-check` which checks a file against a _specified_ ECMAScript version.
Detection of the following ECMAScript versions is supported:
- ES5
- ES6 / ES2015
- ES7 / ES2016
- ES8 / ES2017
- ES9 / ES2018
- ES10 / ES2019
- ES11 / ES2020
- ES12 / ES2021
- ES13 / ES2022
_Note: The underlying `es-check` implementation technically supports ES3 and ES14 / ES2023, but certain tests aren't passing against these targets so they are not currently returned._
## Getting started
### Dependencies
The `es-check-min` CLI tool requires Node 20+. The exported APIs are ESM and share the Node 20+ requirement.
### Installation
Invoke directly:
```sh
npx es-check-min
```
Or, install locally to access the CLI commands in a single project or to import the provided APIs:
```sh
npm install es-check-min
```
Or, install globally for access across your system:
```sh
npm install --global es-check-min
```
## Usage
### CLI
#### Example
```sh
es-check-min ./mystery-file.js
```
prints...
```sh
es6/es2015
```
#### Command: `es-check-min`
Get the minimum supported ECMAScript version of a JavaScript file.
Usage:
```txt
es-check-min
```
| Positional Argument | Description | Type |
| ------------------- | ------------------------------------- | -------- |
| `file` | Path to the JavaScript file to check. | `string` |
| Option | Description | Type |
| ------------------- | ------------------- | --------- |
| `--help`
`-h` | Show help | `boolean` |
| `--version`
`-v` | Show version number | `boolean` |
### Library
A single function is exported:
```ts
function esCheckMin(path: string): Promise
```
## Background
Requests for something like this have come up once or twice:
- [Make babel tell me the minimum version of target that supports my code](https://github.com/babel/babel/issues/8008)
- [Feature Request: Wrapper command for "minimum ES version" for a file](https://github.com/dollarshaveclub/es-check/issues/101)
## Maintainers
[@kitschpatrol](https://github.com/kitschpatrol)
## Acknowledgments
`es-check-min` is just a trivial wrapper over `es-check`. All credit goes to [Jeff Wainwright](https://github.com/yowainwright) and [contributors](https://github.com/yowainwright/es-check?tab=readme-ov-file#contributors) for creating and maintaining [`es-check`](https://github.com/yowainwright/es-check).
## Contributing
[Issues](https://github.com/kitschpatrol/es-check-min/issues) and pull requests are welcome.
## License
[MIT](license.txt) © Eric Mika