Comparing version 1.0.2 to 1.0.3
{ | ||
"name": "tsc-alias", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "Replace absolute paths to relative paths after typescript compilation", | ||
"main": "cjs/index.js", | ||
"module": "lib/index.js", | ||
"types": "lib/index.d.ts", | ||
"main": "bin/index.js", | ||
"module": "bin/index.js", | ||
"types": "bin/index.d.ts", | ||
"bin": { | ||
"tsc-alias": "cjs/index.js" | ||
"tsc-alias": "bin/index.js" | ||
}, | ||
"scripts": { | ||
"build": "npm run build:esm && npm run build:cjs", | ||
"build:esm": "tsc -p ./tsconfig.esm.json", | ||
"build:cjs": "tsc -p ./tsconfig.cjs.json", | ||
"build": "tsc -p ./tsconfig.json", | ||
"build:watch": "tsc -w -p ./tsconfig.json", | ||
"clear": "rm -rf ./lib ./cjs ./coverage", | ||
@@ -16,0 +15,0 @@ "format": "prettier --write \"./*.{js,jsx,ts,tsx}\" \"./src/**/*.{js,jsx,ts,tsx}\"", |
@@ -14,2 +14,4 @@ # tsc-alias | ||
```sh | ||
npm install -g tsc-alias | ||
#or | ||
npm install --save-dev tsc-alias | ||
@@ -26,2 +28,8 @@ # or | ||
} | ||
#or | ||
"scripts": { | ||
"build": "tsc && tsc-alias", | ||
} | ||
``` |
@@ -12,3 +12,3 @@ #! /usr/bin/env node | ||
program | ||
.version('0.0.1') | ||
.version('1.0.2') | ||
.option('-p, --project <file>', 'path to tsconfig.json'); | ||
@@ -18,2 +18,3 @@ | ||
console.log(` | ||
$ tscpath | ||
$ tscpath -p tsconfig.json | ||
@@ -28,11 +29,7 @@ `); | ||
}; | ||
if (!project) { | ||
throw new Error('--project must be specified'); | ||
} | ||
console.log('***tsc-alias starting***'); | ||
console.log = () => {}; | ||
console.info('***tsc-alias starting***'); | ||
const configFile = resolve(process.cwd(), project); | ||
const configFile = resolve(process.cwd(), project ? project : 'tsconfig.json'); | ||
console.log(`tsconfig.json: ${configFile}`); | ||
@@ -93,3 +90,3 @@ | ||
return { | ||
prefix: alias.replace(/\*$/, ''), | ||
prefix: alias.replace(/\*$/, '').replace(/\//g, ''), | ||
basePath, | ||
@@ -137,3 +134,3 @@ paths: _paths, | ||
const index = orig.indexOf(alias.prefix); | ||
const isAlias = requiredModule === alias.prefix; | ||
const isAlias = requiredModule.indexOf(alias.prefix) === 0; | ||
if (index > -1 && isAlias) { | ||
@@ -149,4 +146,4 @@ let absoluteAliasPath; | ||
// console.log('abs', absoluteAliasPath); | ||
// console.log('fileDirName', dirname(file)); | ||
console.log('abs', absoluteAliasPath); | ||
console.log('fileDirName', dirname(file)); | ||
@@ -156,3 +153,3 @@ let relativeAliasPath = normalizePath( | ||
); | ||
// console.log('rel', relativeAliasPath + '\n'); | ||
console.log('rel', relativeAliasPath + '\n'); | ||
@@ -202,2 +199,3 @@ if (relativeAliasPath[0] !== '.') { | ||
const flen = files.length; | ||
let replaceCount = 0; | ||
for (let i = 0; i < flen; i += 1) { | ||
@@ -208,4 +206,7 @@ const file = files[i]; | ||
if (text !== newText) { | ||
replaceCount++; | ||
writeFileSync(file, newText, 'utf8'); | ||
} | ||
} | ||
console.info(`${replaceCount} files have been replaced!`); |
{ | ||
"compilerOptions": { | ||
"watch": true, | ||
"allowJs": false, | ||
@@ -9,3 +10,3 @@ "allowSyntheticDefaultImports": false, | ||
"declaration": true, | ||
"declarationDir": "lib", | ||
"declarationDir": "@types", | ||
"diagnostics": true, | ||
@@ -18,12 +19,12 @@ "forceConsistentCasingInFileNames": true, | ||
"moduleResolution": "Node", | ||
"noEmit": true, | ||
"noEmit": false, | ||
"noErrorTruncation": true, | ||
"noFallthroughCasesInSwitch": true, | ||
"noImplicitAny": false, | ||
"strictNullChecks": false, | ||
"noImplicitReturns": true, | ||
"noImplicitThis": true, | ||
"noUnusedLocals": true, | ||
"strictNullChecks": false, | ||
"noUnusedParameters": true, | ||
"outDir": "lib", | ||
"outDir": "bin", | ||
"paths": { | ||
@@ -41,3 +42,3 @@ "src/*": ["src/*"] | ||
"include": ["node_modules/@types", "src/**/*"], | ||
"exclude": ["node_modules"] | ||
"exclude": ["node_modules", "**/*.spec.*", "**/*.test.*"] | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
0
34
4
187227
17
622
1