@ibm-wch-sdk/cli-utils
v7.2.608
Published
Helper library for rx helpers around node APIs.
Downloads
3
Keywords
Readme
@ibm-wch-sdk/cli-utils
Exposes framework independent utilities to support the implementation command line utilities for @ibm-wch-sdk/ng and similar SDK.
Class documentation
Refer to the documentation.
Usage
Install the module via
npm install --save @ibm-wch-sdk/cli-utils
cli-utils package
Enumerations
| Enumeration | Description | | --- | --- | | PACKAGE_INSTALL | |
Functions
| Function | Description | | --- | --- | | addLayoutToMapping(aLayoutMapping, aLayout) | Adds a layout to a layout mapping entry, inplace | | assertIsValidCredentials(aValue, aName) | Tests if the given value is a valid Credentials object | | assertIsValidPassword(aValue, aName) | Tests if the given value is a valid password, throws if not. | | assertIsValidProjectName(aValue, aName) | Tests if the given value is a valid project name | | assertIsValidUrl(aValue, aName) | Tests if the given value is a valid url, throws if not. | | assertIsValidUserName(aValue, aName) | Tests if the given value is a valid user name, throws if not. | | assertIsValidWchToolsOptions(aValue, aName) | Tests if the given value is a valid WchToolsOptions object | | blackWhiteList(aInclude, aExclude) | | | canonicalizeJson(aData) | Performs an inplace canonicalization of a JSON object | | canTypeHaveLayout(aType) | Tests if an authoring type can have a layout | | cmdCreateProject(aRootFolder, aProjectName, aApiUrl) | Constructs a brand new angular project and adds the SDK to the project | | createGuid(aId, aSecret) | Constructs a GUID in a reproducible way from an ID | | createTypePredicate(aOptions) | Creates a predicate that filters authoring types | | findLayoutComponent(aSource) | Locates the layout component from the source file that represents the layout component declaration. | | findLayoutModule(aLayoutClasses) | Returns a finder for layout modules | | fromRegExp(aRegexp) | Returns a regular expression tester from a sequence of expressions | | fromRegExpString(aRegexp) | | | getLayoutComponents(aAllFiles) | From these files extract all layout components | | getLayoutModules(aAllFiles, aLayoutClasses) | Locates the layout modules | | getLayoutSelector(aLayoutComponent) | Returns the layout selector for the layout component | | getLayoutTemplate(aLayout) | Returns the template identifier from the authoring layout. For an angular layout this is the template, else it is the name or the id as a fallback | | isValidProjectName(projectName) | Validates project names for Angular projects | | ngGetDefaultProject(aJson) | Returns the default project, either the configured project or the first one | | packageInstaller(aDirOrFile) | Returns a function that allows to install packages via the configured package installer. The function will invoke the package manager in the directory of the package JSON located in the given directory | | reduceSourceFiles() | Reduces all source files to an object, keyed by filename | | rxExecuteCli(aPkgDir, aArgs, aLogSvc) | Executes the WCH SDK CLI. If we can find it in the path, use that version, else use npx to install and run it. | | rxExecuteNg(aPkgDir, aArgs, aLogSvc) | Executes the angular command line. If we can find it in the path, use that version, else use npx to install and run it. | | rxExecuteWchTools(aPkgDir, aArgs, aLogSvc) | Executes wchtools. If we can find wchtools in the path, use that version, else use npx to install and run it. | | rxFindAngularJson(aRootDir) | Locates the angular configuration file, next to the package json file | | rxFindAngularVersion(aRootDir) | Locates the version of angular to use | | rxFindAuthoringLayoutMappings(aRoot) | Reads the authoring layouts from a directory | | rxFindAuthoringLayouts(aRoot) | Reads the authoring layouts from a directory | | rxFindAuthoringTypes(aRoot) | Reads the authoring types from a directory | | rxFindDataDir(aDirOrFile) | Locates the data directory | | rxFindPackageJson(aDirOrFile) | Locates the package json relative to the given directory | | rxFindPackageManager(aDirOrFile) | Locates the configured package manager | | rxFindScript(aName, aRoot) | Locates the executable script command | | rxFindSdkVersion(aRootDir) | Locates the version of the SDK to use, either from the package JSON or from our own build | | rxGetSourceFolder(aAngularJson, aProject) | Returns the source folder for the angular application | | rxReadAngularJson(aRootDir) | Reads the angular configuration file, next to the package json file | | rxReadAuthoringLayoutMappings(aRoot) | Reads the authoring layouts from a directory | | rxReadAuthoringLayouts(aRoot) | Reads the authoring layouts from a directory | | rxReadAuthoringTypes(aRoot) | Reads the authoring types from a directory | | rxReadPackageJson(aDirOrFile) | Locates and reads the package json | | rxReadSourceFiles(aRoot) | Reads all typescript files | | rxReadWchToolsOptions(aOptionsDir) | Reads the wchtools options object | | rxVerifyPreRequisites(aPrereq, aRootDir) | Verifies if the installed prerequisites meet the requirements. | | rxWchToolsGetCredentials(aApiUrl) | Reads the wch credentials from the given API URL | | rxWriteJsonEntryMap(aMap) | Persists the entries in the map | | rxWriteWchToolsOptions(aOptionsDir, aOptions) | Reads the wchtools options object | | sdkVersionFromAngularVersion(aAngularVersion) | Returns the SDK version from the Angular version |
Interfaces
| Interface | Description | | --- | --- | | JsonEntry | |
Variables
| Variable | Description | | --- | --- | | VERSION | Exports the current version object |
Type Aliases
| Type Alias | Description | | --- | --- | | AuthoringLayoutMap | Mapping from type id to json record for authoring layouts | | AuthoringLayoutMappingMap | Mapping from type id to json record for authoring layout mappings | | AuthoringTypeMap | Mapping from type id to json record for authoring types | | JsonEntryMap | | | PreRequisites | Prerequisites as module name to string |
Home > @ibm-wch-sdk/cli-utils > PACKAGE_INSTALL
PACKAGE_INSTALL enum
Signature:
export declare enum PACKAGE_INSTALL
Enumeration Members
| Member | Value | Description | | --- | --- | --- | | DEPENDENCIES | 0 | | | DEV_DEPENDENCIES | 1 | | | GLOBAL | 2 | |
Home > @ibm-wch-sdk/cli-utils > addLayoutToMapping
addLayoutToMapping() function
Adds a layout to a layout mapping entry, inplace
Signature:
export declare function addLayoutToMapping(aLayoutMapping: AuthoringLayoutMapping, aLayout: AuthoringLayout): AuthoringLayoutMapping;
Parameters
| Parameter | Type | Description | | --- | --- | --- | | aLayoutMapping | AuthoringLayoutMapping | the layout mapping entry | | aLayout | AuthoringLayout | the layout |
Returns:
AuthoringLayoutMapping
the mapping
Home > @ibm-wch-sdk/cli-utils > assertIsValidCredentials
assertIsValidCredentials() function
Tests if the given value is a valid Credentials object
Signature:
export declare function assertIsValidCredentials(aValue: any, aName?: string): Credentials;
Parameters
| Parameter | Type | Description | | --- | --- | --- | | aValue | any | the value to check | | aName | string | optional name of the field we check |
Returns:
Credentials
the value
Home > @ibm-wch-sdk/cli-utils > assertIsValidPassword
assertIsValidPassword() function
Tests if the given value is a valid password, throws if not.
Signature:
export declare function assertIsValidPassword(aValue: any, aName?: string): string;
Parameters
| Parameter | Type | Description | | --- | --- | --- | | aValue | any | the value to check | | aName | string | optional name of the field we check |
Returns:
string
the value
Home > @ibm-wch-sdk/cli-utils > assertIsValidProjectName
assertIsValidProjectName() function
Tests if the given value is a valid project name
Signature:
export declare function assertIsValidProjectName(aValue: any, aName?: string): string;
Parameters
| Parameter | Type | Description | | --- | --- | --- | | aValue | any | the value to check | | aName | string | optional name of the field we check |
Returns:
string
the value
Home > @ibm-wch-sdk/cli-utils > assertIsValidUrl
assertIsValidUrl() function
Tests if the given value is a valid url, throws if not.
Signature:
export declare function assertIsValidUrl(aValue: any, aName?: string): string;
Parameters
| Parameter | Type | Description | | --- | --- | --- | | aValue | any | the value to check | | aName | string | optional name of the field we check |
Returns:
string
the value
Home > @ibm-wch-sdk/cli-utils > assertIsValidUserName
assertIsValidUserName() function
Tests if the given value is a valid user name, throws if not.
Signature:
export declare function assertIsValidUserName(aValue: any, aName?: string): string;
Parameters
| Parameter | Type | Description | | --- | --- | --- | | aValue | any | the value to check | | aName | string | optional name of the field we check |
Returns:
string
the value
Home > @ibm-wch-sdk/cli-utils > assertIsValidWchToolsOptions
assertIsValidWchToolsOptions() function
Tests if the given value is a valid WchToolsOptions object
Signature:
export declare function assertIsValidWchToolsOptions(aValue: any, aName?: string): WchToolsOptions;
Parameters
| Parameter | Type | Description | | --- | --- | --- | | aValue | any | the value to check | | aName | string | optional name of the field we check |
Returns:
WchToolsOptions
the value
Home > @ibm-wch-sdk/cli-utils > blackWhiteList
blackWhiteList() function
Signature:
export declare function blackWhiteList(aInclude?: string[], aExclude?: string[]): Predicate<string>;
Parameters
| Parameter | Type | Description | | --- | --- | --- | | aInclude | string[] | | | aExclude | string[] | |
Returns:
Predicate<string>
Home > @ibm-wch-sdk/cli-utils > canonicalizeJson
canonicalizeJson() function
Performs an inplace canonicalization of a JSON object
Signature:
export declare function canonicalizeJson(aData: any): any;
Parameters
| Parameter | Type | Description | | --- | --- | --- | | aData | any | the JSON object |
Returns:
any
the canonicalized object
Home > @ibm-wch-sdk/cli-utils > canTypeHaveLayout
canTypeHaveLayout() function
Tests if an authoring type can have a layout
Signature:
export declare function canTypeHaveLayout(aType: AuthoringType): boolean;
Parameters
| Parameter | Type | Description | | --- | --- | --- | | aType | AuthoringType | the type |
Returns:
boolean
true if the type can have a layout, else false
Home > @ibm-wch-sdk/cli-utils > cmdCreateProject
cmdCreateProject() function
Constructs a brand new angular project and adds the SDK to the project
Signature:
export declare function cmdCreateProject(aRootFolder: string, aProjectName: string, aApiUrl: string): Observable<SpawnLine>;
Parameters
| Parameter | Type | Description | | --- | --- | --- | | aRootFolder | string | the root folder of the project | | aProjectName | string | the project name | | aApiUrl | string | the WCH API URL |
Returns:
Observable<SpawnLine>
an observable of the command output
Home > @ibm-wch-sdk/cli-utils > createGuid
createGuid() function
Constructs a GUID in a reproducible way from an ID
Signature:
export declare function createGuid(aId: string, aSecret?: string): string;
Parameters
| Parameter | Type | Description | | --- | --- | --- | | aId | string | the original ID | | aSecret | string | some optional secret |
Returns:
string
the guid
Home > @ibm-wch-sdk/cli-utils > createTypePredicate
createTypePredicate() function
Creates a predicate that filters authoring types
Signature:
export declare function createTypePredicate(aOptions: {
include?: string[];
exclude?: string[];
}): Predicate<AuthoringType>;
Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| aOptions | {<p/>
include?: string[];<p/>
exclude?: string[];<p/>
} | black whitelist options |
Returns:
Predicate<AuthoringType>
the predicate
Home > @ibm-wch-sdk/cli-utils > findLayoutComponent
findLayoutComponent() function
Locates the layout component from the source file that represents the layout component declaration.
Signature:
export declare function findLayoutComponent(aSource: SourceFile): ClassDeclaration;
Parameters
| Parameter | Type | Description | | --- | --- | --- | | aSource | SourceFile | |
Returns:
ClassDeclaration
Home > @ibm-wch-sdk/cli-utils > findLayoutModule
findLayoutModule() function
Returns a finder for layout modules
Signature:
export declare function findLayoutModule(aLayoutClasses: Record<string, ClassDeclaration>): UnaryFunction<SourceFile, ClassDeclaration>;
Parameters
| Parameter | Type | Description | | --- | --- | --- | | aLayoutClasses | Record<string, ClassDeclaration> | record of classes |
Returns:
UnaryFunction<SourceFile, ClassDeclaration>
the finder
Home > @ibm-wch-sdk/cli-utils > fromRegExp
fromRegExp() function
Returns a regular expression tester from a sequence of expressions
Signature:
export declare function fromRegExp(aRegexp?: RegExp[]): Predicate<string>;
Parameters
| Parameter | Type | Description | | --- | --- | --- | | aRegexp | RegExp[] | the expressions |
Returns:
Predicate<string>
the predicate
Home > @ibm-wch-sdk/cli-utils > fromRegExpString
fromRegExpString() function
Signature:
export declare function fromRegExpString(aRegexp?: string[]): Predicate<string>;
Parameters
| Parameter | Type | Description | | --- | --- | --- | | aRegexp | string[] | |
Returns:
Predicate<string>
Home > @ibm-wch-sdk/cli-utils > getLayoutComponents
getLayoutComponents() function
From these files extract all layout components
Signature:
export declare function getLayoutComponents(aAllFiles: Record<string, SourceFile>): Record<string, ClassDeclaration>;
Parameters
| Parameter | Type | Description | | --- | --- | --- | | aAllFiles | Record<string, SourceFile> | |
Returns:
Record<string, ClassDeclaration>
Home > @ibm-wch-sdk/cli-utils > getLayoutModules
getLayoutModules() function
Locates the layout modules
Signature:
export declare function getLayoutModules(aAllFiles: Record<string, SourceFile>, aLayoutClasses: Record<string, ClassDeclaration>): Record<string, ClassDeclaration>;
Parameters
| Parameter | Type | Description | | --- | --- | --- | | aAllFiles | Record<string, SourceFile> | all source files | | aLayoutClasses | Record<string, ClassDeclaration> | the layout classes |
Returns:
Record<string, ClassDeclaration>
all modules that export the classes
Home > @ibm-wch-sdk/cli-utils > getLayoutSelector
getLayoutSelector() function
Returns the layout selector for the layout component
Signature:
export declare function getLayoutSelector(aLayoutComponent: ClassDeclaration): string;
Parameters
| Parameter | Type | Description | | --- | --- | --- | | aLayoutComponent | ClassDeclaration | the layout component |
Returns:
string
the layout selector or undefined
Home > @ibm-wch-sdk/cli-utils > getLayoutTemplate
getLayoutTemplate() function
Returns the template identifier from the authoring layout. For an angular layout this is the template, else it is the name or the id as a fallback
Signature:
export declare function getLayoutTemplate(aLayout: AuthoringLayout): string;
Parameters
| Parameter | Type | Description | | --- | --- | --- | | aLayout | AuthoringLayout | the layout |
Returns:
string
the template
Home > @ibm-wch-sdk/cli-utils > isValidProjectName
isValidProjectName() function
Validates project names for Angular projects
Signature:
export declare function isValidProjectName(projectName: string): boolean;
Parameters
| Parameter | Type | Description | | --- | --- | --- | | projectName | string | the project name |
Returns:
boolean
true if the project name is valid, else false
Home > @ibm-wch-sdk/cli-utils > ngGetDefaultProject
ngGetDefaultProject() function
Returns the default project, either the configured project or the first one
Signature:
export declare function ngGetDefaultProject(aJson: any): string;
Parameters
| Parameter | Type | Description | | --- | --- | --- | | aJson | any | the angular json |
Returns:
string
the default project
Home > @ibm-wch-sdk/cli-utils > packageInstaller
packageInstaller() function
Returns a function that allows to install packages via the configured package installer. The function will invoke the package manager in the directory of the package JSON located in the given directory
Signature:
export declare function packageInstaller(aDirOrFile: string): (aType: PACKAGE_INSTALL, ...aPackages: string[]) => Observable<SpawnLine>;
Parameters
| Parameter | Type | Description | | --- | --- | --- | | aDirOrFile | string | base directory |
Returns:
(aType: PACKAGE_INSTALL, ...aPackages: string[]) => Observable<SpawnLine>
an install callback
Home > @ibm-wch-sdk/cli-utils > reduceSourceFiles
reduceSourceFiles() function
Reduces all source files to an object, keyed by filename
Signature:
export declare function reduceSourceFiles(): OperatorFunction<SourceFile, Record<string, SourceFile>>;
Returns:
OperatorFunction<SourceFile, Record<string, SourceFile>>
the reducer function
Home > @ibm-wch-sdk/cli-utils > rxExecuteCli
rxExecuteCli() function
Executes the WCH SDK CLI. If we can find it in the path, use that version, else use npx to install and run it.
Signature:
export declare function rxExecuteCli(aPkgDir: string, aArgs: string[], aLogSvc?: LoggerService): Observable<SpawnLine>;
Parameters
| Parameter | Type | Description | | --- | --- | --- | | aPkgDir | string | the package directory, will be the execution directory | | aArgs | string[] | the arguments | | aLogSvc | LoggerService | the logger service |
Returns:
Observable<SpawnLine>
an observable with the output of the command
Home > @ibm-wch-sdk/cli-utils > rxExecuteNg
rxExecuteNg() function
Executes the angular command line. If we can find it in the path, use that version, else use npx to install and run it.
Signature:
export declare function rxExecuteNg(aPkgDir: string, aArgs: string[], aLogSvc?: LoggerService): Observable<SpawnLine>;
Parameters
| Parameter | Type | Description | | --- | --- | --- | | aPkgDir | string | the package directory, will be the execution directory | | aArgs | string[] | the arguments | | aLogSvc | LoggerService | the logger service |
Returns:
Observable<SpawnLine>
an observable with the output of the command
Home > @ibm-wch-sdk/cli-utils > rxExecuteWchTools
rxExecuteWchTools() function
Executes wchtools. If we can find wchtools in the path, use that version, else use npx to install and run it.
Signature:
export declare function rxExecuteWchTools(aPkgDir: string, aArgs: string[], aLogSvc?: LoggerService): Observable<SpawnLine>;
Parameters
| Parameter | Type | Description | | --- | --- | --- | | aPkgDir | string | the package directory, will be the execution directory | | aArgs | string[] | the arguments to wchtools | | aLogSvc | LoggerService | the logger service |
Returns:
Observable<SpawnLine>
an observable with the output of the command
Home > @ibm-wch-sdk/cli-utils > rxFindAngularJson
rxFindAngularJson() function
Locates the angular configuration file, next to the package json file
Signature:
export declare function rxFindAngularJson(aRootDir: string): Observable<FileDescriptor>;
Parameters
| Parameter | Type | Description | | --- | --- | --- | | aRootDir | string | the starting directory |
Returns:
Observable<FileDescriptor>
the angular JSON file
Home > @ibm-wch-sdk/cli-utils > rxFindAngularVersion
rxFindAngularVersion() function
Locates the version of angular to use
Signature:
export declare function rxFindAngularVersion(aRootDir: string): Observable<string>;
Parameters
| Parameter | Type | Description | | --- | --- | --- | | aRootDir | string | the root directory used to locate the packae |
Returns:
Observable<string>
the angular version as a semantic version string
Home > @ibm-wch-sdk/cli-utils > rxFindAuthoringLayoutMappings
rxFindAuthoringLayoutMappings() function
Reads the authoring layouts from a directory
Signature:
export declare function rxFindAuthoringLayoutMappings(aRoot: string): Observable<JsonEntry<AuthoringLayoutMapping>>;
Parameters
| Parameter | Type | Description | | --- | --- | --- | | aRoot | string | root directory |
Returns:
Observable<JsonEntry<AuthoringLayoutMapping>>
the result
Home > @ibm-wch-sdk/cli-utils > rxFindAuthoringLayouts
rxFindAuthoringLayouts() function
Reads the authoring layouts from a directory
Signature:
export declare function rxFindAuthoringLayouts(aRoot: string): Observable<JsonEntry<AuthoringLayout>>;
Parameters
| Parameter | Type | Description | | --- | --- | --- | | aRoot | string | root directory |
Returns:
Observable<JsonEntry<AuthoringLayout>>
the result
Home > @ibm-wch-sdk/cli-utils > rxFindAuthoringTypes
rxFindAuthoringTypes() function
Reads the authoring types from a directory
Signature:
export declare function rxFindAuthoringTypes(aRoot: string): Observable<JsonFile<AuthoringType>>;
Parameters
| Parameter | Type | Description | | --- | --- | --- | | aRoot | string | root directory |
Returns:
Observable<JsonFile<AuthoringType>>
the result
Home > @ibm-wch-sdk/cli-utils > rxFindDataDir
rxFindDataDir() function
Locates the data directory
Signature:
export declare function rxFindDataDir(aDirOrFile: string): Observable<string>;
Parameters
| Parameter | Type | Description | | --- | --- | --- | | aDirOrFile | string | root path or file to search from |
Returns:
Observable<string>
the data path
Home > @ibm-wch-sdk/cli-utils > rxFindPackageJson
rxFindPackageJson() function
Locates the package json relative to the given directory
Signature:
export declare function rxFindPackageJson(aDirOrFile: string): Observable<string>;
Parameters
| Parameter | Type | Description | | --- | --- | --- | | aDirOrFile | string | the starting directory or the name of the package json or the name of a package json |
Returns:
Observable<string>
the name of the package json or an error
Home > @ibm-wch-sdk/cli-utils > rxFindPackageManager
rxFindPackageManager() function
Locates the configured package manager
Signature:
export declare function rxFindPackageManager(aDirOrFile: string): Observable<string>;
Parameters
| Parameter | Type | Description | | --- | --- | --- | | aDirOrFile | string | root directory |
Returns:
Observable<string>
the package manager to use
Home > @ibm-wch-sdk/cli-utils > rxFindScript
rxFindScript() function
Locates the executable script command
Signature:
export declare function rxFindScript(aName: string, aRoot?: string): Observable<string>;
Parameters
| Parameter | Type | Description | | --- | --- | --- | | aName | string | name of the script | | aRoot | string | optionally a root to identify the project to seach in |
Returns:
Observable<string>
the full path to the executable script
Home > @ibm-wch-sdk/cli-utils > rxFindSdkVersion
rxFindSdkVersion() function
Locates the version of the SDK to use, either from the package JSON or from our own build
Signature:
export declare function rxFindSdkVersion(aRootDir: string): Observable<string>;
Parameters
| Parameter | Type | Description | | --- | --- | --- | | aRootDir | string | the root directory used to locate the packae |
Returns:
Observable<string>
the SDK version as a semantic version string
Home > @ibm-wch-sdk/cli-utils > rxGetSourceFolder
rxGetSourceFolder() function
Returns the source folder for the angular application
Signature:
export declare function rxGetSourceFolder(aAngularJson: JsonFile<any>, aProject?: string): Observable<FileDescriptor>;
Parameters
| Parameter | Type | Description | | --- | --- | --- | | aAngularJson | JsonFile<any> | the angular JSON file | | aProject | string | optionally the project, otherwise use the default project |
Returns:
Observable<FileDescriptor>
the source folder from that file
Home > @ibm-wch-sdk/cli-utils > rxReadAngularJson
rxReadAngularJson() function
Reads the angular configuration file, next to the package json file
Signature:
export declare function rxReadAngularJson(aRootDir: string): Observable<JsonFile<any>>;
Parameters
| Parameter | Type | Description | | --- | --- | --- | | aRootDir | string | the starting directory |
Returns:
Observable<JsonFile<any>>
the angular JSON file
Home > @ibm-wch-sdk/cli-utils > rxReadAuthoringLayoutMappings
rxReadAuthoringLayoutMappings() function
Reads the authoring layouts from a directory
Signature:
export declare function rxReadAuthoringLayoutMappings(aRoot: string): Observable<AuthoringLayoutMappingMap>;
Parameters
| Parameter | Type | Description | | --- | --- | --- | | aRoot | string | root directory |
Returns:
Observable<AuthoringLayoutMappingMap>
the result
Home > @ibm-wch-sdk/cli-utils > rxReadAuthoringLayouts
rxReadAuthoringLayouts() function
Reads the authoring layouts from a directory
Signature:
export declare function rxReadAuthoringLayouts(aRoot: string): Observable<AuthoringLayoutMap>;
Parameters
| Parameter | Type | Description | | --- | --- | --- | | aRoot | string | root directory |
Returns:
Observable<AuthoringLayoutMap>
the result
Home > @ibm-wch-sdk/cli-utils > rxReadAuthoringTypes
rxReadAuthoringTypes() function
Reads the authoring types from a directory
Signature:
export declare function rxReadAuthoringTypes(aRoot: string): Observable<AuthoringTypeMap>;
Parameters
| Parameter | Type | Description | | --- | --- | --- | | aRoot | string | root directory |
Returns:
Observable<AuthoringTypeMap>
the result
Home > @ibm-wch-sdk/cli-utils > rxReadPackageJson
rxReadPackageJson() function
Locates and reads the package json
Signature:
export declare function rxReadPackageJson(aDirOrFile: string): Observable<any>;
Parameters
| Parameter | Type | Description | | --- | --- | --- | | aDirOrFile | string | directory or file as a starting point |
Returns:
Observable<any>
the package
Home > @ibm-wch-sdk/cli-utils > rxReadSourceFiles
rxReadSourceFiles() function
Reads all typescript files
Signature:
export declare function rxReadSourceFiles(aRoot: string): Observable<SourceFile>;
Parameters
| Parameter | Type | Description | | --- | --- | --- | | aRoot | string | root of the source files |
Returns:
Observable<SourceFile>
an observable of the source files
Home > @ibm-wch-sdk/cli-utils > rxReadWchToolsOptions
rxReadWchToolsOptions() function
Reads the wchtools options object
Signature:
export declare function rxReadWchToolsOptions(aOptionsDir: string): Observable<WchToolsOptions>;
Parameters
| Parameter | Type | Description | | --- | --- | --- | | aOptionsDir | string | the options directory |
Returns:
Observable<WchToolsOptions>
the options
Home > @ibm-wch-sdk/cli-utils > rxVerifyPreRequisites
rxVerifyPreRequisites() function
Verifies if the installed prerequisites meet the requirements.
Signature:
export declare function rxVerifyPreRequisites(aPrereq: PreRequisites, aRootDir: string): Observable<PreRequisites>;
Parameters
| Parameter | Type | Description | | --- | --- | --- | | aPrereq | PreRequisites | required prerequisites | | aRootDir | string | root directory |
Returns:
Observable<PreRequisites>
the missing prerequisites from the input or the empty object
Home > @ibm-wch-sdk/cli-utils > rxWchToolsGetCredentials
rxWchToolsGetCredentials() function
Reads the wch credentials from the given API URL
Signature:
export declare function rxWchToolsGetCredentials(aApiUrl: string): Observable<Credentials>;
Parameters
| Parameter | Type | Description | | --- | --- | --- | | aApiUrl | string | the API URL |
Returns:
Observable<Credentials>
the attached credentials
Home > @ibm-wch-sdk/cli-utils > rxWriteJsonEntryMap
rxWriteJsonEntryMap() function
Persists the entries in the map
Signature:
export declare function rxWriteJsonEntryMap<T>(aMap: JsonEntryMap<T>): Observable<JsonEntry<T>>;
Parameters
| Parameter | Type | Description | | --- | --- | --- | | aMap | JsonEntryMap<T> | the map to persist |
Returns:
Observable<JsonEntry<T>>
an observable stream of the persisted entries
Home > @ibm-wch-sdk/cli-utils > rxWriteWchToolsOptions
rxWriteWchToolsOptions() function
Reads the wchtools options object
Signature:
export declare function rxWriteWchToolsOptions(aOptionsDir: string, aOptions: WchToolsOptions): Observable<WchToolsOptions>;
Parameters
| Parameter | Type | Description | | --- | --- | --- | | aOptionsDir | string | the directory for the options | | aOptions | WchToolsOptions | the new options to write |
Returns:
Observable<WchToolsOptions>
the written options
Home > @ibm-wch-sdk/cli-utils > sdkVersionFromAngularVersion
sdkVersionFromAngularVersion() function
Returns the SDK version from the Angular version
Signature:
export declare function sdkVersionFromAngularVersion(aAngularVersion: string): string;
Parameters
| Parameter | Type | Description | | --- | --- | --- | | aAngularVersion | string | the angular version string |
Returns:
string
the matching SDK version string
Home > @ibm-wch-sdk/cli-utils > JsonEntry
JsonEntry interface
Signature:
export interface JsonEntry<T> extends JsonFile<T>
Properties
| Property | Type | Description | | --- | --- | --- | | id | string | |
Home > @ibm-wch-sdk/cli-utils > VERSION
VERSION variable
Exports the current version object
Signature:
VERSION: import("@ibm-wch-sdk/api").WchSdkVersion
Home > @ibm-wch-sdk/cli-utils > AuthoringLayoutMap
AuthoringLayoutMap type
Mapping from type id to json record for authoring layouts
Signature:
export declare type AuthoringLayoutMap = JsonEntryMap<AuthoringLayout>;
Home > @ibm-wch-sdk/cli-utils > AuthoringLayoutMappingMap
AuthoringLayoutMappingMap type
Mapping from type id to json record for authoring layout mappings
Signature:
export declare type AuthoringLayoutMappingMap = JsonEntryMap<AuthoringLayoutMapping>;
Home > @ibm-wch-sdk/cli-utils > AuthoringTypeMap
AuthoringTypeMap type
Mapping from type id to json record for authoring types
Signature:
export declare type AuthoringTypeMap = JsonEntryMap<AuthoringType>;
Home > @ibm-wch-sdk/cli-utils > JsonEntryMap
JsonEntryMap type
Signature:
export declare type JsonEntryMap<T> = Record<string, JsonEntry<T>>;
Home > @ibm-wch-sdk/cli-utils > PreRequisites
PreRequisites type
Prerequisites as module name to string
Signature:
export declare type PreRequisites = Record<string, string>;
Home > @ibm-wch-sdk/cli-utils > JsonEntry > id
JsonEntry.id property
Signature:
id: string;