README
get-path (OperationClassification cjs)
Useful functions to get paths within King OS.
Depends on sdk-operations, which makes it only work inside of a typerepo.
returns project root folder path
recursive. goes up until it finds a folder that's the project root
if no source path is given, uses the directory name where the function is executed from as a starting point
Input | ||
---|---|---|
fullSourcePath (optional) | string | |
Output | string |
returns project root folder path
recursive. goes up until it finds a folder that's the project root
if no source path is given, uses the directory name where the function is executed from as a starting point
Gets a path of any operation in the project
NB: relies on sdk-operations 100%
Input | ||
---|---|---|
operationName | string | specify the operation folder name |
Output |
Gets project path, or a folder in the root that is convention
Input | ||
---|---|---|
- | ||
Output | string |
Input | ||
---|---|---|
startPath | string | |
Output | string |
returns an array of all (absolute) paths containing operations
for a bundled project, that means /apps, /packages, /modules
for the OS project, that means /operations/tools and /operations/niches
Input | ||
---|---|---|
config (optional) | { manualProjectRoot?: string, } | |
Output | string[] |
returns an array of all (absolute) paths containing operations
for a bundled project, that means /apps, /packages, /modules
for the OS project, that means /operations/tools and /operations/niches
returns a file id (path without extension) relative to the src folder of an operation
e.g. "general" for src/general.ts
NB: assumes all src is in the src folder
NB: removes "/" in the beginning, if found
Input | ||
---|---|---|
operationRelativePath | string | |
Output |
returns a file id (path without extension) relative to the src folder of an operation
e.g. "general" for src/general.ts
NB: assumes all src is in the src folder
NB: removes "/" in the beginning, if found
Returns OperationClassification if it's an operation, or undefined if it's not
NB: don't confuse this with ImportClassification
Input | ||
---|---|---|
folderPath | string | |
Output |
Input | ||
---|---|---|
folderPath (optional) | string | |
Output | { } |
Returns OperationClassification if it's an operation, or undefined if it's not
NB: don't confuse this with ImportClassification
something like src/xxx/xxx/x.ts (no slash at start)
Input | ||
---|---|---|
absolutePath | string | |
Output |
something like src/xxx/xxx/x.ts (no slash at start)
Input | ||
---|---|---|
- | ||
Output |
get all operation-related path information that can be inferred from the path
NB: currently it also looks up the operation name from its packagejson
Input | ||
---|---|---|
absolutePath | string | |
Output |
gets all kinds of information that can be inferred from any path (file or folder).
Input | ||
---|---|---|
absolutePath | string | |
Output | { relativePathFromProjectRoot: string, } |
get all operation-related path information that can be inferred from the path
NB: currently it also looks up the operation name from its packagejson
gets all kinds of information that can be inferred from any path (file or folder).
returns a relative link between two files
Input | ||
---|---|---|
absoluteFromFilePath | string | |
Output | String |
Input | ||
---|---|---|
absolutePath | string | |
Output | string[] |
Checks whether or not an absolute path contains an operation. The only check it's doing is that the folder must contain both a package.json as well as a tsconfig.json
Input | ||
---|---|---|
absoluteFolderPath | string | |
Output | { } |
returns a relative link between two files
Checks whether or not an absolute path contains an operation. The only check it's doing is that the folder must contain both a package.json as well as a tsconfig.json
Show test information(2)
Input | ||
---|---|---|
- | ||
Output |
Show internal (24)
recursive. goes up a folder until it finds a package.json
Input | ||
---|---|---|
- | ||
Output | { folderPath: string, matchResult: { }, } |
recursive. goes up until it finds a folder that's an operation
because it had to read the package.json anyway, it's returning the operation classification as well
Input | ||
---|---|---|
startPath | string | |
Output | { folderPath: string, classification: { }, } |
Input | ||
---|---|---|
operation | Operation | |
Output | string[] |
Finds the common ancestor for two absolute pahts
Input | ||
---|---|---|
path1 | string | |
Output | String |
gets the relative path from a specified root
will start with "/"
Input | ||
---|---|---|
absolutePath | string | |
Output |
Input | ||
---|---|---|
operation | Operation | |
Output |
Input | ||
---|---|---|
tsconfig | { } | |
Output |
simple sync function to check if a folder is the root of a workspace (not operation but a workspace)
Input | ||
---|---|---|
folderPath | string | |
Output | { isBundle: boolean, isWorkspaceRoot: boolean, } |
Input | ||
---|---|---|
packageJson | { } | |
Output |
Input | ||
---|---|---|
tsconfig | TsConfig | |
Output | { } |
recursive. goes up a folder until it finds a package.json
recursive. goes up until it finds a folder that's an operation
because it had to read the package.json anyway, it's returning the operation classification as well
Finds the common ancestor for two absolute pahts
gets the relative path from a specified root
will start with "/"
simple sync function to check if a folder is the root of a workspace (not operation but a workspace)
can only be accessed in the OS
can be accessed in projects as well as in the OS
README
get-path (OperationClassification cjs)
Useful functions to get paths within King OS.
Depends on sdk-operations, which makes it only work inside of a typerepo.
returns project root folder path
recursive. goes up until it finds a folder that's the project root
if no source path is given, uses the directory name where the function is executed from as a starting point
Input | ||
---|---|---|
fullSourcePath (optional) | string | |
Output | string |
returns project root folder path
recursive. goes up until it finds a folder that's the project root
if no source path is given, uses the directory name where the function is executed from as a starting point
Gets a path of any operation in the project
NB: relies on sdk-operations 100%
Input | ||
---|---|---|
operationName | string | specify the operation folder name |
Output |
Gets project path, or a folder in the root that is convention
Input | ||
---|---|---|
- | ||
Output | string |
Input | ||
---|---|---|
startPath | string | |
Output | string |
returns an array of all (absolute) paths containing operations
for a bundled project, that means /apps, /packages, /modules
for the OS project, that means /operations/tools and /operations/niches
Input | ||
---|---|---|
config (optional) | { manualProjectRoot?: string, } | |
Output | string[] |
returns an array of all (absolute) paths containing operations
for a bundled project, that means /apps, /packages, /modules
for the OS project, that means /operations/tools and /operations/niches
returns a file id (path without extension) relative to the src folder of an operation
e.g. "general" for src/general.ts
NB: assumes all src is in the src folder
NB: removes "/" in the beginning, if found
Input | ||
---|---|---|
operationRelativePath | string | |
Output |
returns a file id (path without extension) relative to the src folder of an operation
e.g. "general" for src/general.ts
NB: assumes all src is in the src folder
NB: removes "/" in the beginning, if found
Returns OperationClassification if it's an operation, or undefined if it's not
NB: don't confuse this with ImportClassification
Input | ||
---|---|---|
folderPath | string | |
Output |
Input | ||
---|---|---|
folderPath (optional) | string | |
Output | { } |
Returns OperationClassification if it's an operation, or undefined if it's not
NB: don't confuse this with ImportClassification
something like src/xxx/xxx/x.ts (no slash at start)
Input | ||
---|---|---|
absolutePath | string | |
Output |
something like src/xxx/xxx/x.ts (no slash at start)
Input | ||
---|---|---|
- | ||
Output |
get all operation-related path information that can be inferred from the path
NB: currently it also looks up the operation name from its packagejson
Input | ||
---|---|---|
absolutePath | string | |
Output |
gets all kinds of information that can be inferred from any path (file or folder).
Input | ||
---|---|---|
absolutePath | string | |
Output | { relativePathFromProjectRoot: string, } |
get all operation-related path information that can be inferred from the path
NB: currently it also looks up the operation name from its packagejson
gets all kinds of information that can be inferred from any path (file or folder).
returns a relative link between two files
Input | ||
---|---|---|
absoluteFromFilePath | string | |
Output | String |
Input | ||
---|---|---|
absolutePath | string | |
Output | string[] |
Checks whether or not an absolute path contains an operation. The only check it's doing is that the folder must contain both a package.json as well as a tsconfig.json
Input | ||
---|---|---|
absoluteFolderPath | string | |
Output | { } |
returns a relative link between two files
Checks whether or not an absolute path contains an operation. The only check it's doing is that the folder must contain both a package.json as well as a tsconfig.json
Show test information(2)
Input | ||
---|---|---|
- | ||
Output |
Show internal (24)
recursive. goes up a folder until it finds a package.json
Input | ||
---|---|---|
- | ||
Output | { folderPath: string, matchResult: { }, } |
recursive. goes up until it finds a folder that's an operation
because it had to read the package.json anyway, it's returning the operation classification as well
Input | ||
---|---|---|
startPath | string | |
Output | { folderPath: string, classification: { }, } |
Input | ||
---|---|---|
operation | Operation | |
Output | string[] |
Finds the common ancestor for two absolute pahts
Input | ||
---|---|---|
path1 | string | |
Output | String |
gets the relative path from a specified root
will start with "/"
Input | ||
---|---|---|
absolutePath | string | |
Output |
Input | ||
---|---|---|
operation | Operation | |
Output |
Input | ||
---|---|---|
tsconfig | { } | |
Output |
simple sync function to check if a folder is the root of a workspace (not operation but a workspace)
Input | ||
---|---|---|
folderPath | string | |
Output | { isBundle: boolean, isWorkspaceRoot: boolean, } |
Input | ||
---|---|---|
packageJson | { } | |
Output |
Input | ||
---|---|---|
tsconfig | TsConfig | |
Output | { } |
recursive. goes up a folder until it finds a package.json
recursive. goes up until it finds a folder that's an operation
because it had to read the package.json anyway, it's returning the operation classification as well
Finds the common ancestor for two absolute pahts
gets the relative path from a specified root
will start with "/"
simple sync function to check if a folder is the root of a workspace (not operation but a workspace)
can only be accessed in the OS
can be accessed in projects as well as in the OS