git - 在源代码管理文件更改后运行 TypeScript 编译

标签 git typescript visual-studio-2015

我已经为 Visual Studio 2015 工具安装了 TypeScript,编译速度非常快(与我的旧 Gulp 进程相比)。我在 tsconfig 文件中保存设置时进行编译,一切正常!

但是,如果我撤消源代码管理中的更改,它似乎不会像 Ctrl+S 那样触发编译。有什么方法可以让 VS 在源代码管理更改的文件上启动文件保存?

最佳答案

请注意,在源代码管理中有 3 种不同的方式来“撤消更改”:参见“Undo changes

  • Discard uncommitted changes to a file, bringing the file back to the version in the last commit.
  • Reset your local branch to a previous commit.
  • Revert changes pushed to a remote branch and shared with others.

no git hook for post-reset action .
(尽管Visual Studio 2017 did introduce client-side Git hook support)

这给你留下了某种 service hook ,但它们在服务器端(对于上游 Visual Studio Online 项目)

如果您的重置/撤消操作影响事件文档,可能会起作用。
在这种情况下,您可以使用 DocumentEvents 来触发 typescript 编译。
这不是一个完整的解决方案,而是一个起点。

关于git - 在源代码管理文件更改后运行 TypeScript 编译,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42681897/

相关文章:

git - 将 `develop` 设置为 GitHub 上的默认分支会产生什么后果?

git - 使用 git 从远程存储库获取干净的副本

java - 构建spring框架源码遇到错误

css - 在 Angular 中删除或添加类

typescript - 如何修复错误 TS2339 - 'HTMLElement' 上不存在属性

c++ - 即使启用了 Visual Studio 14 2015 Win64 工具链,也使用 32 位工具链进行编译

git - 使用git,如何避免rebase和push?

angular - 如何设置 Angular 2 组件属性的默认值?

带有 Visual Studio 2015 的 OpenCV(msvcr120d.dll 错误)

angular - 我可以开始使用没有节点的angular 2吗?