@@ -57,21 +57,41 @@ function copyTemplate(templateName, destinationPath) {
57
57
}
58
58
59
59
function getProjectTemplates ( projectDir ) {
60
- const templates = { }
61
-
62
60
const WEBPACK_CONFIG_NAME = "webpack.config.js" ;
61
+ const TSCONFIG_ESM_NAME = "tsconfig.esm.json" ;
62
+
63
+ let templates ;
63
64
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 ) ;
66
66
} else if ( isTypeScript ( { projectDir} ) ) {
67
- templates [ "webpack.typescript.js" ] = WEBPACK_CONFIG_NAME ;
67
+ templates = getTypeScriptTemplates ( WEBPACK_CONFIG_NAME , TSCONFIG_ESM_NAME ) ;
68
68
} else {
69
- templates [ "webpack.javascript.js" ] = WEBPACK_CONFIG_NAME ;
69
+ templates = getJavaScriptTemplates ( WEBPACK_CONFIG_NAME ) ;
70
70
}
71
71
72
72
return getFullTemplatesPath ( projectDir , templates ) ;
73
73
}
74
74
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
+
75
95
function getFullTemplatesPath ( projectDir , templates ) {
76
96
let updatedTemplates = { } ;
77
97
0 commit comments