帮酷LOGO
0 0 评论
文章标签:命令行  React Native  react  Native  Comma  tool  NAT  命令行工具  
:notebook: Command line tool to create a React Native library with a single command

  • 源代码名称:react-native-create-library
  • 源代码网址:http://www.github.com/frostney/react-native-create-library
  • react-native-create-library源代码文档
  • react-native-create-library源代码下载
  • Git URL:
    git://www.github.com/frostney/react-native-create-library.git
  • Git Clone代码到本地:
    git clone http://www.github.com/frostney/react-native-create-library
  • Subversion代码到本地:
    $ svn co --depth empty http://www.github.com/frostney/react-native-create-library
    Checked out revision 1.
    $ cd repo
    $ svn up trunk
    
  • react-native-create-library

    使用单个命令创建响应本机库的工具。

    为什么你需要这个?

    如果要创建本机模块作为本机模块,需要支持每个平台的本机代码,然后一些JavaScript代码。 你自己设置这项工作很耗时。

    这就是这个工具出现的地方。 它使用所有当前最佳实践创建样板。 为什么不使用 react-native new-library不幸的是,命令不会创建最新的库,要求已经初始化了本地项目。

    注意:这只创建了没有视图组件的本地模块。

    react-native-create-bridge

    安装

    要求:node 6.0 +

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

    命令行命令行用法

    导航到空目录以执行命令。

    
    $ react-native-create-library MyFancyLibrary
    
    
    
    

    这将创建文件夹 MyFancyLibrary,库将在其中创建。

    现在通过在新创建的库中运行这个命令来安装依赖项。

     
    $ 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: `yourname@email.com`)
    
    
     --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`)
    
    
    
    

    编程用法

    constcreateLibrary=require('react-native-create-library');createLibrary({
     name:'MyFancyLibrary'}).then(() => {
     console.log('Oh yay! My library has been created!');
    })
    命令行选项
    {
     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: `yourname@email.com`) */ 
     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`) */}

    确认

    react-native-share ( https://github.com/EstebanFuentealba/react-native-share ) 已经成为这个项目的灵感来源。

    许可证

    MIT



    文章标签:COM  tool  COMM  react  Comma  NAT  命令行  Native  

    Copyright © 2011 HelpLib All rights reserved.    知识分享协议 京ICP备05059198号-3  |  如果智培  |  酷兔英语