• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

frostney/react-native-create-library: Command line tool to create a React Native ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

frostney/react-native-create-library

开源软件地址(OpenSource Url):

https://github.com/frostney/react-native-create-library

开源编程语言(OpenSource Language):

JavaScript 100.0%

开源软件介绍(OpenSource Introduction):

react-native-create-library

Tool to create a React Native library with a single command.

Why might you need this?

If you are looking to create a native module for React Native, you need some native code for each platform you want to support and then some JavaScript code to bind it all together. Setting this up by yourself can be time-consuming.

This is where this tool comes in. It creates a boilerplate with all current best practices in mind. Why not use react-native new-library? Unfortunately that command doesn't create an up-to-date library, requires an already initialized React Native project and only sets up the iOS side of things.

Caution: This only creates native modules without a view component.

Alternatives

react-native-create-bridge

Installation

Requirements: Node 6.0+

$ npm install -g react-native-create-library

Command-line usage

Navigate into an empty directory to execute the command.

$ react-native-create-library MyFancyLibrary

This will create the folder MyFancyLibrary in which the library will be created in.

Now install dependencies by running this command in the newly created library.

$ npm install
Usage: react-native-create-library [options] <name>

Options:

  -h, --help                                output usage information
  -V, --version                             output the version number
  -p, --prefix <prefix>                     The prefix for the library (Default: `RN`)
  --module-prefix <modulePrefix>            The module prefix for the library (Default: `react-native`)
  --package-identifier <packageIdentifier>  (Android only!) The package name for the Android module (Default: `com.reactlibrary`)
  --namespace <namespace>                   (Windows only!) The namespace for the Windows module
   (Default: The name as PascalCase)
  --platforms <platforms>                   Platforms the library will be created for. (comma separated; default: `ios,android,windows`)
  --github-account <github_account>         The github account where the library is hosted (Default: `github_account`)
  --author-name <name>                      The author's name (Default: `Your Name`)
  --author-email <email>                    The author's email (Default: `[email protected]`)
  --license <license>                       The license type of this library (Default: `Apache-2.0`)
  --generate-example <shouldGenerate>       Will generate a RN example project and link the new library to it (Default: `false`)

Programmatic usage

const createLibrary = require('react-native-create-library');

createLibrary({
  name: 'MyFancyLibrary'
}).then(() => {
  console.log('Oh yay! My library has been created!');
})

Options

{
  name: String, /* The name of the library (Default: Library) */
  prefix: String, /* The prefix for the library (Default: RN) */
  modulePrefix: String, /* The module prefix for the library (Default: react-native) */
  platforms: Array, /* Platforms the library will be created for. (Default: ['ios', 'android', 'windows']) */
  packageIdentifier: String, /* (Android only!) The package name for the Android module (Default: com.reactlibrary) */
  namespace: String, /* (Windows only!) The namespace for the Windows module (Default: The package identifier as PascalCase, which is `Com.Reactlibrary`) */
  githubAccount: String, /* The github account where the library is hosted (Default: `github_account`) */
  authorName: String, /* The author's name (Default: `Your Name`) */
  authorEmail: String, /* The author's email (Default: `[email protected]`) */ 
  license: String, /* The license type of this library (Default: `Apache-2.0`) */
  generateExample: Boolean, /* Will generate a RN example project and link the new library to it (Default: `false`) */
}

Acknowledgements

react-native-share (https://github.com/EstebanFuentealba/react-native-share) has been a great source of inspiration for this project.

License

MIT




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Androguide/HoloGraphLibrary: Fork of the HoloGraphLibrary by Daniel Nadeau with ...发布时间:2022-08-15
下一篇:
css-for-js/mini-component-library发布时间:2022-08-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap