Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-app-alias

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-app-alias - npm Package Compare versions

Comparing version 2.0.2 to 2.1.0

2

package.json
{
"name": "react-app-alias",
"version": "2.0.2",
"version": "2.1.0",
"description": "Alias for craco or rewire react app",

@@ -5,0 +5,0 @@ "keywords": [

@@ -102,2 +102,26 @@ const fs = require('fs')

function autoscan(tasks) {
const dirlist = dir =>
fs.readdirSync(dir).filter(
file => fs.statSync(path.resolve(dir, file)).isDirectory())
if(!Array.isArray(tasks)) tasks = tasks ? [tasks] : []
tasks = tasks.map(task => (task===task+'') ? {path: task} : task)
tasks = tasks.map(task => ({
prefix: '',
suffix: '',
...task,
}))
const aliasMap = tasks.map(task => (
dirlist(task.path).reduce(
(a, alias) => ({
...a,
[task.prefix + alias + task.suffix]:
path.join(task.path, alias)
}),
{}
)
)).reduce((a, map) => ({...a, ...map}), {})
return aliasMap
}
function configFilePath(configPath = '') {

@@ -144,3 +168,3 @@ if(

const paths = configPathsRaw(confPath)
return Object.keys(paths).reduce( (a, path) => {
const aliasMap = Object.keys(paths).reduce( (a, path) => {
const value = paths[path]

@@ -151,2 +175,3 @@ const target = Array.isArray(value) ? value[0] : value

}, {})
return aliasMap
}

@@ -159,5 +184,10 @@

const aliasMap = options.alias || configPaths(configPath)
const aliasAutoMap = autoscan(options.autoscan)
const opts = {
...options,
aliasMap,
aliasMap: {
...aliasAutoMap,
...aliasMap,
},
}

@@ -189,2 +219,3 @@ return opts

aliasJest,
autoscan,
configFilePath,

@@ -191,0 +222,0 @@ configPathsRaw,

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc