Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: export api.tpl and body.tpl to ygt.config.js #6

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

pasicopan
Copy link

add support key 'apiTpl' and 'bodyTpl' in ygt.config.js

module.exports = {
  // 账号
  account: '[email protected]',
  // 密码
  password: '123456',
  // Yapi网址链接
  originUrl: 'https://xxx.com/',
  ...,
  apiTpl: `{Ignore}{dtsModule}
  import request from '{RequestFilePath}';
  {Wrapper}
  const MockUrl = '{Mock}';`,
  bodyTpl: `/**
  * {Description}
  */
  export function {InterfaceName}(
   {UrlParams}{Query}{Body}configs?: RequestConfig,
   isMock?:boolean ): RequestPromise<{Response}> {
   return {Mapping}({
     ...configs,
     url: isMock && MockUrl ? MockUrl : '{Url}',
     method: "{Method}",
     {DataParam}
     {QueryParam}
   });
 }
 `
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant