1.0.2 • Published 5 years ago

@jace1995/full-paths v1.0.2

Weekly downloads
-
License
ISC
Repository
-
Last release
5 years ago

@jace1995/full-paths

Relative path converter to absolute

Install

npm i -S @jace1995/full-paths

Usage

import { fullPaths, fullPathsFromRoot, fullPathsFromFolder } from '@jace1995/full-paths';
import * as path from 'path';

const relativePaths: Record<string, string> = {
	package: 'package.json',
	tsconfig: 'tsconfig.json',
};

const _fullPaths = fullPaths(relativePaths);

const _fullPathsFromRoot = fullPathsFromRoot('test', relativePaths);

const _fullPathsFromFolder = fullPathsFromFolder(
	path.join(process.cwd(), 'test'),
	relativePaths
);

// { package: '{APP_FOLDER}/package.json', tsconfig: '{APP_FOLDER}/tsconfig.json' }
console.log(_fullPaths);

// { package: '{APP_FOLDER}/test/package.json', tsconfig: '{APP_FOLDER}/test/tsconfig.json' }
console.log(_fullPathsFromRoot);

// { package: '{APP_FOLDER}/test/package.json', tsconfig: '{APP_FOLDER}/test/tsconfig.json' }
console.log(_fullPathsFromFolder);