1.0.17 • Published 1 year ago

@dypnb/dev-tools v1.0.17

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

开发时的提效工具

changelog

  • 1.0.17 swagger 注释增加类型
  • 1.0.16 修复 swagger 生成文件名错误问题

说明

包含 4 个工具:

  • gen-page 生成 vue 模板
  • gen-swagger 根据 swagger 文档生成 vue 代码
  • publish-server 打包后将 dist 打包资源部署到服务器
  • wx-server-notice 企业微信信息通知

使用方法

下载

npm install -S @dypnb/dev-tools

配置文件, 根目录下新建 dyp.config.js

// template.js
const cedata = {
  dome: (parame) => {
    console.log('object :>>我是方法 ', parame);
  },
  vueTemplate: compoenntName => {
      return `<template>
  <div class="${compoenntName}">
      ${compoenntName}组件
  </div>
</template>
<script>
export default {
  name: '${compoenntName}'
};
</script>
<style lang="stylus" scoped>
.${compoenntName} {
};
</style>`
  },
  entryTemplate: compoenntName => {
      return `import ${compoenntName} from './main.vue'
export default [{
  path: "/${compoenntName}",
  name: "${compoenntName}",
  component: ${compoenntName}
}]`
  },

}

export default  {
  // 静态资源上传服务器配置
  uploadServeConfig: {
    // 项目基本信息
    projectInfo: {
      name: "测试项目名",
    },
    // 本地文件打包后文件夹
    locaPath: '/dist/',
    protocol: "http",
    // 服务端静态资源存放地址
    staticPath: {
      dev: 'dev-tools',
      pro: 'dev-tools',
    },
    serverOption: {
      host: ["x.x.x.x", "x.x.x.x"],
      port: "22", // 端口一般默认22
      username: "root", // 用户名
      password: "xxxxxxx", // 密码
      pathNmae: '/usr/local/dome/', // 上传到服务器的位置
    },
  },
  // 微信消息通知配置
  wxServerConfig: { 
    WX_COMPANY_ID: "xxxxxxx", // 企业ID
    WX_APP_ID: "xxxxxx", // 应用ID
    WX_APP_SECRET: "xxxxxxx", // 应用 Secret
  },
  // swagger 生成 vue 配置
  swaggerConfig: {
    // swagger 文档域名
    path: 'http://xx.xx.xx/dev-iotmodel-api',
    // swagger url 路径
    staticPath: '/v3/api-docs',
    // 输出文件路径
    outputDir: '/src/api'
  },
  // 生成 Vue 页面配置
  genPageConfig: {
    // 是否命令行创建
    isEnter: false,
    // 文件名
    name: 'dome',
    // 默认 view 目录下生成,如果需要指定父目录则写入 fatherFileName
    path: '', 
    // 子文件配置
    child: [
      {
        name: 'index.vue',
        template: cedata.vueTemplate,
        templateConfig: {
          // 文件标题,替换模板
          title: '',
        },
      },
      {
        name: 'constants.js',
        template: cedata.vueTemplate,
        templateConfig: {
          // 文件标题,替换模板
          title: '',
        },
      },
    ]
  }
}

package.json 配置

"scripts": {
  "genApi": "dyp-genSwagger",
  "genPage": "dyp-genPage",
  "publish": "vue-cli-service build && dyp-publish && wx-server-notice"
}

具体使用

  • 生成 vue 模板
npm run genPage
  • 生成 swagger vue 文件
npm run genApi
  • 打包发布并企业微信通知
npm run publish
1.0.17

1 year ago

1.0.16

1 year ago

1.0.15

1 year ago

1.0.14

1 year ago

1.0.13

2 years ago

1.0.12

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago