skypager-document

the document asset wrapper for skypager projects

Usage no npm install needed!

<script type="module">
  import skypagerDocument from 'https://cdn.skypack.dev/skypager-document';
</script>

README

Skypager Document Collections

Document Collections are a tool for turning the files inside of your project folder into collections of abstract objects, or entities, and working with them as if they were rows in relational database, or active record objects in an ORM.

It is assumed that the project folder is composed of different subfolders and that generally these subfolders have a specific purpose. This library makes it easy to combine the logic of the project's file organization with information gathered from naming conventions (which are usually prescribed by a framework anyway) with more advanced metadata that can be extracted from parsing the actual files, building an AST, or more advanced tools if the language supports introspection.

Installation

npm install skypager-document --save

Usage

import { mountCollection } from 'skypager-document'

const project = mountCollection(cwd, {
  type: 'project',
  sync: true
})

project.scope('components', /components\/.*\/index.js$/)

// list all of the components
project.scopes.components # [file1, file2, etc]

Examples

ES6 Document Collections

Parses javascript files with babel's es6 parser, as well as the esdoc parser, and makes information extracted from these ASTs available for the purposes of building metadata structures about the code.

Used to auto generate documentation and test suites.

Markdown Collections

Renders markdown documents into HTML but not before extracting information from the writing a which can be used to programatically generate additional content, either by using the writing to fetch external data from some other API or database.

React Component Registry

TODO

Redux Component Registry

TODO