last-cjs-version
v0.4.0
Published
get last cjs version of a module
Downloads
13
Maintainers
Readme
last-cjs-version
get last cjs version of a module
Why
modules are moving to ES module. But when we want keep using CommonJS, and tired of using async
dynamic import()
, u can use this to find last CommonJS version of the module.
Install
$ npm i -g last-cjs-version
# or
$ pnpm add -g last-cjs-version
cli
$ last-cjs-version
last-cjs-version <pkg>
get last cjs version of package
位置:
pkg package name [字符串]
选项:
-m, --major major version only [布尔] [默认值: false]
-h, --help 显示帮助信息 [布尔]
-v, --version 显示版本号 [布尔]
缺少 non-option 参数:传入了 0 个, 至少需要 1 个
$ last-cjs-version execa
5.1.1
$ last-cjs-version got
11.8.3
$ last-cjs-version execa -m
5
$ echo pnpm add execa@`last-cjs-version -m execa`
pnpm add execa@5
# this will exec 'pnpm add execa@5'
$ pnpm add execa@`last-cjs-version -m execa`
add
command
find out the version and exec install command for you
$ last-cjs-version add execa -m
[last-cjs-version] detected package manager: pnpm
[last-cjs-version] executing: pnpm add execa@5
Already up to date
Progress: resolved 332, reused 323, downloaded 0, added 0, done
Done in 2.1s
API
import last-cjs-version from 'last-cjs-version'
lastCjsVersion(pkg: string) => Promise<string>
Changelog
License
the MIT License http://magicdawn.mit-license.org