ts-nameof icon indicating copy to clipboard operation
ts-nameof copied to clipboard

Using ts-nameof with grunt

Open mzohreh opened this issue 6 years ago • 2 comments

Hi,

I am trying to set this library up with grunt, but there doesn't seem to be an easy way to do this. I cant use TSC way either as it is relying on another dependency:

https://github.com/dsherret/ts-nameof/blob/master/packages/ts-nameof/setup/tsc.md

Custom set up requires me to write my own transformer, which is not the direction i want to go. So is it possible to use this package with grunt without an overly complicated set up?

https://github.com/dsherret/ts-nameof/blob/master/packages/ts-nameof/setup/custom.md

Thanks Juju

mzohreh avatar May 20 '19 11:05 mzohreh

Hi @mzohreh, are you using grunt-ts? It doesn't seem to support custom transforms (but does seem to have its own transforms feature).

What you could do is use the custom compiler option though. So...

  1. Follow these instructions: https://github.com/dsherret/ts-nameof/blob/master/packages/ts-nameof/setup/tsc.md -- Except for the last step about compiling.
  2. Specify ttypescript as a custom compiler (read more here: https://www.npmjs.com/package/grunt-ts#compiler). I think the following would work:
    grunt.initConfig({
      ts: {
        options: {
          // or try just 'ttypescript' or './node_modules/ttypescript'
          // I haven't tested what works...
          compiler: './node_modules/ttypescript/bin/tsc'
        }
      }
    });
    

Hopefully that will work.

dsherret avatar May 20 '19 14:05 dsherret

Thanks you @dsherret. I will try and let you know

mzohreh avatar May 20 '19 16:05 mzohreh