-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e8327f1
commit 8b3f404
Showing
6 changed files
with
55 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,19 @@ | ||
import chalk from "chalk"; | ||
import { existsSync } from "fs"; | ||
import { writeFile } from "fs/promises"; | ||
|
||
export default async (appName: string, fileType: string, fileName: string, options: any, fileContent = "") => { | ||
const getFilesExtention = (options: any) => options?.typescript ? ".ts" : ".js"; | ||
|
||
await writeFile(`${appName}/src/${fileType}s/${fileName}.${fileType}${getFilesExtention(options)}`, fileContent).then(() => { | ||
|
||
console.log(chalk.green(`CREATE /src/${fileType}s/${fileName}.${fileType}${getFilesExtention(options)}`)); | ||
|
||
}) | ||
|
||
if(existsSync(`${appName}/src/${fileType}s`)){ | ||
await writeFile(`${appName}/src/${fileType}s/${fileName}.${fileType}${getFilesExtention(options)}`, fileContent).then(() => { | ||
console.log(chalk.green(`🚀 CREATE /src/${fileType}s/${fileName}.${fileType}${getFilesExtention(options)}`)); | ||
}) | ||
}else | ||
{ | ||
console.log(chalk.red(`🚨 FAILED /src/${fileType}s/${fileName}.${fileType}${getFilesExtention(options)}`)); | ||
console.log(chalk.red(`🚦 Initilize Project first`)); | ||
return | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters