@@ -57,21 +57,41 @@ function copyTemplate(templateName, destinationPath) {
5757}
5858
5959function getProjectTemplates ( projectDir ) {
60- const templates = { }
61-
6260 const WEBPACK_CONFIG_NAME = "webpack.config.js" ;
61+ const TSCONFIG_ESM_NAME = "tsconfig.esm.json" ;
62+
63+ let templates ;
6364 if ( isAngular ( { projectDir} ) ) {
64- templates [ "webpack.angular.js" ] = WEBPACK_CONFIG_NAME ;
65- templates [ "tsconfig.esm.json" ] = "tsconfig.esm.json" ;
65+ templates = getAngularTemplates ( WEBPACK_CONFIG_NAME , TSCONFIG_ESM_NAME ) ;
6666 } else if ( isTypeScript ( { projectDir} ) ) {
67- templates [ "webpack.typescript.js" ] = WEBPACK_CONFIG_NAME ;
67+ templates = getTypeScriptTemplates ( WEBPACK_CONFIG_NAME , TSCONFIG_ESM_NAME ) ;
6868 } else {
69- templates [ "webpack.javascript.js" ] = WEBPACK_CONFIG_NAME ;
69+ templates = getJavaScriptTemplates ( WEBPACK_CONFIG_NAME ) ;
7070 }
7171
7272 return getFullTemplatesPath ( projectDir , templates ) ;
7373}
7474
75+ function getAngularTemplates ( webpackConfigName , tsconfigName ) {
76+ return {
77+ "webpack.angular.js" : webpackConfigName ,
78+ [ tsconfigName ] : tsconfigName ,
79+ } ;
80+ }
81+
82+ function getTypeScriptTemplates ( webpackConfigName , tsconfigName ) {
83+ return {
84+ "webpack.typescript.js" : webpackConfigName ,
85+ [ tsconfigName ] : tsconfigName ,
86+ } ;
87+ }
88+
89+ function getJavaScriptTemplates ( webpackConfigName ) {
90+ return {
91+ "webpack.javascript.js" : webpackConfigName ,
92+ } ;
93+ }
94+
7595function getFullTemplatesPath ( projectDir , templates ) {
7696 let updatedTemplates = { } ;
7797
0 commit comments