Grunt ts任务配置 - 未找到任何文件

时间:2016-10-28 14:45:57

标签: gruntjs grunt-ts

我正在尝试将TS编译包含到我的项目中。这是我的tsconfig.json:

{
  "compilerOptions": {
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "module": "system",
    "moduleResolution": "node",
    "noImplicitAny": false,
    "outDir": "build/develop/assets/scripts",
    "removeComments": false,
    "rootDir": "assets/management/",
    "sourceMap": false,
    "target": "ES5"
  },
  "exclude": [
    "node_modules"
  ]
}

这是我的tasks / config / ts.js文件:

/**
 * Compile TS files to JS.
 *
 * @see https://github.com/TypeStrong/grunt-ts
 */
module.exports = function (grunt) {
    grunt.config.set('ts', {
        angular_app_dev: {
            default: {
                // src: [
                //     "assets/management/**/*.ts",
                //     "!node_modules/**/*.ts" // Avoid compiling TypeScript files in node_modules
                // ],
                // outDir: "assets/vili2",
                tsconfig: {
                    tsconfig: true,
                    ignoreFiles: false,
                    ignoreSettings: false,
                    overwriteFilesGlob: false,
                    updateFiles: true,
                    passThrough: false
                }
                // options: {
                //     module: 'commonjs',
                //     // To compile TypeScript using external modules like NodeJS
                //     fast: 'never'
                //     // You'll need to recompile all the files each time for NodeJS
                // }
            }

        }
    });

    grunt.loadNpmTasks('grunt-ts');
};

我正在努力使它能够编译TS文件(后来我想添加一个手表,以便每次我更改它们时都会编译它们,但一次只能做一件事)

当我从命令行运行“tsc”时,它运行正常,但是如果我运行

grunt ts:angular_app_dev -verbose

它产生了这个:

$ grunt ts:angular_app_dev -verbose
Initializing
Command-line options: --verbose

Reading "Gruntfile.js" Gruntfile...OK

Registering Gruntfile tasks.

Registering "grunt-contrib-clean" local Npm module tasks.
Reading D:\Work\...\...\node_modules\grunt-contrib-clean\package.json...OK
Parsing D:\Work\...\...\node_modules\grunt-contrib-clean\package.json...OK
Loading "clean.js" tasks...OK
+ clean

Registering "grunt-contrib-coffee" local Npm module tasks.
Reading D:\Work\...\...\node_modules\grunt-contrib-coffee\package.json...OK
Parsing D:\Work\...\...\node_modules\grunt-contrib-coffee\package.json...OK
Loading "coffee.js" tasks...OK
+ coffee

Registering "grunt-contrib-concat" local Npm module tasks.
Reading D:\Work\...\...\node_modules\grunt-contrib-concat\package.json...OK
Parsing D:\Work\...\...\node_modules\grunt-contrib-concat\package.json...OK
Loading "concat.js" tasks...OK
+ concat

Registering "grunt-contrib-copy" local Npm module tasks.
Reading D:\Work\...\...\node_modules\grunt-contrib-copy\package.json...OK
Parsing D:\Work\...\...\node_modules\grunt-contrib-copy\package.json...OK
Loading "copy.js" tasks...OK
+ copy

Registering "grunt-contrib-cssmin" local Npm module tasks.
Reading D:\Work\...\...\node_modules\grunt-contrib-cssmin\package.json...OK
Parsing D:\Work\...\...\node_modules\grunt-contrib-cssmin\package.json...OK
Loading "cssmin.js" tasks...OK
+ cssmin

Registering "grunt-contrib-jst" local Npm module tasks.
Reading D:\Work\...\...\node_modules\grunt-contrib-jst\package.json...OK
Parsing D:\Work\...\...\node_modules\grunt-contrib-jst\package.json...OK
Loading "jst.js" tasks...OK
+ jst

Registering "grunt-contrib-less" local Npm module tasks.
Reading D:\Work\...\...\node_modules\grunt-contrib-less\package.json...OK
Parsing D:\Work\...\...\node_modules\grunt-contrib-less\package.json...OK
Loading "less.js" tasks...OK
+ less

Registering "grunt-sails-linker" local Npm module tasks.
Reading D:\Work\...\...\node_modules\grunt-sails-linker\package.json...OK
Parsing D:\Work\...\...\node_modules\grunt-sails-linker\package.json...OK
Loading "scriptlinker.js" tasks...OK
+ sails-linker

Registering "grunt-sync" local Npm module tasks.
Reading D:\Work\...\...\node_modules\grunt-sync\package.json...OK
Parsing D:\Work\...\...\node_modules\grunt-sync\package.json...OK
Loading "sync.js" tasks...OK
+ sync

Registering "grunt-ts" local Npm module tasks.
Reading D:\Work\...\...\node_modules\grunt-ts\package.json...OK
Parsing D:\Work\...\...\node_modules\grunt-ts\package.json...OK
Loading "ts.js" tasks...OK
+ ts

Registering "grunt-contrib-uglify" local Npm module tasks.
Reading D:\Work\...\...\node_modules\grunt-contrib-uglify\package.json...OK
Parsing D:\Work\...\...\node_modules\grunt-contrib-uglify\package.json...OK
Loading "uglify.js" tasks...OK
+ uglify

Registering "grunt-contrib-watch" local Npm module tasks.
Reading D:\Work\...\...\node_modules\grunt-contrib-watch\package.json...OK
Parsing D:\Work\...\...\node_modules\grunt-contrib-watch\package.json...OK
Loading "watch.js" tasks...OK
+ watch
Loading "Gruntfile.js" tasks...OK
+ build, buildProd, compileAssets, db:migrate, default, linkAssets, linkAssetsBuild, linkAssetsBuildProd, prod, prodTest, syncAssets

Running tasks: ts:angular_app_dev

Running "ts:angular_app_dev" (ts) task
Verifying property ts.angular_app_dev exists in config...OK
File: [no files]

Done, without errors.

我缺少什么?

1 个答案:

答案 0 :(得分:1)

你没有遗漏任何东西。正如它在底部所说的那样是“完成,没有错误”。删除你的-verbose标志,以获取有关grunt编译的更少信息:)

grunt ts:angular_app_dev 应该是好的