Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>jr-toolsNew to Visual Studio Code? Get it now.
jr-tools

jr-tools

jr-tools

|
89 installs
| (0) | Free
tools
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

jr-tools README

jr 常量生成

/**
 * 只可在文件名称为enum.ts的文件中使用
 * 1.常量必选以Enum结尾
 * 2.必选添加如例子里的注释才会生成
 * 3.可只对需要生成的内容做注释
 * 4.使用!标识符,对应不生成内容
 */
export enum AdminTypeEnum {
  /**! 超级管理员 */
  superAdmin = 1,
  /** 普通管理员 */
  generalAdmin = 0,
}
//一个常量对应多个值

/**
 * 1.必定会有一个Map类型的常量
 * @name type1,type2
 */
export enum AdminTypeEnum {
  /**! 超级管理员,超级管理员Type1,超级管理员Type2 */
  superAdmin = 1,
  /** 普通管理员,普通管理员1 */
  generalAdmin = 0,
  /** 普通管理员 */
  generalAdmin2 = 0,
}

编译

/**
 * 1.工作区中新增jr-tools.config.js文件
 */
module.exports = {
  /**
   * 编译的配置对象
   * @key : "isBuild" | "isPack" | "isGit" | "isZipurl" | "isDeleteZip"
   * @value
   * ```
      {
        checked: boolean;
      }
   * ```
   */
  flatBuildOptions(data, log) {
    log(data);
    return {
      isBuild: {
        checked: false, // 默认勾选状态
      },
      test: {
        label: '听说我是例子', // 显示名称
        checked: true, // 默认勾选状态
        // 简单的commands语句组
        commands: [`echo 我是例子!`],
      },
    };
  },
  /**
   * ````
   * key:
   * 1.command_before 执行命令之前
   * ````
   * ````
   * data:
    {
      commands: {[key:string]: string[]}
      commandSort: string[];
      abilitys: {[key:string]: boolean}
      buildUris: {
          key: string;
          title: string;
          entry: string;
      }[];
      keys: any[];
      titles: any[];
    }
   * ````
   */
  flatBuildHook(key, data, log) {
    log([key, data]);
    if (data.abilitys.test) {
      data.commands.test.push('echo 听说我,我也是测试!');
    }
    return data;
  },
};

模块创建

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft