Skip to content

Instantly share code, notes, and snippets.

View fadi-george's full-sized avatar

Fadi George fadi-george

View GitHub Profile
@fadi-george
fadi-george / codeshift-remove-alias.js
Created February 10, 2022 01:29 — forked from jaroslav-kubicek/codeshift-remove-alias.js
Codeshift script to remove import alias
const path = require("path");
function replacePathAlias(currentFilePath, importPath, pathMap) {
// if windows env, convert backslashes to "/" first
console.log(currentFilePath)
currentFilePath = path.posix.join(...currentFilePath.split(path.sep));
const regex = createRegex(pathMap);
return importPath.replace(regex, replacer);