Git Product home page Git Product logo

hx-configuration-helper's Introduction

hx-configuration-helper

一个能让你的hx插件配置写起来更舒服的东东~

hx插件获取配置太繁琐?配置排序和命名两难择?

没问题!本组件将统统解决这些问题!

使用

本组件分两部分构成: clicjs函数

组件应用实例:hx-copy-to

cli部分

cli用来根据插件项目根目录下的package.json生成配置key的映射文件

主要是为了方便代码自动推断和提示

建议添加在package.json里,方便运行

{
    "scripts": {
        "cfg:build": "hx-cfg-helper"
    }
}

运行后,插件根目录下会生成config.helper.js文件

注意事项: cli部分识别形如hx-my-plugin.a_configName的key,在使用时请确保下划线后的部分不要重复 key的处理识别的是最后一个下划线

cjs函数部分

const {Helper} = require("hx-configuration-helper")

// 初始化,传入根路径(如果当前js不在根路径,则使用path处理后得到的路径)
const h = new Helper(__dirname)
// cli生成的内容
const keyMap = require("./config.helper.js")
// 获取配置项(这里配合生成的`config.helper.js`能获得友好的代码提示)
h.getItem(keyMap.keepUserSelection)
// 更新配置项
h.updateItem(keyMap.keepUserSelection, true)

相关小技巧

参见 小技巧

hx-configuration-helper's People

Contributors

noah227 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.