GitHub .gitignore 推荐

GitHub .gitignore recommendation

.gitignore 文件中应排除哪个 folders/files?

我正在创建一个项目,包括:

  1. /node_modules => 包含依赖项
  2. /dist => 包含已编译的 .js 和 .d.ts 文件
  3. /src => 包含 .ts 文件(主项目)
  4. /test => 包含仅用于测试的 .js 和 .ts

我通常会排除 /node_modules/test 但不确定是否会排除 /src
有什么想法吗?

您应该忽略生成的任何文件。如果我下载你的项目,我可以使用package.json生成node_modules,所以忽略node_modules。

但是如果我下载了你的项目但它没有 src,我还能生成 src 吗?很可能不是,因为这可能是您编写的代码,所以请放上来。