Skip to content

Latest commit

 

History

History
68 lines (51 loc) · 777 Bytes

readme.md

File metadata and controls

68 lines (51 loc) · 777 Bytes

Installation

npm add --save sql-modules
yarn add sql-modules

Example

Given the following file structure:

files/
  fileA.txt
  fileB.txt
  fileC.txt

files/fileA.txt

# requires fileB
File A

files/fileB.txt

# requires fileC
File B

files/fileC.txt

File C

Point topoFiles at the files directory.

const path = require('path')
const {topoFiles} = require('topo-files')

const filesDir = path.join(__dirname, 'files')

const combined = topoFiles(filesDir, {
  ext: '.txt',
  comment: '#'
})

console.log(combined)

Outputs:

# File: fileC.txt
File C

# File: fileA.txt
# requires fileC
File B

# File: fileB.txt
# requires fileB
File A

Declaring file dependencies