将已编译的 Typescript 文件移动到父目录 grunt

Move compiled Typescript files to parent directory grunt

我在尝试将已编译的 Typescript 文件输出到我的父目录时遇到了一些问题。假设我有这样的结构:

app
   routes
   |   src
       | test.ts
       | test2.ts

在这个例子中,我希望我编译的 test.js 和 test2.js 文件仍然出现在 routes 目录中,但不在 src 文件夹中。谁能给我一些指导?这是我的 Grunt 任务的样子:

ts: {
  app: {
    files: {
      src: ["**/\*/src/*.ts", "!node_modules/**/*.ts"],
      dest: "."
    },
    options: {
      module: "commonjs",
      noLib: true,
      target: "es6",          
      sourceMap: false
    }
  }
},

谢谢!

I want my compiled test.js and test2.js files to still appear in the routes directory, but not in an src folder.

推荐 lib 文件夹:

app
   routes
   |   src
       | test.ts
       | test2.ts
   |   lib
       | test.js
       | test2.js

您要找的选项是outDir

更多

有关更多信息,请参阅文档 https://github.com/TypeStrong/grunt-ts