Comparing version
@@ -68,2 +68,3 @@ #! /usr/bin/env node | ||
const exts = ['.js', '.jsx', '.ts', '.tsx', '.d.ts', '.json']; | ||
let replaceCount = 0; | ||
const absToRel = (modulePath, outFile) => { | ||
@@ -86,2 +87,3 @@ const alen = aliases.length; | ||
const rel = toRelative(path_1.dirname(srcFile), moduleSrc); | ||
replaceCount += 1; | ||
verboseLog(`\treplacing '${modulePath}' -> '${rel}' referencing ${path_1.relative(basePath, moduleSrc)}`); | ||
@@ -91,3 +93,3 @@ return rel; | ||
} | ||
verboseLog(`\tcould not replace ${modulePath}`); | ||
console.log(`could not replace ${modulePath}`); | ||
} | ||
@@ -99,6 +101,4 @@ } | ||
const importRegex = /(?:import|from) ['"]([^'"]*)['"]/g; | ||
let replaceCount = 0; | ||
const replaceImportStatement = (orig, matched, outFile) => { | ||
const index = orig.indexOf(matched); | ||
replaceCount += 1; | ||
return (orig.substring(0, index) + | ||
@@ -105,0 +105,0 @@ absToRel(matched, outFile) + |
@@ -66,2 +66,3 @@ #! /usr/bin/env node | ||
const exts = ['.js', '.jsx', '.ts', '.tsx', '.d.ts', '.json']; | ||
let replaceCount = 0; | ||
const absToRel = (modulePath, outFile) => { | ||
@@ -84,2 +85,3 @@ const alen = aliases.length; | ||
const rel = toRelative(dirname(srcFile), moduleSrc); | ||
replaceCount += 1; | ||
verboseLog(`\treplacing '${modulePath}' -> '${rel}' referencing ${relative(basePath, moduleSrc)}`); | ||
@@ -89,3 +91,3 @@ return rel; | ||
} | ||
verboseLog(`\tcould not replace ${modulePath}`); | ||
console.log(`could not replace ${modulePath}`); | ||
} | ||
@@ -97,6 +99,4 @@ } | ||
const importRegex = /(?:import|from) ['"]([^'"]*)['"]/g; | ||
let replaceCount = 0; | ||
const replaceImportStatement = (orig, matched, outFile) => { | ||
const index = orig.indexOf(matched); | ||
replaceCount += 1; | ||
return (orig.substring(0, index) + | ||
@@ -103,0 +103,0 @@ absToRel(matched, outFile) + |
{ | ||
"name": "tscpaths", | ||
"version": "0.0.8", | ||
"version": "0.0.9", | ||
"description": "Replace absolute paths to relative paths after typescript compilation", | ||
@@ -5,0 +5,0 @@ "main": "cjs/index.js", |
@@ -98,2 +98,4 @@ #! /usr/bin/env node | ||
let replaceCount = 0; | ||
const absToRel = (modulePath: string, outFile: string): string => { | ||
@@ -119,2 +121,3 @@ const alen = aliases.length; | ||
const rel = toRelative(dirname(srcFile), moduleSrc); | ||
replaceCount += 1; | ||
verboseLog( | ||
@@ -129,3 +132,3 @@ `\treplacing '${modulePath}' -> '${rel}' referencing ${relative( | ||
} | ||
verboseLog(`\tcould not replace ${modulePath}`); | ||
console.log(`could not replace ${modulePath}`); | ||
} | ||
@@ -139,4 +142,2 @@ } | ||
let replaceCount = 0; | ||
const replaceImportStatement = ( | ||
@@ -148,3 +149,2 @@ orig: string, | ||
const index = orig.indexOf(matched); | ||
replaceCount += 1; | ||
return ( | ||
@@ -151,0 +151,0 @@ orig.substring(0, index) + |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
41621
0.14%