Code Monkey home page Code Monkey logo

xdk-cli's Introduction

xdk-cli

微信小程序cli脚手架,从目前小打卡的脚手架抽离出来的部分功能

目前只有快速创建模版(页面/组件)功能,后续会逐步增加自动化发布,版本号控制,环境变量切换,自动生成文档等一些有趣实用的功能

觉得有用的小伙伴希望可以点个star~ 😄😄😄

安装

使用npm进行全局安装

    npm install -g xdk-cli

当安装成功后可以使用查看当前版本号

    xdk-cli -v

使用 -h 查看当前提供的功能介绍

    xdk-cli -h

创建配置文件

需要在项目目录下创建xdk.config.js

module.exports = {

    // 小程序路径(可选,默认当前目录)
    app: './',

    // 模版文件夹目录(可选,默认使用cli默认模版,使用默认模版情况下false即可)
    template: './template'
};

创建模版文件

提供自动识别分包,页面,添加到app.json, ${page}.json的功能

    # 输入创建命令
    xdk-cli create

    # 选择创建模式
    ? Select the mode you want to create (Use arrow keys)
    ❯ page
      component

创建page

    # 输入页面名称
    ? Set page name (e.g: index):

    # 选择所属分包(none为主包)
    ? Set page ownership module (Use arrow keys or type to search)

    # 创建成功
    >> createPage success

创建component

    # 输入组件名称
    ? Set component name (e.g: index):

    # 选择组件所属范围
    ? Select component scope (Use arrow keys)
    ❯ global
      module
      page

    # 选择所属页面/分包/全局范围
    Set component ownership pages
    ❯ index
    logs
    user

    # 创建成功
    >> createComponent success

自定义模版文件

每个项目可能需要的模版都不太一致,xdk-cli提供一个文件夹插槽,方便自定义需要使用的模版

    // 在xcli.config.js 中配置模版目录
    module.exports = {
        // 模版文件夹
        template: './template'
    };

小程序目录结构如下,component同理

1563431286470.jpg

联系我

如果你有好的意见或建议,欢迎扫面下面二维码交流 👇

image.png

xdk-cli's People

Contributors

jinxuanzheng01 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.