New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@redbuck/shrink

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@redbuck/shrink

remove redundant file create by webpack watch mode

latest
npmnpm
Version
1.1.2
Version published
Maintainers
1
Created
Source

一个用于提交前清除文件的工具

该工具为三部定制. 三部前端页面使用webpack打包.生成文件时,会将content-hash加入文件名. 因此生成的文件会越来越多. 同时watch模式时,也会产生大量文件

该工具利用husky@1.3.1提供的git钩子功能. 提交时,扫描cshtml文件,获取对应的js/css文件标记以及本次构建的hash. 然后再检查提交的文件中对应的js/css文件,删除其中hash不符的文件.

使用

  • 挂vpn
  • 切换npm源为http://nexus.ops.svc.cluster.test/repository/npm-all/
  • 项目根目录下执行yarn add shrink -d
  • 执行node ./node_modules/shrink

参数

传参方式可以通过命令行或者配置shrinkrc.js

  • 命令 node ./node_modules/shrink --staged false --log false
  • shrinkrc.js 一个commonjs模块.

两者冲突时,shrinkrc.js优先级高

参数描述

属性类型默认值描述
sincestringundefinedgit revision
stagedbooleantrue是否只检查暂存区
restagebooleantrue删除冗余文件后是否重新暂存
removebooleanfalse是否删除冗余文件
logbooleantrue是否打印冗余文件
branchstringundefined需要检查的分支
matcherfunction()=>true用于筛选目标文件
supportsstring[]['.js', '.css', '.cshtml']筛选目标文件的扩展名

FAQs

Package last updated on 29 Jun 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts