@easyv/cli
Advanced tools
Comparing version 1.10.4-beta.22 to 1.10.4-beta.23
{ | ||
"name": "@easyv/cli", | ||
"version": "1.10.4-beta.22", | ||
"version": "1.10.4-beta.23", | ||
"description": "Easy[V] component tools", | ||
@@ -5,0 +5,0 @@ "engines": { |
@@ -17,55 +17,34 @@ | ||
}) | ||
console.log(files, 'files', configPath); | ||
if (Array.isArray(files) && files.length) { | ||
const name = files[0].split('.')[0]; | ||
try { | ||
let jsonFile = fs.existsSync( | ||
path.join(configPath, name + '.json'), | ||
); | ||
glob( | ||
`{*.common.assets.{json,js},subConfigs/*.common.assets.{json,js}}`, | ||
{ | ||
cwd: configPath, | ||
}, | ||
function (err, matches) { | ||
console.log(err, matches); | ||
if (err || matches.length === 0) { | ||
// callback( | ||
// `main.json or main.data.json cannot be found in ${configPath}`, | ||
// ); | ||
return config; | ||
} | ||
matches | ||
.map((filename) => filename.split('.')[0]) | ||
.some((name, i) => { | ||
try { | ||
let jsonFile = fs.existsSync( | ||
path.join(configPath, name + '.json'), | ||
); | ||
if (jsonFile) { | ||
config = JSON.parse( | ||
fs.readFileSync(path.resolve(configPath, name + '.json')), | ||
{ encoding: 'utf8' }, | ||
); | ||
} else { | ||
Object.keys(require.cache).forEach(function (key) { | ||
if (key.includes('node_modules')) { | ||
return; | ||
} | ||
delete require.cache[key]; | ||
}); | ||
config = require(path.resolve( | ||
configPath, | ||
name + '.js', | ||
)).default; | ||
} | ||
} catch (error) { | ||
// 不存在也很正常 | ||
if (jsonFile) { | ||
config = JSON.parse( | ||
fs.readFileSync(path.resolve(configPath, name + '.json')), | ||
{ encoding: 'utf8' }, | ||
); | ||
} else { | ||
Object.keys(require.cache).forEach(function (key) { | ||
if (key.includes('node_modules')) { | ||
return; | ||
} | ||
delete require.cache[key]; | ||
}); | ||
}) | ||
}); | ||
config = require(path.resolve( | ||
configPath, | ||
name + '.js', | ||
)).default; | ||
} | ||
} catch (error) { | ||
// 不存在也很正常 | ||
} | ||
} | ||
console.log(files, 'files', configPath); | ||
return config; | ||
} |
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
42729
1292