{"id":16013377,"url":"https://github.com/magicdawn/last-cjs-version","last_synced_at":"2026-04-03T23:04:30.455Z","repository":{"id":62735805,"uuid":"562074385","full_name":"magicdawn/last-cjs-version","owner":"magicdawn","description":"get last cjs version of a module","archived":false,"fork":false,"pushed_at":"2023-05-18T14:09:19.000Z","size":519,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-10-09T14:40:56.724Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/magicdawn.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-11-05T08:18:03.000Z","updated_at":"2022-11-05T10:25:42.000Z","dependencies_parsed_at":"2023-01-25T14:15:58.117Z","dependency_job_id":null,"html_url":"https://github.com/magicdawn/last-cjs-version","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magicdawn%2Flast-cjs-version","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magicdawn%2Flast-cjs-version/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magicdawn%2Flast-cjs-version/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magicdawn%2Flast-cjs-version/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/magicdawn","download_url":"https://codeload.github.com/magicdawn/last-cjs-version/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237506567,"owners_count":19321205,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-08T14:41:00.557Z","updated_at":"2025-10-21T15:31:26.031Z","avatar_url":"https://github.com/magicdawn.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# last-cjs-version\n\n\u003e get last cjs version of a module\n\n[![Build Status](https://img.shields.io/github/workflow/status/magicdawn/last-cjs-version/ci/main?style=flat-square)](https://github.com/magicdawn/last-cjs-version/actions/workflows/ci.yml)\n[![Coverage Status](https://img.shields.io/codecov/c/github/magicdawn/last-cjs-version.svg?style=flat-square)](https://codecov.io/gh/magicdawn/last-cjs-version)\n[![npm version](https://img.shields.io/npm/v/last-cjs-version.svg?style=flat-square)](https://www.npmjs.com/package/last-cjs-version)\n[![npm downloads](https://img.shields.io/npm/dm/last-cjs-version.svg?style=flat-square)](https://www.npmjs.com/package/last-cjs-version)\n[![npm license](https://img.shields.io/npm/l/last-cjs-version.svg?style=flat-square)](http://magicdawn.mit-license.org)\n\n# Why\n\nmodules are moving to ES module. But when we want keep using CommonJS, and tired of using async\ndynamic `import()`, u can use this to find last CommonJS version of the module.\n\n## Install\n\n```sh\n$ npm i -g last-cjs-version\n\n# or\n$ pnpm add -g last-cjs-version\n```\n\n## cli\n\n```sh\n$ last-cjs-version\nlast-cjs-version \u003cpkg\u003e\n\nget last cjs version of package\n\n位置：\n  pkg  package name                                                     [字符串]\n\n选项：\n  -m, --major    major version only                       [布尔] [默认值: false]\n  -h, --help     显示帮助信息                                             [布尔]\n  -v, --version  显示版本号                                               [布尔]\n\n缺少 non-option 参数：传入了 0 个, 至少需要 1 个\n```\n\n```sh\n$ last-cjs-version execa\n5.1.1\n\n$ last-cjs-version got\n11.8.3\n\n$ last-cjs-version execa -m\n5\n\n$ echo pnpm add execa@`last-cjs-version -m execa`\npnpm add execa@5\n\n# this will exec 'pnpm add execa@5'\n$ pnpm add execa@`last-cjs-version -m execa`\n```\n\n### `add` command\n\nfind out the version and exec install command for you\n\n```sh\n$ last-cjs-version add execa -m\n[last-cjs-version] detected package manager: pnpm\n[last-cjs-version] executing: pnpm add execa@5\n\nAlready up to date\nProgress: resolved 332, reused 323, downloaded 0, added 0, done\nDone in 2.1s\n```\n\n## API\n\n```ts\nimport last-cjs-version from 'last-cjs-version'\n\nlastCjsVersion(pkg: string) =\u003e Promise\u003cstring\u003e\n```\n\n## Changelog\n\n[CHANGELOG.md](CHANGELOG.md)\n\n## License\n\nthe MIT License http://magicdawn.mit-license.org\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmagicdawn%2Flast-cjs-version","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmagicdawn%2Flast-cjs-version","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmagicdawn%2Flast-cjs-version/lists"}