Skip to content

Commit

Permalink
Merge pull request #365 from alibaba/fix/mx/master
Browse files Browse the repository at this point in the history
fix(pont-engine): 修复模板路径读取错误的问题
  • Loading branch information
ianfuin authored Feb 7, 2023
2 parents f3e13af + a20e1e0 commit 458b842
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions packages/pont-engine/src/utils/templateHelp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,9 @@ export function getTemplate<T = any>(rootPath: string, templateInfo: TemplateInf
writeFileSync(templateFileName, templateInfo.defaultCode);
}

/** 配置文件相对于rootPath的文件夹路径 */
const relativeDir = path.parse(path.relative(rootPath, templateInfo.templatePath)).dir;
const outDir = path.resolve(rootPath, LOCAL_DICT_DIR, templateInfo.templateType, templateInfo.name || 'default');

const outDir = path.resolve(
rootPath,
`${LOCAL_DICT_DIR}/${relativeDir ? `${relativeDir}/` : ''}${templateInfo.templateType}/${
templateInfo.name || 'default'
}`
);

const outFile = `${outDir}${templateInfo.templatePath.split(rootPath)[1]}`;
const outFile = path.resolve(outDir, path.relative(rootPath, templateInfo.templatePath));

const program = ts.createProgram([templateFileName], {
outDir,
Expand Down

0 comments on commit 458b842

Please sign in to comment.