resolve-tspaths
Advanced tools
Comparing version 0.3.0 to 0.4.0
## [0.4.0](https://github.com/benyap/resolve-tspaths/compare/v0.3.0...v0.4.0) (2022-05-14) | ||
### Features | ||
* pass --ext as list instead of comma-separated string ([23a4cce](https://github.com/benyap/resolve-tspaths/commit/23a4cce7aa9b1b88c436917d5edf3dbcc108ba25)) | ||
### Internal | ||
* add deps to commitlint ([fc5a5b3](https://github.com/benyap/resolve-tspaths/commit/fc5a5b3fd7831c165a8acd88a6bc9406589ebaf6)) | ||
* add test for resolving aliases from nested path ([1e8aaf0](https://github.com/benyap/resolve-tspaths/commit/1e8aaf0280d6ca0b9c317e11e1b53fac8ecdc2f8)) | ||
* gitignore coverage directory ([43b2814](https://github.com/benyap/resolve-tspaths/commit/43b28142ee3e8dfcc7254c449b4c333f8e6ef1dd)) | ||
* rename some start scripts ([ad267c5](https://github.com/benyap/resolve-tspaths/commit/ad267c5aa58f13440ae95a18621509e2b38f39be)) | ||
### Dependencies | ||
* bump @commitlint/cli from 16.2.3 to 16.2.4 ([6094bf5](https://github.com/benyap/resolve-tspaths/commit/6094bf5f127e8b1f14fb539d6e91394ca44cc4d4)) | ||
* bump @commitlint/config-conventional from 16.2.1 to 16.2.4 ([102aa50](https://github.com/benyap/resolve-tspaths/commit/102aa5047bfe848a7316acb4a65225decf2a11c8)) | ||
* bump @release-it/conventional-changelog from 4.2.2 to 4.3.0 ([5112bf2](https://github.com/benyap/resolve-tspaths/commit/5112bf2a67a4b8cfc427bddb8afbfa9eadc37638)) | ||
* bump @types/jest, jest and ts-jest ([1ca13bb](https://github.com/benyap/resolve-tspaths/commit/1ca13bb6d26047689db191eac17c361db35552f4)) | ||
* bump @types/node from 17.0.23 to 17.0.33 ([a6a5034](https://github.com/benyap/resolve-tspaths/commit/a6a503490d28b50be4894d475c5bd15ded69f61f)) | ||
* bump commander from 9.1.0 to 9.2.0 ([0b4a92a](https://github.com/benyap/resolve-tspaths/commit/0b4a92a8c602f9664b6b7211741c58f7ea56509d)) | ||
* bump husky from 7.0.4 to 8.0.1 ([ca95c62](https://github.com/benyap/resolve-tspaths/commit/ca95c626b9eb46acace3a1c292ce517ed2c112e3)) | ||
* bump release-it from 14.14.0 to 14.14.3 ([b7b7547](https://github.com/benyap/resolve-tspaths/commit/b7b7547b3dff65878b5b364d3c542598df563cd7)) | ||
* bump release-it, @release-it/bumper and @release-it/conventional-changelog ([831962c](https://github.com/benyap/resolve-tspaths/commit/831962c5eb72e41b4e59f9aec0b84baaa41248dc)) | ||
* bump tsconfig-paths from 3.14.1 to 4.0.0 ([dac2b9e](https://github.com/benyap/resolve-tspaths/commit/dac2b9eca02db53bb172d02e1088d9b5f6b1d8ff)) | ||
* bump typescript from 4.6.3 to 4.6.4 ([16ca3fd](https://github.com/benyap/resolve-tspaths/commit/16ca3fdc9bec58f1b3aae781c73d81352a82864d)) | ||
## [0.3.0](https://github.com/benyap/resolve-tspaths/compare/v0.2.4...v0.3.0) (2022-04-08) | ||
@@ -4,0 +34,0 @@ |
@@ -25,3 +25,3 @@ "use strict"; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const { project = "tsconfig.json", src = "src", ext = "js,d.ts", out, } = options; | ||
const { project = "tsconfig.json", src = "src", ext = ["js", "d.ts"], out, } = options; | ||
const tsConfig = (0, loadTSConfig_1.loadTSConfig)(project); | ||
@@ -28,0 +28,0 @@ const programPaths = (0, resolvePaths_1.resolvePaths)({ project, src, out }, tsConfig); |
@@ -22,3 +22,3 @@ "use strict"; | ||
.option("-o, --out <path>", "output root path") | ||
.option("--ext <extensions>", "extension types", "js,d.ts") | ||
.option("--ext <extensions...>", "extension types", ["js", "d.ts"]) | ||
.option("--verbose", "output logs", false) | ||
@@ -25,0 +25,0 @@ .option("--noEmit", "changes will not be emitted", false); |
@@ -5,4 +5,4 @@ /** | ||
* @param outPath The output directory. | ||
* @param extensions A comma separated list of extensions to match. | ||
* @param extensions A list of extensions to match. | ||
*/ | ||
export declare function getFilesToProcess(outPath: string, extensions: string): string[]; | ||
export declare function getFilesToProcess(outPath: string, extensions: string[]): string[]; |
@@ -6,3 +6,4 @@ "use strict"; | ||
const fast_glob_1 = require("fast-glob"); | ||
function convertPath(windowsPath) { | ||
// See https://github.com/benyap/resolve-tspaths/pull/20 | ||
function normalisePath(windowsPath) { | ||
return windowsPath | ||
@@ -17,12 +18,11 @@ .replace(/^\\\\\?\\/, "") | ||
* @param outPath The output directory. | ||
* @param extensions A comma separated list of extensions to match. | ||
* @param extensions A list of extensions to match. | ||
*/ | ||
function getFilesToProcess(outPath, extensions) { | ||
const normalizedOutPath = convertPath(outPath); | ||
const extensionsList = extensions.split(","); | ||
const normalizedOutPath = normalisePath(outPath); | ||
let glob = "*"; | ||
if (extensionsList.length === 1) | ||
glob = `*.${extensionsList[0]}`; | ||
else if (extensionsList.length > 1) | ||
glob = `*.{${extensionsList.join(",")}}`; | ||
if (extensions.length === 1) | ||
glob = `*.${extensions[0]}`; | ||
else if (extensions.length > 1) | ||
glob = `*.{${extensions.join(",")}}`; | ||
return (0, fast_glob_1.sync)(`${normalizedOutPath}/**/${glob}`, { | ||
@@ -29,0 +29,0 @@ dot: true, |
@@ -6,4 +6,4 @@ import type { TSConfig } from "../types"; | ||
* | ||
* @param path The path to the tsconfig file. | ||
* @param basePath The path to the tsconfig file. | ||
*/ | ||
export declare function loadTSConfig(basePath: string): TSConfig; |
@@ -11,3 +11,3 @@ "use strict"; | ||
* | ||
* @param path The path to the tsconfig file. | ||
* @param basePath The path to the tsconfig file. | ||
*/ | ||
@@ -14,0 +14,0 @@ function loadTSConfig(basePath) { |
@@ -20,4 +20,4 @@ export interface TSConfig { | ||
out?: string; | ||
/** A comma seperated list of file extensions that will be matched for replacement. */ | ||
ext: string; | ||
/** A list of file extensions that will be matched for replacement. */ | ||
ext: string[]; | ||
/** If `true`, verbose logs will be printed for degugging. */ | ||
@@ -24,0 +24,0 @@ verbose: boolean; |
{ | ||
"version": "0.3.0" | ||
"version": "0.4.0" | ||
} |
{ | ||
"name": "resolve-tspaths", | ||
"version": "0.3.0", | ||
"version": "0.4.0", | ||
"description": "Transform path mappings in your compiled Typescript code", | ||
@@ -36,8 +36,8 @@ "author": "Ben Yap <contact@benyap.com>", | ||
"prepare": "husky install", | ||
"prebuild": "yarn clear", | ||
"clean": "rm -rf ./dist ./coverage", | ||
"prebuild": "yarn clean", | ||
"build": "tsc -p tsconfig.build.json", | ||
"postbuild": "yarn start:dev -p tsconfig.build.json", | ||
"clear": "rm -rf ./dist ./coverage", | ||
"postbuild": "yarn dev -p tsconfig.build.json --verbose", | ||
"format": "prettier --write './src/**/*.ts'", | ||
"start:dev": "ts-node -r tsconfig-paths/register src/main.ts", | ||
"dev": "ts-node -r tsconfig-paths/register src/main.ts", | ||
"start": "node dist/main.js", | ||
@@ -51,3 +51,3 @@ "test": "jest", | ||
"ansi-colors": "4.1.1", | ||
"commander": "9.1.0", | ||
"commander": "9.2.0", | ||
"fast-glob": "3.2.11", | ||
@@ -57,18 +57,18 @@ "jsonc-parser": "3.0.0" | ||
"devDependencies": { | ||
"@commitlint/cli": "16.2.3", | ||
"@commitlint/config-conventional": "16.2.1", | ||
"@release-it/bumper": "3.0.1", | ||
"@release-it/conventional-changelog": "4.2.2", | ||
"@types/jest": "27.4.1", | ||
"@types/node": "17.0.23", | ||
"@commitlint/cli": "16.2.4", | ||
"@commitlint/config-conventional": "16.2.4", | ||
"@release-it/bumper": "4.0.0", | ||
"@release-it/conventional-changelog": "5.0.0", | ||
"@types/jest": "27.5.1", | ||
"@types/node": "17.0.33", | ||
"all-contributors-cli": "6.20.0", | ||
"husky": "7.0.4", | ||
"jest": "27.5.1", | ||
"husky": "8.0.1", | ||
"jest": "28.1.0", | ||
"prettier": "2.6.2", | ||
"release-it": "14.14.0", | ||
"ts-jest": "27.1.4", | ||
"release-it": "15.0.0", | ||
"ts-jest": "28.0.2", | ||
"ts-node": "10.7.0", | ||
"tsconfig-paths": "3.14.1", | ||
"typescript": "4.6.3" | ||
"tsconfig-paths": "4.0.0", | ||
"typescript": "4.6.4" | ||
} | ||
} |
@@ -130,7 +130,7 @@ # resolve-tspaths | ||
#### `--ext <extensions>` | ||
#### `--ext <extension...>` | ||
Provide a comma separated list of file extensions in the output directory that | ||
the program should process. Defaults to `js,d.ts`, which will process `.js` and | ||
`.d.ts` files. | ||
Provide a (space separatated) list of file extensions in the output directory | ||
that the program should process. Defaults to `js` and `d.ts`, which will process | ||
`.js` and `.d.ts` files. | ||
@@ -137,0 +137,0 @@ #### `--verbose` |
49701
+ Addedcommander@9.2.0(transitive)
- Removedcommander@9.1.0(transitive)
Updatedcommander@9.2.0