Skip to content

Cafeine-Software/arboCrafter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Presentation

Simple and efficient way to create a complete filetree in one function. I created it to simplify the build process of my own framework (i know this information about my life is not usefull xD)

Features

  • Create the folders structure
  • Create files
  • Copy file
  • Copy all files from a folder and subfolder

Installation

npm i @cafeine-software/arbo-crafter

Usage

import { buildFileTree } from ' @cafeine-software/arbo-crafter';

// ⬇ Define the structure of the filetree you want to create
const fileTreeStructure = {}

// ⬇ Where to create the filetree
const outputFolder = "out"

// ⬇ Will do nothing , look at example bellow :)
buildFileTree(fileTreeStructure,outputFolder)

Folder creation

Any object in the file tree structure definition will be considered as folder

const fileTreeStructure = {
    folder1: {}
}

buildFileTree(fileTreeStructure,outputFolder)

// Result : 
// - Create a folder 'folder1'

File creation

const fileTreeStructure = {
    folder1:{
        'example.txt':'example content'
    }
}

buildFileTree(fileTreeStructure,outputFolder)

// Result :
// - Create a folder 'folder1'
// - Create a file 'example.txt' with content 'example content'

File Copy

const fileTreeStructure = {
    folder1:{
        'example.txt':'example content',
        '.gitignore.copy': `@.gitignore`,
    }
}

buildFileTree(fileTreeStructure,outputFolder)

// Result :
// - Create a folder 'folder1'
// - Create a file 'example.txt' with content 'example content'
// - Copy file '.gitignore' as '.gitignore.copy'

Folder Files Copy

Will copy all files from source folder but not the structure

const fileTreeStructure = {
    folder1:{
        'example.txt':'example content',
        '.gitignore.copy': `@.gitignore`,
    },
    folderCopy:"@../../srcFolderPath"
}

buildFileTree(fileTreeStructure,outputFolder)

// Result :
// - Create a folder 'folder1'
// - Create a file 'example.txt' with content 'example content'
// - Copy file '.gitignore' as '.gitignore.copy'
// - Copy all files from folder '../../srcFolderPath' in 'folderCopy'

License

Contact

Developed by Quentin Lamamy, contact me on Linked In

Links

Personal :

LinkedIn GitHub

Cafeine Software :

npm GitHub

Support

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published