amphora-fs
v2.0.0
Published
File system utils for Amphora and the Clay ecosystem
Downloads
3,261
Maintainers
Keywords
Readme
Amphora FS
Utility functions for working with the file system in Clay. This module will assume that the process which is running will be triggered from a directory that contains a package.json
file and /components
directory.
Installation
npm install --save amphora-fs
Methods
- fileExists (code|tests|docs) - test if a file exists
- getComponentModule (code|tests|docs) - get a component's
model.js
- getComponentName (code|tests|docs) - get a component's name, validating that it exists in your Clay instance
- getComponentPackage (code|tests|docs) - get a npm component's
package.json
- getComponentPath (code|tests|docs) - get a component's filepath
- getComponents (code|tests|docs) - get a list of all components in your Clay instance
- getFiles (code|tests|docs) - get files (that aren't test or documentation) in a directory
- getFolders (code|tests|docs) - get folders in a directory
- getIndices (code|tests|docs) - get all component references in an object
- getLayoutModule (code|tests|docs) - get a layout's
model.js
- getLayoutName (code|tests|docs) - get a layout's name, validating that it exists in your Clay instance
- getLayoutPath (code|tests|docs) - get a layout's filepath
- getLayouts (code|tests|docs) - get a list of all layouts in your Clay instance
- getSchemaPath (code|tests|docs) - get the path for a layout's / component's schema
- getYaml (code|tests|docs) - get and parse yaml files, including env variables (for
config.yml
andlocal.yml
) - isDirectory (code|tests|docs) - determine if a path is a directory
- readFilePromise (code|tests|docs) -
fs.readFile
that returns a promise - tryRequire (code|tests|docs) - attempt to
require()
a file, with graceful fallback