@cafeine-software/arbo-crafter

1.0.4 • Public • Published

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

Package Sidebar

Install

npm i @cafeine-software/arbo-crafter

Weekly Downloads

5

Version

1.0.4

License

CC BY-NC-SA 4.0

Unpacked Size

281 kB

Total Files

5

Last publish

Collaborators

  • quentin_lamamy