TypeStrong / grunt-ts

A grunt task to manage your complete typescript development to production workflow
https://www.npmjs.com/package/grunt-ts
MIT License
330 stars 121 forks source link

Configuration options are confusing #316

Open korya opened 8 years ago

korya commented 8 years ago

Hi guys,

I really don't get it. What is the correct typescript configuration that is equivalent to:

grunt.initConfig({
  config: {
    tmp: 'build/tmp',
  },
  typescript: {
    all: {
      expand: true,
      cwd: 'app/',
      src: 'app/**/*.ts',
      dest: '<%= config.tmp %>/',
    },
  },
});

What I want to achieve is:

  app/m1/a.ts ---> build/tmp/m1/a.js
  app/m2/b.ts ---> build/tmp/m2/b.js
  etc.

The problems that I have:

I tried

grunt.initConfig({
  typescript: {
    all: {
      options: {
        rootDir: 'app/',
      },
      expand: true,
      src: 'app/**/*.ts',
      outDir: '<%= config.web.tmp %>/',
    },
  },
});

But it did not work.

korya commented 8 years ago

OK, I should remove the expand options. The following config works as expected:

grunt.initConfig({
  typescript: {
    all: {
      options: {
        rootDir: 'app/',
      },
      // expand: true,     <--- removed
      src: 'app/**/*.ts',
      outDir: '<%= config.web.tmp %>/',
    },
  },
});
korya commented 8 years ago

Anyway, do you plan to support a stadndard grunt file configuration (cwd, srd, dest)?

As I see it, it can be just a thin layer inside the plugin converting cwd, src and dest options to typescript ones (out, outDir, rootDir).

basarat commented 8 years ago

All are wrong. typescript: is wrong. It should be ts: :rose: (perhaps a simple typo?)

Docs : https://github.com/TypeStrong/grunt-ts#getting-started

korya commented 8 years ago

Yeah, probably I've posted the issue to a wrong repo ))) I played interchangeably with grunt-ts and grunt-typescript. I found the both plugins confusing in the same way, probably because I'm not familiar with typescript compiler usage.

What about a support of a stadndard grunt file configuration (cwd, src, dest)? Any plans to do it?

IMHO one of the main goals of such grunt plugin is translating grunt's standard configuration options to a specific options of the relevant backend.

nycdotnet commented 8 years ago

While dest directly is not supported, you can use the grunt standard files mechanism with grunt-ts, which allows use of dest. src works as well. cwd is not relevant.

We have no plans to change the API at this time.