@@ -10,10 +10,11 @@ import {
10
10
IGenerator ,
11
11
Inputs ,
12
12
ok ,
13
- Platform ,
14
13
Result ,
15
14
} from "@microsoft/teamsfx-api" ;
16
15
import { merge } from "lodash" ;
16
+ import * as path from "path" ;
17
+ import { featureFlagManager , FeatureFlags } from "../../common/featureFlags" ;
17
18
import { TelemetryEvent , TelemetryProperty } from "../../common/telemetry" ;
18
19
import { MetadataV3 , MetadataV4 } from "../../common/versionMetadata" ;
19
20
import { ProgrammingLanguage , QuestionNames } from "../../question/constants" ;
@@ -26,8 +27,6 @@ import { getAllTemplatesOnPlatform, getDefaultTemplatesOnPlatform } from "./temp
26
27
import { TemplateInfo } from "./templates/templateInfo" ;
27
28
import { getTemplateReplaceMap } from "./templates/templateReplaceMap" ;
28
29
import { convertToLangKey , renderTemplateFileData , renderTemplateFileName } from "./utils" ;
29
- import { featureFlagManager , FeatureFlags } from "../../common/featureFlags" ;
30
- import * as path from "path" ;
31
30
32
31
export class DefaultTemplateGenerator implements IGenerator {
33
32
// override this property to send telemetry event with different component name
@@ -66,7 +65,7 @@ export class DefaultTemplateGenerator implements IGenerator {
66
65
const templatePath = templateInfo . subFolder
67
66
? path . join ( destinationPath , templateInfo . subFolder )
68
67
: destinationPath ;
69
- await this . scaffolding ( context , templateInfo , templatePath , actionContext , inputs ) ;
68
+ await this . scaffolding ( context , inputs , templateInfo , templatePath , actionContext ) ;
70
69
}
71
70
72
71
const postRes = await this . post ( context , inputs , destinationPath , actionContext ) ;
@@ -97,10 +96,10 @@ export class DefaultTemplateGenerator implements IGenerator {
97
96
98
97
private async scaffolding (
99
98
context : Context ,
99
+ inputs : Inputs ,
100
100
templateInfo : TemplateInfo ,
101
101
destinationPath : string ,
102
- actionContext ?: ActionContext ,
103
- inputs ?: Inputs
102
+ actionContext ?: ActionContext
104
103
) : Promise < void > {
105
104
const name = templateInfo . templateName ;
106
105
const language = convertToLangKey ( templateInfo . language ) ?? commonTemplateName ;
@@ -127,7 +126,9 @@ export class DefaultTemplateGenerator implements IGenerator {
127
126
[ TelemetryProperty . TemplateName ] : templateName ,
128
127
} ) ;
129
128
130
- const templateMetadata = getAllTemplatesOnPlatform ( Platform . CLI ) . find ( ( t ) => t . name === name ) ;
129
+ const templateMetadata = getAllTemplatesOnPlatform ( inputs . platform ) . find (
130
+ ( t ) => t . name === name
131
+ ) ;
131
132
const folderName =
132
133
templateMetadata ?. language === "common" || templateMetadata ?. language === "none"
133
134
? templateMetadata . id
@@ -138,7 +139,7 @@ export class DefaultTemplateGenerator implements IGenerator {
138
139
language : language ,
139
140
destination : destinationPath ,
140
141
logProvider : context . logProvider ,
141
- platform : inputs ! . platform ,
142
+ platform : inputs . platform ,
142
143
fileNameReplaceFn : ( fileName , fileData ) =>
143
144
renderTemplateFileName ( fileName , fileData , replaceMap )
144
145
. replace ( / \\ / g, "/" )
0 commit comments