I am using VS Code for making an HTML5 game with TypeScript (JS). The project is getting a little bigger and I want to store the output in a different directory. The problem is that whenever I compile everything, it mirrors the original directory hierarchy. So for example:
-dir1
--dir2
--dir3
---dir4
outputs:
-dir1
--dir2
--dir3
---dir4
(the same)
and I want:
-dir1
*.js
I've tried Grunt/Gulp/VSCode's own TaskRunner but nothing works and "keepDirectoryHierarchy" seems depricated..
I've figured it out. I made a custom Grunt
task which is not optimal but does the job.
module.exports = function(grunt) {
grunt.loadNpmTasks("grunt-typescript");
grunt.loadNpmTasks("grunt-contrib-watch");
grunt.loadNpmTasks('grunt-copy');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.initConfig({
typescript: {
base: {
src: ['./client/**/*.ts'],
dest: './temp',
options: {
'module': 'commonjs',
target: 'es5',
sourceMap: true
}
}
},
copy: {
main: {
files: [
{
src: ['./temp/**/*.js', './temp/**/*.js.map'],
dest: './build/',
flatten: true,
expand: true
}
]
}
},
clean: [
'./temp'
],
watch: {
scripts: {
files: ['./client/**/*.ts'],
tasks: ['typescript', 'copy', 'clean']
}
}
});
grunt.registerTask("default", ['typescript', 'copy', 'clean', 'watch']);
};