bcfiles
v1.3.2
Published
Bundle creator files - This package is designed to save time creating folders and files when starting a project. Additionally, it can be used to add folder and file creation functionality to your software.
Maintainers
Keywords
Readme
BCFiles - Bundle Creator Files
This package is designed to save time creating folders and files when starting a project. Additionally, it can be used to add folder and file creation functionality to your software.
Installation
npm install bcfilespnpm install bcfilesyarn add bcfilesAPI
createFolder(props: CreateFolderProps): Promise<void>
Creates one or more folders in the file system.
props: Properties for the folder creation. It can be a single object or an array of objects.<- "props[]" or "props"folder: Name of the folder or an array of folder names to create.string
Returns a promise that resolves when the folders have been created.
createFile(props: CreateFileProps): Promise<void>
Creates one or more files in the file system.
props: Properties for the file creation. It can be a single object or an array of objects<- "props[]" or "props"fileName: Name of the file to create.stringrelativePath: Relative path from the current directory where the file will be created.stringcontent(optional): File content.string | undefinedextension: File extension.string
Returns a promise that resolves when the files have been created.
Examples:
Create a folder
createFolder({ folder: "src" })Create a file
createFile({
fileName: "app",
relativePath: "src/",
extension: "ts,
content: "import express from 'express';"
})Create multiple folders and files
const extension = "ts"
createFolder([
{ folder: "src/routes" },
{ folder: "src/controllers" },
{ folder: "src/middlewares" },
{ folder: "src/libs" },
{ folder: "src/schemas" }
]).then(() => {
createFile([
{
fileName: "auth.routes",
relativePath: "src/controllers",
extension: extension,
content: "// Auth routes"
},
{
fileName: "auth.middleware",
relativePath: "src/middlewares",
extension: extension,
content: "// Auth middleware"
},
{
fileName: "db.connection",
relativePath: "src/libs",
extension: extension,
content: "// DB connection"
},
{
fileName: "user.schema",
relativePath: "src/schemas",
extension: extension,
content: "// User schema"
}
])
})
License This project is licensed under the MIT License - see the License file for details.
