diff --git a/.azure-pipelines-steps.yml b/.azure-pipelines-steps.yml index a96b8a6cfb18..c4e9f857d422 100644 --- a/.azure-pipelines-steps.yml +++ b/.azure-pipelines-steps.yml @@ -6,7 +6,7 @@ steps: - checkout: self path: jest - # Ensure Node.js 10 is active + # Ensure Node.js 12 is active - task: NodeTool@0 inputs: versionSpec: '12.x' diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml index aedf9b8cb3cf..141c9cffea6c 100644 --- a/.azure-pipelines.yml +++ b/.azure-pipelines.yml @@ -21,7 +21,7 @@ jobs: - job: macOS pool: - vmImage: macos-10.13 + vmImage: macos-10.15 steps: # This step can be removed once Mercurial gets installed on the macOS image. See https://github.com/Microsoft/azure-pipelines-image-generation/issues/604 - script: HOMEBREW_NO_AUTO_UPDATE=1 brew install mercurial diff --git a/.circleci/config.yml b/.circleci/config.yml index 19a63639ed13..bd9be807475f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -18,33 +18,6 @@ aliases: version: 2 jobs: - lint-and-typecheck: - working_directory: ~/jest - docker: - - image: circleci/node:12 - steps: - - checkout - - restore-cache: *restore-cache - - run: yarn --no-progress --frozen-lockfile - - save-cache: *save-cache - - run: yarn lint --format junit -o reports/junit/js-lint-results.xml && yarn lint-es5-build --format junit -o reports/junit/js-es5-lint-results.xml && yarn lint:prettier:ci && yarn check-copyright-headers - - store_test_results: - path: reports/junit - - test-node-8: - working_directory: ~/jest - docker: - - image: circleci/node:8 - steps: - - checkout - - restore-cache: *restore-cache - - run: *install - - save-cache: *save-cache - - run: - command: yarn test-ci-partial - - store_test_results: - path: reports/junit - test-node-10: working_directory: ~/jest docker: @@ -69,7 +42,7 @@ jobs: - run: *install - save-cache: *save-cache - run: - command: JEST_CIRCUS=1 yarn test-ci-partial + command: JEST_CIRCUS=1 yarn test-ci-partial && JEST_CIRCUS=1 yarn test-leak - store_test_results: path: reports/junit @@ -101,16 +74,19 @@ jobs: - store_test_results: path: reports/junit - test-browser: + test-node-14: working_directory: ~/jest docker: - - image: circleci/node:12-browsers + - image: circleci/node:14 steps: - checkout - restore-cache: *restore-cache - run: *install - save-cache: *save-cache - - run: yarn test-ci-es5-build-in-browser + - run: + command: yarn test-ci-partial + - store_test_results: + path: reports/junit test-or-deploy-website: working_directory: ~/jest @@ -131,12 +107,10 @@ workflows: version: 2 build-and-deploy: jobs: - - lint-and-typecheck - - test-node-8 - test-node-10 - test-node-12 - - test-node-13 # current + - test-node-13 + - test-node-14 # current - test-jest-circus - - test-browser - test-or-deploy-website: filters: *filter-ignore-gh-pages diff --git a/.circleci/website.sh b/.circleci/website.sh index e964e431e670..b20b2d567c59 100755 --- a/.circleci/website.sh +++ b/.circleci/website.sh @@ -3,7 +3,7 @@ set -e git diff-tree --no-commit-id --name-only -r HEAD > files_changed.txt -if ! grep -E "(^docs\/.*)|(^website\/.*)" files_changed.txt; then +if ! grep -E "(^docs\/.*)|(^website\/.*)|(^\.circleci/website\.sh$)" files_changed.txt; then echo "Skipping deploy & test. No relevant website files have changed" else echo "Relevant website files have changed" @@ -13,7 +13,7 @@ else git config --global user.name "Website Deployment Script" echo "machine github.com login docusaurus-bot password $DOCUSAURUS_PUBLISH_TOKEN" > ~/.netrc # install Docusaurus and generate file of English strings - yarn && cd website && yarn write-translations + yarn && cd website && node fetchSupporters.js && yarn write-translations # crowdin install sudo apt-get update sudo apt-get install default-jre rsync @@ -30,6 +30,6 @@ else GIT_USER=docusaurus-bot USE_SSH=false yarn publish-gh-pages else echo "Skipping deploy. Test website build" - cd website && yarn && yarn build + cd website && yarn && node fetchSupporters.js && yarn build fi fi diff --git a/.eslintignore b/.eslintignore index a16ec3b78eaa..be8072a6a850 100644 --- a/.eslintignore +++ b/.eslintignore @@ -3,11 +3,11 @@ bin/ flow-typed/** packages/*/build/** -packages/*/build-es5/** packages/jest-diff/src/cleanupSemantic.ts website/blog website/build website/node_modules website/i18n/*.js website/translated_docs +website/static !.eslintrc.js diff --git a/.eslintrc.js b/.eslintrc.js index 29230dde3409..b72d563d7295 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -12,6 +12,7 @@ module.exports = { 'plugin:import/typescript', 'prettier', 'prettier/flowtype', + 'plugin:eslint-comments/recommended', ], overrides: [ { @@ -67,11 +68,40 @@ module.exports = { }, }, { - files: ['packages/jest-types/**/*'], + files: 'packages/jest-types/**/*', rules: { 'import/no-extraneous-dependencies': 0, }, }, + { + files: 'packages/**/*.ts', + rules: { + '@typescript-eslint/explicit-module-boundary-types': 2, + }, + }, + { + files: [ + '**/__tests__/**', + '**/__mocks__/**', + 'packages/jest-jasmine2/src/jasmine/**/*', + 'packages/expect/src/jasmineUtils.ts', + '**/vendor/**/*', + ], + rules: { + '@typescript-eslint/explicit-module-boundary-types': 0, + }, + }, + { + files: [ + 'packages/jest-jasmine2/src/jasmine/**/*', + 'packages/expect/src/jasmineUtils.ts', + '**/vendor/**/*', + ], + rules: { + 'eslint-comments/disable-enable-pair': 0, + 'eslint-comments/no-unlimited-disable': 0, + }, + }, { files: [ 'website/**', @@ -85,9 +115,10 @@ module.exports = { }, ], parser: 'babel-eslint', - plugins: ['markdown', 'import', 'prettier'], + plugins: ['markdown', 'import', 'prettier', 'eslint-comments'], rules: { 'arrow-body-style': 2, + 'eslint-comments/no-unused-disable': 2, 'flowtype/boolean-style': 2, 'flowtype/no-primitive-constructor-types': 2, 'flowtype/require-valid-file-annotation': 2, @@ -100,7 +131,7 @@ module.exports = { '**/__mocks__/**', '**/?(*.)(spec|test).js?(x)', 'scripts/**', - 'eslintImportResolver.js', + 'babel.config.js', 'testSetupFile.js', ], }, @@ -110,8 +141,18 @@ module.exports = { // https://github.com/benmosher/eslint-plugin-import/issues/645 'import/order': 0, 'no-console': 0, + 'no-restricted-imports': [ + 2, + { + message: 'Please use graceful-fs instead.', + name: 'fs', + }, + ], 'no-unused-vars': 2, 'prettier/prettier': 2, 'sort-imports': [2, {ignoreDeclarationSort: true}], }, + settings: { + 'import/ignore': ['react-native'], + }, }; diff --git a/.github/ISSUE_TEMPLATE/bug.md b/.github/ISSUE_TEMPLATE/bug.md index da3db079e46c..d39efb62a3a6 100644 --- a/.github/ISSUE_TEMPLATE/bug.md +++ b/.github/ISSUE_TEMPLATE/bug.md @@ -32,6 +32,6 @@ Run npx envinfo --preset jest Paste the results here: --> -```bash +``` ``` diff --git a/.github/ISSUE_TEMPLATE/regression.md b/.github/ISSUE_TEMPLATE/regression.md index 01da71a7c761..ae6a07a822fe 100644 --- a/.github/ISSUE_TEMPLATE/regression.md +++ b/.github/ISSUE_TEMPLATE/regression.md @@ -34,6 +34,6 @@ Issues without a reproduction link are likely to stall. Paste the results here: -```bash +``` ``` diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml new file mode 100644 index 000000000000..733cd73f5ea0 --- /dev/null +++ b/.github/workflows/nodejs.yml @@ -0,0 +1,90 @@ +name: Node CI + +on: + push: + branches: + - master + pull_request: + branches: + - '**' + +jobs: + cleanup-runs: + runs-on: ubuntu-latest + steps: + - uses: rokroskar/workflow-run-cleanup-action@master + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + if: "!startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/master'" + + lint-and-typecheck: + name: Running TypeScript compiler & ESLint + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Get yarn cache + id: yarn-cache + run: echo "::set-output name=dir::$(yarn cache dir)" + - uses: actions/cache@v1 + with: + path: ${{ steps.yarn-cache.outputs.dir }} + key: ubuntu-latest-node-12.x-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ubuntu-latest-node-12.x-yarn- + - uses: actions/setup-node@v1 + with: + node-version: 12.x + - name: install + run: yarn install-no-ts-build + - name: build + run: node scripts/build.js + - name: run tsc + run: yarn build:ts + - name: verify TypeScript@3.8 compatibility + run: yarn verify-old-ts + - name: run eslint + run: yarn lint + - name: run prettier + run: yarn lint:prettier:ci + - name: check copyright headers + run: yarn check-copyright-headers + test: + name: Node v${{ matrix.node-version }} on ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + node-version: [10.x, 12.x, 13.x, 14.x] + os: [ubuntu-latest, macOS-latest, windows-latest] + runs-on: ${{ matrix.os }} + + steps: + - name: Set git config + shell: bash + run: | + git config --global core.autocrlf false + git config --global core.symlinks true + if: runner.os == 'Windows' + - uses: actions/checkout@v2 + - name: Get yarn cache + id: yarn-cache + run: echo "::set-output name=dir::$(yarn cache dir)" + - uses: actions/cache@v1 + with: + path: ${{ steps.yarn-cache.outputs.dir }} + key: ${{ runner.os }}-node-${{ matrix.node-version }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-node-${{ matrix.node-version }}-yarn- + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - name: remove prettier dep + run: yarn remove-prettier-dep + if: matrix.node-version == '8.17.0' + - name: install + run: yarn install-no-ts-build + - name: run tests + run: yarn test-ci-partial + env: + CI: true diff --git a/.gitignore b/.gitignore index 68f339b4945a..c6b727d6dfa1 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ *.swp *~ /examples/*/node_modules/ +/examples/mongodb/globalConfig.json /e2e/*/node_modules /e2e/*/.pnp @@ -16,7 +17,6 @@ /node_modules /packages/*/build/ -/packages/*/build-es5/ /packages/*/coverage/ /packages/*/node_modules/ /packages/*/package-lock.json @@ -38,3 +38,8 @@ yarn-error.log* junit.xml *.tsbuildinfo + +.pnp.js +.yarn/unplugged/ +.yarn/build-state.yml +e2e/async-regenerator/.yarn/ diff --git a/.vscode/launch.json b/.vscode/launch.json index f4106b4f6605..5de4feacd272 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -7,10 +7,15 @@ { "type": "node", "request": "launch", - "name": "Debug Jest with current test file", - "program": "${workspaceFolder}/packages/jest-cli/bin/jest.js", - "args": ["--runInBand", "${file}"], - "runtimeArgs": ["-r", "flow-remove-types/register"] + "name": "Jest Current File", + "program": "${workspaceFolder}/node_modules/.bin/jest", + "args": ["${fileBasenameNoExtension}"], + "console": "integratedTerminal", + "internalConsoleOptions": "neverOpen", + "disableOptimisticBPs": true, + "windows": { + "program": "${workspaceFolder}/node_modules/jest/bin/jest" + } } ] } diff --git a/.vscode/settings.json b/.vscode/settings.json index c4951686b125..0dcce386c953 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -5,9 +5,10 @@ "**/node_modules": true, "**/build": true }, - "editor.formatOnSave": true, - "flow.useNPMPackagedFlow": true, "javascript.validate.enable": false, "jest.pathToJest": "yarn jest --", - "prettier.eslintIntegration": true + "editor.codeActionsOnSave": { + "source.fixAll.eslint": true + }, + "typescript.tsdk": "node_modules/typescript/lib" } diff --git a/.yarn/releases/yarn-1.19.1.js b/.yarn/releases/yarn-1.22.4.js similarity index 99% rename from .yarn/releases/yarn-1.19.1.js rename to .yarn/releases/yarn-1.22.4.js index 9b78da7a773b..20c45edf99df 100755 --- a/.yarn/releases/yarn-1.19.1.js +++ b/.yarn/releases/yarn-1.22.4.js @@ -1405,7 +1405,7 @@ function _load_glob() { var _os; function _load_os() { - return _os = _interopRequireDefault(__webpack_require__(49)); + return _os = _interopRequireDefault(__webpack_require__(46)); } var _path; @@ -1832,7 +1832,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.getPathKey = getPathKey; -const os = __webpack_require__(49); +const os = __webpack_require__(46); const path = __webpack_require__(0); const userHome = __webpack_require__(67).default; @@ -4388,7 +4388,7 @@ module.exports = require("url"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_isObject__ = __webpack_require__(444); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__util_isFunction__ = __webpack_require__(154); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__util_tryCatch__ = __webpack_require__(56); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__util_errorObject__ = __webpack_require__(47); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__util_errorObject__ = __webpack_require__(48); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__util_UnsubscriptionError__ = __webpack_require__(441); /** PURE_IMPORTS_START _util_isArray,_util_isObject,_util_isFunction,_util_tryCatch,_util_errorObject,_util_UnsubscriptionError PURE_IMPORTS_END */ @@ -25141,6 +25141,12 @@ SafeBuffer.allocUnsafeSlow = function (size) { /***/ }), /* 46 */ +/***/ (function(module, exports) { + +module.exports = require("os"); + +/***/ }), +/* 47 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -25196,7 +25202,7 @@ var MapSubscriber = /*@__PURE__*/ (function (_super) { /***/ }), -/* 47 */ +/* 48 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -25207,7 +25213,7 @@ var errorObject = { e: {} }; /***/ }), -/* 48 */ +/* 49 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -25219,12 +25225,6 @@ function isScheduler(value) { //# sourceMappingURL=isScheduler.js.map -/***/ }), -/* 49 */ -/***/ (function(module, exports) { - -module.exports = require("os"); - /***/ }), /* 50 */ /***/ (function(module, exports, __webpack_require__) { @@ -25425,7 +25425,7 @@ module.exports = new Schema({ "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = tryCatch; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__errorObject__ = __webpack_require__(47); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__errorObject__ = __webpack_require__(48); /** PURE_IMPORTS_START _errorObject PURE_IMPORTS_END */ var tryCatchTarget; @@ -25959,7 +25959,7 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isEmpty", function() { return __WEBPACK_IMPORTED_MODULE_37__internal_operators_isEmpty__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_38__internal_operators_last__ = __webpack_require__(868); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "last", function() { return __WEBPACK_IMPORTED_MODULE_38__internal_operators_last__["a"]; }); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_39__internal_operators_map__ = __webpack_require__(46); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_39__internal_operators_map__ = __webpack_require__(47); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "map", function() { return __WEBPACK_IMPORTED_MODULE_39__internal_operators_map__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_40__internal_operators_mapTo__ = __webpack_require__(869); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "mapTo", function() { return __WEBPACK_IMPORTED_MODULE_40__internal_operators_mapTo__["a"]; }); @@ -26636,7 +26636,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de const path = __webpack_require__(0); -const home = exports.home = __webpack_require__(49).homedir(); +const home = exports.home = __webpack_require__(46).homedir(); const userHomeDir = (_rootUser || _load_rootUser()).default ? path.resolve('/usr/local/share') : home; @@ -34805,15 +34805,27 @@ function hasMergeConflicts(str) { function parse(str, fileLoc) { const parser = new Parser(str, fileLoc); parser.next(); - try { - return parser.parse(); - } catch (error1) { + + if (!fileLoc.endsWith(`.yml`)) { try { - return safeLoad(str, { - schema: FAILSAFE_SCHEMA - }); - } catch (error2) { - throw error1; + return parser.parse(); + } catch (error1) { + try { + return safeLoad(str, { + schema: FAILSAFE_SCHEMA + }); + } catch (error2) { + throw error1; + } + } + } else { + const result = safeLoad(str, { + schema: FAILSAFE_SCHEMA + }); + if (typeof result === 'object') { + return result; + } else { + return {}; } } } @@ -35333,7 +35345,7 @@ function _load_isCi() { var _os; function _load_os() { - return _os = _interopRequireDefault(__webpack_require__(49)); + return _os = _interopRequireDefault(__webpack_require__(46)); } function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } @@ -40721,7 +40733,7 @@ var FilterSubscriber = /*@__PURE__*/ (function (_super) { /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_subscribeToResult__ = __webpack_require__(14); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__OuterSubscriber__ = __webpack_require__(13); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__InnerSubscriber__ = __webpack_require__(84); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__map__ = __webpack_require__(46); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__map__ = __webpack_require__(47); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__observable_from__ = __webpack_require__(62); /** PURE_IMPORTS_START tslib,_util_subscribeToResult,_OuterSubscriber,_InnerSubscriber,_map,_observable_from PURE_IMPORTS_END */ @@ -45918,7 +45930,7 @@ var config = { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = concat; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__util_isScheduler__ = __webpack_require__(48); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__util_isScheduler__ = __webpack_require__(49); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__of__ = __webpack_require__(311); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__from__ = __webpack_require__(62); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__operators_concatAll__ = __webpack_require__(429); @@ -46321,7 +46333,7 @@ var pump = __webpack_require__(781) var mkdirp = __webpack_require__(145) var fs = __webpack_require__(5) var path = __webpack_require__(0) -var os = __webpack_require__(49) +var os = __webpack_require__(46) var win32 = os.platform() === 'win32' @@ -46666,7 +46678,7 @@ function mkdirfix (name, opts, cb) { /* 194 */ /***/ (function(module, exports) { -module.exports = {"name":"yarn","installationMethod":"unknown","version":"1.19.1","license":"BSD-2-Clause","preferGlobal":true,"description":"📦🐈 Fast, reliable, and secure dependency management.","dependencies":{"@zkochan/cmd-shim":"^3.1.0","babel-runtime":"^6.26.0","bytes":"^3.0.0","camelcase":"^4.0.0","chalk":"^2.1.0","cli-table3":"^0.4.0","commander":"^2.9.0","death":"^1.0.0","debug":"^3.0.0","deep-equal":"^1.0.1","detect-indent":"^5.0.0","dnscache":"^1.0.1","glob":"^7.1.1","gunzip-maybe":"^1.4.0","hash-for-dep":"^1.2.3","imports-loader":"^0.8.0","ini":"^1.3.4","inquirer":"^6.2.0","invariant":"^2.2.0","is-builtin-module":"^2.0.0","is-ci":"^1.0.10","is-webpack-bundle":"^1.0.0","js-yaml":"^3.13.1","leven":"^2.0.0","loud-rejection":"^1.2.0","micromatch":"^2.3.11","mkdirp":"^0.5.1","node-emoji":"^1.6.1","normalize-url":"^2.0.0","npm-logical-tree":"^1.2.1","object-path":"^0.11.2","proper-lockfile":"^2.0.0","puka":"^1.0.0","read":"^1.0.7","request":"^2.87.0","request-capture-har":"^1.2.2","rimraf":"^2.5.0","semver":"^5.1.0","ssri":"^5.3.0","strip-ansi":"^4.0.0","strip-bom":"^3.0.0","tar-fs":"^1.16.0","tar-stream":"^1.6.1","uuid":"^3.0.1","v8-compile-cache":"^2.0.0","validate-npm-package-license":"^3.0.4","yn":"^2.0.0"},"devDependencies":{"babel-core":"^6.26.0","babel-eslint":"^7.2.3","babel-loader":"^6.2.5","babel-plugin-array-includes":"^2.0.3","babel-plugin-inline-import":"^3.0.0","babel-plugin-transform-builtin-extend":"^1.1.2","babel-plugin-transform-inline-imports-commonjs":"^1.0.0","babel-plugin-transform-runtime":"^6.4.3","babel-preset-env":"^1.6.0","babel-preset-flow":"^6.23.0","babel-preset-stage-0":"^6.0.0","babylon":"^6.5.0","commitizen":"^2.9.6","cz-conventional-changelog":"^2.0.0","eslint":"^4.3.0","eslint-config-fb-strict":"^22.0.0","eslint-plugin-babel":"^5.0.0","eslint-plugin-flowtype":"^2.35.0","eslint-plugin-jasmine":"^2.6.2","eslint-plugin-jest":"^21.0.0","eslint-plugin-jsx-a11y":"^6.0.2","eslint-plugin-prefer-object-spread":"^1.2.1","eslint-plugin-prettier":"^2.1.2","eslint-plugin-react":"^7.1.0","eslint-plugin-relay":"^0.0.28","eslint-plugin-yarn-internal":"file:scripts/eslint-rules","execa":"^0.11.0","fancy-log":"^1.3.2","flow-bin":"^0.66.0","git-release-notes":"^3.0.0","gulp":"^4.0.0","gulp-babel":"^7.0.0","gulp-if":"^2.0.1","gulp-newer":"^1.0.0","gulp-plumber":"^1.0.1","gulp-sourcemaps":"^2.2.0","jest":"^22.4.4","jsinspect":"^0.12.6","minimatch":"^3.0.4","mock-stdin":"^0.3.0","prettier":"^1.5.2","string-replace-loader":"^2.1.1","temp":"^0.8.3","webpack":"^2.1.0-beta.25","yargs":"^6.3.0"},"resolutions":{"sshpk":"^1.14.2"},"engines":{"node":">=4.0.0"},"repository":"yarnpkg/yarn","bin":{"yarn":"./bin/yarn.js","yarnpkg":"./bin/yarn.js"},"scripts":{"build":"gulp build","build-bundle":"node ./scripts/build-webpack.js","build-chocolatey":"powershell ./scripts/build-chocolatey.ps1","build-deb":"./scripts/build-deb.sh","build-dist":"bash ./scripts/build-dist.sh","build-win-installer":"scripts\\build-windows-installer.bat","changelog":"git-release-notes $(git describe --tags --abbrev=0 $(git describe --tags --abbrev=0)^)..$(git describe --tags --abbrev=0) scripts/changelog.md","dupe-check":"yarn jsinspect ./src","lint":"eslint . && flow check","pkg-tests":"yarn --cwd packages/pkg-tests jest yarn.test.js","prettier":"eslint src __tests__ --fix","release-branch":"./scripts/release-branch.sh","test":"yarn lint && yarn test-only","test-only":"node --max_old_space_size=4096 node_modules/jest/bin/jest.js --verbose","test-only-debug":"node --inspect-brk --max_old_space_size=4096 node_modules/jest/bin/jest.js --runInBand --verbose","test-coverage":"node --max_old_space_size=4096 node_modules/jest/bin/jest.js --coverage --verbose","watch":"gulp watch","commit":"git-cz"},"jest":{"collectCoverageFrom":["src/**/*.js"],"testEnvironment":"node","modulePathIgnorePatterns":["__tests__/fixtures/","packages/pkg-tests/pkg-tests-fixtures","dist/"],"testPathIgnorePatterns":["__tests__/(fixtures|__mocks__)/","updates/","_(temp|mock|install|init|helpers).js$","packages/pkg-tests"]},"config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}}} +module.exports = {"name":"yarn","installationMethod":"unknown","version":"1.22.4","license":"BSD-2-Clause","preferGlobal":true,"description":"📦🐈 Fast, reliable, and secure dependency management.","dependencies":{"@zkochan/cmd-shim":"^3.1.0","babel-runtime":"^6.26.0","bytes":"^3.0.0","camelcase":"^4.0.0","chalk":"^2.1.0","cli-table3":"^0.4.0","commander":"^2.9.0","death":"^1.0.0","debug":"^3.0.0","deep-equal":"^1.0.1","detect-indent":"^5.0.0","dnscache":"^1.0.1","glob":"^7.1.1","gunzip-maybe":"^1.4.0","hash-for-dep":"^1.2.3","imports-loader":"^0.8.0","ini":"^1.3.4","inquirer":"^6.2.0","invariant":"^2.2.0","is-builtin-module":"^2.0.0","is-ci":"^1.0.10","is-webpack-bundle":"^1.0.0","js-yaml":"^3.13.1","leven":"^2.0.0","loud-rejection":"^1.2.0","micromatch":"^2.3.11","mkdirp":"^0.5.1","node-emoji":"^1.6.1","normalize-url":"^2.0.0","npm-logical-tree":"^1.2.1","object-path":"^0.11.2","proper-lockfile":"^2.0.0","puka":"^1.0.0","read":"^1.0.7","request":"^2.87.0","request-capture-har":"^1.2.2","rimraf":"^2.5.0","semver":"^5.1.0","ssri":"^5.3.0","strip-ansi":"^4.0.0","strip-bom":"^3.0.0","tar-fs":"^1.16.0","tar-stream":"^1.6.1","uuid":"^3.0.1","v8-compile-cache":"^2.0.0","validate-npm-package-license":"^3.0.4","yn":"^2.0.0"},"devDependencies":{"babel-core":"^6.26.0","babel-eslint":"^7.2.3","babel-loader":"^6.2.5","babel-plugin-array-includes":"^2.0.3","babel-plugin-inline-import":"^3.0.0","babel-plugin-transform-builtin-extend":"^1.1.2","babel-plugin-transform-inline-imports-commonjs":"^1.0.0","babel-plugin-transform-runtime":"^6.4.3","babel-preset-env":"^1.6.0","babel-preset-flow":"^6.23.0","babel-preset-stage-0":"^6.0.0","babylon":"^6.5.0","commitizen":"^2.9.6","cz-conventional-changelog":"^2.0.0","eslint":"^4.3.0","eslint-config-fb-strict":"^22.0.0","eslint-plugin-babel":"^5.0.0","eslint-plugin-flowtype":"^2.35.0","eslint-plugin-jasmine":"^2.6.2","eslint-plugin-jest":"^21.0.0","eslint-plugin-jsx-a11y":"^6.0.2","eslint-plugin-prefer-object-spread":"^1.2.1","eslint-plugin-prettier":"^2.1.2","eslint-plugin-react":"^7.1.0","eslint-plugin-relay":"^0.0.28","eslint-plugin-yarn-internal":"file:scripts/eslint-rules","execa":"^0.11.0","fancy-log":"^1.3.2","flow-bin":"^0.66.0","git-release-notes":"^3.0.0","gulp":"^4.0.0","gulp-babel":"^7.0.0","gulp-if":"^2.0.1","gulp-newer":"^1.0.0","gulp-plumber":"^1.0.1","gulp-sourcemaps":"^2.2.0","jest":"^22.4.4","jsinspect":"^0.12.6","minimatch":"^3.0.4","mock-stdin":"^0.3.0","prettier":"^1.5.2","string-replace-loader":"^2.1.1","temp":"^0.8.3","webpack":"^2.1.0-beta.25","yargs":"^6.3.0"},"resolutions":{"sshpk":"^1.14.2"},"engines":{"node":">=4.0.0"},"repository":"yarnpkg/yarn","bin":{"yarn":"./bin/yarn.js","yarnpkg":"./bin/yarn.js"},"scripts":{"build":"gulp build","build-bundle":"node ./scripts/build-webpack.js","build-chocolatey":"powershell ./scripts/build-chocolatey.ps1","build-deb":"./scripts/build-deb.sh","build-dist":"bash ./scripts/build-dist.sh","build-win-installer":"scripts\\build-windows-installer.bat","changelog":"git-release-notes $(git describe --tags --abbrev=0 $(git describe --tags --abbrev=0)^)..$(git describe --tags --abbrev=0) scripts/changelog.md","dupe-check":"yarn jsinspect ./src","lint":"eslint . && flow check","pkg-tests":"yarn --cwd packages/pkg-tests jest yarn.test.js","prettier":"eslint src __tests__ --fix","release-branch":"./scripts/release-branch.sh","test":"yarn lint && yarn test-only","test-only":"node --max_old_space_size=4096 node_modules/jest/bin/jest.js --verbose","test-only-debug":"node --inspect-brk --max_old_space_size=4096 node_modules/jest/bin/jest.js --runInBand --verbose","test-coverage":"node --max_old_space_size=4096 node_modules/jest/bin/jest.js --coverage --verbose","watch":"gulp watch","commit":"git-cz"},"jest":{"collectCoverageFrom":["src/**/*.js"],"testEnvironment":"node","modulePathIgnorePatterns":["__tests__/fixtures/","packages/pkg-tests/pkg-tests-fixtures","dist/"],"testPathIgnorePatterns":["__tests__/(fixtures|__mocks__)/","updates/","_(temp|mock|install|init|helpers).js$","packages/pkg-tests"]},"config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}}} /***/ }), /* 195 */ @@ -49416,10 +49428,6 @@ class PackageLinker { } else if (workspaceLayout && remote.type === 'workspace' && !isShallow) { src = remote.reference; type = 'symlink'; - if (dest.indexOf(workspaceLayout.virtualManifestName) !== -1) { - // we don't need to install virtual manifest - continue; - } // to get real path for non hoisted dependencies symlinkPaths.set(dest, src); } else { @@ -49596,6 +49604,10 @@ class PackageLinker { possibleExtraneous.add(path.join(filepath, subfile)); } + } else if (file[0] === '.' && file !== '.bin') { + if (!(yield (_fs || _load_fs()).lstat(filepath)).isDirectory()) { + possibleExtraneous.add(filepath); + } } else { possibleExtraneous.add(filepath); } @@ -52045,6 +52057,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.isValidLicense = isValidLicense; +exports.isValidBin = isValidBin; exports.stringifyPerson = stringifyPerson; exports.parsePerson = parsePerson; exports.normalizePerson = normalizePerson; @@ -52052,12 +52065,20 @@ exports.extractDescription = extractDescription; exports.extractRepositoryUrl = extractRepositoryUrl; +const path = __webpack_require__(0); + const validateLicense = __webpack_require__(959); +const PARENT_PATH = /^\.\.([\\\/]|$)/; + function isValidLicense(license) { return !!license && validateLicense(license).validForNewPackages; } +function isValidBin(bin) { + return !path.isAbsolute(bin) && !PARENT_PATH.test(path.normalize(bin)); +} + function stringifyPerson(person) { if (!person || typeof person !== 'object') { return person; @@ -67243,7 +67264,7 @@ var ReplayEvent = /*@__PURE__*/ (function () { /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return CombineLatestOperator; }); /* unused harmony export CombineLatestSubscriber */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_tslib__ = __webpack_require__(1); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_isScheduler__ = __webpack_require__(48); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_isScheduler__ = __webpack_require__(49); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__util_isArray__ = __webpack_require__(41); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__OuterSubscriber__ = __webpack_require__(13); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__util_subscribeToResult__ = __webpack_require__(14); @@ -67387,7 +67408,7 @@ function defer(observableFactory) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = of; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__util_isScheduler__ = __webpack_require__(48); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__util_isScheduler__ = __webpack_require__(49); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__fromArray__ = __webpack_require__(85); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__empty__ = __webpack_require__(39); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__scalar__ = __webpack_require__(312); @@ -67879,7 +67900,7 @@ var ScanSubscriber = /*@__PURE__*/ (function (_super) { /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__OuterSubscriber__ = __webpack_require__(13); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__InnerSubscriber__ = __webpack_require__(84); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__util_subscribeToResult__ = __webpack_require__(14); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__map__ = __webpack_require__(46); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__map__ = __webpack_require__(47); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__observable_from__ = __webpack_require__(62); /** PURE_IMPORTS_START tslib,_OuterSubscriber,_InnerSubscriber,_util_subscribeToResult,_map,_observable_from PURE_IMPORTS_END */ @@ -69793,6 +69814,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.getRcConfigForCwd = getRcConfigForCwd; +exports.getRcConfigForFolder = getRcConfigForFolder; exports.getRcArgs = getRcArgs; var _fs; @@ -69848,20 +69870,30 @@ function getRcConfigForCwd(cwd, args) { const value = args[index + 1]; if (value && value.charAt(0) !== '-') { - Object.assign(config, loadRcFile((0, (_fs || _load_fs()).readFileSync)(value).toString(), value)); + Object.assign(config, loadRcFile((0, (_fs || _load_fs()).readFileSync)(value, 'utf8'), value)); } } return config; } +function getRcConfigForFolder(cwd) { + const filePath = (0, (_path || _load_path()).resolve)(cwd, '.yarnrc'); + if (!(0, (_fs || _load_fs()).existsSync)(filePath)) { + return {}; + } + + const fileText = (0, (_fs || _load_fs()).readFileSync)(filePath, 'utf8'); + return loadRcFile(fileText, filePath); +} + function loadRcFile(fileText, filePath) { - var _parse = (0, (_lockfile || _load_lockfile()).parse)(fileText, 'yarnrc'); + var _parse = (0, (_lockfile || _load_lockfile()).parse)(fileText, filePath); let values = _parse.object; - if (filePath.match(/\.yml$/)) { + if (filePath.match(/\.yml$/) && typeof values.yarnPath === 'string') { values = { 'yarn-path': values.yarnPath }; } @@ -69984,7 +70016,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.isOffline = isOffline; -const os = __webpack_require__(49); +const os = __webpack_require__(46); const IGNORE_INTERFACES = ['lo0', 'awdl0', 'bridge0']; const LOCAL_IPS = ['127.0.0.1', '::1']; @@ -74680,6 +74712,7 @@ let getBinEntries = exports.getBinEntries = (() => { const registryFolder = _ref4; + binFolders.add(path.resolve(config.cwd, registryFolder, '.bin')); binFolders.add(path.resolve(config.lockfileFolder, registryFolder, '.bin')); } @@ -74827,7 +74860,20 @@ let run = exports.run = (() => { } else { let suggestion; - for (const commandName in scripts) { + for (var _iterator9 = scripts.keys(), _isArray9 = Array.isArray(_iterator9), _i9 = 0, _iterator9 = _isArray9 ? _iterator9 : _iterator9[Symbol.iterator]();;) { + var _ref16; + + if (_isArray9) { + if (_i9 >= _iterator9.length) break; + _ref16 = _iterator9[_i9++]; + } else { + _i9 = _iterator9.next(); + if (_i9.done) break; + _ref16 = _i9.value; + } + + const commandName = _ref16; + const steps = leven(commandName, action); if (steps < 2) { suggestion = commandName; @@ -74912,19 +74958,19 @@ let run = exports.run = (() => { const printedCommands = new Map(); - for (var _iterator9 = pkgCommands, _isArray9 = Array.isArray(_iterator9), _i9 = 0, _iterator9 = _isArray9 ? _iterator9 : _iterator9[Symbol.iterator]();;) { - var _ref16; + for (var _iterator10 = pkgCommands, _isArray10 = Array.isArray(_iterator10), _i10 = 0, _iterator10 = _isArray10 ? _iterator10 : _iterator10[Symbol.iterator]();;) { + var _ref17; - if (_isArray9) { - if (_i9 >= _iterator9.length) break; - _ref16 = _iterator9[_i9++]; + if (_isArray10) { + if (_i10 >= _iterator10.length) break; + _ref17 = _iterator10[_i10++]; } else { - _i9 = _iterator9.next(); - if (_i9.done) break; - _ref16 = _i9.value; + _i10 = _iterator10.next(); + if (_i10.done) break; + _ref17 = _i10.value; } - const pkgCommand = _ref16; + const pkgCommand = _ref17; const action = scripts.get(pkgCommand); invariant(action, 'Action must exists'); @@ -76055,6 +76101,11 @@ class TarballFetcher extends (_baseFetcher || _load_baseFetcher()).default { chown: false, // don't chown. just leave as it is map: header => { header.mtime = now; + if (header.linkname) { + const basePath = path.posix.dirname(path.join('/', header.name)); + const jailPath = path.posix.join(basePath, header.linkname); + header.linkname = path.posix.relative('/', jailPath); + } return header; }, fs: patchedFs @@ -78388,6 +78439,11 @@ class RequestManager { rejectNext(err); }; + const rejectWithoutUrl = function rejectWithoutUrl(err) { + err.message = err.message; + rejectNext(err); + }; + const queueForRetry = reason => { const attempts = params.retryAttempts || 0; if (attempts >= this.maxRetryAttempts - 1) { @@ -78443,6 +78499,11 @@ class RequestManager { } } + if (res.statusCode === 401 && res.caseless && res.caseless.get('server') === 'GitHub.com') { + const message = `${res.body.message}. If using GITHUB_TOKEN in your env, check that it is valid.`; + rejectWithoutUrl(new Error(this.reporter.lang('unauthorizedResponse', res.caseless.get('server'), message))); + } + if (res.statusCode === 401 && res.headers['www-authenticate']) { const authMethods = res.headers['www-authenticate'].split(/,\s*/).map(s => s.toLowerCase()); @@ -85410,7 +85471,7 @@ var RefCountSubscriber = /*@__PURE__*/ (function (_super) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = merge; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Observable__ = __webpack_require__(12); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_isScheduler__ = __webpack_require__(48); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_isScheduler__ = __webpack_require__(49); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__operators_mergeAll__ = __webpack_require__(315); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__fromArray__ = __webpack_require__(85); /** PURE_IMPORTS_START _Observable,_util_isScheduler,_operators_mergeAll,_fromArray PURE_IMPORTS_END */ @@ -85564,7 +85625,7 @@ var RaceSubscriber = /*@__PURE__*/ (function (_super) { /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Observable__ = __webpack_require__(12); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__scheduler_async__ = __webpack_require__(40); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__util_isNumeric__ = __webpack_require__(190); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__util_isScheduler__ = __webpack_require__(48); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__util_isScheduler__ = __webpack_require__(49); /** PURE_IMPORTS_START _Observable,_scheduler_async,_util_isNumeric,_util_isScheduler PURE_IMPORTS_END */ @@ -85616,7 +85677,7 @@ function dispatch(state) { /* harmony export (immutable) */ __webpack_exports__["a"] = audit; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_tslib__ = __webpack_require__(1); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_tryCatch__ = __webpack_require__(56); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__util_errorObject__ = __webpack_require__(47); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__util_errorObject__ = __webpack_require__(48); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__OuterSubscriber__ = __webpack_require__(13); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__util_subscribeToResult__ = __webpack_require__(14); /** PURE_IMPORTS_START tslib,_util_tryCatch,_util_errorObject,_OuterSubscriber,_util_subscribeToResult PURE_IMPORTS_END */ @@ -85729,7 +85790,7 @@ function concatMap(project, resultSelector) { /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_tslib__ = __webpack_require__(1); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Subscriber__ = __webpack_require__(7); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__util_tryCatch__ = __webpack_require__(56); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__util_errorObject__ = __webpack_require__(47); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__util_errorObject__ = __webpack_require__(48); /** PURE_IMPORTS_START tslib,_Subscriber,_util_tryCatch,_util_errorObject PURE_IMPORTS_END */ @@ -96945,6 +97006,24 @@ function _load_asyncToGenerator() { let run = exports.run = (() => { var _ref = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (config, reporter, flags, args) { + const installVersion = flags[`2`] ? `berry` : flags.install; + + if (installVersion) { + const lockfilePath = path.resolve(config.cwd, 'yarn.lock'); + if (!(yield (_fs || _load_fs()).exists(lockfilePath))) { + yield (_fs || _load_fs()).writeFile(lockfilePath, ''); + } + yield (_child || _load_child()).spawn((_constants || _load_constants()).NODE_BIN_PATH, [process.argv[1], 'policies', 'set-version', installVersion], { + stdio: 'inherit', + cwd: config.cwd + }); + yield (_child || _load_child()).spawn((_constants || _load_constants()).NODE_BIN_PATH, [process.argv[1], 'init', ...(flags.yes ? ['-y'] : []), ...(flags.private ? ['-p'] : [])], { + stdio: 'inherit', + cwd: config.cwd + }); + return; + } + const manifests = yield config.getRootManifests(); let repository = {}; @@ -97209,11 +97288,18 @@ function _load_validate() { return _validate = _interopRequireWildcard(__webpack_require__(125)); } +var _constants; + +function _load_constants() { + return _constants = __webpack_require__(8); +} + function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } const objectPath = __webpack_require__(304); + const path = __webpack_require__(0); const yn = __webpack_require__(962); @@ -97221,6 +97307,8 @@ function setFlags(commander) { commander.description('Interactively creates or updates a package.json file.'); commander.option('-y, --yes', 'use default options'); commander.option('-p, --private', 'use default options and private true'); + commander.option('-i, --install ', 'install a specific Yarn release'); + commander.option('-2', 'generates the project using Yarn 2'); } function hasWrapper(commander, args) { @@ -98209,6 +98297,7 @@ var _buildSubCommands = (0, (_buildSubCommands2 || _load_buildSubCommands()).def let bundleUrl; let bundleVersion; + let isV2 = false; if (range === 'nightly' || range === 'nightlies') { bundleUrl = 'https://nightly.yarnpkg.com/latest.js'; @@ -98216,10 +98305,18 @@ var _buildSubCommands = (0, (_buildSubCommands2 || _load_buildSubCommands()).def } else if (range === 'berry' || range === 'v2' || range === '2') { bundleUrl = 'https://github.com/yarnpkg/berry/raw/master/packages/berry-cli/bin/berry.js'; bundleVersion = 'berry'; + isV2 = true; } else { - const releases = yield fetchReleases(config, { - includePrereleases: allowRc - }); + let releases = []; + + try { + releases = yield fetchReleases(config, { + includePrereleases: allowRc + }); + } catch (e) { + reporter.error(e.message); + return; + } const release = releases.find(function (release) { // $FlowFixMe @@ -98240,7 +98337,6 @@ var _buildSubCommands = (0, (_buildSubCommands2 || _load_buildSubCommands()).def reporter.log(`Downloading ${chalk.green(bundleUrl)}...`); const bundle = yield fetchBundle(config, bundleUrl); - const rc = (0, (_rc || _load_rc()).getRcConfigForCwd)(config.lockfileFolder, []); const yarnPath = path.resolve(config.lockfileFolder, `.yarn/releases/yarn-${bundleVersion}.js`); reporter.log(`Saving it into ${chalk.magenta(yarnPath)}...`); @@ -98248,10 +98344,22 @@ var _buildSubCommands = (0, (_buildSubCommands2 || _load_buildSubCommands()).def yield (_fs || _load_fs()).writeFile(yarnPath, bundle); yield (_fs || _load_fs()).chmod(yarnPath, 0o755); - const rcPath = `${config.lockfileFolder}/.yarnrc`; - reporter.log(`Updating ${chalk.magenta(rcPath)}...`); - rc['yarn-path'] = path.relative(config.lockfileFolder, yarnPath); - yield (_fs || _load_fs()).writeFilePreservingEol(rcPath, `${(0, (_lockfile || _load_lockfile()).stringify)(rc)}\n`); + const targetPath = path.relative(config.lockfileFolder, yarnPath).replace(/\\/g, '/'); + + if (isV2) { + const rcPath = `${config.lockfileFolder}/.yarnrc.yml`; + reporter.log(`Updating ${chalk.magenta(rcPath)}...`); + + yield (_fs || _load_fs()).writeFilePreservingEol(rcPath, `yarnPath: ${JSON.stringify(targetPath)}\n`); + } else { + const rcPath = `${config.lockfileFolder}/.yarnrc`; + reporter.log(`Updating ${chalk.magenta(rcPath)}...`); + + const rc = (0, (_rc || _load_rc()).getRcConfigForFolder)(config.lockfileFolder); + rc['yarn-path'] = targetPath; + + yield (_fs || _load_fs()).writeFilePreservingEol(rcPath, `${(0, (_lockfile || _load_lockfile()).stringify)(rc)}\n`); + } reporter.log(`Done!`); })(); @@ -99574,11 +99682,11 @@ let run = exports.run = (() => { throw new (_errors || _load_errors()).MessageError(reporter.lang('workspaceRootNotFound', config.cwd)); } - if (flags.originalArgs < 1) { + if (args.length < 1) { throw new (_errors || _load_errors()).MessageError(reporter.lang('workspaceMissingWorkspace')); } - if (flags.originalArgs < 2) { + if (args.length < 2) { throw new (_errors || _load_errors()).MessageError(reporter.lang('workspaceMissingCommand')); } @@ -99587,7 +99695,7 @@ let run = exports.run = (() => { const workspaces = yield config.resolveWorkspaces(workspaceRootFolder, manifest); - var _ref2 = flags.originalArgs || []; + var _ref2 = args || []; const workspaceName = _ref2[0], rest = _ref2.slice(1); @@ -99773,28 +99881,23 @@ let runScript = exports.runScript = (() => { const workspaces = yield config.resolveWorkspaces(workspaceRootFolder, manifest); try { - var _ref6 = flags.originalArgs || []; - - const _ = _ref6[0], - rest = _ref6.slice(1); - for (var _iterator4 = Object.keys(workspaces), _isArray4 = Array.isArray(_iterator4), _i4 = 0, _iterator4 = _isArray4 ? _iterator4 : _iterator4[Symbol.iterator]();;) { - var _ref7; + var _ref6; if (_isArray4) { if (_i4 >= _iterator4.length) break; - _ref7 = _iterator4[_i4++]; + _ref6 = _iterator4[_i4++]; } else { _i4 = _iterator4.next(); if (_i4.done) break; - _ref7 = _i4.value; + _ref6 = _i4.value; } - const workspaceName = _ref7; + const workspaceName = _ref6; const loc = workspaces[workspaceName].loc; - - yield (_child || _load_child()).spawn((_constants2 || _load_constants2()).NODE_BIN_PATH, [(_constants2 || _load_constants2()).YARN_BIN_PATH, ...rest], { + reporter.log(`${os.EOL}> ${workspaceName}`); + yield (_child || _load_child()).spawn((_constants2 || _load_constants2()).NODE_BIN_PATH, [(_constants2 || _load_constants2()).YARN_BIN_PATH, 'run', ...args], { stdio: 'inherit', cwd: loc }); @@ -99847,6 +99950,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de const invariant = __webpack_require__(9); const path = __webpack_require__(0); +const os = __webpack_require__(46); const semver = __webpack_require__(22); function hasWrapper(commander, args) { @@ -100013,7 +100117,11 @@ let main = exports.main = (() => { commandName = 'install'; isKnownCommand = true; } - + if (commandName === 'set' && args[0] === 'version') { + commandName = 'policies'; + args.splice(0, 1, 'set-version'); + isKnownCommand = true; + } if (!isKnownCommand) { // if command is not recognized, then set default to `run` args.unshift(commandName); @@ -100024,15 +100132,20 @@ let main = exports.main = (() => { let warnAboutRunDashDash = false; // we are using "yarn