Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | 1x 1x 9x 2x 2x 1x | import * as path from 'path'
import { TIMPLA_PROCESS } from '../internal'
/**
* A function that can be used to resolve a path relatively to the
* project directory.
*
* We often want to resolve paths relatively to the project root
* directory. To do that, we use the `INIT_CWD` environment variable
* provided by Gulp. This variable always resolves to the project
* root directory so we use it as the seed path and then add the
* remaining arguments passed and resolving everything using the
* `path.resolve` function.
*
* The returned path is a fully resolved absolute path relative to
* the project root directory.
*/
export const projectPath = (...paths: Array<string | undefined>) => {
if (paths.length) {
const cleaned: string[] = paths.filter(Boolean) as string[]
return path.resolve(TIMPLA_PROCESS.INIT_CWD, ...cleaned)
}
return TIMPLA_PROCESS.INIT_CWD
}
|