Compare commits
2 Commits
9aebeb31a6
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| f8d78d05fc | |||
| 6e2288f157 |
15
README.md
15
README.md
@@ -6,6 +6,17 @@ Node package compare and change runner.
|
|||||||
[](https://www.npmjs.com/package/pkgcomp)
|
[](https://www.npmjs.com/package/pkgcomp)
|
||||||
[](https://nodejs.org/api/documentation.html#documentation_stability_index)
|
[](https://nodejs.org/api/documentation.html#documentation_stability_index)
|
||||||
|
|
||||||
|
This tool will execute a command if the dependencies or lock files of your module have changed since the last time it was run. Any of the following will be considered a change:
|
||||||
|
|
||||||
|
- If the `dependencies` or `devDependencies` in `package.json` change
|
||||||
|
- If the `dependencies` or `devDependencies` in any of your workspaces change
|
||||||
|
- Uses `workspaces` property in root `package.json`, works with Yarn workspaces
|
||||||
|
- If one of the files in your `checkFiles` config's md5 hash changes
|
||||||
|
|
||||||
|
If the command exits with a non-zero exit code, `pkgcomp` will exit with the same exit code.
|
||||||
|
|
||||||
|
**NOTE:** Out of the box the script will do nothing, you have to provide a command to run, via the `cmd` config. See [Configuration](#configuration) below.
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
Simply install the package and run it from the command line in your project. You can install it globally and run it that way, but installing locally is generally better.
|
Simply install the package and run it from the command line in your project. You can install it globally and run it that way, but installing locally is generally better.
|
||||||
@@ -15,9 +26,7 @@ yarn add -D pkgcomp
|
|||||||
npx pkgcomp
|
npx pkgcomp
|
||||||
```
|
```
|
||||||
|
|
||||||
If the `dependencies` or `devDependencies` in `package.json` change, or if one of the files in your `checkFiles` config's md5 hash changes, your command will run. If the command exits with a non-zero exit code, `pkgcomp` will exit with the same exit code.
|
**NOTE:** Out of the box the script will do nothing, you have to provide a command to run, via the `cmd` config. See [Configuration](#configuration) below.
|
||||||
|
|
||||||
Out of the box the script will do nothing, you have to provide a command to run, via the `cmd` config. See [Configuration](#configuration) below.
|
|
||||||
|
|
||||||
You can also set the command, and control how the script works, via the available [command line arguments](#cli-arguments)
|
You can also set the command, and control how the script works, via the available [command line arguments](#cli-arguments)
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,11 @@ exports.getPackageInfo = () => {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
if (!name) throw new Error('Unable to read project name from package.json');
|
if (!name) throw new Error('Unable to read project name from package.json');
|
||||||
return { name, workspaces };
|
|
||||||
|
// handle nohoist config: https://yarnpkg.com/blog/2018/02/15/nohoist/
|
||||||
|
const realWorkspaces = workspaces.packages ? workspaces.packages : workspaces;
|
||||||
|
|
||||||
|
return { name, workspaces: realWorkspaces };
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.getPackageWorkspaces = () => {
|
exports.getPackageWorkspaces = () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user