Husky 和 lint-staged 无法 运行 gulp 命令
Husky and lint-staged unable to run gulp command
我正在尝试 运行 gulp 来自 package.json 的命令。但是无法执行。
这是我的package.json。
"scripts": {
"deploy": "gulp deploy",
"lint": "eslint",
"lint-fix": "eslint --ext .js"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"*": [
"gulp locale-sass", // not working
"npm run lint", // working fine
"git add"
]
},
"devDependencies": {
"@open-tech-world/cli-progress-bar": "^1.0.6",
"colors": "^1.4.0",
"console-table-printer": "^1.1.58",
"del": "^5.1.0",
"eslint": "^6.8.0",
"eslint-plugin-deprecate": "^0.7.0",
"glob": "^7.1.6",
"gulp": "^4.0.2",
"gulp-changed": "^4.0.2",
"gulp-clean": "^0.4.0",
"gulp-clean-css": "^4.2.0",
"gulp-compass": "^2.1.0",
"gulp-concat": "^2.6.1",
"gulp-consolidate": "0.2.0",
"gulp-css-globbing": "^0.2.2",
"gulp-debug": "^4.0.0",
"gulp-eslint": "^6.0.0",
"gulp-ext-replace": "^0.3.0",
"gulp-if": "^3.0.0",
"gulp-jshint": "^2.1.0",
"gulp-livereload": "^4.0.2",
"gulp-load-plugins": "^2.0.2",
"gulp-rename": "^2.0.0",
"gulp-replace": "^1.0.0",
"gulp-sass": "^4.0.2",
"gulp-sass-lint": "^1.4.0",
"gulp-scan": "^0.1.4",
"gulp-shell": "^0.7.1",
"gulp-sourcemaps": "^2.6.5",
"gulp-svg-symbols": "^3.2.3",
"gulp-svgmin": "^2.2.0",
"gulp-terser": "^1.2.0",
"gulp-util": "^3.0.8",
"gulp-watch": "^5.0.1",
"husky": "^4.2.5",
"jshint": "^2.11.0",
"jshint-stylish": "2.2.1",
"lint-staged": "^10.2.2",
"minimist": "^1.2.0",
"node-sass-asset-functions": "^0.1.0",
"npm-audit-resolver": "^2.2.0",
"path": "^0.12.7",
"sass-lint": "^1.13.1",
"through2": "^3.0.1"
}
}
npm 运行 lint 工作正常。
此处 gulp locale-sass 不工作。
✖ gulp locale-sass && npm 运行 lint:
任务从未定义:&&
列出可用任务,尝试 运行ning: gulp --tasks
使用gulp文件/u02/home/user01/drupal/drupal-7.9/sites/medic/gulpfile.js
husky > 预提交挂钩失败(添加 --no-verify 绕过)
我通过添加 "locale-sass"
和 lint-staged
npm run gulp locale-sass
而不是 gulp locale-sass
修改脚本部分来解决
"scripts": {
"deploy": "gulp deploy",
"lint": "eslint",
"lint-fix": "eslint --ext .js",
"locale-sass": "gulp locale-sass"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"*": [
"npm run gulp locale-sass", // Working
"npm run lint", // working
"git add"
]
},
我正在尝试 运行 gulp 来自 package.json 的命令。但是无法执行。
这是我的package.json。
"scripts": {
"deploy": "gulp deploy",
"lint": "eslint",
"lint-fix": "eslint --ext .js"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"*": [
"gulp locale-sass", // not working
"npm run lint", // working fine
"git add"
]
},
"devDependencies": {
"@open-tech-world/cli-progress-bar": "^1.0.6",
"colors": "^1.4.0",
"console-table-printer": "^1.1.58",
"del": "^5.1.0",
"eslint": "^6.8.0",
"eslint-plugin-deprecate": "^0.7.0",
"glob": "^7.1.6",
"gulp": "^4.0.2",
"gulp-changed": "^4.0.2",
"gulp-clean": "^0.4.0",
"gulp-clean-css": "^4.2.0",
"gulp-compass": "^2.1.0",
"gulp-concat": "^2.6.1",
"gulp-consolidate": "0.2.0",
"gulp-css-globbing": "^0.2.2",
"gulp-debug": "^4.0.0",
"gulp-eslint": "^6.0.0",
"gulp-ext-replace": "^0.3.0",
"gulp-if": "^3.0.0",
"gulp-jshint": "^2.1.0",
"gulp-livereload": "^4.0.2",
"gulp-load-plugins": "^2.0.2",
"gulp-rename": "^2.0.0",
"gulp-replace": "^1.0.0",
"gulp-sass": "^4.0.2",
"gulp-sass-lint": "^1.4.0",
"gulp-scan": "^0.1.4",
"gulp-shell": "^0.7.1",
"gulp-sourcemaps": "^2.6.5",
"gulp-svg-symbols": "^3.2.3",
"gulp-svgmin": "^2.2.0",
"gulp-terser": "^1.2.0",
"gulp-util": "^3.0.8",
"gulp-watch": "^5.0.1",
"husky": "^4.2.5",
"jshint": "^2.11.0",
"jshint-stylish": "2.2.1",
"lint-staged": "^10.2.2",
"minimist": "^1.2.0",
"node-sass-asset-functions": "^0.1.0",
"npm-audit-resolver": "^2.2.0",
"path": "^0.12.7",
"sass-lint": "^1.13.1",
"through2": "^3.0.1"
}
}
npm 运行 lint 工作正常。
此处 gulp locale-sass 不工作。
✖ gulp locale-sass && npm 运行 lint: 任务从未定义:&&
列出可用任务,尝试 运行ning: gulp --tasks
使用gulp文件/u02/home/user01/drupal/drupal-7.9/sites/medic/gulpfile.js
husky > 预提交挂钩失败(添加 --no-verify 绕过)
我通过添加 "locale-sass"
和 lint-staged
npm run gulp locale-sass
而不是 gulp locale-sass
"scripts": {
"deploy": "gulp deploy",
"lint": "eslint",
"lint-fix": "eslint --ext .js",
"locale-sass": "gulp locale-sass"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"*": [
"npm run gulp locale-sass", // Working
"npm run lint", // working
"git add"
]
},