lib/plugins/package/lib/zipService.js/excludeNodeDevDependencies
function excludeNodeDevDependencies(servicePath) {
  const cwd = process.cwd();
  let exclude = [];
  let include = [];

  try {
    const packageJsonFilePaths = globby.sync([
      '**/package.json',
      // TODO add glob for node_modules filtering
    ], {
      cwd: servicePath,
      dot: true,
      silent: true,
      follow: true,
      nosort: true,
    });

    // filter out non node_modules file paths
    const relevantFilePaths = _.filter(packageJsonFilePaths, (filePath) => {
      const isNodeModulesDir = !!filePath.match(/node_modules/);
      return !isNodeModulesDir;
    });

    _.forEach(relevantFilePaths, (relevantFilePath) => {
      // the path where the package.json file lives
      const fullPath = path.join(servicePath, relevantFilePath);
      const rootDirPath = fullPath.replace(path.join(path.sep, 'package.json'), '');

      process.chdir(rootDirPath);

      // TODO replace with package-manager independent directory traversal?!
      const prodDependencies = childProcess
        .execSync('npm ls --prod=true --parseable=true --silent')
        .toString().trim();

      const nodeModulesRegex = new RegExp(`${path.join('node_modules', path.sep)}.*`, 'g');
      const prodDependencyPaths = prodDependencies.match(nodeModulesRegex);

      let pathToDep = '';
      // if the package.json file is not in the root of the service path
      if (rootDirPath !== servicePath) {
        // the path without the servicePath prepended
        const relativeFilePath = rootDirPath.replace(path.join(servicePath, path.sep), '');
        pathToDep = relativeFilePath ? `${relativeFilePath}/` : '';
      }

      const includePatterns = _.map(prodDependencyPaths, (depPath) =>
        `${pathToDep}${depPath}/**`);

      if (includePatterns.length) {
        // at first exclude the whole node_modules directory
        // after that re-include the production relevant modules
        exclude = _.union(exclude, [`${pathToDep}node_modules/**`]);
        include = _.union(include, includePatterns);
      }
    });
  } catch (e) {
    // npm is not installed
  } finally {
    // make sure to always chdir back to the cwd, no matter what
    process.chdir(cwd);
  }

  return {
    exclude,
    include,
  };
}