{"id":18609679,"url":"https://github.com/unlight/changed","last_synced_at":"2025-11-02T20:30:26.926Z","repository":{"id":57111757,"uuid":"93240900","full_name":"unlight/changed","owner":"unlight","description":"Check if file was changed","archived":false,"fork":false,"pushed_at":"2020-05-27T08:07:55.000Z","size":127,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-27T13:04:08.050Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/unlight.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-06-03T10:23:36.000Z","updated_at":"2020-05-27T08:07:51.000Z","dependencies_parsed_at":"2022-08-21T00:01:03.412Z","dependency_job_id":null,"html_url":"https://github.com/unlight/changed","commit_stats":null,"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unlight%2Fchanged","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unlight%2Fchanged/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unlight%2Fchanged/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unlight%2Fchanged/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/unlight","download_url":"https://codeload.github.com/unlight/changed/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239400596,"owners_count":19632049,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-07T03:06:56.823Z","updated_at":"2025-11-02T20:30:26.836Z","avatar_url":"https://github.com/unlight.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# is-changed\nDesigned to track dependencies in package.json and check file modification time.\nResult is saved to local files, but not memory.\nUseful for task runners and builders, when you need to know is it necessary run rebuild someting.\n\n## CLI\nCheck dependencies in package.json, run command `npm run build:libs` if changes found.\nSnapshot will be stored in `.libs.dat`.\n```sh\nis-changed --dependencies -t .libs.dat -u \"npm run build:libs\"\n```\n\nCheck file `src/style.scss` time modification, execute `npm run build:style` if time is different from latest saved snapshot to `.style.dat`.\n```sh\nis-changed -f src/style.scss -t .style.dat -u \"npm run build:style\"\n```\n\n## API\n```ts\nchanged.file({ targetFile: string, databaseFile?: string }): Result\ntype Result = {\n    result: boolean; // is file modified\n    update: () =\u003e void; // update filemtime\n};\n```\n```ts\nchanged.dependenciesdependencies({ databaseFile?: string, cwd?: string }): Result\ntype Result = {\n    result: boolean; // has changed\n    update: () =\u003e void; // update filemtime\n    initial: boolean; // indicates first run\n    diff: Dict | null; // result difference\n};\ntype Dict = { [name: string]: { $set: any, $was: any } };\n```\n\n## EXAMPLES\n```\nconst changed = require('is-changed');\nconst Path = require('path');\nconst buildPath = 'dist';\n```\n#### Example 1: File changed\n```ts\nconst styleChanged = changed.file(`src/style.scss`, Path.resolve(buildPath, '.style.dat'));\n// do something useful with src/style.scss...\nstyleChanged.update();\n```\n#### Example 2: Track dependencies\n```ts\nconst libsChanged = changed.dependencies(Path.resolve(buildPath, '.libs.dat'));\n// do something...\nstyleChanged.update();\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funlight%2Fchanged","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Funlight%2Fchanged","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funlight%2Fchanged/lists"}