2.1.1 • Published 7 years ago

@epam/changed v2.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
7 years ago

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

changed.file(targetFile: string, dbFile?: string): Result
type Result = {
    result: boolean; // is file modified
    update: () => void; // update filemtime
};
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

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

const libsChanged = changed.dependencies(Path.resolve(buildPath, '.libs.dat'));
// do something...
styleChanged.update();
2.1.1

7 years ago

2.1.0

7 years ago

2.0.0

7 years ago

1.6.0

7 years ago

1.5.0

7 years ago

1.4.0

7 years ago

1.3.0

7 years ago

1.2.1

7 years ago

1.2.0

7 years ago

1.1.0

7 years ago

1.0.1

7 years ago