You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
538 B
24 lines
538 B
'use strict';
|
|
|
|
// NOTE: the following code was partially adopted from https://github.com/iarna/in-publish
|
|
module.exports = function getNpmArgs() {
|
|
// https://github.com/iarna/in-publish/pull/14
|
|
if (process.env.npm_command) {
|
|
return [process.env.npm_command];
|
|
}
|
|
|
|
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;
|
|
};
|