# @build-script/poormans-package-change

> - Do you manage more than 10 package at same time? - Did you forgot/lazy to tag previous version with git? - Did you remember which package changed since last publish? - Should you increase version and publish it again?

Latest version **1.0.34** (published 2024-08-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install @build-script/poormans-package-change
pnpm add @build-script/poormans-package-change
yarn add @build-script/poormans-package-change
bun add @build-script/poormans-package-change
```

Provides the command `poormans-package-change`.

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 1.0.34 |
| Published | 2024-08-28 |
| First published | 2020-03-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 11 |
| Unpacked size | 98.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 12 |
| Maintainers | gongt |

## Links

- npm: https://www.npmjs.com/package/@build-script/poormans-package-change
- Repository: https://github.com/GongT/baobao
- Homepage: https://github.com/GongT/baobao#readme
- Issues: https://github.com/GongT/baobao/issues
- npm.io page: https://npm.io/package/@build-script/poormans-package-change

## Dependencies (11)

- [execa](https://npm.io/package/execa.md) ^7.2.0
- [targz](https://npm.io/package/targz.md) ^1.0.1
- [tslib](https://npm.io/package/tslib.md) ^2.6.0
- [semver](https://npm.io/package/semver.md) ^7.5.4
- [global-agent](https://npm.io/package/global-agent.md) ^3.0.0
- [@idlebox/node](https://npm.io/package/@idlebox/node.md) ^1.3.7
- [@idlebox/common](https://npm.io/package/@idlebox/common.md) ^1.3.31
- [@pnpm/store-path](https://npm.io/package/@pnpm/store-path.md) ^8.0.0
- [npm-registry-fetch](https://npm.io/package/npm-registry-fetch.md) ^17.0.1
- [source-map-support](https://npm.io/package/source-map-support.md) ^0.5.21
- [@idlebox/node-json-edit](https://npm.io/package/@idlebox/node-json-edit.md) ^2.0.30

## Recent versions

- 1.0.34 (latest) — 2024-08-28
- 1.0.33 — 2023-08-24
- 1.0.32 — 2023-08-03
- 1.0.31 — 2023-07-20
- 1.0.30 — 2023-07-20
- 1.0.29 — 2023-07-05
- 1.0.28 — 2022-11-28
- 1.0.26 — 2022-11-28
- 1.0.25 — 2022-08-15
- 1.0.24 — 2022-08-09
- 1.0.23 — 2022-07-29
- 1.0.22 — 2022-06-24
- 1.0.21 — 2022-06-23
- 1.0.20 — 2022-03-17
- 1.0.19 — 2022-03-16
- … 16 more at https://npm.io/package/@build-script/poormans-package-change/versions

## README

# poormans-package-change

-   Do you manage more than 10 package at same time?
-   Did you forgot/lazy to tag previous version with git?
-   Did you remember which package changed since last publish?
-   Should you increase version and publish it again?

Run this now! It's FREE! Pickup your phone (BEEEEEP)

# Usage

```
poormans-package-change <command> [--args]
```

## command: detect-package-change

```
Usage: poormans-package-change detect-package-change --registry ??? --dist-tag ??? --package ??? --bump --json --quiet
         registry: default to use system .npmrc
         dist-tag: default to "latest"
         package: this folder contains package.json (default to ./)
         bump: increase patch version in package.json if change detected
		 json: print json output even if stdout is tty
		 quiet: disable verbose debug output to stderr
```

Require `git` available on PATH.

Output:

-   `{ changedFiles: [......], changed: true }` if `!process.stdout.isTTY` OR `--json` is set
-   `changed no.` or `changed yes.` if stdout isTTY AND `--json` is not set
-   no output if `--bump` is set

The return code always 0 if no error. no matter changed or not.

### What happens

1. download newest `package.json` from npm, and cache it at `${TMPDIR}/package-json-cache`
1. compare `version` field with local package.json
    - If they are not equal. Then I will do nothing and print "changed yes.".
1. download published tarball from npm
1. run `pnpm pack` locally, or `npm run prepack`+`npm pack` if no pnpm.
1. compare files in created `.tgz` file and downloaded one. (by running some magic `git` commands)
    1. if `--bump` is set, increase patch version in `package.json`
    2. if any file do not equal, print "changed yes.".
    3. if everything exact same, print "changed no."

## command: run-if-version-mismatch

```
Usage: poormans-package-change run-if-version-mismatch [--quiet] -- <command to run>
	Eg: poormans-package-change run-if-version-mismatch -- pnpm publish --no-git-checks
```

Run a command, if local `version` in `package.json` is NOT same with npm registry.  
**The `--` is required.**

# Example

```bash
# update package.json if something changed
poormans-package-change detect-package-change --bump --quiet
# run pnpm publish if version is not same with npm
#    maybe modified by above command
#    maybe by hand
poormans-package-change run-if-version-mismatch --quiet -- pnpm publish --no-git-checks
```

---
_Source: https://npm.io/package/@build-script/poormans-package-change · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
