只有 运行 yarn 时执行什么?

What is executed when only running yarn?

当 运行 在 package.json 中定义一个脚本时,使用 yarn 的通常方法是 yarn run myscriptname。但是只有运行宁yarn没有run myscriptname时到底执行了什么?它仍然会编译所有内容,但我想知道在没有参数的情况下调用时,它究竟是从什么以及从哪里获取有关 运行 的信息的。我正在使用的示例是 project in GitHub,package.json 如下所示:

{
  "private": true,
  "name": "parent",
  "version": "0.0.0",
  "engines": {
    "yarn": "1.0.x || >=1.2.1",
    "node": ">=7.9.0"
  },
  "devDependencies": {
    "@types/chai": "^4.0.1",
    "@types/chai-as-promised": "0.0.31",
    "@types/chai-string": "^1.4.0",
    "@types/jsdom": "^11.0.4",
    "@types/mocha": "^2.2.41",
    "@types/sinon": "^2.3.5",
    "@types/temp": "^0.8.29",
    "@types/webdriverio": "^4.7.0",
    "chai": "^4.1.0",
    "chai-string": "^1.4.0",
    "concurrently": "^3.5.0",
    "electron-mocha": "^3.5.0",
    "istanbul": "^0.4.5",
    "istanbul-instrumenter-loader": "^3.0.0",
    "jsdom": "^11.5.1",
    "lerna": "^2.2.0",
    "mocha": "^3.4.2",
    "nyc": "^11.0.3",
    "remap-istanbul": "^0.9.5",
    "rimraf": "^2.6.1",
    "selenium-standalone": "^6.2.0",
    "sinon": "^3.3.0",
    "temp": "^0.8.3",
    "ts-node": "^3.2.0",
    "tslint": "^5.7.0",
    "typedoc": "^0.8",
    "typescript": "^2.7.2",
    "uuid": "^3.1.0",
    "wdio-mocha-framework": "^0.5.9",
    "wdio-phantomjs-service": "^0.2.2",
    "wdio-selenium-standalone-service": "0.0.8",
    "wdio-spec-reporter": "^0.1.0",
    "webdriverio": "^4.6.2"
  },
  "scripts": {
    "prepare": "yarn rebuild:clean && yarn build:clean",
    "build": "run build",
    "build:clean": "run prepare",
    "docs": "run docs \"@theia/!(example-)*\"",
    "test": "yarn test:theia && yarn test:electron && yarn test:browser",
    "test:theia": "run test \"@theia/!(example-)*\" --parallel",
    "test:browser": "yarn rebuild:browser && run test \"@theia/example-browser\"",
    "test:electron": "yarn rebuild:electron && run test \"@theia/example-electron\"",
    "rebuild:clean": "rimraf .browser_modules",
    "rebuild:browser": "theia rebuild:browser",
    "rebuild:electron": "theia rebuild:electron",
    "rebuild:electron:debug": "DEBUG=electron-rebuild && yarn rebuild:electron",
    "watch": "lerna run watch --scope \"@theia/!(example-)*\" --parallel",
    "publish": "yarn && yarn test && yarn publish:latest",
    "publish:latest": "lerna publish --registry=https://registry.npmjs.org/ --skip-git",
    "publish:next": "lerna publish --registry=https://registry.npmjs.org/ --exact --canary=next --npm-tag=next --force-publish --skip-git --yes"
  },
  "workspaces": [
    "dev-packages/*",
    "packages/*",
    "examples/*"
  ]
}

根据:https://yarnpkg.com/lang/en/docs/cli/#toc-default-command

Running yarn with no command will run yarn install, passing through any provided flags.

yarn === npm install

它只安装来自 package.json 的节点包及其依赖项。

(现在你不应该使用 Yarn。NPM 是最快的)