load-proto
    TypeScript icon, indicating that this package has built-in type declarations

    2.2.4 • Public • Published

    load-proto

    Load proto file from gitlab, and convert to protobufjs' Root

    Example

    import { loadProto } from "load-proto";
    
    const token = process.argv[2];
    
    loadProto({
      gitUrls: [
        {
          url: 'git@git.myscrm.cn:ykcommon/ykproto.git',
          branch: 'master',
        },
        'git@git.myscrm.cn:2c/panther-proto.git',
        'git@git.myscrm.cn:2c/thanos-third-proto.git',
      ],
      accessToken: token,
      branch: 'dev',
      resolvePath: (origin: string, target: string, rootDir: string) => {
        if (/^git\.myscrm\.cn\/golang\/common\/proto\/(google|common)\//.test(target)) {
          return `${rootDir}/git.myscrm.cn/ykcommon/ykproto/${target.replace(/^git\.myscrm\.cn\/golang\/common\/proto\//, '')}`;
        } else if (/^proto\/(common|google)\//.test(target)) {
          return `${rootDir}/git.myscrm.cn/ykcommon/ykproto/${target.replace(/^proto\//, '')}`;
        } else if (/^proto\//.test(target)) {
          return target.replace(/^proto\/([^\/]+)(.+)/, (_target, $1, $2) => {
            return `${rootDir}/git.myscrm.cn/2c/${$1.replace(/_/g, '-')}${$2}`;
          });
        } else if (/^(common|google\/api)\//.test(target)) {
          return `${rootDir}/git.myscrm.cn/ykcommon/ykproto/${target}`;
        }
        return null;
      },
    })
      .then((root) => {
        console.info(root);
      })

    Keywords

    none

    Install

    npm i load-proto

    DownloadsWeekly Downloads

    24

    Version

    2.2.4

    License

    MIT

    Unpacked Size

    37.4 kB

    Total Files

    13

    Last publish

    Collaborators

    • avatar
    • avatar