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

19 lines
413 B
JavaScript
Raw Normal View History

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