Skip to content

feat: createIfMissing option, named exports, README overhaul, remove internal docs#16

Merged
bchr02 merged 1 commit into
masterfrom
copilot/update-readme-and-fix-code-issues
Apr 30, 2026
Merged

feat: createIfMissing option, named exports, README overhaul, remove internal docs#16
bchr02 merged 1 commit into
masterfrom
copilot/update-readme-and-fix-code-issues

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 30, 2026

Several code quality issues: incorrect default documented for saveDelay, raw ENOENT on missing files, no named exports for ESM/TS consumers, and internal working-note .md files cluttering the repo root.

Changes

app.js

  • createIfMissing config option (default: false) — when true, load() initializes contents to {} and writes the file instead of propagating ENOENT
  • Named exports — adds module.exports.Filejson and module.exports.default alongside the default export
// Now works in CJS and ESM
const { Filejson } = require('filejson');
import { Filejson } from 'filejson';

// Auto-create missing config files
const file = new Filejson({ createIfMissing: true });
const instance = await file.load('settings.json'); // creates {} if absent

index.d.ts

  • Switched from export = Filejson to export { Filejson }; export default Filejson; for true ESM named-import support
  • Added createIfMissing?: boolean to Config

README.md

  • Removed outdated Requirements section (Node.js version table, legacy Node 5 section)
  • Async/Await example now leads; callback and promise examples follow
  • Fixed Recommended Delays table — 0ms was incorrectly marked as the default; 100ms is the default

Deleted internal docs

Removed 6 *-IMPLEMENTATION-SUMMARY.md files (ATOMIC-WRITES, DEBOUNCE, ESLINT, IMPLEMENTATION, NPM-DISCOVERABILITY, TEST) that were internal working notes with no value to consumers.

…ove internal docs

Agent-Logs-Url: https://github.com/bchr02/filejson/sessions/7c7666fd-759b-433d-9a4a-245790a63c81

Co-authored-by: bchr02 <10158167+bchr02@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants