ant-design-vue/antd-tools/utils/get-npm-args.js

19 lines
407 B
JavaScript
Raw Normal View History

2018-03-18 11:59:38 +00:00
'use strict'
// NOTE: the following code was partially adopted from https://github.com/iarna/in-publish
module.exports = function getNpmArgs () {
let npmArgv = null
try {
npmArgv = JSON.parse(process.env.npm_config_argv)
} catch (err) {
return null
}
if (typeof npmArgv !== 'object' || !npmArgv.cooked || !Array.isArray(npmArgv.cooked)) {
return null
}
return npmArgv.cooked
}