Skip to content
ModularRocks

Workspace

A Workspace for working with virtual codebases

Installation

npm install @modular-rocks/workspace

or

yarn add @modular-rocks/workspace

Usage

A Workspace can contain multiple Codebases, a Codebase will contain FileContainers. It is designed to be highly configurable, allowing you to extend the Workspace, Codebase or FileContainer classes, allowing you to build anything you want on top.

Each Workspace and Codebase accepts an Options argument containing configuration options.

OptionDescriptionTypeExample
pipelineArray of functionsFunction[][functionA, functionB]
filesArray of arrays consisting of pathname and code[pathname
, code
][]
[[‘/path’, ‘hello world’]]
srcsource of the projectstring‘/path/to/project’
extensionsArray of extensions to filter the files bystring[][‘ts’, ‘js’]
ignoredFilesArray of files to filter the files bystring[][‘.d.ts’]
ignoredImportsArray of import statementsstring[][‘$GlobalVariable’]
packageContentsJSON Object like in package.jsonObject[‘$GlobalVariable’]
const opts: Options = {
  pipeline,
  files,
  src: '/',
  extensions: [],
  ignoredFiles: [],
  ignoredImports: [],
  packageContents: {}
}

A FileContainer accepts 3 arguments: pathname:string, code:string, codebase:Codebase.

The pipeline is described in detail in the readme of the pipeline folder.

Framework specific versions

Examples

Examples coming soon…

License

Apache 2.0