{"id":22218568,"url":"https://github.com/megahertz/electron-cfg","last_synced_at":"2025-08-30T16:35:55.924Z","repository":{"id":57221554,"uuid":"88194917","full_name":"megahertz/electron-cfg","owner":"megahertz","description":"Simple key-value storage for electron","archived":false,"fork":false,"pushed_at":"2021-10-05T07:28:57.000Z","size":45,"stargazers_count":45,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-30T04:44:05.160Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/megahertz.png","metadata":{"files":{"readme":"README.md","changelog":null,"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-04-13T18:31:49.000Z","updated_at":"2024-12-04T23:43:48.000Z","dependencies_parsed_at":"2022-08-29T04:01:53.961Z","dependency_job_id":null,"html_url":"https://github.com/megahertz/electron-cfg","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"purl":"pkg:github/megahertz/electron-cfg","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/megahertz%2Felectron-cfg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/megahertz%2Felectron-cfg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/megahertz%2Felectron-cfg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/megahertz%2Felectron-cfg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/megahertz","download_url":"https://codeload.github.com/megahertz/electron-cfg/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/megahertz%2Felectron-cfg/sbom","scorecard":{"id":634964,"data":{"date":"2025-08-11","repo":{"name":"github.com/megahertz/electron-cfg","commit":"a697ca65ae4b26ec2e66ce2ebea522e837927505"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-21T08:53:01.540Z","repository_id":57221554,"created_at":"2025-08-21T08:53:01.540Z","updated_at":"2025-08-21T08:53:01.540Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272878214,"owners_count":25008340,"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","status":"online","status_checked_at":"2025-08-30T02:00:09.474Z","response_time":77,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-12-02T22:27:10.089Z","updated_at":"2025-08-30T16:35:55.908Z","avatar_url":"https://github.com/megahertz.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# electron-cfg\n[![Build Status](https://travis-ci.org/megahertz/electron-cfg.svg?branch=master)](https://travis-ci.org/megahertz/electron-cfg)\n[![npm version](https://badge.fury.io/js/electron-cfg.svg)](https://badge.fury.io/js/electron-cfg)\n[![Dependencies status](https://img.shields.io/david/megahertz/electron-cfg)](https://david-dm.org/megahertz/electron-cfg)\n\n## Description\n\nJust a very easy solution for storing settings for an electron\napplication.\n\n### Key features\n\n - Settings observer\n - Built-in helper for saving and restoring window state\n - No dependencies\n\n## Installation\n\nInstall with [npm](https://npmjs.org/package/electron-cfg):\n\n    npm install --save electron-cfg\n\n## Usage\n\n```js\nconst config = require('electron-cfg');\n\nconst downloadsPath = config.get('downloads.path', process.cwd());\n\nconfig.observe('album', (current, old) =\u003e {\n  console.log(`Previous: ${old.name}, current: ${current.name}`);\n});\n\nconfig.set('album', { name, photos: photos.length });\n```\n\n### Methods\n\n#### `create(filePath, logger = null)`\nCreate a new config instance with different file path.\n\n#### `get(key, defaultValue = null): any`\n\nReturns a value associated with the key.\n\nParam         | Type   | Description\n--------------|--------|------------\nkey           | string | Key name, use dot in key to return nested value of some object\ndefaultValue? | any    | Return this values instead if key not found\n\n#### `set(key, value): electron-cfg`\n\nSets a value.\n\n#### `has(key): boolean`\n\nIs key exists in the config.\n\n#### `delete(key): electron-cfg`\n\nRemoves values associated with the key.\n\n#### `getAll(): Object`\n\nGets the root object of the config\n\n#### `setAll(data): ElectronCfg`\n\nSets the root object of the config\n\n#### `file(filePath = null): string`\n\nGets / Sets config's file path. If relative, it uses `app.getPath('userData')`\nto resolve the full path.\n\n#### `observe(key, handler): electron-cfg`\nAttaches a handler on keyName property changes. Changes are observable\nonly in the same process.\n\nParam         | Type                              | Description\n--------------|-----------------------------------|------------\nkey           | string                            | Key name\nhandler       | (newValue, oldValue, key) =\u003e void | Observer\n\n#### `purge(): electron-cfg`\n\nRemoves all data from config\n\n#### `logger(logger = console)`\n\nGets / Sets a logger (object with error, warn and debug methods)\n\n#### `window(options?): WindowManager`\n\nAllow to save/restore window size and position. See next section for details\n\n Param                    | Type             | Description\n--------------------------|------------------|------------\n options = {              | object           | \n -- name: 'main'          | string           | Useful when store settings of multiple windows\n -- saveFullscreen: true  | boolean          | Whether to restore fullscreen state\n -- saveMaximize: true    | boolean          | Whether to restore maximized state\n }                        |                  |\n\n#### `resolveUserDataPath(filePath, appName?)`\n\nReturn file path relative to userData directory, similar to\n\n```path.join(app.getPath('userData'), filePath)```\n\nIf appName is set, electron-cfg uses its own code to find userData directory\nfor appName without calling app.getPath. Can be helpful in dev environment\nwhen app.getPath('userData') resolves an incorrect path.\n\n### Save/restore window state\n\n```js\nconst { BrowserWindow } = require('electron');\nconst cfg = require('electron-cfg');\n\nfunction createWindow() {\n  const winCfg = cfg.window();\n  const window = new BrowserWindow({\n    width: 800,  // default, optional\n    height: 600, // default, optional\n    ...winCfg.options(),\n  });\n  winCfg.assign(window);\n  return window;\n}\n```\n\nor it can be simplified using the `create` shortcut:\n\n```js\nconst cfg = require('electron-cfg');\n\nfunction createWindow() {\n  return cfg.window().create({ width: 800, height: 600 });\n}\n```\n\nRemarks:\n - Don't set `useContentSize` to true at creating BrowserWindow instance because\n   it changes how to calculate window size.\n - Don't call `cfg.window()` before the ready event is fired.\n \n#### WindowManager methods\n  - **create(options): BrowserWindow** - shortcut (see example above)\n  - **assign(window: BrowserWindow)** - start handling size/position change\n  - **options(): Rectangle | object** - get options for BrowserWindow\n    constructor\n  - **unassign()** - stop handling size/position change\n\n## Related project\n\nHere is a few alternatives which you can try:\n - [electron-json-config](https://github.com/de-luca/electron-json-config)\n - [electron-config](https://github.com/sindresorhus/electron-config)\n - [electron-settings](https://github.com/nathanbuchar/electron-settings)\n\nA lot of code of Saving/restoring window state is based on\n[electron-window-state](https://github.com/mawie81/electron-window-state)\n\n## License\n\nLicensed under MIT.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmegahertz%2Felectron-cfg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmegahertz%2Felectron-cfg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmegahertz%2Felectron-cfg/lists"}