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

Possible to change structure of source files in memory

Open sajal50 opened this issue 8 years ago • 6 comments

Is it possible to move/copy files around after project.addExistingSourceFiles("*.ts"); in memory rather than committing to the file system and then build? Current sourceFile.copyImmediately("foo.ts"); makes changes to the file system.

sajal50 avatar Aug 27 '18 19:08 sajal50

Yes, use .copy instead of .copyImmediately.

I'll update the js docs to make that more clear.

dsherret avatar Aug 27 '18 19:08 dsherret

And .move() is available as well?

sajal50 avatar Aug 27 '18 19:08 sajal50

Yup.

dsherret avatar Aug 27 '18 20:08 dsherret

Thanks for the quick reply! :smiley:

sajal50 avatar Aug 27 '18 20:08 sajal50

No problem! Let me know if you run into any issues or unexpected behaviour. The internals of that part of the library are kind of complex, but it should work well.

dsherret avatar Aug 27 '18 20:08 dsherret

Sure, will do!

sajal50 avatar Aug 27 '18 20:08 sajal50