# specified-package-version-check

> check the specified package version is outdated or not

Latest version **3.0.0** (published 2023-08-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install specified-package-version-check
pnpm add specified-package-version-check
yarn add specified-package-version-check
bun add specified-package-version-check
```

Provides the command `specified-package-version-check`.

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.0.0 |
| Published | 2023-08-24 |
| First published | 2021-05-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 5 |
| Unpacked size | 80.9 KB |
| Known vulnerabilities | 0 (+23 in 1 direct dependencies) |
| Install scripts | no |
| Author | Shoujian Zhou |
| Maintainers | szhou |
| Keywords | version, check, checker |

## Links

- npm: https://www.npmjs.com/package/specified-package-version-check
- Homepage: https://github.com/zhoushoujian/specified-package-version-check
- npm.io page: https://npm.io/package/specified-package-version-check

## Dependencies (5)

- [ora](https://npm.io/package/ora.md) ^5.4.1
- [axios](https://npm.io/package/axios.md) ^0.21.1
- [semver](https://npm.io/package/semver.md) ^7.3.5
- [depcheck](https://npm.io/package/depcheck.md) ^1.4.2
- [error-stack-parser](https://npm.io/package/error-stack-parser.md) ^2.0.6

## Recent versions

- 3.0.0 (latest) — 2023-08-24
- 3.0.0-beta (beta) — 2023-08-24
- 2.0.3 — 2021-07-17
- 2.0.2 — 2021-07-17
- 1.0.0 — 2021-06-03
- 0.0.1 — 2021-05-29

## README

# specified-package-version-check

[ENGLISH] | [中文](https://github.com/zhoushoujian/specified-package-version-check/blob/master/readme_zh.md)

## Introduce

specified-package-version-check is a script which can check the specified package version is outdated or not, if outdated, develop env process will be exist.

For some case, e.g. our team develop ourselves eslint rules as a npm package, if we update the npm package version, we hope all of our team member must use the latest npm version.

## Usage

```js
// Run this script first, e.g. { "start": node check && webpack-dev-server --open --history-api-fallback -d --colors}
//check.js
const checkDependenceVersion = require('specified-package-version-check');

async function func() {
  await checkDependenceVersion({
    dependenceArr: ['axios', 'eslint-config-ts-base'],
    useDepCheck: true,
    ignoreCheck: false,
    onlyWarn: false,
    checkAllLocalDependencies: false,
    ignoreSelf: false,
    remoteUrl: '',
  });

  console.log('end');
}

func();
```

## API

| Property                  | Description                                                      | Type     | Default                                                                              | required | Version |
| :------------------------ | :--------------------------------------------------------------- | :------- | :----------------------------------------------------------------------------------- | -------- | :------ |
| dependenceArr             | dependence need to be checked                                    | string[] | []                                                                                   | true     | 1.0.0   |
| ignoreCheck               | skip check                                                       | boolean  | undefined                                                                            | false    | 1.0.0   |
| onlyWarn                  | only warn when specified package outdated                        | boolean  | false                                                                                | false    | 1.0.0   |
| checkAllLocalDependencies | check all packages version in package.json                       | boolean  | undefined                                                                            | false    | 1.0.0   |
| ignoreSelf                | ignore check @shuyun-ep-team/specified-package-version-check     | boolean  | undefined                                                                            | false    | 1.0.0   |
| remoteUrl                 | check specified npm global cli version                           | string   | <https://api-track.kylin.shuyun.com/monitor-service/static/global-package-info.json> | false    | 1.0.0   |
| uploadPackageInfoUrl      | upload package info                                              | string   | <https://api-track.kylin.shuyun.com/monitor-service/upload-package-info>             | false    | 1.2.1   |
| useDepCheck               | use depcheck to check useless dependencies and miss dependencies | boolean  | undefined                                                                            | false    | 1.2.1   |
| depcheckOptions           | refer to <https://github.com/depcheck/depcheck#api>              | object   | {}                                                                                   | false    | 1.2.1   |
| autoFixOutdateDep         | auto fix outdate specified package                               | boolean  | true                                                                                 | false    | 1.3.0   |
| silent                    | hide output                                                      | boolean  | false                                                                                | false    | 1.6.0   |
| enableGlobalCliCheck      | check specified global npm package cli version                   | boolean  | true                                                                                 | false    | 1.6.0   |

## 关于配置文件

Insert the following into script in package.json

```json
{
  "prestart": "npx specified-package-version-check"
}
```

Command will read current folder's .spvrc.js where package.json is, if not found that file, console would happen an error

```js
//.spvrc.js like as follows
module.exports = {
  dependenceArr: ['eslint-config-ts-base', 'put your deps here...'],
  ignoreCheck: false,
  onlyWarn: false,
  checkAllLocalDependencies: false,
  useDepCheck: true,
  autoFixOutdateDep: true,
};
```

## something about remoteUrl json

`json content construct must be as following`

```json
{
  "info": [
    {
      "command": "show version command", //e.g. yarn -v
      "name": "package name" //e.g. yarn
    }
  ]
}
```

---
_Source: https://npm.io/package/specified-package-version-check · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
