{"id":18929486,"url":"https://github.com/thecodingmachine/rnb-toolbox","last_synced_at":"2025-04-15T15:31:03.520Z","repository":{"id":57684388,"uuid":"419779280","full_name":"thecodingmachine/rnb-toolbox","owner":"thecodingmachine","description":"Toolbox to create amazing plugins for our react-native boilerplate. 🧰","archived":false,"fork":false,"pushed_at":"2023-07-03T06:39:17.000Z","size":16201,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":9,"default_branch":"main","last_synced_at":"2025-04-11T18:59:50.512Z","etag":null,"topics":["boilerplate","react-native"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thecodingmachine.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2021-10-21T15:30:48.000Z","updated_at":"2024-03-28T23:28:32.000Z","dependencies_parsed_at":"2024-11-08T11:48:45.429Z","dependency_job_id":null,"html_url":"https://github.com/thecodingmachine/rnb-toolbox","commit_stats":{"total_commits":16,"total_committers":3,"mean_commits":5.333333333333333,"dds":0.3125,"last_synced_commit":"9f29725ea89411baa3ab49b61a429236bc349096"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thecodingmachine%2Frnb-toolbox","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thecodingmachine%2Frnb-toolbox/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thecodingmachine%2Frnb-toolbox/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thecodingmachine%2Frnb-toolbox/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thecodingmachine","download_url":"https://codeload.github.com/thecodingmachine/rnb-toolbox/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249097861,"owners_count":21212363,"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":["boilerplate","react-native"],"created_at":"2024-11-08T11:32:58.759Z","updated_at":"2025-04-15T15:31:03.203Z","avatar_url":"https://github.com/thecodingmachine.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TheCodingMachine React Native boilerplate - Toolbox\n![React Native Boilerplate Toolbox License](https://img.shields.io/github/license/thecodingmachine/rnb-toolbox)\n![React Native Boilerplate Toolbox Version](https://flat.badgen.net/npm/v/@thecodingmachine/rnb-toolbox)\n![React Native Boilerplate Toolbox Release Date](https://img.shields.io/github/release-date/thecodingmachine/rnb-toolbox)\n![React Native Boilerplate Toolbox Download](https://flat.badgen.net/npm/dt/@thecodingmachine/rnb-toolbox)\n![React Native Boilerplate Toolbox Top Language](https://img.shields.io/github/languages/top/thecodingmachine/rnb-toolbox)\n[![CI](https://github.com/thecodingmachine/rnb-toolbox/actions/workflows/CI.yml/badge.svg)](https://github.com/thecodingmachine/rnb-toolbox/actions/workflows/CI.yml)\n\n🚧 This is a work in progress documentation. 🚧\n\nThis project is part of our [React Native Boilerplate](https://github.com/thecodingmachine/react-native-boilerplate/) that can be used to kickstart a mobile application.\n\nThis boilerplate provides **an optimized architecture for building solid cross-platform mobile applications** through separation of concerns between the UI and business logic. It is fully documented so that each piece of code that lands in your application can be understood and re-used.\n\nThis toolbox allows you to build plugin modules that can be used to extend the functionality of the boilerplate.\n\n## Quick start\n\nThe best way to get started is to use the template repository. It will provide you with a working project that you can start from scratch.\n\n## Documentation\n\n### Initialization\n\nTo initialize a plugin, you have to use the RNBPlugin constructor like this:\n\n```javascript\nconst { RNBPlugin } = require('@thecodingmachine/rnb-toolbox');\n\nconst plugin = new RNBPlugin({\n  organisation: '\u003cpackage-organisation\u003e',\n  packageName: '\u003cpackage-name\u003e',\n  // version: 'latest | \u003cpackage-version\u003e', // default: latest\n  promptsOptions: {\n    type: 'confirm',\n    color: 'blue',\n    text: 'Do you want to use my custom plugin ?',\n    initial: false,\n  },\n});\n```\n#### PromptsOptions\n| Key name       | default   | type                        | description                                                                                                   | required |\n|----------------|-----------|-----------------------------|---------------------------------------------------------------------------------------------------------------|----------|\n| organisation   |           | string                      | the organisation name on the npm registry                                                                     | true     |\n| packageName    |           | string                      | the package name on the npm registry                                                                          | true     |\n| version        | 'latest'  | string                      | the version of the plugin (use it when you make rc/beta/alpha version)                                        | false    |\n| promptsOptions |           | PromptsOptionsWrapperParams | the prompt that will be printed for the final user ([Prompts doc](https://github.com/terkelg/prompts#readme)) | true     |\n\n#### PromptsOptionsWrapperParams:\n\n| Key name | default | type   | description                                               |\n|----------|---------|--------|-----------------------------------------------------------|\n| type     |         | string | [Prompts type](https://github.com/terkelg/prompts#readme) |\n| color    | 'white' | string | [Kleur colors](https://github.com/lukeed/kleur#api)       |\n| text     |         | string | the prompt text to display                                |\n| initial  |         | any    | the prompt default value                                  |\n\n### Life cycle\nA RNBPlugin as a defined lifecycle with two hooks:\n- onInstall\n- afterInstall\n\n#### onInstall\nThis hook is called right after the plugin is installed. It is called with the following parameters:\n\n#### afterInstall\nThis hook is called right after the plugin onInstall hook is finished and the plugin is removed from the boilerplate. It is called with the following parameters:\n\n### Helper functions\nGenerally, you will want to do some operation into life cycle hooks. For example, you will want to loop on plugin files to paste them into the boilerplate code base.\nOr you will want loop on the boilerplate files and rename them. To do that you can use the following helper functions:\n- loopOnPluginFiles\n- loopOnSourceFiles\n\n#### loopOnPluginFiles \u0026 loopOnSourceFiles\n| Helper function  | default                   | type     | description                                 | required |\n|------------------|---------------------------|----------|---------------------------------------------|----------|\n| accumulatedPath  | '/'                       | string   | the current path during the loop            | false    |\n| onDirectoryFound | () =\u003e Promise.resolve({}) | function | function to start when a directory is found | false    |\n| onFileFound      | () =\u003e Promise.resolve({}) | function | function to start when a file is found      | false    |\n| ...args          |                           | any      | custom arguments to give in each loop       | false    |\n\n##### Example\n\n```javascript\nplugin.lifecycle.onInstall = async () =\u003e {\n  await plugin.helpers.loopOnSourceFiles({\n    directoryCounter: false, // will be exposed in onFileFound() and onDirectoryFound()\n    onDirectoryFound: async ({\n      item, accumulatedPath, directoryCounter,\n    }) =\u003e {\n      // do something with the directory\n      return Promise.resolve({ directoryCounter: directoryCounter + 1 });\n    },\n  });\n};\n```\n\n## License\n\nThis project is released under the [MIT License](LICENSE).\n\n## About us\n\n[TheCodingMachine](https://www.thecodingmachine.com/) is a web and mobile agency based in Paris and Lyon, France. We are [constantly looking for new developers and team leaders](https://www.thecodingmachine.com/nous-rejoindre/) and we love [working with freelancers](https://coders.thecodingmachine.com/). You'll find [an overview of all our open source projects on our website](https://thecodingmachine.io/open-source) and on [Github](https://github.com/thecodingmachine).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthecodingmachine%2Frnb-toolbox","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthecodingmachine%2Frnb-toolbox","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthecodingmachine%2Frnb-toolbox/lists"}