npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

sherlock-cli

v1.0.44

Published

component library for react-native and react-native-web

Downloads

183

Readme

rnsherlock

一、简介

链尚网React-Native 组件库 CLI

查看:组件库文档

二、安装

本地安装

npm install sherlock-cli --save

全局安装 

npm install sherlock-cli -g

三、开发

sherlock组件库的结构:

Libraries/:
    存放所有组件(包括新建的组件)
    每个组件为单独的一个Nodejs 模块包(需要单独进行Npm 发布)

sherlock-mind:

    用于引用Libraries下所有组件的nodejs模块,相当于组件库模块,

    我们在使用时 只要依赖shelock-mind就可以了

    例如:
    
        package.json:

        dependencies:{
            'sherlock-mind':'^0.1.x'
        }

        import {Modal} from 'sherlock-mind'

    在使用sherlock相关命令变更组件时,会自动刷新
    sherlock-mind对Libraries的引用,以及版本号变更

    例如:
        使用npm run new modal
        会自动刷新sherlock-min/index.js 新增对modal的引用
        ....
        import Modal from "sherlock-modal"

        export {Modal,....}

        以及更新sherlock-mind的package.json 

        dependencies:{
            'sherlock-modal':'xx.x.x'
        }

四、新建组件

命令:

 npm run new <模块名称> [平台类型(默认:common 可选:ios,android,web,all(所有支持的平台))] [force(是否强制覆盖已存在的组件)]           


 执行新建组件命令后,可以在Libraries目录找到组件模块目录,支持快速调试指定工程。

 例如:
    
    sherlock new Modal 

    Libraries目录下:
        Modal
        Modal/package.json
        Modal/test/index.js
        Modal/src/index.js
        Modal/src/Modal.js
        多平台:
        Modal/src/Modal.web.js
        Modal/src/Modal.android.js
        Modal/src/Modal.ios.js
    
    package.json
        {
            name:'sherlock-modal' //默认会在组件名称前面添加sherlock前缀
        }

    更新sherlock-mind

        更新sherlock-mind/index.js 引用
        更新sherlock-mind/package.json /dependencies

五、移除组件

命令:
    npm run remove <组件名称>

    删除Libraries/组件
    移除sherlock-mind对组件引用

六、发布组件

命令:
    npm run release <组件名称> [组件版本号(可选)]

    npm run release modal  (根据sherlock-modal/package.json的version发布)

    npm run release modal 1.0.3 (强制使用1.0.3发布版本(不能小于当前组件版本号)

    发布过程:
    
    1.npm publish 发布当前组件 

    2.更新sherlock-mind 对组件的引用(package.json dependencies以及引用)

    3.npm publish sherlock-mind (sherlock-mind版本自动patch +1,如果当前组件为新增组件 则minor+1)

七、调试组件

快速全局调试:

    1.修改根目录下要测试的组件模块 sherlock.js

    2.执行 npm test [可选平台ios android web,默认:web]

     例如:
            npm test
            npm test android
            npm test ios
            npm test web
其他调试:

    命令:
        npm run debug [platform(平台类型 ios android web)] [组件名称(可选)]

    调试准备:

        1.修改组件目录下的/test/index.js

        单组件调试:

        npm run debug [android/ios/web] 组件名称

        例如: npm run debug web modal

        全局调试:

        npm run debug [android/ios/web]

        例如: npm run debug web
        
调试sherlock-mind

    npm run debug android/web/ios ./sherlock-mind/test/index.js

八、使用

安装:

npm install sherlock-mind

使用:

```js

import {Modal,Base} from 'sherlock-mind'

class Page extends React.Component{

    render(){
        <Modal .... />
    }
}

```

九、关于cli

安装cli:

    npm install sherlock-cli -g

为什么有CLI

    可以在快在其他工程下,建立sherlock风格的组件库

使用:

    创建组件

        sherlock new  <模块名称> [平台类型(默认:common 可选:ios,android,web,all(所有支持的平台))] [force(是否强制覆盖已存在的组件)]  

        例如:sherlock new Modal all

        注意:新创建的组件均继承于sherlock-base组件 sherlock-base进行组件性能优化 详情参见sherlock-base组件

    调试组件
        sherlock debug <plaform> <entry> --platform:默认:web
        sherlock debug (android 或 ios 或 web) (其中可以使用,号连接,表示同时启动多个平台的调试)

    删除组件

        sherlock remove <组件名称>

    发布组件

    sherlock release <组件名称> [组件版本号(可选)]

十、开源许可

基于 MIT License 开源,使用代码只需说明来源,或者引用 license.txt 即可。