artifactListing
Determine application artifacts by inspecting flow, pages and widgets.
Contents
Module Members
Types
Module Members
defaultAssets( artifact )
Return the default assets for the given artifact, determined by it's type
and descriptor's styleSource
and templateSource
attributes.
Parameters
Property |
Type |
Description |
artifact |
Object |
an artifact created by the ArtifactCollector |
Returns
Type |
Description |
Object |
a partial descriptor containing the artifact's default assets |
create( options )
Create an artifact listing instance.
Example:
const listing = laxarTooling.artifactListing.create( {
resolve: ref => path.relative( process.cwd, path.resolve( ref ) ),
readJson: filename => new Promise( ( resolve, reject ) => {
fs.readFile( filename, ( err, contents ) => {
try {
err ? reject( err ) : resolve( JSON.parse( contents ) );
}
catch( err ) {
reject( err );
}
} );
} ),
requireFile: ( module, loader ) => ( () => `require( '${module}' )` )
} );
Parameters
Property |
Type |
Description |
options |
Object |
additional options |
options.resolve |
Function |
a function resolving a given file path to something that can be read by the readJson function and either returning it as a String or asynchronously |
options.assetResolver |
Function |
override the default asset resolver created with the resolve callback |
options.requireFile |
Function |
a callback that is called for descriptors, definitions, modules and assets, to inject content into the output |
Returns
buildArtifacts( artifacts )
Parameters
Returns
Type |
Description |
Promise.<Object> |
the generated listing, ready to be serialized. |
buildAssets( artifact, themes )
Build the assets object for an artifact and the given themes.
Parameters
Property |
Type |
Description |
artifact |
Object |
the artifact to generate the asset listing for |
themes |
Array.<Object> |
the themes to use for resolving themed artifacts |
Returns
Type |
Description |
Object |
the asset listing, containing sub-listings for each theme and entries for each (available) asset, pointing either to a URL or including the asset's raw content |
Types
ArtifactListing