{"id":19475539,"url":"https://github.com/artdecocode/africa","last_synced_at":"2025-02-25T15:47:20.421Z","repository":{"id":135404013,"uuid":"115829235","full_name":"artdecocode/africa","owner":"artdecocode","description":"A library to interactively create and read configuration files.","archived":false,"fork":false,"pushed_at":"2019-08-01T20:40:22.000Z","size":197,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-08T06:32:27.508Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://africa.sobes.io","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/artdecocode.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-12-30T22:46:19.000Z","updated_at":"2019-08-01T20:40:24.000Z","dependencies_parsed_at":null,"dependency_job_id":"d2005284-8a49-4d5b-9f7c-6c695f5598c1","html_url":"https://github.com/artdecocode/africa","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artdecocode%2Fafrica","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artdecocode%2Fafrica/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artdecocode%2Fafrica/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artdecocode%2Fafrica/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/artdecocode","download_url":"https://codeload.github.com/artdecocode/africa/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240699340,"owners_count":19843511,"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-10T19:33:30.130Z","updated_at":"2025-02-25T15:47:20.361Z","avatar_url":"https://github.com/artdecocode.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# africa\n\n[![npm version](https://badge.fury.io/js/africa.svg)](https://npmjs.org/package/africa)\n\n\u003ca href=\"https://npmjs.org/packages/africa\"\u003e\n    \u003cimg src=\"./africa.jpg\" alt=\"Africa\" /\u003e\n\u003c/a\u003e\n\n`africa` is a _Node.JS_ package which simplifies reading from and writing to persistent configuration files in user's home directory. If a configuration exists, it will be read, and if not, the user will be presented with questions, after which the answers will be stored in the `.rc` file.\n\n```sh\nyarn add africa\n```\n\n## Table Of Contents\n\n- [Table Of Contents](#table-of-contents)\n- [API](#api)\n- [`async africa(packageName: string, questions: object, config?: AfricaConfig): Object`](#async-africapackagename-stringquestions-objectconfig-force-booleanhomedir-stringquestionstimeout-numberlocal-booleanrcnamefunction-function-object)\n  * [`_africa.Config`](#type-_africaconfig)\n\n\u003cp align=\"center\"\u003e\u003ca href=\"#table-of-contents\"\u003e\n  \u003cimg src=\"/.documentary/section-breaks/0.svg?sanitize=true\"\u003e\n\u003c/a\u003e\u003c/p\u003e\n\n## API\n\nThe package is available by importing its default function:\n\n```js\nimport africa from 'africa'\n```\n\n\u003cp align=\"center\"\u003e\u003ca href=\"#table-of-contents\"\u003e\n  \u003cimg src=\"/.documentary/section-breaks/1.svg?sanitize=true\"\u003e\n\u003c/a\u003e\u003c/p\u003e\n\n## `async africa(`\u003cbr/\u003e\u0026nbsp;\u0026nbsp;`packageName: string,`\u003cbr/\u003e\u0026nbsp;\u0026nbsp;`questions: object,`\u003cbr/\u003e\u0026nbsp;\u0026nbsp;`config?: {`\u003cbr/\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;`force?: boolean,`\u003cbr/\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;`homedir?: string,`\u003cbr/\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;`questionsTimeout?: number,`\u003cbr/\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;`local?: boolean,`\u003cbr/\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;`rcNameFunction?: function,`\u003cbr/\u003e\u0026nbsp;\u0026nbsp;`},`\u003cbr/\u003e`): Object`\n\nCall `africa` asynchronously to read or create a new configuration. Questions should adhere to the [`reloquent`][2]'s interface.\n\n|   Argument    |                                             Description                                             |\n| ------------- | --------------------------------------------------------------------------------------------------- |\n| `packageName` | Name of the package which uses `africa`. It will be used when generating a name for the `.rc` file. |\n| `questions` | An object with questions answers to which will be saved into the `.rc` file. |\n| `config` | Additional configuration parameters, see [`AfricaConfig` Type](#africaconfig-type). |\n\n```javascript\nimport africa from 'africa'\nimport { userInfo } from 'os'\n\n(async () =\u003e {\n  try {\n    const config = await africa('africa', {\n      name: {\n        defaultValue: userInfo().username,\n        text: 'user',\n      },\n    }, { force: true })\n    console.log(config)\n  } catch ({ stack }) {\n    console.log(stack)\n  }\n})()\n```\n\n```sh\nuser: [zavr]\n{ name: 'zavr' }\n```\n\n\u003cstrong\u003e\u003ca name=\"type-_africaconfig\"\u003e`_africa.Config`\u003c/a\u003e\u003c/strong\u003e: The configuration object to configure additional functionality.\n\u003ctable\u003e\n \u003cthead\u003e\u003ctr\u003e\n  \u003cth\u003eName\u003c/th\u003e\n  \u003cth\u003eType \u0026amp; Description\u003c/th\u003e\n  \u003cth\u003eDefault\u003c/th\u003e\n \u003c/tr\u003e\u003c/thead\u003e\n \u003ctr\u003e\n  \u003ctd rowSpan=\"3\" align=\"center\"\u003eforce\u003c/td\u003e\n  \u003ctd\u003e\u003cem\u003eboolean\u003c/em\u003e\u003c/td\u003e\n  \u003ctd rowSpan=\"3\"\u003e\u003ccode\u003efalse\u003c/code\u003e\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\u003c/tr\u003e\n \u003ctr\u003e\n  \u003ctd\u003eAsk questions and update the configuration file even if it already exists.\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n  \u003ctd rowSpan=\"3\" align=\"center\"\u003ehomedir\u003c/td\u003e\n  \u003ctd\u003e\u003cem\u003estring\u003c/em\u003e\u003c/td\u003e\n  \u003ctd rowSpan=\"3\"\u003e\u003ccode\u003eos.homedir()\u003c/code\u003e\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\u003c/tr\u003e\n \u003ctr\u003e\n  \u003ctd\u003eIn which directory to save and search for configuration file.\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n  \u003ctd rowSpan=\"3\" align=\"center\"\u003equestionsTimeout\u003c/td\u003e\n  \u003ctd\u003e\u003cem\u003enumber\u003c/em\u003e\u003c/td\u003e\n  \u003ctd rowSpan=\"3\"\u003e-\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\u003c/tr\u003e\n \u003ctr\u003e\n  \u003ctd\u003eHow log to wait in ms before timing out. Will wait forever by default.\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n  \u003ctd rowSpan=\"3\" align=\"center\"\u003elocal\u003c/td\u003e\n  \u003ctd\u003e\u003cem\u003eboolean\u003c/em\u003e\u003c/td\u003e\n  \u003ctd rowSpan=\"3\"\u003e\u003ccode\u003efalse\u003c/code\u003e\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\u003c/tr\u003e\n \u003ctr\u003e\n  \u003ctd\u003eWhether to read a local config file in the current working directory rather than in the \u003ccode\u003eHOMEDIR\u003c/code\u003e. When initialising, the default values will be taken from the home config if it exists so that it is easy to extend \u003ccode\u003e.rc\u003c/code\u003e files.\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n  \u003ctd rowSpan=\"3\" align=\"center\"\u003ercNameFunction\u003c/td\u003e\n  \u003ctd\u003e\u003cem\u003efunction(string): string\u003c/em\u003e\u003c/td\u003e\n  \u003ctd rowSpan=\"3\"\u003e-\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\u003c/tr\u003e\n \u003ctr\u003e\n  \u003ctd\u003eFunction used to generate the \u003ccode\u003e.rc\u003c/code\u003e name. Default: packageName =\u0026gt; \u003ccode\u003e.${packageName}rc\u003c/code\u003e.\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/table\u003e\n\n\n\n\u003cp align=\"center\"\u003e\u003ca href=\"#table-of-contents\"\u003e\n  \u003cimg src=\"/.documentary/section-breaks/-1.svg?sanitize=true\"\u003e\n\u003c/a\u003e\u003c/p\u003e\n\nPhoto [Diana Robinson][3], 2017\n\n\u003ctable\u003e\n  \u003ctr\u003e\n    \u003cth\u003e\n      \u003ca href=\"https://artd.eco\"\u003e\n        \u003cimg width=\"100\" src=\"https://raw.githubusercontent.com/wrote/wrote/master/images/artdeco.png\"\n          alt=\"Art Deco\"\u003e\n      \u003c/a\u003e\n    \u003c/th\u003e\n    \u003cth\u003e© \u003ca href=\"https://artd.eco\"\u003eArt Deco\u003c/a\u003e   2019\u003c/th\u003e\n    \u003cth\u003e\n      \u003ca href=\"https://www.technation.sucks\" title=\"Tech Nation Visa\"\u003e\n        \u003cimg width=\"100\" src=\"https://raw.githubusercontent.com/idiocc/cookies/master/wiki/arch4.jpg\"\n          alt=\"Tech Nation Visa\"\u003e\n      \u003c/a\u003e\n    \u003c/th\u003e\n    \u003cth\u003e\u003ca href=\"https://www.technation.sucks\"\u003eTech Nation Visa Sucks\u003c/a\u003e\u003c/th\u003e\n  \u003c/tr\u003e\n\u003c/table\u003e\n\n[2]: https://www.npmjs.com/package/reloquent\n[3]: https://www.flickr.com/photos/dianasch/31316774424/in/photolist-PHmDYC-moFj48-Q4Aya5-63Gpiw-mLTkJi-VNKhAn-Rz3Mrh-62BZoA-5q9HuM-6cnt7G-5Jv17M-zn5DFn-5QA73Q-6xjraT-aqGVsL-odrGp-azaw9g-wJQZ9M-4nGawg-4rHcYe-atRxbW-5JYiwy-eki9WF-ahdLm5-aTm2jZ-bp9exn-9xL37X-NBPkZ9-38Exqu-69Wv9G-7yxhvg-8GsnfW-agEC2n-svkzJf-k1ihc6-pPd9Aj-5SuyNP-aAg4Gf-DAMWZ1-DHceLL-oCxZ7U-pQe8E4-y875RB-c21GHN-dNZXJ3-NJ5yVx-e663y6-e6bFDq-jYo6Sm-cem5Xu","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fartdecocode%2Fafrica","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fartdecocode%2Fafrica","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fartdecocode%2Fafrica/lists"}