From 71d858cb8f9d9e79df59bf2e7889d75b36ef3f2e Mon Sep 17 00:00:00 2001 From: Adam McElwee Date: Tue, 3 Sep 2019 09:07:34 -0500 Subject: [PATCH] Retain original rootDir for scrubbing user-specific paths from @ts-ignore comments (#15) --- dist/cli.d.ts | 1 + dist/cli.js | 14 +++++++++----- dist/cli.js.map | 2 +- dist/collectFiles.d.ts | 8 ++------ dist/collectFiles.js | 4 ++-- dist/collectFiles.js.map | 2 +- dist/commitAll.js | 2 +- dist/commitAll.js.map | 2 +- dist/convertCodebase.js | 4 ++-- dist/convertCodebase.js.map | 2 +- dist/ignoreErrorsRunner.js | 2 +- dist/ignoreErrorsRunner.js.map | 2 +- dist/stripCommentsRunner.js | 2 +- dist/stripCommentsRunner.js.map | 2 +- dist/tsCompilerHelpers.js | 4 ++-- dist/tsCompilerHelpers.js.map | 2 +- src/cli.ts | 15 ++++++++++----- src/collectFiles.ts | 12 ++++-------- src/commitAll.ts | 2 +- src/convertCodebase.ts | 4 ++-- src/ignoreErrorsRunner.ts | 2 +- src/stripCommentsRunner.ts | 2 +- src/tsCompilerHelpers.ts | 4 ++-- 23 files changed, 49 insertions(+), 47 deletions(-) diff --git a/dist/cli.d.ts b/dist/cli.d.ts index 331dc3f..bda64c3 100644 --- a/dist/cli.d.ts +++ b/dist/cli.d.ts @@ -1,5 +1,6 @@ export interface FilePaths { rootDir: string; + projectDir: string; include: string[]; exclude: string[]; extensions: string[]; diff --git a/dist/cli.js b/dist/cli.js index e04bcae..2f0b84a 100644 --- a/dist/cli.js +++ b/dist/cli.js @@ -26,14 +26,18 @@ const ignoreFileErrorsRunner_1 = __importDefault(require("./ignoreFileErrorsRunn const convertCodebase_1 = __importDefault(require("./convertCodebase")); const checkRunner_1 = __importDefault(require("./checkRunner")); const path_1 = __importDefault(require("path")); -const constructPaths = (rootDir = process.cwd()) => { - if (!path_1.default.isAbsolute(rootDir)) { - rootDir = path_1.default.resolve(rootDir); +const constructPaths = (projectDir = process.cwd()) => { + const rootDir = process.cwd(); + if (!path_1.default.isAbsolute(projectDir)) { + projectDir = path_1.default.resolve(projectDir); } - process.chdir(rootDir); - const { configJSON } = tsCompilerHelpers_1.createTSCompiler(rootDir); + if (rootDir !== projectDir) { + process.chdir(projectDir); + } + const { configJSON } = tsCompilerHelpers_1.createTSCompiler(projectDir); return { rootDir, + projectDir, include: configJSON.config.include || [], exclude: configJSON.config.exclude || [], extensions: [".ts", ".tsx"] diff --git a/dist/cli.js.map b/dist/cli.js.map index 1cd7550..82f458a 100644 --- a/dist/cli.js.map +++ b/dist/cli.js.map @@ -1 +1 @@ -{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,0DAAgC;AAChC,2DAAuD;AACvD,gFAAkD;AAClD,2EAAmE;AACnE,sFAAwD;AACxD,wEAAgD;AAChD,gEAAuC;AACvC,gDAAwB;AASxB,MAAM,cAAc,GAAG,CAAC,UAAkB,OAAO,CAAC,GAAG,EAAE,EAAa,EAAE;IACpE,IAAI,CAAC,cAAI,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE;QAC7B,OAAO,GAAG,cAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;KACjC;IACD,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACvB,MAAM,EAAE,UAAU,EAAE,GAAG,oCAAgB,CAAC,OAAO,CAAC,CAAC;IACjD,OAAO;QACL,OAAO;QACP,OAAO,EAAE,UAAU,CAAC,MAAM,CAAC,OAAO,IAAI,EAAE;QACxC,OAAO,EAAE,UAAU,CAAC,MAAM,CAAC,OAAO,IAAI,EAAE;QACxC,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC;KAC5B,CAAC;AACJ,CAAC,CAAC;AAEF,mBAAO;KACJ,OAAO,CAAC,gBAAgB,CAAC;KACzB,MAAM,CAAC,kBAAkB,CAAC;KAC1B,MAAM,CAAC,cAAc,CAAC;KACtB,MAAM,CACL,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AAC;AAC5C,CAAC,CAAC,CAAC;AAEL,mBAAO;KACJ,OAAO,CAAC,aAAa,CAAC;KACtB,MAAM,CAAC,kBAAkB,CAAC;KAC1B,MAAM,CAAC,cAAc,CAAC;KACtB,MAAM,CAAC,CAAC,GAAyB,EAAE,EAAE;IACpC,OAAO,CAAC,GAAG,CAAC,yDAAyD,CAAC,CAAC;IACvE,MAAM,SAAS,GAAG,cAAc,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAC9C,qBAAU,CAAC,SAAS,CAAC,CAAC;AACxB,CAAC,CAAC,CAAC;AAEL,mBAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/collectFiles.d.ts b/dist/collectFiles.d.ts index d733350..bf43d6d 100644 --- a/dist/collectFiles.d.ts +++ b/dist/collectFiles.d.ts @@ -1,6 +1,2 @@ -export default function collectFiles(paths: { - rootDir: string; - include: string[]; - exclude: string[]; - extensions: string[]; -}): Promise; +import { FilePaths } from "cli"; +export default function collectFiles(paths: FilePaths): Promise; diff --git a/dist/collectFiles.js b/dist/collectFiles.js index 016b965..afaacdb 100644 --- a/dist/collectFiles.js +++ b/dist/collectFiles.js @@ -31,10 +31,10 @@ function getFiles(dir) { function collectFiles(paths) { return __awaiter(this, void 0, void 0, function* () { const filesArr = yield Promise.all(paths.include.map((include) => __awaiter(this, void 0, void 0, function* () { - const isFile = (yield stat(path_1.default.join(paths.rootDir, include))).isFile(); + const isFile = (yield stat(path_1.default.join(paths.projectDir, include))).isFile(); return isFile ? [include] - : yield getFiles(path_1.default.join(paths.rootDir, include)); + : yield getFiles(path_1.default.join(paths.projectDir, include)); }))); const files = filesArr.reduce((a, f) => a.concat(f), []); const filesWithExtensions = files.filter(f => { diff --git a/dist/collectFiles.js.map b/dist/collectFiles.js.map index ae046f9..a74dca6 100644 --- a/dist/collectFiles.js.map +++ b/dist/collectFiles.js.map @@ -1 +1 @@ -{"version":3,"file":"collectFiles.js","sour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,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;QACnD,CAAC,CAAC,CAAC;QACH,MAAM,sBAAsB,GAAG,mBAAmB,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE;YAC5D,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;QACjD,CAAC,CAAC,CAAC;QACH,OAAO,sBAAsB,CAAC;IAChC,CAAC;CAAA;AAnBD,+BAmBC"} \ No newline at end of file diff --git a/dist/commitAll.js b/dist/commitAll.js index e259d29..b0e3aea 100644 --- a/dist/commitAll.js +++ b/dist/commitAll.js @@ -14,7 +14,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); const promise_1 = __importDefault(require("simple-git/promise")); function commit(message, filePaths) { return __awaiter(this, void 0, void 0, function* () { - const git = promise_1.default(filePaths.rootDir); + const git = promise_1.default(filePaths.projectDir); console.log(`Committing: "${message}"`); try { yield git.add("."); diff --git a/dist/commitAll.js.map b/dist/commitAll.js.map index 3cc2bb3..3b5fbc0 100644 --- a/dist/commitAll.js.map +++ b/dist/commitAll.js.map @@ -1 +1 @@ -{"version":3,"file":"commitAll.js","sourceRoot":"","sources":["../src/commitAll.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,iEAA2C;AAG3C,SAA8B,MAAM,CAAC,OAAe,EAAE,SAAoB;;QACxE,MAAM,GAAG,GAAG,iBAAS,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;QACzC,OAAO,CAAC,GAAG,CAAC,gBAAgB,OAAO,GAAG,CAAC,CAAC;QACxC,IAAI;YACF,MAAM,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;SACpB;QAAC,OAAO,CAAC,EAAE;YACV,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;YAC5B,MAAM,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC;SACpB;QAED,IAAI;YACF,MAAM,GAAG,CAAC,MAAM,CAAC,OAAO,EAAE,SAAS,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;SACtD;QAAC,OAAO,CAAC,EAAE;YACV,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;YAChC,MAAM,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC;SACpB;IACH,CAAC;CAAA;AAhBD,yBAgBC"} \ No newline at end of file +{"version":3,"file":"commitAll.js","sourceRoot":"","sources":["../src/commitAll.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,iEAA2C;AAG3C,SAA8B,MAAM,CAAC,OAAe,EAAE,SAAoB;;QACxE,MAAM,GAAG,GAAG,iBAAS,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;QAC5C,OAAO,CAAC,GAAG,CAAC,gBAAgB,OAAO,GAAG,CAAC,CAAC;QACxC,IAAI;YACF,MAAM,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;SACpB;QAAC,OAAO,CAAC,EAAE;YACV,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;YAC5B,MAAM,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC;SACpB;QAED,IAAI;YACF,MAAM,GAAG,CAAC,MAAM,CAAC,OAAO,EAAE,SAAS,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;SACtD;QAAC,OAAO,CAAC,EAAE;YACV,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;YAChC,MAAM,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC;SACpB;IACH,CAAC;CAAA;AAhBD,yBAgBC"} \ No newline at end of file diff --git a/dist/convertCodebase.js b/dist/convertCodebase.js index fc034a0..5b83a86 100644 --- a/dist/convertCodebase.js +++ b/dist/convertCodebase.js @@ -22,10 +22,10 @@ const commitAll_1 = __importDefault(require("./commitAll")); const exists = util_1.promisify(fs_1.default.exists); function process(filePaths, shouldCommit, shouldRename, filesFromCLI) { return __awaiter(this, void 0, void 0, function* () { - const git = promise_1.default(filePaths.rootDir); + const git = promise_1.default(filePaths.projectDir); const files = filesFromCLI || (yield collectFiles_1.default(filePaths)); console.log(`Converting ${files.length} files`); - const { successFiles, errorFiles } = yield converter_1.default(files, filePaths.rootDir); + const { successFiles, errorFiles } = yield converter_1.default(files, filePaths.projectDir); console.log(`${successFiles.length} converted successfully.`); console.log(`${errorFiles.length} errors:`); if (errorFiles.length) diff --git a/dist/convertCodebase.js.map b/dist/convertCodebase.js.map index a6aba9e..172d070 100644 --- a/dist/convertCodebase.js.map +++ b/dist/convertCodebase.js.map @@ -1 +1 @@ -{"version":3,"file":"convertCodebase.js","sourceRoot":"","sources":["../src/convertCodebase.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,gDAA6B;AAE7B,4CAAoB;AAEpB,+BAAiC;AACjC,iEAA2C;AAE3C,kEAA0C;AAC1C,4DAAkC;AAClC,iCAAsC;AACtC,4DAAiC;AAGjC,MAAM,MAAM,GAAG,gBAAS,CAAC,YAAE,CAAC,MAAM,CAAC,CAAC;AAEpC,SAA8B,OAAO,CACnC,SAAoB,EACpB,YAAqB,EACrB,YAAqB,EACrB,YAAkC;;QAElC,MAAM,GAAG,GAAG,iBAAS,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;QAEzC,MAAM,KAAK,GAAG,YAAY,IAAI,CAAC,MAAM,sBAAY,CAAC,SAAS,CAAC,CAAC,CAAC;QAE9D,OAAO,CAAC,GAAG,CAAC,cAAc,KAAK,CAAC,MAAM,QAAQ,CAAC,CAAC;QAChD,MAAM,EAAE,YAAY,EAAE,UAAU,EAAE,GAAG,MAAM,mBAAO,CAAC,KAAK,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC;QAE7E,OAAO,CAAC,GAAG,CAAC,GAAG,YAAY,CAAC,MAAM,0BAA0B,CAAC,CAAC;QAC9D,OAAO,CAAC,GAAG,CAAC,GAAG,UAAU,CAAC,MAAM,UAAU,CAAC,C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AAC,GAAG,CAAC,GAAG,YAAY,CAAC,MAAM,0BAA0B,CAAC,CAAC;YAC9D,OAAO,CAAC,GAAG,CAAC,GAAG,UAAU,CAAC,MAAM,SAAS,CAAC,CAAC;YAC3C,IAAI,UAAU,CAAC,MAAM;gBAAE,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;SAChD;IACH,CAAC;CAAA;AApGD,0BAoGC"} \ No newline at end of file diff --git a/dist/ignoreErrorsRunner.js b/dist/ignoreErrorsRunner.js index 65efa62..89cc3fe 100644 --- a/dist/ignoreErrorsRunner.js +++ b/dist/ignoreErrorsRunner.js @@ -75,7 +75,7 @@ function compile(paths, shouldCommit, includeJSX) { const filePath = tsCompilerHelpers_1.getFilePath(paths, fileDiagnostics[0]); const modifiedCodeSplitByLine = fileDiagnostics.reduce((codeSplitByLine, diagnostic) => insertIgnore_1.insertIgnore(diagnostic, codeSplitByLine, includeJSX, paths.rootDir), fs_1.readFileSync(filePath, "utf8").split("\n")); const fileData = modifiedCodeSplitByLine.join("\n"); - const formattedFileData = prettierFormat_1.default(fileData, paths.rootDir); + const formattedFileData = prettierFormat_1.default(fileData, paths.projectDir); fs_1.writeFileSync(filePath, formattedFileData); successFiles.push(fileName); } diff --git a/dist/ignoreErrorsRunner.js.map b/dist/ignoreErrorsRunner.js.map index aa05f7a..da20f1c 100644 --- a/dist/ignoreErrorsRunner.js.map +++ b/dist/ignoreErrorsRunner.js.map @@ -1 +1 @@ -{"version":3,"file":"ignoreErrorsRunner.js","sourceRoot":"","sources":["../src/ignoreErrorsRunner.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,mCAAyC;AACzC,yCAAqD;AACrD,iDAAsE;AACtE,4DAAiC;AACjC,sEAA8C;AAC9C,2DAAkE;AAElE,kEAA0C;AAC1C,+BAAiC;AAEjC,MAAM,YAAY,GAAa,EAAE,CAAC;AAClC,MAAM,UAAU,GAAa,EAAE,CAAC;AAEhC,MAAM,QAAQ,GAAG,gBAAS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AC;SACpD;QAED,OAAO,CAAC,GAAG,CAAC,GAAG,YAAY,CAAC,MAAM,0CAA0C,CAAC,CAAC;QAE9E,MAAM,mBAAmB,GAAG,qCAAsB,EAAE,CAAC;QAErD,IAAI,mBAAmB,CAAC,MAAM,GAAG,CAAC,EAAE;YAClC,OAAO,CAAC,GAAG,CACT,sCAAsC,mBAAmB,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CACtE,CAAC;SACH;QAED,IAAI,UAAU,CAAC,MAAM,EAAE;YACrB,OAAO,CAAC,GAAG,CAAC,kBAAkB,UAAU,CAAC,MAAM,SAAS,CAAC,CAAC;YAC1D,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;SACzB;IACH,CAAC;CAAA;AA/DD,0BA+DC"} \ No newline at end of file diff --git a/dist/stripCommentsRunner.js b/dist/stripCommentsRunner.js index 98232d5..315f7da 100644 --- a/dist/stripCommentsRunner.js +++ b/dist/stripCommentsRunner.js @@ -33,7 +33,7 @@ function run(paths, comments, shouldComit) { const code = fs_1.readFileSync(filePath, "utf8"); const [fileData, countRemoved] = stripComments_1.stripComments(code, comments || flowComments); count = count + countRemoved; - const formattedFileData = prettierFormat_1.default(fileData, paths.rootDir); + const formattedFileData = prettierFormat_1.default(fileData, paths.projectDir); fs_1.writeFileSync(filePath, formattedFileData); successFiles.push(filePath); } diff --git a/dist/stripCommentsRunner.js.map b/dist/stripCommentsRunner.js.map index 12bb62c..5686f35 100644 --- a/dist/stripCommentsRunner.js.map +++ b/dist/stripCommentsRunner.js.map @@ -1 +1 @@ -{"version":3,"file":"stripCommentsRunner.js","sourceRoot":"","sources":["../src/stripCommentsRunner.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2BAAiD;AACjD,kEAA0C;AAC1C,mDAAgD;AAChD,4DAAiC;AACjC,sEAA8C;AAG9C,MAAM,YAAY,GAAa,EAAE,CAAC;AAClC,MAAM,UAAU,GAAa,EAAE,CAAC;AAEhC,MAAM,YAAY,GAAG;I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G,KAAK,gBAAgB,YAAY,CAAC,MAAM,+BAA+B,CAC3E,CAAC;QAEF,IAAI,UAAU,CAAC,MAAM,EAAE;YACrB,OAAO,CAAC,GAAG,CAAC,+BAA+B,UAAU,CAAC,MAAM,SAAS,CAAC,CAAC;YACvE,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;SACzB;IACH,CAAC;CAAA;AArCD,sBAqCC"} \ No newline at end of file diff --git a/dist/tsCompilerHelpers.js b/dist/tsCompilerHelpers.js index b4124d6..222b9ce 100644 --- a/dist/tsCompilerHelpers.js +++ b/dist/tsCompilerHelpers.js @@ -34,7 +34,7 @@ exports.createTSCompiler = createTSCompiler; function getDiagnostics(paths) { return __awaiter(this, void 0, void 0, function* () { const files = yield collectFiles_1.default(paths); - const { compilerOptions } = createTSCompiler(paths.rootDir); + const { compilerOptions } = createTSCompiler(paths.projectDir); const program = typescript_1.default.createProgram(files, compilerOptions.options); const diagnostics = typescript_1.default.getPreEmitDiagnostics(program); return diagnostics.filter(diagnostic => paths.include.some(includedPath => diagnostic.file.fileName.includes(includedPath))); @@ -43,7 +43,7 @@ function getDiagnostics(paths) { exports.getDiagnostics = getDiagnostics; function getFilePath(paths, diagnostic) { const fileName = diagnostic.file.fileName; - let filePath = path_1.default.join(paths.rootDir, fileName); + let filePath = path_1.default.join(paths.projectDir, fileName); if (!fs_1.existsSync(filePath)) { filePath = fileName; if (!fs_1.existsSync(filePath)) { diff --git a/dist/tsCompilerHelpers.js.map b/dist/tsCompilerHelpers.js.map index 2e2b386..a62d0a5 100644 --- a/dist/tsCompilerHelpers.js.map +++ b/dist/tsCompilerHelpers.js.map @@ -1 +1 @@ -{"version":3,"file":"tsCompilerHelpers.js","sourceRoot":"","sources":["../src/tsCompilerHelpers.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,4DAA4B;AAC5B,2BAAgC;AAEhC,gDAAwB;AACxB,kEAA0C;AAG1C,SAAgB,gBAAgB,CAAC,OAAe;IAC9C,MAAM,U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AAQ,CAAC;AAClB,CAAC;AAVD,kCAUC"} \ No newline at end of file diff --git a/src/cli.ts b/src/cli.ts index e89f90a..565eeef 100755 --- a/src/cli.ts +++ b/src/cli.ts @@ -9,19 +9,24 @@ import path from "path"; export interface FilePaths { rootDir: string; + projectDir: string; include: string[]; exclude: string[]; extensions: string[]; } -const constructPaths = (rootDir: string = process.cwd()): FilePaths => { - if (!path.isAbsolute(rootDir)) { - rootDir = path.resolve(rootDir); +const constructPaths = (projectDir: string = process.cwd()): FilePaths => { + const rootDir = process.cwd() + if (!path.isAbsolute(projectDir)) { + projectDir = path.resolve(projectDir); } - process.chdir(rootDir); - const { configJSON } = createTSCompiler(rootDir); + if (rootDir !== projectDir) { + process.chdir(projectDir); + } + const { configJSON } = createTSCompiler(projectDir); return { rootDir, + projectDir, include: configJSON.config.include || [], exclude: configJSON.config.exclude || [], extensions: [".ts", ".tsx"] diff --git a/src/collectFiles.ts b/src/collectFiles.ts index 2119589..5bcd80f 100644 --- a/src/collectFiles.ts +++ b/src/collectFiles.ts @@ -3,6 +3,7 @@ import path from "path"; import { promisify } from "util"; import { resolve } from "path"; +import { FilePaths } from "cli"; const readdir = promisify(fs.readdir); const stat = promisify(fs.stat); @@ -19,19 +20,14 @@ async function getFiles(dir: string): Promise { return files.reduce((a, f) => a.concat(f), [] as string[]); } -export default async function collectFiles(paths: { - rootDir: string; - include: string[]; - exclude: string[]; - extensions: string[]; -}) { +export default async function collectFiles(paths: FilePaths) { const filesArr = await Promise.all( paths.include.map(async include => { - const isFile = (await stat(path.join(paths.rootDir, include))).isFile(); + const isFile = (await stat(path.join(paths.projectDir, include))).isFile(); return isFile ? [include] - : await getFiles(path.join(paths.rootDir, include)); + : await getFiles(path.join(paths.projectDir, include)); }) ); const files = filesArr.reduce((a, f) => a.concat(f), [] as string[]); diff --git a/src/commitAll.ts b/src/commitAll.ts index 2adcd8d..88825fa 100644 --- a/src/commitAll.ts +++ b/src/commitAll.ts @@ -2,7 +2,7 @@ import simplegit from "simple-git/promise"; import { FilePaths } from "./cli"; export default async function commit(message: string, filePaths: FilePaths) { - const git = simplegit(filePaths.rootDir); + const git = simplegit(filePaths.projectDir); console.log(`Committing: "${message}"`); try { await git.add("."); diff --git a/src/convertCodebase.ts b/src/convertCodebase.ts index 0efa56b..9cfd869 100644 --- a/src/convertCodebase.ts +++ b/src/convertCodebase.ts @@ -19,12 +19,12 @@ export default async function process( shouldRename: boolean, filesFromCLI: string[] | undefined ) { - const git = simplegit(filePaths.rootDir); + const git = simplegit(filePaths.projectDir); const files = filesFromCLI || (await collectFiles(filePaths)); console.log(`Converting ${files.length} files`); - const { successFiles, errorFiles } = await convert(files, filePaths.rootDir); + const { successFiles, errorFiles } = await convert(files, filePaths.projectDir); console.log(`${successFiles.length} converted successfully.`); console.log(`${errorFiles.length} errors:`); diff --git a/src/ignoreErrorsRunner.ts b/src/ignoreErrorsRunner.ts index cf1c370..50c9aeb 100644 --- a/src/ignoreErrorsRunner.ts +++ b/src/ignoreErrorsRunner.ts @@ -90,7 +90,7 @@ export default async function compile( readFileSync(filePath, "utf8").split("\n") ); const fileData = modifiedCodeSplitByLine.join("\n"); - const formattedFileData = prettierFormat(fileData, paths.rootDir); + const formattedFileData = prettierFormat(fileData, paths.projectDir); writeFileSync(filePath, formattedFileData); successFiles.push(fileName); } catch (e) { diff --git a/src/stripCommentsRunner.ts b/src/stripCommentsRunner.ts index cef9ecf..a4b21d4 100644 --- a/src/stripCommentsRunner.ts +++ b/src/stripCommentsRunner.ts @@ -31,7 +31,7 @@ export default async function run( comments || flowComments ); count = count + countRemoved; - const formattedFileData = prettierFormat(fileData, paths.rootDir); + const formattedFileData = prettierFormat(fileData, paths.projectDir); writeFileSync(filePath, formattedFileData); successFiles.push(filePath); } catch (e) { diff --git a/src/tsCompilerHelpers.ts b/src/tsCompilerHelpers.ts index 548876d..e3fd408 100644 --- a/src/tsCompilerHelpers.ts +++ b/src/tsCompilerHelpers.ts @@ -33,7 +33,7 @@ export function createTSCompiler(rootDir: string) { export async function getDiagnostics(paths: FilePaths) { const files = await collectFiles(paths); - const { compilerOptions } = createTSCompiler(paths.rootDir); + const { compilerOptions } = createTSCompiler(paths.projectDir); const program = ts.createProgram(files, compilerOptions.options); @@ -47,7 +47,7 @@ export async function getDiagnostics(paths: FilePaths) { export function getFilePath(paths: FilePaths, diagnostic: ts.Diagnostic) { const fileName = diagnostic.file!.fileName; - let filePath = path.join(paths.rootDir, fileName); + let filePath = path.join(paths.projectDir, fileName); if (!existsSync(filePath)) { filePath = fileName; if (!existsSync(filePath)) {