craco-alias
Advanced tools
Comparing version 2.1.1 to 2.2.0
{ | ||
"name": "craco-alias", | ||
"version": "2.1.1", | ||
"version": "2.2.0", | ||
"description": "A craco plugin for automatic aliases generation", | ||
@@ -5,0 +5,0 @@ "main": "plugin/index.js", |
@@ -5,3 +5,3 @@ const exitWithError = message => { | ||
console.log( | ||
'\nPlease read plugin documentation:', | ||
'\nPlugin documentation:', | ||
'\x1b[34mhttps://github.com/risenforces/craco-alias\x1b[0m' | ||
@@ -8,0 +8,0 @@ ) |
@@ -11,3 +11,3 @@ const checkConfigContents = ({ | ||
} catch (err) { | ||
return handleError(`Cannot parse ${configFileName}`) | ||
return handleError(`Cannot parse ${configFileName}. Please validate it on https://jsonformatter.curiousconcept.com.`) | ||
} | ||
@@ -14,0 +14,0 @@ |
@@ -21,3 +21,3 @@ const check = require('./check-config-contents') | ||
expect(handleErrorMock).toHaveBeenLastCalledWith( | ||
`Cannot parse ${configFileName}` | ||
`Cannot parse ${configFileName}. Please validate it on https://jsonformatter.curiousconcept.com.` | ||
) | ||
@@ -24,0 +24,0 @@ }) |
@@ -127,7 +127,24 @@ # craco-alias | ||
{ | ||
compilerOptions: { | ||
baseUrl: "src", | ||
paths: { | ||
"@file": ["file.js"], | ||
"@dir/*": ["dir/*", "dir"] | ||
"compilerOptions": { | ||
"baseUrl": "./src", | ||
"paths": { | ||
// file aliases | ||
"@baz": ["./baz.js"], | ||
"@boo": ["./boo.jsx"], | ||
// folder aliases | ||
"@root": ["./"], | ||
"@root/*": ["./*"], | ||
"@lib": ["./lib"], | ||
"@lib/*": ["./lib/*"], | ||
// package aliases (types is optional without ts) | ||
"@my-react-select": [ | ||
"../node_modules/react-select", | ||
"../node_modules/@types/react-select" | ||
], | ||
"@my-react-select/*": [ | ||
"../node_modules/react-select/*", | ||
"../node_modules/@types/react-select" | ||
] | ||
} | ||
@@ -148,11 +165,27 @@ } | ||
3. Edit it as follows: | ||
```js | ||
{ | ||
"compilerOptions": { | ||
// baseUrl is optional for plugin, but some IDEs require it | ||
"baseUrl": "src", | ||
"baseUrl": "./src", | ||
"paths": { | ||
"@file-alias": ["./your/file.tsx"], | ||
"@folder-alias/*": ["./very/long/path/*", "./very/long/path/"] | ||
// file aliases | ||
"@baz": ["./baz.ts"], | ||
"@boo": ["./boo.tsx"], | ||
// folder aliases | ||
"@root": ["./"], | ||
"@root/*": ["./*"], | ||
"@lib": ["./lib"], | ||
"@lib/*": ["./lib/*"], | ||
// package aliases | ||
"@my-react-select": [ | ||
"../node_modules/react-select", | ||
"../node_modules/@types/react-select" | ||
], | ||
"@my-react-select/*": [ | ||
"../node_modules/react-select/*", | ||
"../node_modules/@types/react-select" | ||
] | ||
} | ||
@@ -159,0 +192,0 @@ } |
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
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
31293
30
243