首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >调用嵌套的package.json脚本

调用嵌套的package.json脚本
EN

Stack Overflow用户
提问于 2021-05-25 03:18:43
回答 1查看 578关注 0票数 1

因此,我有一个包脚本文件夹,它保存了我在react环境中构建的所有脚本:

代码语言:javascript
复制
const npsUtils = require('nps-utils')

module.exports = {
  scripts: {
    default: 'react-scripts start',
    build: 'react-scripts build',
    test: 'react-scripts test',
    eject: 'react-scripts eject',
    lint: {
      default: 'eslint ./ --ignore-path .gitignore',
      fix: 'yarn run lint -- --fix',
    },
    format: 'prettier --write "{,!(node_modules)/**/}*.js"',
    validate: npsUtils.concurrent.nps('lint', 'format', 'build'),
  },
}

但是,当我试图调用lint脚本时,它总是失败的。我的调用yarn start lint:fix总是失败,并给出错误

脚本必须解析为字符串。没有任何脚本可以从"lint:fix“中解析。

那我该怎么称呼皮棉修复呢?

EN

回答 1

Stack Overflow用户

发布于 2021-05-25 03:37:38

你可以这样做:

代码语言:javascript
复制
scripts: {
  ...
  "lint:default": "eslint ./ --ignore-path .gitignore",
  "lint:fix": "yarn run lint -- --fix",
  ...
}

并称之为:

代码语言:javascript
复制
yarn start lint:fix
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/67681314

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档