Louis Michael
Louis Michael

Reputation: 398

grunt-ts multiple outputdir

I have this grunt file

module.exports = function (grunt) {
    grunt.initConfig({
        ts: {
            compileTwoSetsOfFilesToDirUsingArrayStyle: {
                files: [
                    {
                        src: ["./api/controllers/typescripts/*.ts"],
                        dest: "./api/controllers"
                    },
                    {
                        src: ["./api/services/typescripts/*.ts"],
                        dest: "./api/services"
                    },
                     {
                        src: ["./api/repositories/typescripts/*.ts"],
                        dest: "./api/repositories"
                    }
                ],
                options: {
                    fast: 'never',
                    sourceMap: false
                },
                watch: "."
            }
        }
    });

    grunt.loadNpmTasks("grunt-ts");
    grunt.registerTask("default", ["ts"]);
};

The issue I am facing right now is that the first set of files are saving on the right path, which is in ./api/controllers.

The issue I am having right now is regarding the next set of files which are not saving properly. What the compiler do is create several folders like this enter image description here

controllers folder under API is just fine but looking at repositories folder and services folder doesn't seem to fit the definition from the src in grunt.

I'm stuck with this and hopefully, somebody can help.

Thanks!

Upvotes: 0

Views: 118

Answers (1)

NYCdotNet
NYCdotNet

Reputation: 4637

Look at the rootDir feature - you want to set it to the common folder that you expect to be modeled in your outDir folder. That helps TypeScript understand your intent so it doesn't have to guess. If that doesn't work for you, please open an issue on the grunt-ts site on Github.

Upvotes: 0

Related Questions