# @epam/changed

> Designed to track dependencies in package.json and check file modification time

Latest version **2.1.1** (published 2017-07-03) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install @epam/changed
pnpm add @epam/changed
yarn add @epam/changed
bun add @epam/changed
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 2.1.1 |
| Published | 2017-07-03 |
| First published | 2017-06-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 5 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Maintainers | iamthes |

## Links

- npm: https://www.npmjs.com/package/@epam/changed
- Repository: https://github.com/unlight/changed
- Homepage: https://github.com/unlight/changed#readme
- Issues: https://github.com/unlight/changed/issues
- npm.io page: https://npm.io/package/@epam/changed

## Dependencies (5)

- [mkdirp](https://npm.io/package/mkdirp.md) ^0.5.1
- [read-pkg](https://npm.io/package/read-pkg.md) ^2.0.0
- [filenamify](https://npm.io/package/filenamify.md) ^2.0.0
- [@epam/inject](https://npm.io/package/@epam/inject.md) ^1.0.0
- [difference-json](https://npm.io/package/difference-json.md) ^1.0.6

## Recent versions

- 2.1.1 (latest) — 2017-07-03
- 2.1.0 — 2017-06-05
- 2.0.0 — 2017-06-05
- 1.6.0 — 2017-06-04
- 1.5.0 — 2017-06-03
- 1.4.0 — 2017-06-03
- 1.3.0 — 2017-06-03
- 1.2.1 — 2017-06-03
- 1.2.0 — 2017-06-03
- 1.1.0 — 2017-06-03
- 1.0.1 — 2017-06-03

## README

changed
---
Designed to track dependencies in package.json and check file modification time.
Result is saved to local files, but not memory.
Useful for task runners and builders, when you need to know is it necessary run rebuild someting.

API
---
```ts
changed.file(targetFile: string, dbFile?: string): Result
type Result = {
    result: boolean; // is file modified
    update: () => void; // update filemtime
};
```
```ts
changed.dependenciesdependencies(dbFile?: string, cwd?: string): Result
type Result = {
    result: boolean; // has changed
    update: () => void; // update filemtime
    initial: boolean; // indicates first run
    diff: Dict | null; // result difference
};
type Dict = { [name: string]: { $set: any, $was: any } };
```

EXAMPLES
---
```
const changed = require('@epam/changed');
const Path = require('path');
const buildPath = 'dist';
```
#### Example 1: File changed
```ts
const styleChanged = changed.file(`src/style.scss`, Path.resolve(buildPath, '.style.dat'));
// do something useful with src/style.scss...
styleChanged.update();
```
#### Example 2: Track dependencies
```ts
const libsChanged = changed.dependencies(Path.resolve(buildPath, '.libs.dat'));
// do something...
styleChanged.update();
```

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