@@ -15,6 +15,7 @@ const moveFile = promisify(fs.rename);
1515const templatesRootDir = resolve ( __dirname , '../../templates' ) ;
1616const templateCorePath = resolve ( templatesRootDir , 'core' ) ;
1717const templateJsPath = resolve ( templatesRootDir , 'js' ) ;
18+ const templateTsPath = resolve ( templatesRootDir , 'ts' ) ;
1819
1920export interface FlexPluginArguments extends CLIArguments {
2021 targetDirectory : string ;
@@ -94,6 +95,9 @@ export const _scaffold = async (config: FlexPluginArguments): Promise<boolean> =
9495
9596 // Get src directory from template URL if provided
9697 let srcPath = templateJsPath ;
98+ if ( config . typescript ) {
99+ srcPath = templateTsPath ;
100+ }
97101 if ( config . template ) {
98102 dirObject = tmp . dirSync ( ) ;
99103 await downloadFromGitHub ( config , config . template , dirObject . name ) ;
@@ -109,9 +113,11 @@ export const _scaffold = async (config: FlexPluginArguments): Promise<boolean> =
109113
110114 // Rename plugins
111115 if ( ! dirObject ) {
116+ const ext = config . typescript ? 'tsx' : 'js' ;
117+
112118 await moveFile (
113- join ( config . targetDirectory , ' src/DemoPlugin.js' ) ,
114- join ( config . targetDirectory , `src/${ config . pluginClassName } .js ` ) ,
119+ join ( config . targetDirectory , ` src/DemoPlugin.${ ext } ` ) ,
120+ join ( config . targetDirectory , `src/${ config . pluginClassName } .${ ext } ` ) ,
115121 ) ;
116122 }
117123
0 commit comments