SOURCE

const generateIngoreListByPath = (path) => {
  const pathSegment = path.split('/');
  const results = [];
  for (let i = 0, len = pathSegment.length; i < len - 1; i += 1) {
    results.push(`${pathSegment.slice(0, i + 1).join('/')}/*`);
    results.push(`!${pathSegment.slice(0, i + 2).join('/')}`);
  }
  return results;
};
 
const paths = generateIngoreListByPath('src/views/platform/income/*');
const ignoreStr = paths.join('\n');
console.log(ignoreStr);
console 命令行工具 X clear

                    
>
console