diff --git a/.circleci/config.yml b/.circleci/config.yml index bd6f6f0dd9..73cd559039 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -7,7 +7,7 @@ docker_defaults: &docker_defaults macos_defaults: &macos_defaults macos: - xcode: "9.0" + xcode: "11.0" working_directory: ~/project/yarn attach_workspace: &attach_workspace @@ -122,6 +122,16 @@ jobs: root: ~/project paths: - yarn + test-pkg-tests-linux-node13: + <<: *docker_defaults + docker: + - image: node:13 + <<: *pkg_tests + test-pkg-tests-linux-node12: + <<: *docker_defaults + docker: + - image: node:12 + <<: *pkg_tests test-pkg-tests-linux-node10: <<: *docker_defaults docker: @@ -130,8 +140,20 @@ jobs: test-pkg-tests-linux-node8: <<: *docker_defaults <<: *pkg_tests + test-linux-node13: + <<: *docker_defaults + docker: + - image: node:13 + <<: *test_steps + test-linux-node12: + <<: *docker_defaults + docker: + - image: node:12 + <<: *test_steps test-linux-node10: <<: *docker_defaults + docker: + - image: node:10 <<: *test_steps test-linux-node8: <<: *docker_defaults @@ -155,7 +177,6 @@ jobs: name: Install Node 10 command: | brew uninstall --ignore-dependencies node - brew update HOMEBREW_NO_AUTO_UPDATE=1 brew install node@10 brew link --overwrite --force node@10 [[ $(node --version) =~ ^v10\. ]] @@ -177,6 +198,8 @@ jobs: - *test_run test-macos-node6: <<: *macos_defaults + macos: + xcode: "9.0" steps: - run: name: Install Node 6 @@ -248,6 +271,14 @@ workflows: filters: *default_filters requires: - install + - test-pkg-tests-linux-node13: + filters: *default_filters + requires: + - install + - test-pkg-tests-linux-node12: + filters: *default_filters + requires: + - install - test-pkg-tests-linux-node10: filters: *default_filters requires: @@ -256,6 +287,14 @@ workflows: filters: *default_filters requires: - install + - test-linux-node13: + filters: *default_filters + requires: + - install + - test-linux-node12: + filters: *default_filters + requires: + - install - test-linux-node10: filters: *default_filters requires: @@ -294,8 +333,12 @@ workflows: branches: ignore: /.*/ requires: + - test-pkg-tests-linux-node13 + - test-pkg-tests-linux-node12 - test-pkg-tests-linux-node10 - test-pkg-tests-linux-node8 + - test-linux-node13 + - test-linux-node12 - test-linux-node10 - test-linux-node8 - test-linux-node6 diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md deleted file mode 100644 index 706bde4eb4..0000000000 --- a/.github/ISSUE_TEMPLATE.md +++ /dev/null @@ -1,13 +0,0 @@ - - -**Do you want to request a *feature* or report a *bug*?** - - -**What is the current behavior?** - -**If the current behavior is a bug, please provide the steps to reproduce.** - - -**What is the expected behavior?** - -**Please mention your node.js, yarn and operating system version.** diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000000..175b23fb5b --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,47 @@ +--- +name: Bug report +about: Create a report +--- + + + + + + + +### Bug description + + +**Command** + +```sh +yarn [your command] +``` + +**What is the current behavior?** + + + +**What is the expected behavior?** + + + +**Steps to Reproduce** + + +1. +2. + +**Environment** + +- Node Version: `x.x.x` +- Yarn v1 Version: `1.x.x` +- OS and version: diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 0000000000..89e05efb1a --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,6 @@ + +blank_issues_enabled: false +contact_links: + - name: Yarn v1 documentation + url: https://legacy.yarnpkg.com/en/docs + about: Please visit the documentation for v1.x.x before opening a bug report diff --git a/CHANGELOG.md b/CHANGELOG.md index c45b7398fa..87656a692d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,114 @@ Please add one entry in this file for each change in Yarn's behavior. Use the sa ## Master +- Passes arguments following `--` when running a workspace script (`yarn workspace pkg run command -- arg`) + + [#7776](https://github.com/yarnpkg/yarn/pull/7776) - [**Jeff Valore**](https://twitter.com/rally25rs) + +- Prints workspace names with `yarn workspaces` (silence with `-s`) + + [#7722](https://github.com/yarnpkg/yarn/pull/7722) - [**Orta**](https://twitter.com/orta) + +- Implements `yarn init --install ` + + [#7723](https://github.com/yarnpkg/yarn/pull/7723) - [**Maël Nison**](https://twitter.com/arcanis) + +- Implements `yarn init -2` + + [#7862](https://github.com/yarnpkg/yarn/pull/7862) - [**Maël Nison**](https://twitter.com/arcanis) + +- Implements `yarn set version ` as an alias for `policies set-version` + + [#7862](https://github.com/yarnpkg/yarn/pull/7862) - [**Maël Nison**](https://twitter.com/arcanis) + +- Fixes an issue where the archive paths were incorrectly sanitized + + [#7831](https://github.com/yarnpkg/yarn/pull/7831) - [**Maël Nison**](https://twitter.com/arcanis) + +- Allows some dots in binary names again + + [#7811](https://github.com/yarnpkg/yarn/pull/7811) - [**Valery Bugakov**](https://github.com/valerybugakov) + +- Better error handling on `yarn set version` + + [#7848](https://github.com/yarnpkg/yarn/pull/7848) - [**Nick Olinger**](https://github.com/olingern) + +## 1.19.2 + +- Folders like `.cache` won't be pruned from the `node_modules` after each install. + + [#7699](https://github.com/yarnpkg/yarn/pull/7699) - [**Maël Nison**](https://twitter.com/arcanis) + +- Correctly installs workspace child dependencies when workspace child not symlinked to root. + + [#7289](https://github.com/yarnpkg/yarn/pull/7289) - [**Daniel Tschinder**](https://github.com/danez) + +- Makes running scripts with Plug'n Play possible on node 13. + + [#7650](https://github.com/yarnpkg/yarn/pull/7650) - [**Sander Verweij**](https://github.com/sverweij) + +- Change run command to check cwd/node_modules/.bin for commands. Fixes run in workspaces. + + [#7151](https://github.com/yarnpkg/yarn/pull/7151) - [**Jeff Valore**](https://twitter.com/codingwithspike) + +## 1.19.1 + +**Important:** This release contains a cache bump. It will cause the very first install following the upgrade to take slightly more time, especially if you don't use the [Offline Mirror](https://yarnpkg.com/blog/2016/11/24/offline-mirror/) feature. After that everything will be back to normal. + +- Computes the `--modules-folder` & friends paths based on the cwd. + + [#7607](https://github.com/yarnpkg/yarn/pull/7607) - [**mbpreble**](https://github.com/mbpreble) + +- Stores the sha512 in the cache even when not provided by the server. + + [#7591](https://github.com/yarnpkg/yarn/pull/7591) - [**Maël Nison**](https://twitter.com/arcanis) / [#7595](https://github.com/yarnpkg/yarn/pull/7595) - [**Michael**](https://github.com/Blasz) + +- Uses the right Node binary when using `yarn-path`. + + [#7592](https://github.com/yarnpkg/yarn/pull/7592) - [**Maël Nison**](https://twitter.com/arcanis) + +## 1.19.0 + +**Important:** This release contains a cache bump. It will cause the very first install following the upgrade to take slightly more time, especially if you don't use the [Offline Mirror](https://yarnpkg.com/blog/2016/11/24/offline-mirror/) feature. After that everything will be back to normal. + +- Fixes a potential vulnerability regarding how the build artifacts are stored + + Reported by [**ChALkeR**](https://github.com/ChALkeR), fixed by [**Maël Nison**](https://twitter.com/arcanis) + +## 1.18.0 + +- Suggests using the Yarn 2 development trunk on PnP-enabled projects + + [#7512](https://github.com/yarnpkg/yarn/pull/7512) - [**Maël Nison**](https://twitter.com/arcanis) + +- Preserves linked packages when calling `yarn create` + + [#7543](https://github.com/yarnpkg/yarn/pull/7543) - [**Nick McCurdy**](https://github.com/nickmccurdy) + +- Fixes the offline mirror filenames when using Verdaccio + + [#7499](https://github.com/yarnpkg/yarn/pull/7499) - [**xv2**](https://github.com/xv2) + +- Fixes using `link:.` to refer to the package folder + + [#7512](https://github.com/yarnpkg/yarn/pull/7512) - [**Maël Nison**](https://twitter.com/arcanis) + +- Runs the `prepare` lifecycle of git dependencies even if `NODE_ENV` is set to `production`. + + [#7398](https://github.com/yarnpkg/yarn/pull/7398) - [**John Firebaugh**](https://github.com/jfirebaugh) + +- Fixes the `postversion` lifecycle method not being called when using `--no-git-tag-version`. + + [#7154](https://github.com/yarnpkg/yarn/pull/7154) - [**Hampus Tågerud**](https://github.com/hampustagerud) + +- Ignores potentially large vscode keys in package.json to avoid E2BIG errors. + + [#7419](https://github.com/yarnpkg/yarn/pull/7419) - [**Eric Amodio**](https://twitter.com/eamodio) + +- Enforces https for the Yarn and npm registries. + + [#7393](https://github.com/yarnpkg/yarn/pull/7393) - [**Maël Nison**](https://twitter.com/arcanis) + - Adds support for reading `yarnPath` from v2-produced `.yarnrc.yml` files. [#7350](https://github.com/yarnpkg/yarn/pull/7350) - [**Maël Nison**](https://twitter.com/arcanis) diff --git a/__tests__/__snapshots__/normalize-manifest.js.snap b/__tests__/__snapshots__/normalize-manifest.js.snap index c5a78707da..96bece70ad 100644 --- a/__tests__/__snapshots__/normalize-manifest.js.snap +++ b/__tests__/__snapshots__/normalize-manifest.js.snap @@ -60,6 +60,27 @@ Array [ ] `; +exports[`dangerous bin name: dangerous bin name 1`] = ` +Array [ + "foo: Invalid bin entry for \\".\\" (in \\"foo\\").", + "foo: Invalid bin entry for \\"..\\" (in \\"foo\\").", + "foo: Invalid bin entry for \\"/tmp/foo\\" (in \\"foo\\").", + "foo: Invalid bin entry for \\"../tmp/foo\\" (in \\"foo\\").", + "foo: Invalid bin entry for \\"tmp/../../foo\\" (in \\"foo\\").", + "foo: Invalid bin entry for \\"build:cli\\" (in \\"foo\\").", + "foo: No license field", +] +`; + +exports[`dangerous bin values: dangerous bin values 1`] = ` +Array [ + "foo: Invalid bin entry for \\"foo\\" (in \\"foo\\").", + "foo: Invalid bin entry for \\"bar\\" (in \\"foo\\").", + "foo: Invalid bin entry for \\"baz\\" (in \\"foo\\").", + "foo: No license field", +] +`; + exports[`dedupe all trivial dependencies: dedupe all trivial dependencies 1`] = ` Array [ "No license field", @@ -92,6 +113,7 @@ Array [ exports[`empty bin string: empty bin string 1`] = ` Array [ + "foo: Invalid bin field for \\"foo\\".", "foo: No license field", ] `; diff --git a/__tests__/commands/install/integration.js b/__tests__/commands/install/integration.js index e969e2a9ee..ec78abb54e 100644 --- a/__tests__/commands/install/integration.js +++ b/__tests__/commands/install/integration.js @@ -117,6 +117,16 @@ test('installing a package with a renamed file should not delete it', () => expect(await fs.exists(`${config.cwd}/node_modules/pkg/state.js`)).toEqual(true); })); +test("installing a tree shouldn't remove preexisting cache directories", () => + runInstall({}, 'cache-folder-nm', async (config, reporter): Promise => { + expect(await fs.exists(`${config.cwd}/node_modules/.cache/hello.txt`)).toEqual(true); + + const reInstall = new Install({}, config, reporter, await Lockfile.fromDirectory(config.cwd)); + await reInstall.init(); + + expect(await fs.exists(`${config.cwd}/node_modules/.cache/hello.txt`)).toEqual(true); + })); + test("installing a new package should correctly update it, even if the files mtime didn't change", () => runInstall({}, 'mtime-same', async (config, reporter): Promise => { await misc.sleep(2000); @@ -632,6 +642,11 @@ test('install should be idempotent', () => null, )); +test('install should fail to authenticate integrity with incorrect hash and correct sha512', () => + expect(runInstall({}, 'invalid-checksum-good-integrity')).rejects.toMatchObject({ + message: expect.stringContaining("computed integrity doesn't match our records"), + })); + test('install should authenticate integrity field with sha1 checksums', () => runInstall({}, 'install-update-auth-sha1', async config => { const lockFileContent = await fs.readFile(path.join(config.cwd, 'yarn.lock')); @@ -1160,3 +1175,102 @@ test('install skips the scripts if the yarnrc specifies skip-scripts true', () = const ignoredScriptsMessage = reporter.lang('ignoredScripts'); expect(stdout).toMatch(ignoredScriptsMessage); })); + +describe('Cache', () => { + test('install should cache package without integrity prefix if no integrity field present', () => + runInstall({}, 'install-update-auth-no-integrity-field', async config => { + const pkgCacheDir = path.join( + config.cwd, + '.yarn-cache', + `v${constants.CACHE_VERSION}`, + 'npm-safe-buffer-5.1.1-893312af69b2123def71f57889001671eeb2c853', + ); + + expect(await fs.exists(pkgCacheDir)).toEqual(true); + })); + + test('install should cache package with integrity suffix if integrity field present', () => + runInstall({}, 'install-update-auth-sha512', async config => { + const pkgCacheDir = path.join( + config.cwd, + '.yarn-cache', + `v${constants.CACHE_VERSION}`, + 'npm-safe-buffer-5.1.1-893312af69b2123def71f57889001671eeb2c853-integrity', + ); + + expect(await fs.exists(pkgCacheDir)).toEqual(true); + })); + + test('install should store cached sha1 + sha512 integrity when lockfile has sha1 integrity field', () => + runInstall({}, 'install-update-auth-sha1-safebuffer', async config => { + const pkgCacheDir = path.join( + config.cwd, + '.yarn-cache', + `v${constants.CACHE_VERSION}`, + 'npm-safe-buffer-5.1.1-893312af69b2123def71f57889001671eeb2c853-integrity', + ); + const pkgCacheMetaData = JSON.parse( + await fs.readFile(path.join(pkgCacheDir, 'node_modules', 'safe-buffer', constants.METADATA_FILENAME)), + ); + expect(pkgCacheMetaData.remote.cacheIntegrity).toBe( + // eslint-disable-next-line max-len + 'sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg== sha1-iTMSr2myEj3vcfV4iQAWce6yyFM=', + ); + })); + + test('install should store cached sha1 + sha512 integrity when lockfile has sha512 integrity field', () => + runInstall({}, 'install-update-auth-sha512', async config => { + const pkgCacheDir = path.join( + config.cwd, + '.yarn-cache', + `v${constants.CACHE_VERSION}`, + 'npm-safe-buffer-5.1.1-893312af69b2123def71f57889001671eeb2c853-integrity', + ); + const pkgCacheMetaData = JSON.parse( + await fs.readFile(path.join(pkgCacheDir, 'node_modules', 'safe-buffer', constants.METADATA_FILENAME)), + ); + expect(pkgCacheMetaData.remote.cacheIntegrity).toBe( + // eslint-disable-next-line max-len + 'sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg== sha1-iTMSr2myEj3vcfV4iQAWce6yyFM=', + ); + })); + + test('install should store cached sha1 + sha512 integrity when lockfile has no integrity field', () => + runInstall({}, 'install-update-auth-no-integrity-field', async config => { + const pkgCacheDir = path.join( + config.cwd, + '.yarn-cache', + `v${constants.CACHE_VERSION}`, + 'npm-safe-buffer-5.1.1-893312af69b2123def71f57889001671eeb2c853', + ); + const pkgCacheMetaData = JSON.parse( + await fs.readFile(path.join(pkgCacheDir, 'node_modules', 'safe-buffer', constants.METADATA_FILENAME)), + ); + + expect(pkgCacheMetaData.remote.cacheIntegrity).toBe( + // eslint-disable-next-line max-len + 'sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg== sha1-iTMSr2myEj3vcfV4iQAWce6yyFM=', + ); + })); + + test('install should fail when cached package integrity does not match lockfile integrity field', () => + expect(runInstall({}, 'install-update-auth-invalid-cache-integrity')).rejects.toThrow( + // eslint-disable-next-line max-len + 'Incorrect integrity when fetching from the cache for "safe-buffer". Cache has "sha512-foo sha1-bar" and remote has "sha1-iTMSr2myEj3vcfV4iQAWce6yyFM="', + )); + + test('install should fail when cached package hash does not match remote hash', () => + expect(runInstall({}, 'install-update-auth-invalid-cache-hash')).rejects.toThrow( + // eslint-disable-next-line max-len + 'Incorrect hash when fetching from the cache for "safe-buffer". Cache has "bad-hash" and remote has "893312af69b2123def71f57889001671eeb2c853"', + )); + + test('install should not fail cache integrity validation when lockfile has sha1 integrity field', () => + expect(runInstall({}, 'install-update-auth-sha1-with-cache')).resolves.toBeUndefined()); + + test('install should not fail cache integrity validation when lockfile has sha512 integrity field', () => + expect(runInstall({}, 'install-update-auth-sha512-with-cache')).resolves.toBeUndefined()); + + test('install should not fail cache integrity validation when lockfile has no integrity field', () => + expect(runInstall({}, 'install-update-auth-no-integrity-field-with-cache')).resolves.toBeUndefined()); +}); diff --git a/__tests__/commands/install/workspaces-install.js b/__tests__/commands/install/workspaces-install.js index a0e0c0be15..5181352fc3 100644 --- a/__tests__/commands/install/workspaces-install.js +++ b/__tests__/commands/install/workspaces-install.js @@ -103,6 +103,25 @@ test.concurrent('install should install unhoistable dependencies in workspace no }); }); +test.concurrent( + 'install should install unhoistable dependencies in workspace node_modules even when no symlink exists', + (): Promise => { + return runInstall({}, 'workspaces-install-conflict-without-symlink', async (config): Promise => { + // node_modules/isarray@1.0.0 + let packageFile = await fs.readFile(path.join(config.cwd, 'node_modules', 'isarray', 'package.json')); + expect(JSON.parse(packageFile).version).toEqual('1.0.0'); + + // node_modules/arrify@1.0.0 + packageFile = await fs.readFile(path.join(config.cwd, 'node_modules', 'arrify', 'package.json')); + expect(JSON.parse(packageFile).version).toEqual('1.0.0'); + + // node_modules/arrify/isarray@2.0.0 + packageFile = await fs.readFile(path.join(config.cwd, 'arrify', 'node_modules', 'isarray', 'package.json')); + expect(JSON.parse(packageFile).version).toEqual('2.0.0'); + }); + }, +); + test.concurrent('install should link workspaces that refer each other', (): Promise => { return runInstall({}, 'workspaces-install-link', async (config): Promise => { // packages/workspace-1/node_modules/left-pad - missing because it is hoisted to the root diff --git a/__tests__/commands/run.js b/__tests__/commands/run.js index 2bad11ef51..35a1221e56 100644 --- a/__tests__/commands/run.js +++ b/__tests__/commands/run.js @@ -207,6 +207,16 @@ test('adds workspace root node_modules/.bin to path when in a workspace', (): Pr expect(envPaths).toContain(path.join(config.cwd, 'packages', 'pkg1', 'node_modules', '.bin')); })); +test('adds cwd node_modules/.bin to path when in a workspace usig nohoist', (): Promise => + runRunInWorkspacePackage('packages/pkg1', ['env'], {}, 'nohoist-workspace', (config, reporter): ?Promise => { + const logEntry = reporter.getBuffer().find(entry => entry.type === 'log'); + const parsedLogData = JSON.parse(logEntry ? logEntry.data.toString() : '{}'); + const envPaths = (parsedLogData.PATH || parsedLogData.Path).split(path.delimiter); + + expect(envPaths).toContain(path.join(config.cwd, 'node_modules', '.bin')); + expect(envPaths).toContain(path.join(config.cwd, 'packages', 'pkg1', 'node_modules', '.bin')); + })); + test('runs script with custom script-shell', (): Promise => runRunWithCustomShell('/usr/bin/dummy', ['start'], {}, 'script-shell', async (config): ?Promise => { const pkg = await fs.readJson(path.join(config.cwd, 'package.json')); diff --git a/__tests__/commands/version.js b/__tests__/commands/version.js index 6210a40a5e..50c1111b2b 100644 --- a/__tests__/commands/version.js +++ b/__tests__/commands/version.js @@ -162,6 +162,108 @@ test('run version and make sure commit hooks are disabled by config', async (): }); }); +test('run version with --no-git-tag-version and make sure git tags are disabled', async (): Promise => { + const fixture = 'no-args'; + await fs.mkdirp(path.join(fixturesLoc, fixture, '.git')); + + return runRun([], {newVersion, gitTagVersion: false}, fixture, async (config): ?Promise => { + const pkg = await fs.readJson(path.join(config.cwd, 'package.json')); + expect(pkg.version).toBe(newVersion); + + expect(spawn.mock.calls.length).toBe(0); + }); +}); + +test('run version and make sure git tags are disabled by config', async (): Promise => { + const fixture = 'no-args-no-git-tags'; + await fs.mkdirp(path.join(fixturesLoc, fixture, '.git')); + + return runRun([], {newVersion, gitTagVersion}, fixture, async (config): ?Promise => { + const pkg = await fs.readJson(path.join(config.cwd, 'package.json')); + expect(pkg.version).toBe(newVersion); + + expect(spawn.mock.calls.length).toBe(0); + }); +}); + +test('run version with --no-git-tag-version, make sure all lifecycle steps runs', async (): Promise => { + const fixture = 'no-args'; + await fs.mkdirp(path.join(fixturesLoc, fixture, '.git')); + + return runRun([], {newVersion, gitTagVersion: false}, fixture, async (config): ?Promise => { + expect(spawn.mock.calls.length).toBe(0); + + const pkg = await fs.readJson(path.join(config.cwd, 'package.json')); + + const preversionLifecycle = { + stage: 'preversion', + config, + cmd: pkg.scripts.preversion, + cwd: config.cwd, + isInteractive: true, + }; + const versionLifecycle = { + stage: 'version', + config, + cmd: pkg.scripts.version, + cwd: config.cwd, + isInteractive: true, + }; + const postversionLifecycle = { + stage: 'postversion', + config, + cmd: pkg.scripts.postversion, + cwd: config.cwd, + isInteractive: true, + }; + + expect(execCommand.mock.calls.length).toBe(3); + + expect(execCommand.mock.calls[0]).toEqual([preversionLifecycle]); + expect(execCommand.mock.calls[1]).toEqual([versionLifecycle]); + expect(execCommand.mock.calls[2]).toEqual([postversionLifecycle]); + }); +}); + +test('run version with git tags disabled in config, make sure all lifecycle steps runs', async (): Promise => { + const fixture = 'no-args-no-git-tags'; + await fs.mkdirp(path.join(fixturesLoc, fixture, '.git')); + + return runRun([], {newVersion, gitTagVersion}, fixture, async (config): ?Promise => { + expect(spawn.mock.calls.length).toBe(0); + + const pkg = await fs.readJson(path.join(config.cwd, 'package.json')); + + const preversionLifecycle = { + stage: 'preversion', + config, + cmd: pkg.scripts.preversion, + cwd: config.cwd, + isInteractive: true, + }; + const versionLifecycle = { + stage: 'version', + config, + cmd: pkg.scripts.version, + cwd: config.cwd, + isInteractive: true, + }; + const postversionLifecycle = { + stage: 'postversion', + config, + cmd: pkg.scripts.postversion, + cwd: config.cwd, + isInteractive: true, + }; + + expect(execCommand.mock.calls.length).toBe(3); + + expect(execCommand.mock.calls[0]).toEqual([preversionLifecycle]); + expect(execCommand.mock.calls[1]).toEqual([versionLifecycle]); + expect(execCommand.mock.calls[2]).toEqual([postversionLifecycle]); + }); +}); + test('run version with --major flag and make sure major version is incremented', (): Promise => { return runRun([], {gitTagVersion, major: true}, 'no-args', async (config): ?Promise => { const pkg = await fs.readJson(path.join(config.cwd, 'package.json')); diff --git a/__tests__/commands/workspace.js b/__tests__/commands/workspace.js index a50442d22e..17d5c66d0c 100644 --- a/__tests__/commands/workspace.js +++ b/__tests__/commands/workspace.js @@ -38,12 +38,8 @@ async function runWorkspace( } } -// The unit tests don't use commander.js for argument parsing. -// `originalArgs` is normally passed by index.js so we just simulate it in the tests. - test('workspace run command', (): Promise => { - const originalArgs = ['workspace-1', 'run', 'script']; - return runWorkspace({originalArgs}, ['workspace-1', 'run', 'script'], 'run-basic', config => { + return runWorkspace({}, ['workspace-1', 'run', 'script'], 'run-basic', config => { expect(spawn).toHaveBeenCalledWith(NODE_BIN_PATH, [YARN_BIN_PATH, 'run', 'script'], { stdio: 'inherit', cwd: path.join(fixturesLoc, 'run-basic', 'packages', 'workspace-child-1'), @@ -52,8 +48,7 @@ test('workspace run command', (): Promise => { }); test('workspace run command forwards raw arguments', (): Promise => { - const originalArgs = ['workspace-1', 'run', 'script', 'arg1', '--flag1']; - return runWorkspace({originalArgs}, ['workspace-1', 'run', 'script'], 'run-basic', config => { + return runWorkspace({}, ['workspace-1', 'run', 'script', 'arg1', '--flag1'], 'run-basic', config => { expect(spawn).toHaveBeenCalledWith(NODE_BIN_PATH, [YARN_BIN_PATH, 'run', 'script', 'arg1', '--flag1'], { stdio: 'inherit', cwd: path.join(fixturesLoc, 'run-basic', 'packages', 'workspace-child-1'), diff --git a/__tests__/commands/workspaces.js b/__tests__/commands/workspaces.js index ad81f2df76..6a7ba993c1 100644 --- a/__tests__/commands/workspaces.js +++ b/__tests__/commands/workspaces.js @@ -49,13 +49,12 @@ test('workspaces info should list the workspaces', (): Promise => { }); test('workspaces run should spawn command for each workspace', (): Promise => { - const originalArgs = ['run', 'script', 'arg1', '--flag1']; - return runWorkspaces({originalArgs}, ['run', 'script', 'arg1', '--flag1'], 'run-basic', config => { - expect(spawn).toHaveBeenCalledWith(NODE_BIN_PATH, [YARN_BIN_PATH, 'script', 'arg1', '--flag1'], { + return runWorkspaces({}, ['run', 'script', 'arg1', '--flag1'], 'run-basic', config => { + expect(spawn).toHaveBeenCalledWith(NODE_BIN_PATH, [YARN_BIN_PATH, 'run', 'script', 'arg1', '--flag1'], { stdio: 'inherit', cwd: path.join(fixturesLoc, 'run-basic', 'packages', 'workspace-child-1'), }); - expect(spawn).toHaveBeenCalledWith(NODE_BIN_PATH, [YARN_BIN_PATH, 'script', 'arg1', '--flag1'], { + expect(spawn).toHaveBeenCalledWith(NODE_BIN_PATH, [YARN_BIN_PATH, 'run', 'script', 'arg1', '--flag1'], { stdio: 'inherit', cwd: path.join(fixturesLoc, 'run-basic', 'packages', 'workspace-child-2'), }); diff --git a/__tests__/fetchers.js b/__tests__/fetchers.js index ed5f5b0cc6..5c95c6af7f 100644 --- a/__tests__/fetchers.js +++ b/__tests__/fetchers.js @@ -125,6 +125,40 @@ test('GitFetcher.fetch with prepare script', async () => { expect(await fs.exists(path.join(dir, 'generated', 'prepublish'))).toBe(false); }); +test('GitFetcher.fetch with prepare script, NODE_ENV=production', async () => { + const NODE_ENV = process.env.NODE_ENV; + try { + process.env.NODE_ENV = 'production'; + const dir = await mkdir('git-fetcher-with-prepare'); + const fetcher = new GitFetcher( + dir, + { + type: 'git', + reference: 'https://github.com/Volune/test-js-git-repo', + hash: '0e56593e326069ed4bcec8126bb48a1891215c57', + registry: 'npm', + }, + await Config.create(), + ); + await fetcher.fetch(); + const name = (await fs.readJson(path.join(dir, 'package.json'))).name; + expect(name).toBe('test-js-git-repo'); + const dependencyName = (await fs.readJson(path.join(dir, 'dependency-package.json'))).name; + expect(dependencyName).toBe('beeper'); + // The file "prepare.js" is not in "files" list + expect(await fs.exists(path.join(dir, 'prepare.js'))).toBe(false); + // Check the dependency with a bin script was correctly executed + expect(await fs.exists(path.join(dir, 'testscript.output.txt'))).toBe(true); + // Check executed lifecycle scripts + expect(await fs.exists(path.join(dir, 'generated', 'preinstall'))).toBe(true); + expect(await fs.exists(path.join(dir, 'generated', 'install'))).toBe(true); + expect(await fs.exists(path.join(dir, 'generated', 'postinstall'))).toBe(true); + expect(await fs.exists(path.join(dir, 'generated', 'prepublish'))).toBe(false); + } finally { + process.env.NODE_ENV = NODE_ENV; + } +}); + test('TarballFetcher.fetch', async () => { const dir = await mkdir('tarball-fetcher'); const fetcher = new TarballFetcher( @@ -278,6 +312,25 @@ test('TarballFetcher.fetch properly stores tarball of scoped package in offline expect(exists).toBe(true); }); +test('TarballFetcher.fetch properly stores tarball of scoped package in offline mirror for Verdaccio', async () => { + const dir = await mkdir('git-fetcher'); + const config = await Config.create(); + config.registries.yarn.config['yarn-offline-mirror'] = 'test'; + + const fetcher = new TarballFetcher( + dir, + { + type: 'tarball', + hash: '6f0ab73cdd7b82d8e81e80838b49e9e4c7fbcc44', + reference: 'http://npm.xxxyyyzzz.ru/@types%2fevents/-/events-3.0.0.tgz', + registry: 'npm', + }, + config, + ); + const cachePath = fetcher.getTarballMirrorPath(); + expect(cachePath).toBe(path.join('test', '@types-events-3.0.0.tgz')); +}); + test('TarballFetcher.fetch properly stores tarball for scoped package resolved from artifactory registry', async () => { const dir = await mkdir('tarball-fetcher'); const offlineMirrorDir = await mkdir('offline-mirror'); diff --git a/__tests__/fixtures/cache/corrupted/.yarn-cache/v4/corrupted-meta-empty/node_modules/corrupted-meta-empty/.yarn-metadata.json b/__tests__/fixtures/cache/corrupted/.yarn-cache/v6/corrupted-meta-empty/node_modules/corrupted-meta-empty/.yarn-metadata.json similarity index 100% rename from __tests__/fixtures/cache/corrupted/.yarn-cache/v4/corrupted-meta-empty/node_modules/corrupted-meta-empty/.yarn-metadata.json rename to __tests__/fixtures/cache/corrupted/.yarn-cache/v6/corrupted-meta-empty/node_modules/corrupted-meta-empty/.yarn-metadata.json diff --git a/__tests__/fixtures/cache/corrupted/.yarn-cache/v4/corrupted-meta-not-existing/node_modules/corrupted-meta-not-existing/.gitkeep b/__tests__/fixtures/cache/corrupted/.yarn-cache/v6/corrupted-meta-not-existing/node_modules/corrupted-meta-not-existing/.gitkeep similarity index 100% rename from __tests__/fixtures/cache/corrupted/.yarn-cache/v4/corrupted-meta-not-existing/node_modules/corrupted-meta-not-existing/.gitkeep rename to __tests__/fixtures/cache/corrupted/.yarn-cache/v6/corrupted-meta-not-existing/node_modules/corrupted-meta-not-existing/.gitkeep diff --git a/__tests__/fixtures/cache/corrupted/.yarn-cache/v4/corrupted-meta-typo/node_modules/corrupted-meta-typo/.yarn-metadata.json b/__tests__/fixtures/cache/corrupted/.yarn-cache/v6/corrupted-meta-typo/node_modules/corrupted-meta-typo/.yarn-metadata.json similarity index 100% rename from __tests__/fixtures/cache/corrupted/.yarn-cache/v4/corrupted-meta-typo/node_modules/corrupted-meta-typo/.yarn-metadata.json rename to __tests__/fixtures/cache/corrupted/.yarn-cache/v6/corrupted-meta-typo/node_modules/corrupted-meta-typo/.yarn-metadata.json diff --git a/__tests__/fixtures/cache/corrupted/.yarn-cache/v4/good/node_modules/good/.yarn-metadata.json b/__tests__/fixtures/cache/corrupted/.yarn-cache/v6/good/node_modules/good/.yarn-metadata.json similarity index 100% rename from __tests__/fixtures/cache/corrupted/.yarn-cache/v4/good/node_modules/good/.yarn-metadata.json rename to __tests__/fixtures/cache/corrupted/.yarn-cache/v6/good/node_modules/good/.yarn-metadata.json diff --git a/__tests__/fixtures/certificates/cacerts.pem b/__tests__/fixtures/certificates/cacerts.pem index f752995039..ff0e06fae5 100644 --- a/__tests__/fixtures/certificates/cacerts.pem +++ b/__tests__/fixtures/certificates/cacerts.pem @@ -34,35 +34,37 @@ rUCGwbCUDI0mxadJ3Bz4WxR6fyNpBK2yAinWEsikxqEt -----END CERTIFICATE----- comments should be stripped -----BEGIN CERTIFICATE----- -MIIFgDCCA2gCCQC8rITAE36eyDANBgkqhkiG9w0BAQUFADCBgTELMAkGA1UEBhMC -VVMxCzAJBgNVBAgMAk1BMQ8wDQYDVQQHDAZCb3N0b24xEzARBgNVBAoMCkV4YW1w -bGUgQ28xEDAOBgNVBAsMB3RlY2hvcHMxCzAJBgNVBAMMAmNhMSAwHgYJKoZIhvcN -AQkBFhFjZXJ0c0BleGFtcGxlLmNvbTAeFw0xNjExMDExMDU5MDRaFw00NDAzMTgx -MDU5MDRaMIGBMQswCQYDVQQGEwJVUzELMAkGA1UECAwCTUExDzANBgNVBAcMBkJv -c3RvbjETMBEGA1UECgwKRXhhbXBsZSBDbzEQMA4GA1UECwwHdGVjaG9wczELMAkG -A1UEAwwCY2ExIDAeBgkqhkiG9w0BCQEWEWNlcnRzQGV4YW1wbGUuY29tMIICIjAN -BgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA5dlk+OKb+S14hj/EHVUMzGSAfTpc -TJgAPxhaWChp4ICBspYX3OrIdQ4XXEzJYu0ZFIxhV0VD0XBB9XEdmyaJpgqJORFi -MplDtIOAAsiHL64g7ZW8vKrVH/VWnCk5lt4CX+u7bUzhcGo11Esmvy/uAWDeStLI -m+49esBbr3nL+oYMaGw3u2tgZgaalvozg4p+Tatl3J3TUgpt9fK5tpHwlGmXIOp0 -O6Lq3affXZzFivMm/jJVMGyV1/AowPCtXbhS1O8qQQKws4HZUx9Od34yzOpPCkQf -Wl9YkZKd2OQ1MPTnpjiXluBEbhAPPHKq7P12B+wrlFP+4l9wNwqpTIxFR6j/iy+H -9exO4yaU0QcaQFHOSPxVP3rl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qLR +HUk4TDySH59lprorRwi9O5MEseu/VR6kpVGFaqf8Uk3roO1PLcrLl7mIVEBMT+xr +dsQZ2t5uPdRWl17CC3FPjQIDAQABo2YwZDAdBgNVHQ4EFgQUiv23fsFng48bIdox +T5+R4ZyblCUwHwYDVR0jBBgwFoAUiv23fsFng48bIdoxT5+R4ZyblCUwDgYDVR0P +AQH/BAQDAgEGMBIGA1UdEwEB/wQIMAYBAf8CAQEwDQYJKoZIhvcNAQELBQADggIB +AGyXNgSgEKTsP6khvdCIognjKBPxHloKRa1VjVDISsOTrhpnpzD8iK5fI7PLNTu4 +I57O90Ouo689np766iUIWTGDX3gHXLwPjvEtHFBOctfkDRD6vSk6jT74AWq5SM6R +i+Us6iLcOoyJOXfpRA2RJ8mSmYpswmY16s3vNQtBQASDEgqd1+tuKUXdf1ijBUEI +fua0tUBfmroEDphzi9SOyeo3KbXafjrgHnRRF/EZS86UuwI1OEYqfzqzZzU2aR+i +zKdA+V5m/myfgiFHWnN8hT5TgJC3zjuLrfPE0oWF1xUJouMhDiKp0tWu6S4wyU0w +cxtpCBPoeqjVr4eVyvmpFREPIW6fANUT21QDTu22gjorKoewoFlt62Q/SIiVe8Fd +zMNLzJykHzP8W5E4p2lUFmuZ+cgU0ASsqTf21VfWuBYOLMCe/Z1mRw/egg7/ZlkB +dbgbZVj0hkfh6zGybtAeCPVQ5g+eQ5AOJCaW30xs8zove9Ke6/Pc/QPQ/nU5KhJX +/Vr4xnoOvgq+UM/CwhYgqMcqk04czBF1KHKPKPFv4i+XDZ++cckUq3PMvWHMg8Og ++9LT8+6nWhoz3C2khOeRXJn5JV0+NqrVFYSrk1Ck2Z1h6dVDhz25fyPV+9+hZlDL +iG8MH0iCyXWz6kiZKW0s9LV7AW/PUPU/rZdS+P2HgS0E -----END CERTIFICATE----- another comment diff --git a/__tests__/fixtures/certificates/client-cert.pem b/__tests__/fixtures/certificates/client-cert.pem index 0fcb7fec45..755b80ec4a 100644 --- a/__tests__/fixtures/certificates/client-cert.pem +++ b/__tests__/fixtures/certificates/client-cert.pem @@ -1,32 +1,34 @@ -----BEGIN CERTIFICATE----- -MIIFijCCA3KgAwIBAgIJAJtFZrwaJuiyMA0GCSqGSIb3DQEBBQUAMIGBMQswCQYD -VQQGEwJVUzELMAkGA1UECAwCTUExDzANBgNVBAcMBkJvc3RvbjETMBEGA1UECgwK -RXhhbXBsZSBDbzEQMA4GA1UECwwHdGVjaG9wczELMAkGA1UEAwwCY2ExIDAeBgkq -hkiG9w0BCQEWEWNlcnRzQGV4YW1wbGUuY29tMB4XDTE2MTEwMTExMDIxMloXDTE5 -MDcyODExMDIxMlowgYYxCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJNQTEPMA0GA1UE -BwwGQm9zdG9uMRMwEQYDVQQKDApFeGFtcGxlIENvMRAwDgYDVQQLDAd0ZWNob3Bz -MRAwDgYDVQQDDAdjbGllbnQxMSAwHgYJKoZIhvcNAQkBFhFjZXJ0c0BleGFtcGxl -LmNvbTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBALIBe3sK4CKnNTyp -M7GwNzHHrCtgW/nVBML9KRbHSCDodvhegfNWJRTvarWCipbej+V0iBsw/LcYuynw -4QDzINJVQTfdXYpfr2PBjY2PlTurYMHoA6W9Qefw3TZNQbt1wygJznShPPfdVDi7 -KBaXCCmLZ98dh4o8+A+4FTEdkMmtLjKp7j/chDmmO+vM0+odSBtf5CfEEgIQNAiw -uaKJhFjOD0voMDfDEowIBqA/s5MPN8iizOoPhpgl4HJrkWGULEl/xpmO0oOiLITx -xG1wAeKsGXa+28Xv+FU3nK8AgpToGsnOt4jUmAqO8f0Y1CnBFL9LkOB99UQG9XBS -H2j61pZnJaL3L3GwSVeGxfhZWgEhTcZDsA9/xD4dRJEzi49A+Q0DVArj9nyccLP5 -NgXClC4wQZzRTH/ptkfNzmnkZ935ffn9tnJNAv/Cq9sTpEL5TmQU976shhxpomXa -/ADW+jojVnlBZkZugVEbvFU1r7EFUz9aEHvq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IlLTYCRwwHwYDVR0jBBgwFoAUiv23fsFng48b +IdoxT5+R4ZyblCUwDgYDVR0PAQH/BAQDAgWgMB0GA1UdJQQWMBQGCCsGAQUFBwMB +BggrBgEFBQcDAjAMBgNVHRMBAf8EAjAAMA0GCSqGSIb3DQEBCwUAA4ICAQCOAj+5 +qS81ES3OD0yO4zyR4ICHZo68c15USeZakiWTtt64t3e2ZMyW3onDoKunmxc0u6NO +8qxzM3HVGrTCL18sbYNRIOHlnKrajETb9Uv4QG2ULB+euwhOB18EGHBMEJmvuhr6 ++gL0OEEb1JPGVHC0AowPLPdU0DdVFzLz6AxwpFfQY6qOOaNkdh8N8DIwK8yzE9Z5 +sloh5W/2MtrKPNzY6BIOv2UNuzUySTUfOsqecGQUtFkmyUs11BtmqvxZNdwcSPBG +eO6lysh8Ts6g3PVISx05MLANjkkP5q78UlQGiLbfJFNqVDyeUdSHoCnEZvvJ4oSu +1F6jGJBMzBQwkLHqDp2nfnpnhR6YNAX0nJARxLv0fUbHf+3ikpwyX7tBf94Nd5sQ +Of029YGWnzhB+bLjTXP7JKTsQeFjN3dnssvFQEtyWWJsALWsG3h7TcNRKgADluXQ +2mZBPwXNEx2AAfbAbCXhG0+pJ5sOpOtNk0KwjvyUyUaglTJqFhHscvtf9HmGE9oe +5Wfnftz6dQCtKqPNO4JD55qQ5lL7yESYBIbmm1mACUeXLOM8vFYEZhPqrcT8BIHn +UvZXtzR5/Eyvmjaa4mEj7dtWBxoAgfdS1iMFLK51wqWWtUYojrTihTnpSl1z6S+q +np/9R919j0P7jA5k+2jdFcAMO1K5xLbztVvqaA== -----END CERTIFICATE----- diff --git a/__tests__/fixtures/certificates/client-key.pem b/__tests__/fixtures/certificates/client-key.pem index 6e35a7f79d..fa80438dcf 100644 --- a/__tests__/fixtures/certificates/client-key.pem +++ b/__tests__/fixtures/certificates/client-key.pem @@ -1,51 +1,52 @@ ------BEGIN RSA PRIVATE KEY----- -MIIJKAIBAAKCAgEAsgF7ewrgIqc1PK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247gmDId/mzlTmAZU6yDah+7pDeH -KW79Q78slTDITO3hS1+Lk7e04bLKm2yMdSiXEe+FKUnKlVS6PCh7cWZRSRSpECw+ -YUlrAt/1jmJT2g7oG3VuiubHZ/XvJ7gdkopR9JIlV1ihttMlxtYW5zsc3qEiqFEM -grgBUNo3vNnbEyb7USKcEl71HLOms88SoaIhBxQlmx30Kv4V/oRKPvYzyJOgu84s -olxjTwl995eFlaNTlRdsPx/s/6LmHHEfgY3zUdBgXHqMilxgYC2JOuXgM/ebjUvK -hIDSxQKCAQAWdd1RBGr3PjuoMm88tk3P3a40autTI0qL5x9JOluz4KSgx/5DvgZ7 -RGPKFTBs7WuU/cPG0ol4myssI2zBene/3Imxf5QvA/78XJnipIk1rdqleD2B00Sj -tdQtt63n1VnL3Nz2gVvlvGnJoYJlX8uaaPF+sGupIxqHvH6+kpezUgUsO4leOWYK -x3BSv50+A3FATgRL3IfRQ1YyLMILjL/BjCvYyOc436688TRm+/V6DIuFttCKm6k8 -7hSaHlXYReU2WU4h9hvZRGsSRyPQ8I5oCgSnuhGYAdpkoJhQts3+KkK2gLE5r684 -xMP6A/pgH0iEBaB5Ps4hcocaX3glgYCBAoIBAFZsTWy2sgQCe5G3XcNsaa2UNl39 -0lBbFFmvQff3QqyDoMrvTGmXh84ni6by7ouIQsK6toVEufLo0ab5tbg7gPfJPa2T -1+yPO2pcRX3XifAPTcqcy6yP45F4fu9/ZEISuzk3ZL8vQloqNy6P3SUmcH7HnEkv -yZyBZlOMnGBfIkSpQ85Sh+Lwhf/Y0yaZHISeNubRvqcx47LemNeZ7Jq+8fzH9UED -vfk68qx01s/PxV/xs2U96XB6U2zWlJGekTkuz4AB8jtqD594wdxVEPofL6rmnMJZ -LIASsBEniiVESphjqwv62EPmqbdSB5eBWzcl+U2YFMUilhkO6YN0LpfJSeI= ------END RSA PRIVATE KEY----- +-----BEGIN PRIVATE KEY----- +MIIJQwIBADANBgkqhkiG9w0BAQEFAASCCS0wggkpAgEAAoICAQDC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server-ca-cert.pem b/__tests__/fixtures/certificates/server-ca-cert.pem index f85c614fbe..7fbc831ba1 100644 --- a/__tests__/fixtures/certificates/server-ca-cert.pem +++ b/__tests__/fixtures/certificates/server-ca-cert.pem @@ -1,32 +1,34 @@ -----BEGIN CERTIFICATE----- -MIIFgDCCA2gCCQC8rITAE36eyDANBgkqhkiG9w0BAQUFADCBgTELMAkGA1UEBhMC -VVMxCzAJBgNVBAgMAk1BMQ8wDQYDVQQHDAZCb3N0b24xEzARBgNVBAoMCkV4YW1w -bGUgQ28xEDAOBgNVBAsMB3RlY2hvcHMxCzAJBgNVBAMMAmNhMSAwHgYJKoZIhvcN -AQkBFhFjZXJ0c0BleGFtcGxlLmNvbTAeFw0xNjExMDExMDU5MDRaFw00NDAzMTgx -MDU5MDRaMIGBMQswCQYDVQQGEwJVUzELMAkGA1UECAwCTUExDzANBgNVBAcMBkJv -c3RvbjETMBEGA1UECgwKRXhhbXBsZSBDbzEQMA4GA1UECwwHdGVjaG9wczELMAkG -A1UEAwwCY2ExIDAeBgkqhkiG9w0BCQEWEWNlcnRzQGV4YW1wbGUuY29tMIICIjAN -BgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA5dlk+OKb+S14hj/EHVUMzGSAfTpc -TJgAPxhaWChp4ICBspYX3OrIdQ4XXEzJYu0ZFIxhV0VD0XBB9XEdmyaJpgqJORFi -MplDtIOAAsiHL64g7ZW8vKrVH/VWnCk5lt4CX+u7bUzhcGo11Esmvy/uAWDeStLI -m+49esBbr3nL+oYMaGw3u2tgZgaalvozg4p+Tatl3J3TUgpt9fK5tpHwlGmXIOp0 -O6Lq3affXZzFivMm/jJVMGyV1/AowPCtXbhS1O8qQQKws4HZUx9Od34yzOpPCkQf -Wl9YkZKd2OQ1MPTnpjiXluBEbhAPPHKq7P12B+wrlFP+4l9wNwqpTIxFR6j/iy+H -9exO4yaU0QcaQFHOSPxVP3rl0KdEFq/oTkto23Y5nrEuwEZ9TVEdNaxiOElNy/qy -cMU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roO1PLcrLl7mIVEBMT+xr +dsQZ2t5uPdRWl17CC3FPjQIDAQABo2YwZDAdBgNVHQ4EFgQUiv23fsFng48bIdox +T5+R4ZyblCUwHwYDVR0jBBgwFoAUiv23fsFng48bIdoxT5+R4ZyblCUwDgYDVR0P +AQH/BAQDAgEGMBIGA1UdEwEB/wQIMAYBAf8CAQEwDQYJKoZIhvcNAQELBQADggIB +AGyXNgSgEKTsP6khvdCIognjKBPxHloKRa1VjVDISsOTrhpnpzD8iK5fI7PLNTu4 +I57O90Ouo689np766iUIWTGDX3gHXLwPjvEtHFBOctfkDRD6vSk6jT74AWq5SM6R +i+Us6iLcOoyJOXfpRA2RJ8mSmYpswmY16s3vNQtBQASDEgqd1+tuKUXdf1ijBUEI +fua0tUBfmroEDphzi9SOyeo3KbXafjrgHnRRF/EZS86UuwI1OEYqfzqzZzU2aR+i +zKdA+V5m/myfgiFHWnN8hT5TgJC3zjuLrfPE0oWF1xUJouMhDiKp0tWu6S4wyU0w +cxtpCBPoeqjVr4eVyvmpFREPIW6fANUT21QDTu22gjorKoewoFlt62Q/SIiVe8Fd +zMNLzJykHzP8W5E4p2lUFmuZ+cgU0ASsqTf21VfWuBYOLMCe/Z1mRw/egg7/ZlkB +dbgbZVj0hkfh6zGybtAeCPVQ5g+eQ5AOJCaW30xs8zove9Ke6/Pc/QPQ/nU5KhJX +/Vr4xnoOvgq+UM/CwhYgqMcqk04czBF1KHKPKPFv4i+XDZ++cckUq3PMvWHMg8Og ++9LT8+6nWhoz3C2khOeRXJn5JV0+NqrVFYSrk1Ck2Z1h6dVDhz25fyPV+9+hZlDL +iG8MH0iCyXWz6kiZKW0s9LV7AW/PUPU/rZdS+P2HgS0E -----END CERTIFICATE----- diff --git a/__tests__/fixtures/certificates/server-cert.pem b/__tests__/fixtures/certificates/server-cert.pem index 48f07af5e7..5350c49748 100644 --- a/__tests__/fixtures/certificates/server-cert.pem +++ b/__tests__/fixtures/certificates/server-cert.pem @@ -1,32 +1,34 @@ -----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0lBBYwFAYIKwYBBQUH +AwEGCCsGAQUFBwMCMAwGA1UdEwEB/wQCMAAwDQYJKoZIhvcNAQELBQADggIBAEWs +61OBlPRofZao1x1qLKPmH1FVerazgAB24s/g3nbTfiJ47OSjtDu9YMtHjmQ0NKh5 +5O7Mm0r1yoNeU6qUWSM3NmhWeJCzJG6clFo1b1AtVECCeq3dAPdsILKiVX2KzjmH +0Ek15joein0a2qdzcwclsx5B6MsWr77ciM6tIBtD/Lt6l9CNiblB6hThAy5Kgfyk +lK6AXjdbq5IR0L0qZNDUunn2ewzU5TAEiR99GYa9BzZhAfM+RQhwZggQ/2ldfygk +BYR9qMDlQlfs+5ZrIIvKTcuhgc7GcSq35p8Ack35UCGzJQR97BVSFflVksgK0bHE +zmS22RBPjBkGO70X0SHpXCFlLZZ/qjdJL315tdD6q3Pdfpt0igEXwoeSZwt/7T9E +2X/QfEv9BOzLmed8DR8WWcfGn2FR7H7fEuyRWc+z+PlsEFYdVVXTVGn0CNg8eolt +gEbDalpJOUtnYSK1xPXBO7hK/TQFd10r5wm1u1x0k9/DsBGJeSNukdKbrxgwzODY +fy09AL5oTzyYD8jPSF5QcqNh6qmO9MBsIUxSgv6Rxk3dUvhiqCpioMjUmnfoaan+ +GvmOCM3k0jAntU7Vky1Ew8ljtxMlN0E0Rf/Q3nccswlTWQLZFGFFcbuOMBff9R4Q +YCvZpXOrf5hk1tJNShFmWykD5GHxBtsybbc1Zug8 -----END CERTIFICATE----- diff --git a/__tests__/fixtures/certificates/server-key.pem b/__tests__/fixtures/certificates/server-key.pem index 68e82d7e57..53ceec103d 100644 --- a/__tests__/fixtures/certificates/server-key.pem +++ b/__tests__/fixtures/certificates/server-key.pem @@ -1,51 +1,52 @@ ------BEGIN RSA PRIVATE KEY----- -MIIJKAIBAAKCAgEArZgHshixyZHRgO40abko3ZZNat/kbDjNyECw6JEIBKOnJtHY -spyM70ERQEieTsFsI3+7shbQnSjHKFLcBO+afThjeqalFGBaZR/G5NeTMSmgT41E -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QA4PyJ9yY7twBueeVgVvREtLBV3S0rXe5ak6BJo4esrA +o4KOUssDDJX9iEPe8zgtt9Rr1EPTsn4TI1q/M7OkjJh+COTquRsXyFq1+8E+jazF +xOo1+FWyqZPwJQQy0YZwwcjgVG5lGgHTj32VvrP70A8K33/CkF0SdztXJuLWue8K +0rAZLFa7WpU3Hpl2W/r2WvtNTI2vqnkF5Y31aU7NAoIBAQCW+/3U3muMMar85NDG +2bHRiAGebRS3zt4vZx8rT3W3E0L0Zu//q1KqqS72BRkZo5fZ38zwLK+p7Ux97q/2 +SZohNkVrgv040ASpRzE7Xdy+eKhCZOq5DxUQ5eIOoLa6fsfZQc9nRkCX3J73V2dV +n2tjoV2LtEK8f0bLfcEaDL6GPLdJKZGskximUyifADRlo1tO131o3EHv3U9CYNiI +qiSZLcIzhSUvPmU3FF49lPcCnrnv5OA2JDMx+BYLSFxwNnVcMlhTYIT1pBxfPPT1 +qGFvL3CGNSnwMV5VDWIk8Aizo500dgqmsS6SlT7M7/KYSMO08lPhvE72NpLT7LF/ +LkYpAoIBAQCNqwFJCm4MWZbCzGBqjOxdEmp6vvmIl2S1UUIoWH3jBbkMR9R5HRma +1fJp2IrCYCWhhwbYV7atSWf18uTEZ82gudRdefruu5PZBGPStMHN9Uq0pTmoDR6S +KjHc6GWd/yX4rhQb7exQyjGZXVgP9NOibuCa5mH5Qw7a6hIwIniOZev8nCAuppT9 +LY888zW2vx2ggEpyQKqu8ZnUSwDP6MUHA9x9aCCFHc9wSs4lR4aFLyzqyv9Ek94c +mASU+w6/0mi94qOgAvj8kYRbfilKtkSdN8LTw7Wj6RNcwwz6kxWh3bWduCyg/N0E +sWNV9GzIArdm5GlK2XyWjl/dW9/UvzmQ +-----END PRIVATE KEY----- diff --git a/__tests__/fixtures/index/run-failing-script/package.json b/__tests__/fixtures/index/run-failing-script/package.json new file mode 100644 index 0000000000..ced76150aa --- /dev/null +++ b/__tests__/fixtures/index/run-failing-script/package.json @@ -0,0 +1,8 @@ +{ + "name": "test_run_failing_script", + "version": "1.0.0", + "license": "UNLICENSED", + "scripts": { + "custom-script": "echo \"Hi\" && exit 1" + } +} diff --git a/__tests__/fixtures/index/run-suggestion/package.json b/__tests__/fixtures/index/run-suggestion/package.json new file mode 100644 index 0000000000..5757bb3b8c --- /dev/null +++ b/__tests__/fixtures/index/run-suggestion/package.json @@ -0,0 +1,8 @@ +{ + "name": "test_suggestion", + "version": "1.0.0", + "license": "UNLICENSED", + "scripts": { + "foobar": "foobar" + } +} diff --git a/__tests__/fixtures/index/run-workspace/packages/workspace-child-1/package.json b/__tests__/fixtures/index/run-workspace/packages/workspace-child-1/package.json index ad2acf109c..3bc59de531 100644 --- a/__tests__/fixtures/index/run-workspace/packages/workspace-child-1/package.json +++ b/__tests__/fixtures/index/run-workspace/packages/workspace-child-1/package.json @@ -5,6 +5,6 @@ "prescript": "echo workspace-1 prescript", "script": "echo workspace-1 script", "postscript": "echo workspace-1 postscript", - "check": "echo $1" + "check": "echo ARGS:" } } diff --git a/__tests__/fixtures/index/run-workspace/packages/workspace-child-2/package.json b/__tests__/fixtures/index/run-workspace/packages/workspace-child-2/package.json index 9d5534e885..6fff5b5006 100644 --- a/__tests__/fixtures/index/run-workspace/packages/workspace-child-2/package.json +++ b/__tests__/fixtures/index/run-workspace/packages/workspace-child-2/package.json @@ -4,7 +4,8 @@ "scripts": { "prescript": "echo workspace-2 prescript", "script": "echo workspace-2 script", - "postscript": "echo workspace-2 postscript" + "postscript": "echo workspace-2 postscript", + "check": "echo WORKSPACE-CHILD-2 ARGS:" }, "dependencies": { "workspace-1": "1.0.0" diff --git a/__tests__/fixtures/install/cache-folder-nm/node_modules/.cache/hello.txt b/__tests__/fixtures/install/cache-folder-nm/node_modules/.cache/hello.txt new file mode 100644 index 0000000000..557db03de9 --- /dev/null +++ b/__tests__/fixtures/install/cache-folder-nm/node_modules/.cache/hello.txt @@ -0,0 +1 @@ +Hello World diff --git a/__tests__/fixtures/install/cache-folder-nm/package.json b/__tests__/fixtures/install/cache-folder-nm/package.json new file mode 100644 index 0000000000..7bd6acf1a9 --- /dev/null +++ b/__tests__/fixtures/install/cache-folder-nm/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "feed": "0.3.0" + } +} diff --git a/__tests__/fixtures/install/cache-folder-nm/yarn.lock b/__tests__/fixtures/install/cache-folder-nm/yarn.lock new file mode 100644 index 0000000000..4ab6c0f534 --- /dev/null +++ b/__tests__/fixtures/install/cache-folder-nm/yarn.lock @@ -0,0 +1,13 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +feed@0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/feed/-/feed-0.3.0.tgz#65bcc4c9c57fde8e277faf4afff80c2d1d90e82d" + dependencies: + xml ">= 0.0.5" + +"xml@>= 0.0.5": + version "1.0.1" + resolved "https://registry.yarnpkg.com/xml/-/xml-1.0.1.tgz#78ba72020029c5bc87b8a81a3cfcd74b4a2fc1e5" diff --git a/__tests__/fixtures/install/install-production/yarn.lock b/__tests__/fixtures/install/install-production/yarn.lock index 83f2533fdc..0d7972c07f 100644 --- a/__tests__/fixtures/install/install-production/yarn.lock +++ b/__tests__/fixtures/install/install-production/yarn.lock @@ -5,7 +5,9 @@ is-array@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/is-array/-/is-array-1.0.1.tgz#e9850cc2cc860c3bc0977e84ccf0dd464584279a" + integrity sha1-6YUMwsyGDDvAl36EzPDdRkWEJ5o= left-pad@^1.1.3: version "1.1.3" resolved "https://registry.yarnpkg.com/left-pad/-/left-pad-1.1.3.tgz#612f61c033f3a9e08e939f1caebeea41b6f3199a" + integrity sha1-YS9hwDPzqeCOk58crr7qQbbzGZo= diff --git a/__tests__/fixtures/install/install-update-auth-cached-sha1/package.json b/__tests__/fixtures/install/install-update-auth-cached-sha1/package.json new file mode 100644 index 0000000000..9de32f63f4 --- /dev/null +++ b/__tests__/fixtures/install/install-update-auth-cached-sha1/package.json @@ -0,0 +1,14 @@ +{ + "name": "install-update-auth-cached-sha1", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "", + "license": "ISC", + "dependencies": { + "safe-buffer": "^5.1.1" + } +} diff --git a/__tests__/fixtures/install/install-update-auth-cached-sha1/yarn.lock b/__tests__/fixtures/install/install-update-auth-cached-sha1/yarn.lock new file mode 100644 index 0000000000..852a1f4378 --- /dev/null +++ b/__tests__/fixtures/install/install-update-auth-cached-sha1/yarn.lock @@ -0,0 +1,8 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +safe-buffer@^5.1.1: + version "5.1.1" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.1.tgz#893312af69b2123def71f57889001671eeb2c853" + integrity "sha1-iTMSr2myEj3vcfV4iQAWce6yyFM=" diff --git a/__tests__/fixtures/install/install-update-auth-cached-sha512/package.json b/__tests__/fixtures/install/install-update-auth-cached-sha512/package.json new file mode 100644 index 0000000000..9de32f63f4 --- /dev/null +++ b/__tests__/fixtures/install/install-update-auth-cached-sha512/package.json @@ -0,0 +1,14 @@ +{ + "name": "install-update-auth-cached-sha1", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "", + "license": "ISC", + "dependencies": { + "safe-buffer": "^5.1.1" + } +} diff --git a/__tests__/fixtures/install/install-update-auth-cached-sha512/yarn.lock b/__tests__/fixtures/install/install-update-auth-cached-sha512/yarn.lock new file mode 100644 index 0000000000..923cd9ada0 --- /dev/null +++ b/__tests__/fixtures/install/install-update-auth-cached-sha512/yarn.lock @@ -0,0 +1,8 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +safe-buffer@^5.1.1: + version "5.1.1" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.1.tgz#893312af69b2123def71f57889001671eeb2c853" + integrity "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==" diff --git a/__tests__/fixtures/install/install-update-auth-invalid-cache-hash/.yarn-cache/v6/npm-safe-buffer-5.1.1-893312af69b2123def71f57889001671eeb2c853-integrity/node_modules/safe-buffer/.yarn-metadata.json b/__tests__/fixtures/install/install-update-auth-invalid-cache-hash/.yarn-cache/v6/npm-safe-buffer-5.1.1-893312af69b2123def71f57889001671eeb2c853-integrity/node_modules/safe-buffer/.yarn-metadata.json new file mode 100644 index 0000000000..185b68ab60 --- /dev/null +++ b/__tests__/fixtures/install/install-update-auth-invalid-cache-hash/.yarn-cache/v6/npm-safe-buffer-5.1.1-893312af69b2123def71f57889001671eeb2c853-integrity/node_modules/safe-buffer/.yarn-metadata.json @@ -0,0 +1,19 @@ +{ + "manifest": { + "name": "safe-buffer", + "version": "5.1.1" + }, + "artifacts": [], + "remote": { + "resolved": "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.1.tgz#bad-hash", + "type": "tarball", + "reference": "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.1.tgz", + "hash": "bad-hash", + "integrity": "sha1-iTMSr2myEj3vcfV4iQAWce6yyFM=", + "registry": "npm", + "packageName": "safe-buffer", + "cacheIntegrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg== sha1-iTMSr2myEj3vcfV4iQAWce6yyFM=" + }, + "registry": "npm", + "hash": "bad-hash" +} diff --git a/__tests__/fixtures/install/install-update-auth-invalid-cache-hash/.yarn-cache/v6/npm-safe-buffer-5.1.1-893312af69b2123def71f57889001671eeb2c853-integrity/node_modules/safe-buffer/package.json b/__tests__/fixtures/install/install-update-auth-invalid-cache-hash/.yarn-cache/v6/npm-safe-buffer-5.1.1-893312af69b2123def71f57889001671eeb2c853-integrity/node_modules/safe-buffer/package.json new file mode 100644 index 0000000000..c129437073 --- /dev/null +++ b/__tests__/fixtures/install/install-update-auth-invalid-cache-hash/.yarn-cache/v6/npm-safe-buffer-5.1.1-893312af69b2123def71f57889001671eeb2c853-integrity/node_modules/safe-buffer/package.json @@ -0,0 +1,4 @@ +{ + "name": "safe-buffer", + "version": "5.1.1" +} diff --git a/__tests__/fixtures/install/install-update-auth-invalid-cache-hash/package.json b/__tests__/fixtures/install/install-update-auth-invalid-cache-hash/package.json new file mode 100644 index 0000000000..8eede4b5ce --- /dev/null +++ b/__tests__/fixtures/install/install-update-auth-invalid-cache-hash/package.json @@ -0,0 +1,14 @@ +{ + "name": "install-update-auth-invalid-cache-integrity", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "", + "license": "ISC", + "dependencies": { + "safe-buffer": "^5.1.1" + } +} diff --git a/__tests__/fixtures/install/install-update-auth-invalid-cache-hash/yarn.lock b/__tests__/fixtures/install/install-update-auth-invalid-cache-hash/yarn.lock new file mode 100644 index 0000000000..852a1f4378 --- /dev/null +++ b/__tests__/fixtures/install/install-update-auth-invalid-cache-hash/yarn.lock @@ -0,0 +1,8 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +safe-buffer@^5.1.1: + version "5.1.1" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.1.tgz#893312af69b2123def71f57889001671eeb2c853" + integrity "sha1-iTMSr2myEj3vcfV4iQAWce6yyFM=" diff --git a/__tests__/fixtures/install/install-update-auth-invalid-cache-integrity/.yarn-cache/v6/npm-safe-buffer-5.1.1-893312af69b2123def71f57889001671eeb2c853-integrity/node_modules/safe-buffer/.yarn-metadata.json b/__tests__/fixtures/install/install-update-auth-invalid-cache-integrity/.yarn-cache/v6/npm-safe-buffer-5.1.1-893312af69b2123def71f57889001671eeb2c853-integrity/node_modules/safe-buffer/.yarn-metadata.json new file mode 100644 index 0000000000..4ccfbabb09 --- /dev/null +++ b/__tests__/fixtures/install/install-update-auth-invalid-cache-integrity/.yarn-cache/v6/npm-safe-buffer-5.1.1-893312af69b2123def71f57889001671eeb2c853-integrity/node_modules/safe-buffer/.yarn-metadata.json @@ -0,0 +1,19 @@ +{ + "manifest": { + "name": "safe-buffer", + "version": "5.1.1" + }, + "artifacts": [], + "remote": { + "resolved": "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.1.tgz#893312af69b2123def71f57889001671eeb2c853", + "type": "tarball", + "reference": "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.1.tgz", + "hash": "893312af69b2123def71f57889001671eeb2c853", + "integrity": "sha1-bar", + "registry": "npm", + "packageName": "safe-buffer", + "cacheIntegrity": "sha512-foo sha1-bar" + }, + "registry": "npm", + "hash": "893312af69b2123def71f57889001671eeb2c853" +} diff --git a/__tests__/fixtures/install/install-update-auth-invalid-cache-integrity/.yarn-cache/v6/npm-safe-buffer-5.1.1-893312af69b2123def71f57889001671eeb2c853-integrity/node_modules/safe-buffer/package.json b/__tests__/fixtures/install/install-update-auth-invalid-cache-integrity/.yarn-cache/v6/npm-safe-buffer-5.1.1-893312af69b2123def71f57889001671eeb2c853-integrity/node_modules/safe-buffer/package.json new file mode 100644 index 0000000000..c129437073 --- /dev/null +++ b/__tests__/fixtures/install/install-update-auth-invalid-cache-integrity/.yarn-cache/v6/npm-safe-buffer-5.1.1-893312af69b2123def71f57889001671eeb2c853-integrity/node_modules/safe-buffer/package.json @@ -0,0 +1,4 @@ +{ + "name": "safe-buffer", + "version": "5.1.1" +} diff --git a/__tests__/fixtures/install/install-update-auth-invalid-cache-integrity/package.json b/__tests__/fixtures/install/install-update-auth-invalid-cache-integrity/package.json new file mode 100644 index 0000000000..8eede4b5ce --- /dev/null +++ b/__tests__/fixtures/install/install-update-auth-invalid-cache-integrity/package.json @@ -0,0 +1,14 @@ +{ + "name": "install-update-auth-invalid-cache-integrity", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "", + "license": "ISC", + "dependencies": { + "safe-buffer": "^5.1.1" + } +} diff --git a/__tests__/fixtures/install/install-update-auth-invalid-cache-integrity/yarn.lock b/__tests__/fixtures/install/install-update-auth-invalid-cache-integrity/yarn.lock new file mode 100644 index 0000000000..852a1f4378 --- /dev/null +++ b/__tests__/fixtures/install/install-update-auth-invalid-cache-integrity/yarn.lock @@ -0,0 +1,8 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +safe-buffer@^5.1.1: + version "5.1.1" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.1.tgz#893312af69b2123def71f57889001671eeb2c853" + integrity "sha1-iTMSr2myEj3vcfV4iQAWce6yyFM=" diff --git a/__tests__/fixtures/install/install-update-auth-no-integrity-field-with-cache/.yarn-cache/v6/npm-safe-buffer-5.1.1-893312af69b2123def71f57889001671eeb2c853/node_modules/safe-buffer/.yarn-metadata.json b/__tests__/fixtures/install/install-update-auth-no-integrity-field-with-cache/.yarn-cache/v6/npm-safe-buffer-5.1.1-893312af69b2123def71f57889001671eeb2c853/node_modules/safe-buffer/.yarn-metadata.json new file mode 100644 index 0000000000..463bded466 --- /dev/null +++ b/__tests__/fixtures/install/install-update-auth-no-integrity-field-with-cache/.yarn-cache/v6/npm-safe-buffer-5.1.1-893312af69b2123def71f57889001671eeb2c853/node_modules/safe-buffer/.yarn-metadata.json @@ -0,0 +1,17 @@ +{ + "manifest": { + "name": "safe-buffer", + "version": "5.1.1" + }, + "remote": { + "resolved": "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.1.tgz#893312af69b2123def71f57889001671eeb2c853", + "type": "tarball", + "reference": "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.1.tgz", + "hash": "893312af69b2123def71f57889001671eeb2c853", + "registry": "npm", + "packageName": "safe-buffer", + "cacheIntegrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg== sha1-iTMSr2myEj3vcfV4iQAWce6yyFM=" + }, + "registry": "npm", + "hash": "893312af69b2123def71f57889001671eeb2c853" +} diff --git a/__tests__/fixtures/install/install-update-auth-no-integrity-field-with-cache/.yarn-cache/v6/npm-safe-buffer-5.1.1-893312af69b2123def71f57889001671eeb2c853/node_modules/safe-buffer/package.json b/__tests__/fixtures/install/install-update-auth-no-integrity-field-with-cache/.yarn-cache/v6/npm-safe-buffer-5.1.1-893312af69b2123def71f57889001671eeb2c853/node_modules/safe-buffer/package.json new file mode 100644 index 0000000000..c129437073 --- /dev/null +++ b/__tests__/fixtures/install/install-update-auth-no-integrity-field-with-cache/.yarn-cache/v6/npm-safe-buffer-5.1.1-893312af69b2123def71f57889001671eeb2c853/node_modules/safe-buffer/package.json @@ -0,0 +1,4 @@ +{ + "name": "safe-buffer", + "version": "5.1.1" +} diff --git a/__tests__/fixtures/install/install-update-auth-no-integrity-field-with-cache/package.json b/__tests__/fixtures/install/install-update-auth-no-integrity-field-with-cache/package.json new file mode 100644 index 0000000000..308b3bb6df --- /dev/null +++ b/__tests__/fixtures/install/install-update-auth-no-integrity-field-with-cache/package.json @@ -0,0 +1,9 @@ +{ + "name": "install-update-auth-no-integrity-field", + "version": "1.0.0", + "main": "index.js", + "license": "MIT", + "dependencies": { + "safe-buffer": "^5.1.1" + } +} diff --git a/__tests__/fixtures/install/install-update-auth-no-integrity-field-with-cache/yarn.lock b/__tests__/fixtures/install/install-update-auth-no-integrity-field-with-cache/yarn.lock new file mode 100644 index 0000000000..2cb9827a12 --- /dev/null +++ b/__tests__/fixtures/install/install-update-auth-no-integrity-field-with-cache/yarn.lock @@ -0,0 +1,7 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +safe-buffer@^5.1.1: + version "5.1.1" + resolved "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz#893312af69b2123def71f57889001671eeb2c853" diff --git a/__tests__/fixtures/install/install-update-auth-sha1-safebuffer/package.json b/__tests__/fixtures/install/install-update-auth-sha1-safebuffer/package.json new file mode 100644 index 0000000000..baea96337e --- /dev/null +++ b/__tests__/fixtures/install/install-update-auth-sha1-safebuffer/package.json @@ -0,0 +1,14 @@ +{ + "name": "install-update-auth-sha512", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "", + "license": "ISC", + "dependencies": { + "safe-buffer": "^5.1.1" + } +} diff --git a/__tests__/fixtures/install/install-update-auth-sha1-safebuffer/yarn.lock b/__tests__/fixtures/install/install-update-auth-sha1-safebuffer/yarn.lock new file mode 100644 index 0000000000..b852d6c68a --- /dev/null +++ b/__tests__/fixtures/install/install-update-auth-sha1-safebuffer/yarn.lock @@ -0,0 +1,8 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +safe-buffer@^5.1.1: + version "5.1.1" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.1.tgz#893312af69b2123def71f57889001671eeb2c853" + integrity sha1-iTMSr2myEj3vcfV4iQAWce6yyFM= diff --git a/__tests__/fixtures/install/install-update-auth-sha1-with-cache/.yarn-cache/v6/npm-safe-buffer-5.1.1-893312af69b2123def71f57889001671eeb2c853-integrity/node_modules/safe-buffer/.yarn-metadata.json b/__tests__/fixtures/install/install-update-auth-sha1-with-cache/.yarn-cache/v6/npm-safe-buffer-5.1.1-893312af69b2123def71f57889001671eeb2c853-integrity/node_modules/safe-buffer/.yarn-metadata.json new file mode 100644 index 0000000000..631b0f084a --- /dev/null +++ b/__tests__/fixtures/install/install-update-auth-sha1-with-cache/.yarn-cache/v6/npm-safe-buffer-5.1.1-893312af69b2123def71f57889001671eeb2c853-integrity/node_modules/safe-buffer/.yarn-metadata.json @@ -0,0 +1,19 @@ +{ + "manifest": { + "name": "safe-buffer", + "version": "5.1.1" + }, + "artifacts": [], + "remote": { + "resolved": "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.1.tgz#893312af69b2123def71f57889001671eeb2c853", + "type": "tarball", + "reference": "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.1.tgz", + "hash": "893312af69b2123def71f57889001671eeb2c853", + "integrity": "sha1-iTMSr2myEj3vcfV4iQAWce6yyFM=", + "registry": "npm", + "packageName": "safe-buffer", + "cacheIntegrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg== sha1-iTMSr2myEj3vcfV4iQAWce6yyFM=" + }, + "registry": "npm", + "hash": "893312af69b2123def71f57889001671eeb2c853" +} diff --git a/__tests__/fixtures/install/install-update-auth-sha1-with-cache/.yarn-cache/v6/npm-safe-buffer-5.1.1-893312af69b2123def71f57889001671eeb2c853-integrity/node_modules/safe-buffer/package.json b/__tests__/fixtures/install/install-update-auth-sha1-with-cache/.yarn-cache/v6/npm-safe-buffer-5.1.1-893312af69b2123def71f57889001671eeb2c853-integrity/node_modules/safe-buffer/package.json new file mode 100644 index 0000000000..c129437073 --- /dev/null +++ b/__tests__/fixtures/install/install-update-auth-sha1-with-cache/.yarn-cache/v6/npm-safe-buffer-5.1.1-893312af69b2123def71f57889001671eeb2c853-integrity/node_modules/safe-buffer/package.json @@ -0,0 +1,4 @@ +{ + "name": "safe-buffer", + "version": "5.1.1" +} diff --git a/__tests__/fixtures/install/install-update-auth-sha1-with-cache/package.json b/__tests__/fixtures/install/install-update-auth-sha1-with-cache/package.json new file mode 100644 index 0000000000..baea96337e --- /dev/null +++ b/__tests__/fixtures/install/install-update-auth-sha1-with-cache/package.json @@ -0,0 +1,14 @@ +{ + "name": "install-update-auth-sha512", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "", + "license": "ISC", + "dependencies": { + "safe-buffer": "^5.1.1" + } +} diff --git a/__tests__/fixtures/install/install-update-auth-sha1-with-cache/yarn.lock b/__tests__/fixtures/install/install-update-auth-sha1-with-cache/yarn.lock new file mode 100644 index 0000000000..b852d6c68a --- /dev/null +++ b/__tests__/fixtures/install/install-update-auth-sha1-with-cache/yarn.lock @@ -0,0 +1,8 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +safe-buffer@^5.1.1: + version "5.1.1" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.1.tgz#893312af69b2123def71f57889001671eeb2c853" + integrity sha1-iTMSr2myEj3vcfV4iQAWce6yyFM= diff --git a/__tests__/fixtures/install/install-update-auth-sha1/yarn.lock b/__tests__/fixtures/install/install-update-auth-sha1/yarn.lock index 9772bdb613..c53270e9c0 100644 --- a/__tests__/fixtures/install/install-update-auth-sha1/yarn.lock +++ b/__tests__/fixtures/install/install-update-auth-sha1/yarn.lock @@ -4,7 +4,7 @@ abab@^1.0.4: version "1.0.4" - resolved "https://registry.yarnpkg.com/abab/-/abab-1.0.4.tgz#foo" + resolved "https://registry.yarnpkg.com/abab/-/abab-1.0.4.tgz#5faad9c2c07f60dd76770f71cf025b62a63cfd4e" integrity sha1-X6rZwsB/YN12dw9xzwJbYqY8/U4= leftpad@^0.0.1: diff --git a/__tests__/fixtures/install/install-update-auth-sha512-with-cache/.yarn-cache/v6/npm-safe-buffer-5.1.1-893312af69b2123def71f57889001671eeb2c853-integrity/node_modules/safe-buffer/.yarn-metadata.json b/__tests__/fixtures/install/install-update-auth-sha512-with-cache/.yarn-cache/v6/npm-safe-buffer-5.1.1-893312af69b2123def71f57889001671eeb2c853-integrity/node_modules/safe-buffer/.yarn-metadata.json new file mode 100644 index 0000000000..631b0f084a --- /dev/null +++ b/__tests__/fixtures/install/install-update-auth-sha512-with-cache/.yarn-cache/v6/npm-safe-buffer-5.1.1-893312af69b2123def71f57889001671eeb2c853-integrity/node_modules/safe-buffer/.yarn-metadata.json @@ -0,0 +1,19 @@ +{ + "manifest": { + "name": "safe-buffer", + "version": "5.1.1" + }, + "artifacts": [], + "remote": { + "resolved": "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.1.tgz#893312af69b2123def71f57889001671eeb2c853", + "type": "tarball", + "reference": "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.1.tgz", + "hash": "893312af69b2123def71f57889001671eeb2c853", + "integrity": "sha1-iTMSr2myEj3vcfV4iQAWce6yyFM=", + "registry": "npm", + "packageName": "safe-buffer", + "cacheIntegrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg== sha1-iTMSr2myEj3vcfV4iQAWce6yyFM=" + }, + "registry": "npm", + "hash": "893312af69b2123def71f57889001671eeb2c853" +} diff --git a/__tests__/fixtures/install/install-update-auth-sha512-with-cache/.yarn-cache/v6/npm-safe-buffer-5.1.1-893312af69b2123def71f57889001671eeb2c853-integrity/node_modules/safe-buffer/package.json b/__tests__/fixtures/install/install-update-auth-sha512-with-cache/.yarn-cache/v6/npm-safe-buffer-5.1.1-893312af69b2123def71f57889001671eeb2c853-integrity/node_modules/safe-buffer/package.json new file mode 100644 index 0000000000..c129437073 --- /dev/null +++ b/__tests__/fixtures/install/install-update-auth-sha512-with-cache/.yarn-cache/v6/npm-safe-buffer-5.1.1-893312af69b2123def71f57889001671eeb2c853-integrity/node_modules/safe-buffer/package.json @@ -0,0 +1,4 @@ +{ + "name": "safe-buffer", + "version": "5.1.1" +} diff --git a/__tests__/fixtures/install/install-update-auth-sha512-with-cache/package.json b/__tests__/fixtures/install/install-update-auth-sha512-with-cache/package.json new file mode 100644 index 0000000000..baea96337e --- /dev/null +++ b/__tests__/fixtures/install/install-update-auth-sha512-with-cache/package.json @@ -0,0 +1,14 @@ +{ + "name": "install-update-auth-sha512", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "", + "license": "ISC", + "dependencies": { + "safe-buffer": "^5.1.1" + } +} diff --git a/__tests__/fixtures/install/install-update-auth-sha512-with-cache/yarn.lock b/__tests__/fixtures/install/install-update-auth-sha512-with-cache/yarn.lock new file mode 100644 index 0000000000..ab73b927de --- /dev/null +++ b/__tests__/fixtures/install/install-update-auth-sha512-with-cache/yarn.lock @@ -0,0 +1,8 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +safe-buffer@^5.1.1: + version "5.1.1" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.1.tgz#893312af69b2123def71f57889001671eeb2c853" + integrity sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg== diff --git a/__tests__/fixtures/install/invalid-checksum-good-integrity/package.json b/__tests__/fixtures/install/invalid-checksum-good-integrity/package.json new file mode 100644 index 0000000000..8c928771a0 --- /dev/null +++ b/__tests__/fixtures/install/invalid-checksum-good-integrity/package.json @@ -0,0 +1,14 @@ +{ + "name": "badpkg", + "version": "1.0.0", + "description": "A bad package", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "", + "license": "UNLICENSED", + "dependencies": { + "express": "4.11.1" + } +} diff --git a/__tests__/fixtures/install/invalid-checksum-good-integrity/yarn.lock b/__tests__/fixtures/install/invalid-checksum-good-integrity/yarn.lock new file mode 100644 index 0000000000..5c2f89fa3b --- /dev/null +++ b/__tests__/fixtures/install/invalid-checksum-good-integrity/yarn.lock @@ -0,0 +1,8 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +express@4.11.1: + version "4.11.1" + resolved "https://registry.yarnpkg.com/ponyhooves/-/ponyhooves-1.0.1.tgz#36d04dd27aa1667634e987529767f9c99de7903f" + integrity sha1-5XycPpdtVw+X8ik1bKXW7hPv01g= diff --git a/__tests__/fixtures/install/workspaces-install-conflict-without-symlink/arrify/package.json b/__tests__/fixtures/install/workspaces-install-conflict-without-symlink/arrify/package.json new file mode 100644 index 0000000000..6bd08c8c85 --- /dev/null +++ b/__tests__/fixtures/install/workspaces-install-conflict-without-symlink/arrify/package.json @@ -0,0 +1,7 @@ +{ + "name": "arrify", + "version": "2.0.0", + "dependencies": { + "isarray": "2.0.0" + } +} diff --git a/__tests__/fixtures/install/workspaces-install-conflict-without-symlink/package.json b/__tests__/fixtures/install/workspaces-install-conflict-without-symlink/package.json new file mode 100644 index 0000000000..01b65e9fa7 --- /dev/null +++ b/__tests__/fixtures/install/workspaces-install-conflict-without-symlink/package.json @@ -0,0 +1,11 @@ +{ + "name": "my-project", + "private": true, + "dependencies": { + "arrify": "1.0.0", + "isarray": "1.0.0" + }, + "workspaces": [ + "arrify" + ] +} diff --git a/__tests__/fixtures/normalize-manifest/dangerous bin name/actual.json b/__tests__/fixtures/normalize-manifest/dangerous bin name/actual.json new file mode 100644 index 0000000000..2b429e5e9f --- /dev/null +++ b/__tests__/fixtures/normalize-manifest/dangerous bin name/actual.json @@ -0,0 +1,13 @@ +{ + "name": "foo", + "version": "", + "bin": { + ".": "main.js", + "..": "main.js", + "/tmp/foo": "main.js", + "../tmp/foo": "main.js", + "tmp/../../foo": "main.js", + "build:cli": "main.js", + "build.cli": "main.js" + } +} diff --git a/__tests__/fixtures/normalize-manifest/dangerous bin name/expected.json b/__tests__/fixtures/normalize-manifest/dangerous bin name/expected.json new file mode 100644 index 0000000000..b7f6cf75df --- /dev/null +++ b/__tests__/fixtures/normalize-manifest/dangerous bin name/expected.json @@ -0,0 +1,7 @@ +{ + "name": "foo", + "version": "", + "bin": { + "build.cli": "main.js" + } +} diff --git a/__tests__/fixtures/normalize-manifest/dangerous bin values/actual.json b/__tests__/fixtures/normalize-manifest/dangerous bin values/actual.json new file mode 100644 index 0000000000..a8e335abb3 --- /dev/null +++ b/__tests__/fixtures/normalize-manifest/dangerous bin values/actual.json @@ -0,0 +1,9 @@ +{ + "name": "foo", + "version": "", + "bin": { + "foo": "../../../../../foo", + "bar": "/hello/world", + "baz": "./foo/bar/../../../../../../foo" + } +} diff --git a/__tests__/fixtures/normalize-manifest/dangerous bin values/expected.json b/__tests__/fixtures/normalize-manifest/dangerous bin values/expected.json new file mode 100644 index 0000000000..80ce110c76 --- /dev/null +++ b/__tests__/fixtures/normalize-manifest/dangerous bin values/expected.json @@ -0,0 +1,5 @@ +{ + "name": "foo", + "version": "", + "bin": {} +} diff --git a/__tests__/fixtures/normalize-manifest/empty bin string/expected.json b/__tests__/fixtures/normalize-manifest/empty bin string/expected.json index 7c894d5fd8..15a2224ef8 100644 --- a/__tests__/fixtures/normalize-manifest/empty bin string/expected.json +++ b/__tests__/fixtures/normalize-manifest/empty bin string/expected.json @@ -1,5 +1,4 @@ { "name": "foo", - "version": "", - "bin": "" + "version": "" } diff --git a/__tests__/fixtures/request-cache/GET/gitlab.com/leanlabsio/kanban/raw/7f21696fb9d08130dd62abd96c9572f513c05301/package.json.bin b/__tests__/fixtures/request-cache/GET/gitlab.com/leanlabsio/kanban/raw/7f21696fb9d08130dd62abd96c9572f513c05301/package.json.bin new file mode 100644 index 0000000000..11580057f6 --- /dev/null +++ b/__tests__/fixtures/request-cache/GET/gitlab.com/leanlabsio/kanban/raw/7f21696fb9d08130dd62abd96c9572f513c05301/package.json.bin @@ -0,0 +1,62 @@ +HTTP/1.1 200 OK +Server: nginx +Date: Sun, 29 Dec 2019 14:24:54 GMT +Content-Type: text/plain; charset=utf-8 +Content-Length: 1181 +Cache-Control: max-age=3600, public +Content-Disposition: inline +Etag: W/"78309fbf8af4479c47eca65b0c5e3f51" +Referrer-Policy: strict-origin-when-cross-origin +Set-Cookie: experimentation_subject_id=IjJjZjk1MWRjLWUzMDgtNDc3ZC05MTlkLTA0MGU5MWFjY2VlOCI%3D--64f51f0ae3455ebf84d41c0a0a6723703e719689; domain=.gitlab.com; path=/; expires=Thu, 29 Dec 2039 14:24:54 -0000; secure; HttpOnly +X-Content-Type-Options: nosniff +X-Download-Options: noopen +X-Frame-Options: DENY +X-Permitted-Cross-Domain-Policies: none +X-Request-Id: xcIbPa5i6G2 +X-Runtime: 0.056763 +X-Ua-Compatible: IE=edge +X-Xss-Protection: 1; mode=block +Strict-Transport-Security: max-age=31536000 +Referrer-Policy: strict-origin-when-cross-origin +GitLab-LB: fe-07-lb-gprd +GitLab-SV: web-28-sv-gprd + +{ + "name": "kanban", + "version": "0.0.1", + "repository": "gitlab.com/leanlabsio/kanban", + "scripts": { + "install": "npm install", + "build": "grunt build", + "watch": "grunt watch" + }, + "devDependencies": { + "grunt": "~0.4.1", + "grunt-cli": "~0.1.13", + "grunt-contrib-copy": "^0.5.0", + "grunt-contrib-concat": "~0.5.0", + "grunt-contrib-watch": "~0.5.3", + "grunt-contrib-uglify": "~0.7.0", + "grunt-sass": "1.0.0", + "grunt-contrib-connect": "~0.8.0", + "grunt-connect-proxy": "~0.1.11" + }, + "dependencies": { + "angular": "=1.5.6", + "angular-lodash": "https://github.com/EMSSConsulting/angular-lodash.git#68a726c", + "foundation-sites": "5.5.2", + "angular-foundation": "https://github.com/pineconellc/angular-foundation.git#8f3f260", + "angular-loading-bar": "=0.5.2", + "angular-storage": "=0.0.6", + "angular-ui-router": "=0.3.0", + "angularjs-datepicker": "=0.2.15", + "font-awesome": "=4.6.3", + "markdown-it": "=5.0.2", + "markdown-it-emoji": "=1.1.0", + "ng-sortable": "=1.3.6", + "sass-flex-mixin": "=1.0.3", + "lodash": "=4.13.1", + "twemoji": "=2.1.0", + "angular-file-upload": "=2.3.4" + } +} diff --git a/__tests__/fixtures/request-cache/GET/gitlab.com/leanlabsio/kanban/raw/f139bd887dea8e48c46fd7fcfe42b5ffc53d79dd/package.json.bin b/__tests__/fixtures/request-cache/GET/gitlab.com/leanlabsio/kanban/raw/f139bd887dea8e48c46fd7fcfe42b5ffc53d79dd/package.json.bin new file mode 100644 index 0000000000..e0be38d90e --- /dev/null +++ b/__tests__/fixtures/request-cache/GET/gitlab.com/leanlabsio/kanban/raw/f139bd887dea8e48c46fd7fcfe42b5ffc53d79dd/package.json.bin @@ -0,0 +1,56 @@ +HTTP/1.1 200 OK +Server: nginx +Date: Wed, 27 Mar 2019 12:51:12 GMT +Content-Type: text/plain; charset=utf-8 +Content-Length: 1181 +Cache-Control: max-age=3600, public +Content-Disposition: inline +Etag: W/"78309fbf8af4479c47eca65b0c5e3f51" +X-Content-Type-Options: nosniff +X-Frame-Options: DENY +X-Request-Id: kTsEGIR9zSa +X-Runtime: 0.099649 +X-Ua-Compatible: IE=edge +X-Xss-Protection: 1; mode=block +Strict-Transport-Security: max-age=31536000 +Content-Security-Policy: object-src 'none'; worker-src https://assets.gitlab-static.net https://gl-canary.freetls.fastly.net https://gitlab.com blob:; script-src 'self' 'unsafe-inline' 'unsafe-eval' https://assets.gitlab-static.net https://gl-canary.freetls.fastly.net https://www.google.com/recaptcha/ https://www.recaptcha.net/ https://www.gstatic.com/recaptcha/ https://apis.google.com; style-src 'self' 'unsafe-inline' https://assets.gitlab-static.net https://gl-canary.freetls.fastly.net; img-src * data: blob:; frame-src 'self' https://www.google.com/recaptcha/ https://www.recaptcha.net/ https://content.googleapis.com https://content-compute.googleapis.com https://content-cloudbilling.googleapis.com https://content-cloudresourcemanager.googleapis.com https://*.codesandbox.io; frame-ancestors 'self'; connect-src 'self' https://assets.gitlab-static.net https://gl-canary.freetls.fastly.net wss://gitlab.com https://sentry.gitlab.net https://customers.gitlab.com https://snowplow.trx.gitlab.net + +{ + "name": "kanban", + "version": "0.0.1", + "repository": "gitlab.com/leanlabsio/kanban", + "scripts": { + "install": "npm install", + "build": "grunt build", + "watch": "grunt watch" + }, + "devDependencies": { + "grunt": "~0.4.1", + "grunt-cli": "~0.1.13", + "grunt-contrib-copy": "^0.5.0", + "grunt-contrib-concat": "~0.5.0", + "grunt-contrib-watch": "~0.5.3", + "grunt-contrib-uglify": "~0.7.0", + "grunt-sass": "1.0.0", + "grunt-contrib-connect": "~0.8.0", + "grunt-connect-proxy": "~0.1.11" + }, + "dependencies": { + "angular": "=1.5.6", + "angular-lodash": "https://github.com/EMSSConsulting/angular-lodash.git#68a726c", + "foundation-sites": "5.5.2", + "angular-foundation": "https://github.com/pineconellc/angular-foundation.git#8f3f260", + "angular-loading-bar": "=0.5.2", + "angular-storage": "=0.0.6", + "angular-ui-router": "=0.3.0", + "angularjs-datepicker": "=0.2.15", + "font-awesome": "=4.6.3", + "markdown-it": "=5.0.2", + "markdown-it-emoji": "=1.1.0", + "ng-sortable": "=1.3.6", + "sass-flex-mixin": "=1.0.3", + "lodash": "=4.13.1", + "twemoji": "=2.1.0", + "angular-file-upload": "=2.3.4" + } +} diff --git a/__tests__/fixtures/request-cache/GET/registry.yarnpkg.com/arrify/-/arrify-1.0.0.tgz.bin b/__tests__/fixtures/request-cache/GET/registry.yarnpkg.com/arrify/-/arrify-1.0.0.tgz.bin new file mode 100644 index 0000000000..2f5b1d63b4 Binary files /dev/null and b/__tests__/fixtures/request-cache/GET/registry.yarnpkg.com/arrify/-/arrify-1.0.0.tgz.bin differ diff --git a/__tests__/fixtures/request-cache/GET/registry.yarnpkg.com/is-pnp.bin b/__tests__/fixtures/request-cache/GET/registry.yarnpkg.com/is-pnp.bin new file mode 100644 index 0000000000..73976105f8 --- /dev/null +++ b/__tests__/fixtures/request-cache/GET/registry.yarnpkg.com/is-pnp.bin @@ -0,0 +1,18 @@ +HTTP/1.1 200 OK +Date: Wed, 27 Mar 2019 12:49:49 GMT +Content-Type: application/vnd.npm.install-v1+json +Content-Length: 4072 +Connection: keep-alive +Set-Cookie: __cfduid=d2e7739722b1e2621b032ee7a09984edd1553690988; expires=Thu, 26-Mar-20 12:49:48 GMT; path=/; domain=.registry.yarnpkg.com; HttpOnly +CF-Cache-Status: REVALIDATED +Cache-Control: max-age=300 +CF-Ray: 4be17c86d97f56c3-IAD +Accept-Ranges: bytes +ETag: "49fffc656197ace1f624570132931c23" +Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" +Last-Modified: Thu, 01 Nov 2018 01:11:09 GMT +Vary: accept-encoding, accept +x-amz-meta-rev: 3-72d30e72712ca5e8a55f6613d7a30236 +Server: cloudflare + +{"versions":{"1.0.0":{"name":"is-pnp","version":"1.0.0","bin":{"is-pnp":"./bin.js"},"_hasShrinkwrap":false,"directories":{},"dist":{"shasum":"47d3d7151df242eb7ca4768fc2e7f6228871899a","integrity":"sha512-Lx0Sh5h20HtLz+xnlh4NRhQ6w231tGN4yuU3oBi6vn7oSbiIk2V4sqoIn00bczm9ojwkFPzzFUeSOIKEgYpszA==","tarball":"https://registry.npmjs.org/is-pnp/-/is-pnp-1.0.0.tgz","fileCount":5,"unpackedSize":2268,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb2lGmCRA9TVsSAnZWagAARHYP/1botUA//2RoqJEP3nHB\nnQ0G1qhSYL685aLgZTWJW9pS3ucPzxxeofbnByOsbSjUqycwsHBqL/DDeYsq\nz3b0dmfcfESK+CSafYECSnj8kPJH5N5VU2UXs+A+wLEM0D0nSe4wfJLVptA0\nrOpeYrkfwX8ZC1EGLGvQM4cMqpk3Ji6RBZHtD0U/ttYR3A0vP5P76oO2/tBl\n3QSK3nJSpU83OkMBPVY3hnDrGkCjJqwvcqWoWUG0/BtHS5KYD99yrxFAzT5f\nMhtqCZiediDcGtrMhP5b0VAkqdrwFPg/tZPpgqYCevR+2ipWhkxhD0Z4yyx1\n2AuJnEoQKRiBiFPIv5aiJZD9Jj00iey4tdQ1NcXnRtAA16Lo0t4MX/OnkyJW\nBfcSd795mVpe4AO9u6bqMDZfkQrBRunxa7OKKCEXUGihm0YNtTWKat5ym1ia\n9H9Bwlgm3GoFAuHQMu07ZEwidLpWoQfjrTUOufw+/rKNSIRoMNuL3Z/8i4Hj\nazYRMgdzb9rkf6+F7LLJKnyZaDY/bS/KIb61LdkfkX8JCcKUfhVAd5KIvI4e\nAwLAUfHwWM2u2smbexFzvgvXnNFmVrcCGBbMcIrQ+JfiJ+izFVJ7YyLY+Fpt\nwxbV0Vug6gyYDyDtjFCdeL2wFmgR3+nASXWFY4CZ+ZoFX+ontSZ4U5b9PTIs\n1ojq\r\n=DAoM\r\n-----END PGP SIGNATURE-----\r\n"},"engines":{"node":">=6"}},"1.0.1":{"name":"is-pnp","version":"1.0.1","bin":{"is-pnp":"./sources/cli.js"},"_hasShrinkwrap":false,"directories":{},"dist":{"shasum":"ec0e4e443287214ce90bcb6fcd112d20de51f120","integrity":"sha512-uwFQ9SabYoNJwZnDqHUs+WTPvegmoLHjVQqkX4+MiKSjhRBRk+n/zKBAex4yvWnzbN352W7FUuYX8L5yEVmiVA==","tarball":"https://registry.npmjs.org/is-pnp/-/is-pnp-1.0.1.tgz","fileCount":5,"unpackedSize":2276,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb2lJICRA9TVsSAnZWagAAX2IP/jE0+3aAdO7cu9DXNJnb\njoi3rDo8CRfARhWbJRhUj7omDxeP37U3dIIkK69AL8XZSPPUQ8o2uH1AOjZB\niI8cp0IX4bgalRXzEWPj3v8l3z6/BwJoUXy7N5ugdxron+AYj4kS4I1jI6Pa\nUo3z096sc8zAgXFE00RiKwUBGNw+4xpg0yVri/vXpezsahi8r4qZbrc9/hr3\nWzoIK6GwQnGpn5FEhdiuPbB0QiZvalYHn5v2IWtMpQG4ed6jM/vSBAqKqkFv\n95McUD13wz7iJ59BaJHwbypD/WFWz34ZBPZ8QpONk6UAJ2IZwh6J2Wj44k7a\nNtiEj3xo3A5stikfELI//H0AruTI6sSI++EJ8YvHQUj73s6kG0Z/FzPptgKp\nKYLSqXNAC/zHiId1s7uj+jsCLXIm4G2bPQUTsDMfejDS6TfjAVO2COxRF34q\ncLGzYFL1/R+/hO4ckoLl7vz6Vm/zSlMaxZPDUFDy8d0ScxHZOL+760cdIhjT\nr1XGyXAmyjGLWTHvA6sE5X0H0PgghQErsLYXi679KBdnZjN2+Xcmv0pNIqbg\nwS7SBjV+KGpc1PnwtZdfvZcegvY+252zsBvRye9/hcQ0Rdmetbod8XicA3Bw\nuTLC2N9opHeTI7a9bKrACXkSApJftjzYSfnycb27r9bgIAY6BeNhr7JFEMKV\nnxUD\r\n=8Blc\r\n-----END PGP SIGNATURE-----\r\n"},"engines":{"node":">=6"}},"1.0.2":{"name":"is-pnp","version":"1.0.2","bin":{"is-pnp":"./sources/cli.js"},"_hasShrinkwrap":false,"directories":{},"dist":{"shasum":"cbe5d6ad751897822fd92539ac5cfa37c04f3852","integrity":"sha512-BzoewUq0EZFJYKlYpObv2xRdTRJQXwMLbk2Y5l8Dhl0EQGPhdPrSdBlQaAT46gIKjAkNBNScDiUDbuBCTDNCsQ==","tarball":"https://registry.npmjs.org/is-pnp/-/is-pnp-1.0.2.tgz","fileCount":5,"unpackedSize":2282,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb2lKpCRA9TVsSAnZWagAAkFcP+QHfioEIu01ww57y/Jnw\neOtM4JPvx0hDMKxMBKSyvVHmjZKwqxvkAnqdyybHts7i6auvuuMKDO43oaRO\n5GY5i/u29arwBKnPgeVrC6TUnbVxiSP4KBtfzRs3YCXbQ0MfSPmXiH4nzzi/\ngWeNGutgCAbefJjB0eahVCUgO7DL+sM8kEt2iNSDM1gKUDSVq5yvsZD20tX+\n/60eLG4xtz/2zXDKjoqo+DZtvW9kdLJ6TlvbDU1mt1OBSzkTiakIe1XXymVT\n+gRC0QGKGMP+YJG+VothHez/JAagl/92c/JDsb54HkW/OkUKCHFyUAw0P3h1\n46p0vEr54rHa7wT6O0fKg7q+MN1mMOKR3wO258LQW20n+DQJK1hxcJOkk+xf\n6iOa2d6Ywox9yT9B/V555BEZ2fYbnNb4gw+oo3/YyJcZ1Ooadt5kvEyDb67+\ntOaOMBXZh7/FR8EghwBBqlOndWCD4OQYVXVCwIdf/PFyUtB1+Obd4/1H+Dkw\nmg01pi7jYHG8mKLIMNdjggWi966nJ3fZqBDLW0eRtFzCbe+8VSOPKGRSHHnI\n99SD9oY/dgmimcakZ3hInuGlMGf0UrSLjHwi24y0ae1O0AlnQz0bXU0qHAH2\nH/Npr3zjOcAULwvHqtu2l1mNv/PX8GtafyybiMaXBcERearcUN/48tbvcbFX\nZmBP\r\n=z5fE\r\n-----END PGP SIGNATURE-----\r\n"},"engines":{"node":">=6"}}},"name":"is-pnp","dist-tags":{"latest":"1.0.2"},"modified":"2018-11-01T01:11:07.975Z"} \ No newline at end of file diff --git a/__tests__/fixtures/request-cache/GET/registry.yarnpkg.com/is-pnp/-/is-pnp-1.0.2.tgz.bin b/__tests__/fixtures/request-cache/GET/registry.yarnpkg.com/is-pnp/-/is-pnp-1.0.2.tgz.bin new file mode 100644 index 0000000000..980bdfcbec Binary files /dev/null and b/__tests__/fixtures/request-cache/GET/registry.yarnpkg.com/is-pnp/-/is-pnp-1.0.2.tgz.bin differ diff --git a/__tests__/fixtures/request-cache/GET/registry.yarnpkg.com/isarray/-/isarray-2.0.0.tgz.bin b/__tests__/fixtures/request-cache/GET/registry.yarnpkg.com/isarray/-/isarray-2.0.0.tgz.bin new file mode 100644 index 0000000000..55b2d8eec0 Binary files /dev/null and b/__tests__/fixtures/request-cache/GET/registry.yarnpkg.com/isarray/-/isarray-2.0.0.tgz.bin differ diff --git a/__tests__/fixtures/request-cache/GET/registry.yarnpkg.com/ponyhooves/-/ponyhooves-1.0.1.tgz.bin b/__tests__/fixtures/request-cache/GET/registry.yarnpkg.com/ponyhooves/-/ponyhooves-1.0.1.tgz.bin new file mode 100644 index 0000000000..4c3db35535 Binary files /dev/null and b/__tests__/fixtures/request-cache/GET/registry.yarnpkg.com/ponyhooves/-/ponyhooves-1.0.1.tgz.bin differ diff --git a/__tests__/fixtures/run/nohoist-workspace/package.json b/__tests__/fixtures/run/nohoist-workspace/package.json new file mode 100644 index 0000000000..c4ac3364a3 --- /dev/null +++ b/__tests__/fixtures/run/nohoist-workspace/package.json @@ -0,0 +1,5 @@ +{ + "workspaces": [ + "packages/*" + ] +} diff --git a/__tests__/fixtures/run/workspace/packages/pkg1/node_modules/.bin/cat-names b/__tests__/fixtures/run/nohoist-workspace/packages/pkg1/node_modules/.bin/cat-names similarity index 100% rename from __tests__/fixtures/run/workspace/packages/pkg1/node_modules/.bin/cat-names rename to __tests__/fixtures/run/nohoist-workspace/packages/pkg1/node_modules/.bin/cat-names diff --git a/__tests__/fixtures/run/nohoist-workspace/packages/pkg1/package.json b/__tests__/fixtures/run/nohoist-workspace/packages/pkg1/package.json new file mode 100644 index 0000000000..0967ef424b --- /dev/null +++ b/__tests__/fixtures/run/nohoist-workspace/packages/pkg1/package.json @@ -0,0 +1 @@ +{} diff --git a/__tests__/fixtures/version/no-args-no-git-tags/.yarnrc b/__tests__/fixtures/version/no-args-no-git-tags/.yarnrc new file mode 100644 index 0000000000..5cb9a09b64 --- /dev/null +++ b/__tests__/fixtures/version/no-args-no-git-tags/.yarnrc @@ -0,0 +1 @@ +version-git-tag false diff --git a/__tests__/fixtures/version/no-args-no-git-tags/package.json b/__tests__/fixtures/version/no-args-no-git-tags/package.json new file mode 100644 index 0000000000..c8c699e438 --- /dev/null +++ b/__tests__/fixtures/version/no-args-no-git-tags/package.json @@ -0,0 +1,9 @@ +{ + "version": "1.0.0", + "license": "BSD-2-Clause", + "scripts": { + "preversion": "echo preversion", + "version": "echo version", + "postversion": "echo postversion" + } +} diff --git a/__tests__/index.js b/__tests__/index.js index 80345e9569..425e8acb76 100644 --- a/__tests__/index.js +++ b/__tests__/index.js @@ -49,9 +49,9 @@ async function execCommand( cwd: workingDir, env: cleanedEnv, }, - (error, stdout) => { + (error, stdout, stderr) => { if (error) { - reject(Object.assign((new Error(error.message): any), {stdout})); + reject(Object.assign((new Error(error.message): any), {stdout, stderr})); } else { const stdoutLines = stdout .toString() @@ -171,6 +171,15 @@ test.concurrent('should run custom script without run command', async () => { expectRunOutput(stdout); }); +test.concurrent('should run without extra output for failing sub commands', async () => { + try { + await execCommand('run', ['--silent', 'custom-script'], 'run-failing-script'); + throw new Error('the command did not fail'); + } catch (err) { + expect(err.stderr).toBe(''); + } +}); + test.concurrent('should run help command', async () => { const stdout = await execCommand('help', [], 'run-help'); expectHelpOutput(stdout); @@ -291,6 +300,10 @@ test.concurrent('should throws missing command for unknown command', async () => await expectAnErrorMessage(execCommand('unknown', [], 'run-add', true), 'Command "unknown" not found'); }); +test.concurrent('should suggest options for other commands when missing a command', async () => { + await expectAnErrorMessage(execCommand('foobarx', [], 'run-suggestion', true), 'Did you mean "foobar"?'); +}); + test.concurrent('should not display documentation link for unknown command', async () => { await expectAnInfoMessageAfterError(execCommand('unknown', [], 'run-add', true), ''); }); @@ -342,6 +355,39 @@ test.concurrent('should run help for camelised command', async () => { // but actual flags on the command line are passed. test.concurrent('should not pass yarnrc flags to workspace command', async () => { const stdout = await execCommand('workspace', ['workspace-1', 'run', 'check', '--x'], 'run-workspace', true); - const params = stdout.find(x => x && x.indexOf('--x') >= 0); + const params = stdout.find(x => x && x.indexOf('ARGS:') === 0); expect(params).not.toMatch(/emoji/); }); + +// regression test for #7776 +test.concurrent('should pass args to workspace command without need for "--"', async () => { + const stdout = await execCommand('workspace', ['workspace-1', 'run', 'check', '--x', 'y'], 'run-workspace', true); + const params = stdout.find(x => x && x.indexOf('ARGS:') === 0); + expect(params).toEqual('ARGS: --x y'); +}); + +// regression test for #7776 +test.concurrent('should pass args after "--" to workspace command', async () => { + const stdout = await execCommand( + 'workspace', + ['workspace-1', 'run', 'check', '--', 'x', '-y'], + 'run-workspace', + true, + ); + const params = stdout.find(x => x && x.indexOf('ARGS:') === 0); + expect(params).toEqual('ARGS: x -y'); +}); + +// regression test for #7776 +test.concurrent('should pass args to workspaces command without need for "--"', async () => { + const stdout = await execCommand('workspaces', ['run', 'check', '--x', 'y'], 'run-workspace', true); + const params = stdout.find(x => x && x.indexOf('ARGS:') === 0); + expect(params).toEqual('ARGS: --x y'); +}); + +// regression test for #7776 +test.concurrent('should pass args after "--" to workspaces command', async () => { + const stdout = await execCommand('workspaces', ['run', 'check', '--', 'x', '-y'], 'run-workspace', true); + const params = stdout.find(x => x && x.indexOf('ARGS:') === 0); + expect(params).toEqual('ARGS: x -y'); +}); diff --git a/__tests__/integration.js b/__tests__/integration.js index 4a57493ba1..eda727e896 100644 --- a/__tests__/integration.js +++ b/__tests__/integration.js @@ -83,6 +83,7 @@ const getRandomPort = () => Math.floor(Math.random() * PORT_RANGE) + MIN_PORT_NU async function runYarn(args: Array = [], options: Object = {}): Promise> { if (!options['env']) { options['env'] = {...process.env}; + options['env']['YARN_SILENT'] = 0; options['extendEnv'] = false; } options['env']['FORCE_COLOR'] = 0; @@ -559,3 +560,36 @@ test('yarn init -y', async () => { const manifestFile = await fs.readFile(path.join(cwd, 'package.json')); expect(manifestFile).toEqual(initialManifestFile); }); + +test('--modules-folder option', async () => { + /** + * The behavior of --modules-folder (and other folder options) was that it resolved relative not to the current + * working directory, but instead to the closest project root (folder containing a package.json file). + * + * This behavior was at best surprising and could result in data loss. This test captures a scenario in which + * there would previously have been data loss, demonstrating the fix for --modules-folder and other folder options. + * + */ + const projectFolder = await makeTemp(); + const libraryFolder = path.join(projectFolder, 'lib'); + + const initialManifestFile = JSON.stringify({name: 'test', license: 'ISC', version: '1.0.0'}); + const importantData = 'I definitely care about this file!'; + + await fs.writeFile(`${projectFolder}/package.json`, initialManifestFile); + await fs.writeFile(`${projectFolder}/IMPORTANT_FILE.txt`, importantData); + await fs.mkdirp(libraryFolder); + + const options = {cwd: libraryFolder}; + + // This yarn command fails with the previous behavior, the rest of the test is defense in depth + await runYarn(['add', 'left-pad', '--modules-folder', '.'], options); + + // Dependencies should have been installed in the 'lib' folder + const libraryFolderContents = await fs.readdir(`${libraryFolder}`); + expect(libraryFolderContents).toContain('left-pad'); + + // Additionally, there should have not been any data loss in the project folder + const importantFile = await fs.readFile(`${projectFolder}/IMPORTANT_FILE.txt`); + expect(importantFile).toBe(importantData); +}); diff --git a/__tests__/package-resolver.js b/__tests__/package-resolver.js index 269c1b614d..3c0ff6c485 100644 --- a/__tests__/package-resolver.js +++ b/__tests__/package-resolver.js @@ -14,7 +14,7 @@ jasmine.DEFAULT_TIMEOUT_INTERVAL = 90000; const path = require('path'); // regexp which verifies that the cache path contains a path component ending with semver + hash -const cachePathRe = /-\d+\.\d+\.\d+-[\dabcdef]{40}[\\\/]/; +const cachePathRe = /-\d+\.\d+\.\d+-[\dabcdef]{40}(?:-integrity)?[\\\/]/; async function createEnv(configOptions): Object { const lockfile = new Lockfile(); diff --git a/__tests__/registries/npm-registry.js b/__tests__/registries/npm-registry.js index b5177b7719..54ade142a0 100644 --- a/__tests__/registries/npm-registry.js +++ b/__tests__/registries/npm-registry.js @@ -781,6 +781,30 @@ describe('getRequestUrl functional test', () => { expect(npmRegistry.getRequestUrl(registry, pathname)).toEqual('https://my.registry.co/registry/foo/bar/baz'); }); + + for (const host of [`registry.yarnpkg.com`, `registry.npmjs.org`, `registry.npmjs.com`]) { + test(`enforces loading packages through https when they come from ${host}`, () => { + const testCwd = '.'; + const {mockRequestManager, mockRegistries, mockReporter} = createMocks(); + const npmRegistry = new NpmRegistry(testCwd, mockRegistries, mockRequestManager, mockReporter, true, []); + const registry = `http://${host}/registry`; + const pathname = 'foo/bar/baz'; + + expect(npmRegistry.getRequestUrl(registry, pathname)).toEqual(`https://${host}/registry/foo/bar/baz`); + }); + } + + test("doesn't change the protocol for packages from other registries", () => { + const testCwd = '.'; + const {mockRequestManager, mockRegistries, mockReporter} = createMocks(); + const npmRegistry = new NpmRegistry(testCwd, mockRegistries, mockRequestManager, mockReporter, true, []); + const registry = 'http://registry.mylittlepony.org/registry'; + const pathname = 'foo/bar/baz'; + + expect(npmRegistry.getRequestUrl(registry, pathname)).toEqual( + 'http://registry.mylittlepony.org/registry/foo/bar/baz', + ); + }); }); describe('getScope functional test', () => { diff --git a/azure-pipelines.yml b/azure-pipelines.yml index c625c8a030..01d9333f35 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -8,10 +8,15 @@ jobs: strategy: matrix: - node_8_x: - node_version: 8.x +# Azure is currently timeouting a lot on Win / Node 8 +# node_8_x: +# node_version: 8.x node_10_x: node_version: 10.x + node_12_x: + node_version: 12.x + node_13_x: + node_version: 13.x steps: - template: scripts/azure-run-tests.yml @@ -29,6 +34,10 @@ jobs: node_version: 8.x node_10_x: node_version: 10.x + node_12_x: + node_version: 12.x + node_13_x: + node_version: 13.x steps: - template: scripts/azure-run-tests.yml @@ -46,6 +55,10 @@ jobs: node_version: 8.x node_10_x: node_version: 10.x + node_12_x: + node_version: 12.x + node_13_x: + node_version: 13.x steps: - - template: scripts/azure-run-tests.yml \ No newline at end of file + - template: scripts/azure-run-tests.yml diff --git a/package.json b/package.json index c88e3f7102..0d43423675 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "yarn", "installationMethod": "unknown", - "version": "1.18.0-0", + "version": "1.22.0", "license": "BSD-2-Clause", "preferGlobal": true, "description": "📦🐈 Fast, reliable, and secure dependency management.", diff --git a/src/cli/commands/create.js b/src/cli/commands/create.js index cdbcc0ad8c..49b81ac5f7 100644 --- a/src/cli/commands/create.js +++ b/src/cli/commands/create.js @@ -5,6 +5,7 @@ import {MessageError} from '../../errors.js'; import type {Reporter} from '../../reporters/index.js'; import * as child from '../../util/child.js'; import {makeEnv} from '../../util/execute-lifecycle-script'; +import * as fs from '../../util/fs.js'; import {run as runGlobal, getBinFolder} from './global.js'; const path = require('path'); @@ -58,7 +59,13 @@ export async function run(config: Config, reporter: Reporter, flags: Object, arg } const {fullName: packageName, name: commandName} = coerceCreatePackageName(builderName); - await runGlobal(config, reporter, {}, ['add', packageName]); + + const linkLoc = path.join(config.linkFolder, commandName); + if (await fs.exists(linkLoc)) { + reporter.info(reporter.lang('linkUsing', packageName)); + } else { + await runGlobal(config, reporter, {}, ['add', packageName]); + } const binFolder = await getBinFolder(config, {}); const command = path.resolve(binFolder, commandName); diff --git a/src/cli/commands/init.js b/src/cli/commands/init.js index 4a52bcc97b..0576ba0942 100644 --- a/src/cli/commands/init.js +++ b/src/cli/commands/init.js @@ -8,6 +8,7 @@ import GitHubResolver from '../../resolvers/exotics/github-resolver.js'; import * as child from '../../util/child.js'; import * as fs from '../../util/fs.js'; import * as validate from '../../util/normalize-manifest/validate.js'; +import {NODE_BIN_PATH} from '../../constants'; const objectPath = require('object-path'); const path = require('path'); @@ -17,6 +18,8 @@ export function setFlags(commander: Object) { 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'); } export function hasWrapper(commander: Object, args: Array): boolean { @@ -26,6 +29,28 @@ export function hasWrapper(commander: Object, args: Array): boolean { export const shouldRunInCurrentCwd = true; export async function run(config: Config, reporter: Reporter, flags: Object, args: Array): Promise { + const installVersion = flags[`2`] ? `berry` : flags.install; + + if (installVersion) { + const lockfilePath = path.resolve(config.cwd, 'yarn.lock'); + if (!await fs.exists(lockfilePath)) { + await fs.writeFile(lockfilePath, ''); + } + await child.spawn(NODE_BIN_PATH, [process.argv[1], 'policies', 'set-version', installVersion], { + stdio: 'inherit', + cwd: config.cwd, + }); + await child.spawn( + NODE_BIN_PATH, + [process.argv[1], 'init', ...(flags.yes ? ['-y'] : []), ...(flags.private ? ['-p'] : [])], + { + stdio: 'inherit', + cwd: config.cwd, + }, + ); + return; + } + const manifests = await config.getRootManifests(); let repository = {}; diff --git a/src/cli/commands/install.js b/src/cli/commands/install.js index af3f64f56a..bbe044fc35 100644 --- a/src/cli/commands/install.js +++ b/src/cli/commands/install.js @@ -560,6 +560,11 @@ export class Install { this.reporter.warn(this.reporter.lang('npmLockfileWarning')); } + if (this.config.plugnplayEnabled) { + this.reporter.info(this.reporter.lang('plugnplaySuggestV2L1')); + this.reporter.info(this.reporter.lang('plugnplaySuggestV2L2')); + } + let flattenedTopLevelPatterns: Array = []; const steps: Array<(curr: number, total: number) => Promise<{bailout: boolean} | void>> = []; const { diff --git a/src/cli/commands/list.js b/src/cli/commands/list.js index b9b5a8a0ef..b64936e7e7 100644 --- a/src/cli/commands/list.js +++ b/src/cli/commands/list.js @@ -152,7 +152,7 @@ export async function buildTree( } export function getParent(key: string, treesByKey: Object): Object { - const parentKey = key.split('#').slice(0, -1).join('#'); + const parentKey = key.slice(0, key.lastIndexOf('#')); return treesByKey[parentKey]; } diff --git a/src/cli/commands/login.js b/src/cli/commands/login.js index dd55cd1a67..1c0e2dbf60 100644 --- a/src/cli/commands/login.js +++ b/src/cli/commands/login.js @@ -120,6 +120,7 @@ export async function getToken( reporter.success(reporter.lang('revokedToken')); await config.registries.npm.request(`-/user/token/${token}`, { method: 'DELETE', + registry, }); }; } else { diff --git a/src/cli/commands/policies.js b/src/cli/commands/policies.js index 298bafba3f..037121caf2 100644 --- a/src/cli/commands/policies.js +++ b/src/cli/commands/policies.js @@ -3,7 +3,7 @@ import type {Reporter} from '../../reporters/index.js'; import type Config from '../../config.js'; import buildSubCommands from './_build-sub-commands.js'; -import {getRcConfigForCwd} from '../../rc.js'; +import {getRcConfigForFolder} from '../../rc.js'; import * as fs from '../../util/fs.js'; import {stringify} from '../../lockfile'; @@ -114,6 +114,7 @@ const {run, setFlags, examples} = buildSubCommands('policies', { let bundleUrl; let bundleVersion; + let isV2 = false; if (range === 'nightly' || range === 'nightlies') { bundleUrl = 'https://nightly.yarnpkg.com/latest.js'; @@ -121,10 +122,18 @@ const {run, setFlags, examples} = buildSubCommands('policies', { } 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 = await fetchReleases(config, { - includePrereleases: allowRc, - }); + let releases = []; + + try { + releases = await fetchReleases(config, { + includePrereleases: allowRc, + }); + } catch (e) { + reporter.error(e.message); + return; + } const release = releases.find(release => { // $FlowFixMe @@ -145,7 +154,6 @@ const {run, setFlags, examples} = buildSubCommands('policies', { reporter.log(`Downloading ${chalk.green(bundleUrl)}...`); const bundle = await fetchBundle(config, bundleUrl); - const rc = getRcConfigForCwd(config.lockfileFolder, []); const yarnPath = path.resolve(config.lockfileFolder, `.yarn/releases/yarn-${bundleVersion}.js`); reporter.log(`Saving it into ${chalk.magenta(yarnPath)}...`); @@ -153,10 +161,22 @@ const {run, setFlags, examples} = buildSubCommands('policies', { await fs.writeFile(yarnPath, bundle); await fs.chmod(yarnPath, 0o755); - const rcPath = `${config.lockfileFolder}/.yarnrc`; - reporter.log(`Updating ${chalk.magenta(rcPath)}...`); - rc['yarn-path'] = path.relative(config.lockfileFolder, yarnPath); - await fs.writeFilePreservingEol(rcPath, `${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)}...`); + + await fs.writeFilePreservingEol(rcPath, `yarnPath: ${JSON.stringify(yarnPath)}\n`); + } else { + const rcPath = `${config.lockfileFolder}/.yarnrc`; + reporter.log(`Updating ${chalk.magenta(rcPath)}...`); + + const rc = getRcConfigForFolder(config.lockfileFolder); + rc['yarn-path'] = targetPath; + + await fs.writeFilePreservingEol(rcPath, `${stringify(rc)}\n`); + } reporter.log(`Done!`); }, diff --git a/src/cli/commands/run.js b/src/cli/commands/run.js index 47451f5c6b..f0dfbf455d 100644 --- a/src/cli/commands/run.js +++ b/src/cli/commands/run.js @@ -4,6 +4,7 @@ import type {Reporter} from '../../reporters/index.js'; import type Config from '../../config.js'; import {execCommand, makeEnv} from '../../util/execute-lifecycle-script.js'; import {dynamicRequire} from '../../util/dynamic-require.js'; +import {callThroughHook} from '../../util/hooks.js'; import {MessageError} from '../../errors.js'; import {checkOne as checkCompatibility} from '../../package-compatibility.js'; import * as fs from '../../util/fs.js'; @@ -30,6 +31,7 @@ export async function getBinEntries(config: Config): Promise // Setup the node_modules/.bin folders for analysis for (const registryFolder of config.registryFolders) { + binFolders.add(path.resolve(config.cwd, registryFolder, '.bin')); binFolders.add(path.resolve(config.lockfileFolder, registryFolder, '.bin')); } @@ -91,9 +93,11 @@ export async function run(config: Config, reporter: Reporter, flags: Object, arg } } - async function runCommand(args): Promise { - const action = args.shift(); + function runCommand([action, ...args]): Promise { + return callThroughHook('runScript', () => realRunCommand(action, args), {action, args}); + } + async function realRunCommand(action, args): Promise { // build up list of commands const cmds = []; @@ -145,7 +149,7 @@ export async function run(config: Config, reporter: Reporter, flags: Object, arg } else { let suggestion; - for (const commandName in scripts) { + for (const commandName of scripts.keys()) { const steps = leven(commandName, action); if (steps < 2) { suggestion = commandName; diff --git a/src/cli/commands/version.js b/src/cli/commands/version.js index eb77c696de..f7ade77bf7 100644 --- a/src/cli/commands/version.js +++ b/src/cli/commands/version.js @@ -170,44 +170,41 @@ export async function setVersion( await runLifecycle('version'); - // check if committing the new version to git is overriden - if (!flags.gitTagVersion || !config.getOption('version-git-tag')) { - // Don't tag the version in Git - return () => Promise.resolve(); - } - return async function(): Promise { invariant(newVersion, 'expected version'); - // add git commit and tag - let isGit = false; - const parts = config.cwd.split(path.sep); - while (parts.length) { - isGit = await fs.exists(path.join(parts.join(path.sep), '.git')); - if (isGit) { - break; - } else { - parts.pop(); + // check if a new git tag should be created + if (flags.gitTagVersion && config.getOption('version-git-tag')) { + // add git commit and tag + let isGit = false; + const parts = config.cwd.split(path.sep); + while (parts.length) { + isGit = await fs.exists(path.join(parts.join(path.sep), '.git')); + if (isGit) { + break; + } else { + parts.pop(); + } } - } - if (isGit) { - const message = (flags.message || String(config.getOption('version-git-message'))).replace(/%s/g, newVersion); - const sign: boolean = Boolean(config.getOption('version-sign-git-tag')); - const flag = sign ? '-sm' : '-am'; - const prefix: string = String(config.getOption('version-tag-prefix')); - const args: Array = ['commit', '-m', message, ...(isCommitHooksDisabled() ? ['-n'] : [])]; + if (isGit) { + const message = (flags.message || String(config.getOption('version-git-message'))).replace(/%s/g, newVersion); + const sign: boolean = Boolean(config.getOption('version-sign-git-tag')); + const flag = sign ? '-sm' : '-am'; + const prefix: string = String(config.getOption('version-tag-prefix')); + const args: Array = ['commit', '-m', message, ...(isCommitHooksDisabled() ? ['-n'] : [])]; - const gitRoot = (await spawnGit(['rev-parse', '--show-toplevel'], {cwd: config.cwd})).trim(); + const gitRoot = (await spawnGit(['rev-parse', '--show-toplevel'], {cwd: config.cwd})).trim(); - // add manifest - await spawnGit(['add', path.relative(gitRoot, pkgLoc)], {cwd: gitRoot}); + // add manifest + await spawnGit(['add', path.relative(gitRoot, pkgLoc)], {cwd: gitRoot}); - // create git commit - await spawnGit(args, {cwd: gitRoot}); + // create git commit + await spawnGit(args, {cwd: gitRoot}); - // create git tag - await spawnGit(['tag', `${prefix}${newVersion}`, flag, message], {cwd: gitRoot}); + // create git tag + await spawnGit(['tag', `${prefix}${newVersion}`, flag, message], {cwd: gitRoot}); + } } await runLifecycle('postversion'); diff --git a/src/cli/commands/workspace.js b/src/cli/commands/workspace.js index f6708cd8d5..4be65c6ed1 100644 --- a/src/cli/commands/workspace.js +++ b/src/cli/commands/workspace.js @@ -21,11 +21,11 @@ export async function run(config: Config, reporter: Reporter, flags: Object, arg throw new MessageError(reporter.lang('workspaceRootNotFound', config.cwd)); } - if (flags.originalArgs < 1) { + if (args.length < 1) { throw new MessageError(reporter.lang('workspaceMissingWorkspace')); } - if (flags.originalArgs < 2) { + if (args.length < 2) { throw new MessageError(reporter.lang('workspaceMissingCommand')); } @@ -33,7 +33,7 @@ export async function run(config: Config, reporter: Reporter, flags: Object, arg invariant(manifest && manifest.workspaces, 'We must find a manifest with a "workspaces" property'); const workspaces = await config.resolveWorkspaces(workspaceRootFolder, manifest); - const [workspaceName, ...rest] = flags.originalArgs || []; + const [workspaceName, ...rest] = args || []; if (!Object.prototype.hasOwnProperty.call(workspaces, workspaceName)) { throw new MessageError(reporter.lang('workspaceUnknownWorkspace', workspaceName)); diff --git a/src/cli/commands/workspaces.js b/src/cli/commands/workspaces.js index 616cffe041..e95e45f180 100644 --- a/src/cli/commands/workspaces.js +++ b/src/cli/commands/workspaces.js @@ -10,6 +10,7 @@ import {NODE_BIN_PATH, YARN_BIN_PATH} from '../../constants'; const invariant = require('invariant'); const path = require('path'); +const os = require('os'); const semver = require('semver'); export function hasWrapper(commander: Object, args: Array): boolean { @@ -75,12 +76,10 @@ export async function runScript(config: Config, reporter: Reporter, flags: Objec const workspaces = await config.resolveWorkspaces(workspaceRootFolder, manifest); try { - const [_, ...rest] = flags.originalArgs || []; - for (const workspaceName of Object.keys(workspaces)) { const {loc} = workspaces[workspaceName]; - - await child.spawn(NODE_BIN_PATH, [YARN_BIN_PATH, ...rest], { + reporter.log(`${os.EOL}> ${workspaceName}`); + await child.spawn(NODE_BIN_PATH, [YARN_BIN_PATH, 'run', ...args], { stdio: 'inherit', cwd: loc, }); diff --git a/src/cli/index.js b/src/cli/index.js index ad3b7961f8..5a66fc03a4 100644 --- a/src/cli/index.js +++ b/src/cli/index.js @@ -187,7 +187,11 @@ export async function main({ commandName = 'install'; isKnownCommand = true; } - + if (commandName === ('set': string) && args[0] === 'version') { + commandName = ('policies': string); + args.splice(0, 1, 'set-version'); + isKnownCommand = true; + } if (!isKnownCommand) { // if command is not recognized, then set default to `run` args.unshift(commandName); @@ -198,15 +202,20 @@ export async function main({ let warnAboutRunDashDash = false; // we are using "yarn