diff --git a/README.md b/README.md index f15f46d17a..39e434e29b 100644 --- a/README.md +++ b/README.md @@ -32,20 +32,18 @@ Install packages. **Arguments:** * `pkgsToInstall` - *Object | String[]* - either an object that maps package names to version ranges or inputs usually passed to `npm install` (e.g., `foo@1.0.0`, `foo`). +* `options.storeController` - *Object* - required. An object that does all the manipulations with the store. +* `options.store` - *String* - required. Location of the store. * `options.saveProd` - *Boolean* - package will appear in `dependencies`. * `options.saveDev` - *Boolean* - package will appear in `devDependencies`. * `options.saveOptional` - *Boolean* - package will appear in `optionalDependencies`. * `options.saveExact` - *Boolean* - saved dependencies will be configured with an exact version rather than using npm's default semver range operator. * `options.global` - *Boolean* - the packages will be installed globally rather than locally. * `options.prefix` - *String* - the directory in which the installation will be performed. By default the `process.cwd()` value is used. -* `options.metaCache` - *Map* - a cache for package meta info. -* `options.networkConcurrency` - *Number* - `16` by default. Max amount of network requests to perform concurrently. * `options.offline` - *Boolean* - `false` by default. Install packages using only the local registry mirror, w/o doing any network requests. * `options.reporter` - *Function* - A function that listens for logs. * `options.packageManager` - *Object* - The `package.json` of the package manager. * `options.hooks` - *Object* - A property that contains installation hooks. Hooks are [documented separately](#hooks). -* `options.ignoreFile` - *Function & (filename: string) => boolean* - A function that decides which files in a package are ignored. For instance, - there's no need in `.travis.yml` files in production, so you can set `{ignoreFile: fn => fn === '.travis.yml'}`. * `options.packageImportMethod` - *auto | hardlink | reflink | copy* - how to import the packages from the store into node_modules. Defaults to `auto`, which will attempt to do hardlinks, and then copy if hardlinks fail. * `options.shrinkwrapOnly` - *Boolean* - `false` by default. When `true`, only updates `shrinkwrap.yaml` and `package.json` instead of checking `node_modules` and downloading dependencies. diff --git a/package.json b/package.json index 1189228640..a1ac3c8235 100644 --- a/package.json +++ b/package.json @@ -20,8 +20,6 @@ }, "dependencies": { "@pnpm/check-package": "^1.0.0", - "@pnpm/default-fetcher": "^0.3.0", - "@pnpm/default-resolver": "^0.1.0", "@pnpm/fs-locker": "^1.0.0", "@pnpm/package-requester": "^0.6.0", "@pnpm/pkgid-to-filename": "^1.0.0", @@ -65,7 +63,7 @@ "p-filter": "^1.0.0", "p-limit": "^1.1.0", "p-series": "^1.0.0", - "package-store": "^0.13.0", + "package-store": "^0.13.1", "path-absolute": "^1.0.0", "path-exists": "^3.0.0", "path-name": "^1.0.0", @@ -87,6 +85,8 @@ "@commitlint/cli": "^4.2.0", "@commitlint/config-angular": "^4.2.0", "@commitlint/prompt-cli": "^4.2.0", + "@pnpm/default-fetcher": "^0.3.1", + "@pnpm/default-resolver": "^0.1.1", "@pnpm/logger": "^1.0.0", "@types/mkdirp": "^0.5.1", "@types/sinon": "^4.1.2", diff --git a/shrinkwrap.yaml b/shrinkwrap.yaml index 608114e133..7c83f4c948 100644 --- a/shrinkwrap.yaml +++ b/shrinkwrap.yaml @@ -1,16 +1,14 @@ dependencies: '@pnpm/check-package': 1.0.0 - '@pnpm/default-fetcher': 0.3.0 - '@pnpm/default-resolver': 0.1.0 '@pnpm/fs-locker': 1.0.0 - '@pnpm/package-requester': 0.6.1 + '@pnpm/package-requester': 0.6.2 '@pnpm/pkgid-to-filename': 1.0.0 '@pnpm/types': 1.7.0 '@types/byline': 4.2.31 '@types/common-tags': 1.4.0 '@types/load-json-file': 2.0.7 '@types/mz': 0.0.32 - '@types/node': 8.5.2 + '@types/node': 8.5.7 '@types/nopt': 3.0.29 '@types/npm': 2.0.29 '@types/p-series': 1.0.1 @@ -43,9 +41,9 @@ dependencies: npm-lifecycle: 2.0.0 os-homedir: 1.0.2 p-filter: 1.0.0 - p-limit: 1.1.0 + p-limit: 1.2.0 p-series: 1.0.0 - package-store: 0.13.0 + package-store: 0.13.1 path-absolute: 1.0.0 path-exists: 3.0.0 path-name: 1.0.0 @@ -66,6 +64,8 @@ devDependencies: '@commitlint/cli': 4.3.0 '@commitlint/config-angular': 4.3.0 '@commitlint/prompt-cli': 4.3.0 + '@pnpm/default-fetcher': 0.3.2 + '@pnpm/default-resolver': 0.1.1 '@pnpm/logger': 1.0.0 '@types/mkdirp': 0.5.2 '@types/sinon': 4.1.2 @@ -187,32 +187,30 @@ packages: node: '>=4' resolution: integrity: sha512-rN+hiOjGtxwwus7c/E0xkCs9prBeXzZCSCW/Q3k2WdHGSRNLAepr777iv+i2eqTfz9vXlTF0rLZOGi62ujzwYA== - /@pnpm/default-fetcher/0.3.0: + /@pnpm/default-fetcher/0.3.2: dependencies: '@pnpm/git-fetcher': 0.2.0 - '@pnpm/tarball-fetcher': 0.3.1 - '@pnpm/types': 1.7.0 - dev: false + '@pnpm/tarball-fetcher': 0.3.3 + dev: true engines: node: '>=4' resolution: - integrity: sha512-cgpFi6f0uJBhti7qqCO3uK7sw5tnOp6d4RfCRCDTEUqoWmOp7NwzflguSPnuPgD/sNrTCnj0SlGYnwEQlMhGOg== - /@pnpm/default-resolver/0.1.0: + integrity: sha512-icyvz75XAP7iNsRRELrdzzhzAeZOG3NdNuObPLwoYcIQPzlBsHGRiCn0QcmN16dAVzIpRqxaLjAMrrE+7pJFiw== + /@pnpm/default-resolver/0.1.1: dependencies: '@pnpm/git-resolver': 0.3.0 '@pnpm/local-resolver': 0.1.0 - '@pnpm/npm-resolver': 0.3.9 + '@pnpm/npm-resolver': 0.3.10 '@pnpm/tarball-resolver': 0.1.0 - '@pnpm/types': 1.7.0 - dev: false + dev: true engines: node: '>=4' resolution: - integrity: sha512-NeZBprWXvAM58LaHOhD8KrpjieW97SK+hWm4whmXjlsYDW3nNFAVvYUEz4E8vt3Y2LqCvux4G7xRAeSFYHqDhg== + integrity: sha512-G42KfH4Ptzo4S6rGffZHzupyG3VW0pvfRnYQ5vS8IBc8YtXR+KgpHBjR3SRWyRJTtfbGE926pR/TYrulflSIdA== /@pnpm/exec/1.1.2: dependencies: '@types/got': 7.1.6 - '@types/node': 8.5.2 + '@types/node': 8.5.7 command-exists: 1.2.2 cross-spawn: 5.1.0 got: 8.0.1 @@ -223,7 +221,7 @@ packages: integrity: sha512-ZNaOAOvl9J45nhrnMcRxT9wd2G6hPzC444nRmo8Wk/GmY6dd8FVN/XG/nEdHPjcYPyyrW2UA3McNi+klB9oBHw== /@pnpm/fs-locker/1.0.0: dependencies: - '@types/node': 8.5.2 + '@types/node': 8.5.7 mkdirp-promise: 5.0.1 proper-lockfile: 2.0.1 dev: false @@ -233,23 +231,23 @@ packages: integrity: sha512-JRIhC8lBFJjuaDnTMgCfCaO8IEa04JHCrNMW4RAjNrCeWBdcw2sczxp7qjqZPDc90z1VgUMlkpkGzXePcS9flQ== /@pnpm/git-fetcher/0.2.0: dependencies: - '@types/node': 8.5.2 + '@types/node': 8.5.7 dint: 2.0.0 execa: 0.8.0 rimraf-then: 1.0.1 - dev: false + dev: true engines: node: '>=4' resolution: integrity: sha512-IhFB0gZO38sf7hZAsIDuTcV3mtYggK20MHQjnPk0klCIMmJPpDlWQOQVOpmDTvXWrTl79bmjjvkwwfL/P7fUlQ== /@pnpm/git-resolver/0.3.0: dependencies: - '@types/node': 8.5.2 + '@types/node': 8.5.7 got: 8.0.1 graceful-git: 1.0.1 hosted-git-info: 2.5.0 normalize-ssh: 1.0.0 - dev: false + dev: true engines: node: '>=4' peerDependencies: @@ -259,19 +257,19 @@ packages: /@pnpm/local-resolver/0.1.0: dependencies: '@pnpm/types': 1.7.0 - '@types/node': 8.5.2 + '@types/node': 8.5.7 normalize-path: 2.1.1 osenv: 0.1.4 read-package-json: 2.0.12 util.promisify: 1.0.0 - dev: false + dev: true engines: node: '>=4' resolution: integrity: sha512-CLtqpLDq06PLDMy8D1TJ+RW5gw7dXCcnN5wWkE29J5w8e025PKFKJEH8+dvr+zJCVTb2YHyk+Y+IwtOP6uMIIw== /@pnpm/logger/1.0.0: dependencies: - '@types/node': 8.5.2 + '@types/node': 8.5.7 bole: 3.0.2 ndjson: 1.5.0 dev: true @@ -279,12 +277,12 @@ packages: node: '>=4' resolution: integrity: sha512-VRqE5/SiuR7ZrwBmS+Af89BTXli5xBbiqu7WPq56gEtWT8dKf9rFLoimmmMBVeRq5LmVZIXlOxs29F9I+vgSvQ== - /@pnpm/npm-resolver/0.3.9: + /@pnpm/npm-resolver/0.3.10: dependencies: '@pnpm/types': 1.7.0 '@types/load-json-file': 2.0.7 '@types/mem': 1.1.2 - '@types/node': 8.5.2 + '@types/node': 8.5.7 '@types/semver': 5.4.0 '@types/write-json-file': 2.2.1 credentials-by-uri: 1.0.0 @@ -292,19 +290,19 @@ packages: fetch-from-npm-registry: 0.1.0 load-json-file: 4.0.0 mem: 3.0.0 - p-limit: 1.1.0 + p-limit: 1.2.0 semver: 5.4.1 ssri: 5.0.0 version-selector-type: 2.0.0 write-json-file: 2.3.0 - dev: false + dev: true engines: node: '>=4' peerDependencies: '@pnpm/logger': ^1.0.0 resolution: - integrity: sha512-J0V65jUasnWehZ1CsvekFHgy06Jqw7f0PbxVk9iEX2TBHCdJBaMke6Peof9yj61t/fxTzo3qgrxuzTLkM0mW4w== - /@pnpm/package-requester/0.6.1: + integrity: sha512-Sc58Q8F3eHyOgVXxJhjrGTyzIRZIILjlH6tlR0X7FPUbehtDGFrZxZ6rIgy7bg/X9Kf99a5MC6ZlXAULtBYRpA== + /@pnpm/package-requester/0.6.2: dependencies: '@pnpm/check-package': 1.0.0 '@pnpm/pkgid-to-filename': 1.0.0 @@ -316,7 +314,7 @@ packages: load-json-file: 4.0.0 mkdirp-promise: 5.0.1 mz: 2.7.0 - p-limit: 1.1.0 + p-limit: 1.2.0 p-queue: 2.3.0 path-exists: 3.0.0 read-package-json: 2.0.12 @@ -332,7 +330,7 @@ packages: peerDependencies: '@pnpm/logger': ^1.0.0 resolution: - integrity: sha512-ecpgK5U15ZyeqGPQm6eCfbWsiIT/UxDTC7DGCho9np5xLkEnPNAsCjy7ZnVHH9nY7kCULxMBNCGaBljnL8+A6Q== + integrity: sha512-BOWtAMXWUfr2AP/tX5NQmVM33dQSL4JRbVDfW1CsK5v38yR5Vm9DTObvbhKwLD+JFRdV3suqYubwvSdmJvLaqw== /@pnpm/pkgid-to-filename/1.0.0: dependencies: normalize-path: 2.1.1 @@ -341,11 +339,11 @@ packages: node: '>=4' resolution: integrity: sha512-HnWDy3ecIKBsbRR9bwf+GJpV1CWLQ9Injj7eLSEQIsXQ+CLXU0h1NaxBCW7zcJm+2kbwnm0E1aFdFIEJXhHiTg== - /@pnpm/tarball-fetcher/0.3.1: + /@pnpm/tarball-fetcher/0.3.3: dependencies: '@types/mem': 1.1.2 '@types/mz': 0.0.32 - '@types/node': 8.5.2 + '@types/node': 8.5.7 '@types/retry': 0.10.2 credentials-by-uri: 1.0.0 fetch-from-npm-registry: 0.1.0 @@ -357,31 +355,31 @@ packages: retry: 0.10.1 ssri: 5.0.0 unpack-stream: 3.0.0 - dev: false + dev: true engines: node: '>=4' resolution: - integrity: sha512-gnh1si28RSaPqiaMKF7dlIOcrVrJOfjb7oIc9OPeIPE/1A5bxrEYpwU8G8c8pt3ELdgDGTQ35k6N1ioBFbuLPQ== + integrity: sha512-VNO6idIdgEckqFuOG82hQl90KUy0zpecNiIfsfCaXt8kW2CIvgxA/c5wQAR4jxRhd3X56XLK1UiyNH300S2c4A== /@pnpm/tarball-resolver/0.1.0: dependencies: parse-npm-tarball-url: 1.0.2 - dev: false + dev: true engines: node: '>=4' resolution: integrity: sha512-Ieeu9Gg5qZkUdgnsHkjFlqr1Gp2z0LegDnCKe7l4l2klnH5Yp2fjqegfkebpM7Qut9YYe+aFsXFWxSCUk13Z8g== /@pnpm/types/1.7.0: - dev: false resolution: integrity: sha512-pn7g4uxcofWTNG/cxmKvkMK2lxr4OUIhrQDrEVYEdVhW0WkWztsHkFrYjFgfNzPbYu3ITlB3T6aSVjCoJQTOlw== /@sindresorhus/is/0.6.0: + dev: true engines: node: '>=4' resolution: integrity: sha1-OD9Faya8lseInwMyB59DWLFsWNw= /@types/byline/4.2.31: dependencies: - '@types/node': 8.5.2 + '@types/node': 8.5.7 dev: false resolution: integrity: sha1-DmH8ucA+BH0hxEllVMcRYperYM0= @@ -391,13 +389,13 @@ packages: integrity: sha512-HI1tSO87vmd1sPS3DOVSK4gvVKROvCBFvAnXlLiQtAus/+1xXMQcNyu9TX2ChwRXFeQZeB9+f+nMo99xLd5DdA== /@types/fs-extra/4.0.7: dependencies: - '@types/node': 8.5.2 + '@types/node': 8.5.7 dev: true resolution: integrity: sha512-BN48b/2F3kL0Ual7tjcHjj0Fl+nuYKtHa0G/xT3Q43HuCpN7rQD5vIx6Aqnl9x10oBI5xMJh8Ly+FQpP205JlA== /@types/got/7.1.6: dependencies: - '@types/node': 8.5.2 + '@types/node': 8.5.7 dev: true resolution: integrity: sha512-MTgskaiThy9e07/V/gWj1PY3FWsfghgFQVgSLgEV+k7r+rTxvfKNDDNjIcFV/aDhDBCpUEaqdHAeaxjM9uaSKA== @@ -405,30 +403,30 @@ packages: resolution: integrity: sha512-NrH6jPlV77QCVPhAHofWeiOr77TgpKt82c2RVxSBChWBJqyY/u4ngl3CA4mcsAg/w7rNLrkR7dkObMV0ihLLXw== /@types/mem/1.1.2: - dev: false + dev: true resolution: integrity: sha1-48iwlfLyVjtRjwqtWd+f5qi4IGU= /@types/mkdirp/0.5.2: dependencies: - '@types/node': 8.5.2 + '@types/node': 8.5.7 dev: true resolution: integrity: sha512-U5icWpv7YnZYGsN4/cmh3WD2onMY0aJIiTE6+51TwJCttdHvtCYmkBNOobHlXwrJRL0nkH9jH4kD+1FAdMN4Tg== /@types/mz/0.0.32: dependencies: - '@types/node': 8.5.2 + '@types/node': 8.5.7 resolution: integrity: sha512-cy3yebKhrHuOcrJGkfwNHhpTXQLgmXSv1BX+4p32j+VUQ6aP2eJ5cL7OvGcAQx75fCTFaAIIAKewvqL+iwSd4g== - /@types/node/8.5.2: + /@types/node/8.5.7: resolution: - integrity: sha512-KA4GKOpgXnrqEH2eCVhiv2CsxgXGQJgV1X0vsGlh+WCnxbeAE1GT44ZsTU1IN5dEeV/gDupKa7gWo08V5IxWVQ== + integrity: sha512-+1ZfzGIq8Y3EV7hPF7bs3i+Gi2mqYOiEGGRxGYPrn+hTYLMmzg+/5TkMkCHiRtLB38XSNvr/43aQ9+cUq4BbBg== /@types/nopt/3.0.29: dev: false resolution: integrity: sha1-8Z3z20yX7hRZonQAKDIKcdcJZM4= /@types/npm/2.0.29: dependencies: - '@types/node': 8.5.2 + '@types/node': 8.5.7 dev: false resolution: integrity: sha512-McqGDdeT1tSMu8sPaL0ya7xBwojQYKGVwCrlPNBcaF+o+H4wLNH03nYRTfycU11Xdu8eziEb4cgdGmu4VF/NWA== @@ -449,11 +447,10 @@ packages: resolution: integrity: sha1-H1uKGzsaxtH+4TfFP6xfoPKK4Nc= /@types/retry/0.10.2: - dev: false + dev: true resolution: integrity: sha512-LqJkY4VQ7S09XhI7kA3ON71AxauROhSv74639VsNXC9ish4IWHnIi98if+nP1MxQV3RMPqXSCYgpPsDHjlg9UQ== /@types/semver/5.4.0: - dev: false resolution: integrity: sha512-PBHCvO98hNec9A491vBbh0ZNDOVxccwKL1u2pm6fs9oDgm7SEnw0lEHqHfjsYryDxnE3zaf7LvERWEXjOp1hig== /@types/sinon/4.1.2: @@ -470,7 +467,7 @@ packages: integrity: sha512-7NQmHra/JILCd1QqpSzl8+mJRc8ZHz3uDm8YV1Ks9IhK0epEiTw8aIErbvH9PI+6XbqhyIQy3462nEsn7UVzjQ== /@types/tape/4.2.31: dependencies: - '@types/node': 8.5.2 + '@types/node': 8.5.7 dev: true resolution: integrity: sha512-DEPn8FJKQR6eeMHZ407TuAqlhBKQa54PTM3c7Z6pKOI1uHaPnidmpmOXYtNZTcDrL5hnZofSHPwX1AQ9HbaMUg== @@ -548,7 +545,7 @@ packages: /agent-base/4.1.2: dependencies: es6-promisify: 5.0.0 - dev: false + dev: true engines: node: '>= 4.0.0' resolution: @@ -556,7 +553,7 @@ packages: /agentkeepalive/3.3.0: dependencies: humanize-ms: 1.2.1 - dev: false + dev: true engines: node: '>= 4.0.0' resolution: @@ -782,7 +779,7 @@ packages: resolution: integrity: sha1-E+v+d4oDIFz+A3UUgeu0szAMEmo= /bluebird/3.5.1: - dev: false + dev: true resolution: integrity: sha512-MKiLiV+I1AA596t9w1sQJ8jkiSr5+ZKi0WKrYGUn6d1Fx+Ij4tIj+m2WMQSGczs5jZVxV339chE8iwk6F64wjA== /body-parser/1.18.2: @@ -890,7 +887,7 @@ packages: unbzip2-stream: 1.2.5 resolution: integrity: sha1-ya73AIprlDy+mcxhcSXrS9R4KWs= - /cacache/10.0.1: + /cacache/10.0.2: dependencies: bluebird: 3.5.1 chownr: 1.0.1 @@ -905,9 +902,9 @@ packages: ssri: 5.0.0 unique-filename: 1.1.0 y18n: 3.2.1 - dev: false + dev: true resolution: - integrity: sha512-dRHYcs9LvG9cHgdPzjiI+/eS7e1xRhULrcyOx04RZQsszNJXU2SL9CyG60yLnge282Qq5nwTv+ieK2fH+WPZmA== + integrity: sha512-dljb7dk1jqO5ogE+dRpoR9tpHYv5xz9vPSNunh1+0wRuNdYxmzp9WmsyokgW/DUF1FDRVA/TMsmxt027R8djbQ== /cacheable-request/2.1.4: dependencies: clone-response: 1.0.2 @@ -917,6 +914,7 @@ packages: lowercase-keys: 1.0.0 normalize-url: 2.0.1 responselike: 1.0.2 + dev: true resolution: integrity: sha1-DYCIAbY0KtM8kd+dC0TcCbkeXD0= /camelcase-keys/2.1.0: @@ -1033,6 +1031,7 @@ packages: /clone-response/1.0.2: dependencies: mimic-response: 1.0.0 + dev: true resolution: integrity: sha1-0dyXOSAxTfZ/vrlCI7TuNQI56Ws= /co/4.6.0: @@ -1115,6 +1114,7 @@ packages: inherits: 2.0.3 readable-stream: 2.3.3 typedarray: 0.0.6 + dev: true engines: '0': node >= 0.8 resolution: @@ -1175,7 +1175,7 @@ packages: mkdirp: 0.5.1 rimraf: 2.6.2 run-queue: 1.0.3 - dev: false + dev: true resolution: integrity: sha512-f2domd9fsVDFtaFcbaRZuYXwtdmnzqbADSwhSWYxYB/Q8zsdUUFMXVRwXGDMWmbEzAn1kdRrtI1T/KTFOL4X2A== /core-js/2.5.3: @@ -1216,7 +1216,7 @@ packages: /credentials-by-uri/1.0.0: dependencies: nerf-dart: 1.0.0 - dev: false + dev: true resolution: integrity: sha512-WtoZkGQV2KgEfEqWKPetJ2btv+GxldzOe2vHVqAcyuiYdpIwCX7viL2+P9EaZLLfR+SFAZgPdP1+HZJ7MqRc2A== /cross-spawn/5.1.0: @@ -1242,7 +1242,7 @@ packages: resolution: integrity: sha1-mI3zP+qxke95mmE2nddsF635V+o= /cyclist/0.2.2: - dev: false + dev: true resolution: integrity: sha1-GzN5LhHpFKL9bW7WRHRkRE5fpkA= /dargs/4.1.0: @@ -1275,12 +1275,12 @@ packages: /debug/2.6.9: dependencies: ms: 2.0.0 + dev: true resolution: integrity: sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA== /debug/3.1.0: dependencies: ms: 2.0.0 - dev: false resolution: integrity: sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g== /decamelize-keys/1.1.0: @@ -1299,6 +1299,7 @@ packages: resolution: integrity: sha1-9lNNFRSCabIDUue+4m9QH5oZEpA= /decode-uri-component/0.2.0: + dev: true engines: node: '>=0.10' resolution: @@ -1313,6 +1314,7 @@ packages: /decompress-response/3.3.0: dependencies: mimic-response: 1.0.0 + dev: true engines: node: '>=4' resolution: @@ -1401,9 +1403,8 @@ packages: graceful-fs: 4.1.11 mz: 2.7.0 p-every: 1.0.2 - p-limit: 1.1.0 + p-limit: 1.2.0 ssri: 5.0.0 - dev: false engines: node: '>=4' resolution: @@ -1459,6 +1460,7 @@ packages: resolution: integrity: sha1-rOb/gIwc5mtX0ev5eXessCM0z8E= /duplexer3/0.1.4: + dev: true resolution: integrity: sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI= /duplexify/3.5.1: @@ -1489,7 +1491,6 @@ packages: /encode-registry/1.1.0: dependencies: mem: 3.0.0 - dev: false engines: node: '>=4' resolution: @@ -1503,7 +1504,7 @@ packages: /encoding/0.1.12: dependencies: iconv-lite: 0.4.19 - dev: false + dev: true resolution: integrity: sha1-U4tm8+5izRq1HsMjgp0flIDHS+s= /end-of-stream/1.4.0: @@ -1512,7 +1513,7 @@ packages: resolution: integrity: sha1-epDYM+/abPpurA9JSduw+tOmMgY= /err-code/1.1.2: - dev: false + dev: true resolution: integrity: sha1-BuARbTAo9q70gGhJ6w6mp0iuaWA= /error-ex/1.3.1: @@ -1541,13 +1542,13 @@ packages: resolution: integrity: sha1-RTVSSKiJeQNLZ5Lhm7gfK3l13Q0= /es6-promise/4.2.2: - dev: false + dev: true resolution: integrity: sha512-LSas5vsuA6Q4nEdf9wokY5/AJYXry98i0IzXsv49rYsgDGDNDPbqAYR1Pe23iFxygfbGZNR/5VrHXBCh2BhvUQ== /es6-promisify/5.0.0: dependencies: es6-promise: 4.2.2 - dev: false + dev: true resolution: integrity: sha1-UQnWLz5W6pZ8S2NQWu8IKRyKUgM= /escape-html/1.0.3: @@ -1612,7 +1613,6 @@ packages: p-finally: 1.0.0 signal-exit: 3.0.2 strip-eof: 1.0.0 - dev: false engines: node: '>=4' resolution: @@ -1694,9 +1694,9 @@ packages: integrity: sha1-oB6c2cnkkXFcmKdaQtXwu9EH/3Y= /fetch-from-npm-registry/0.1.0: dependencies: - '@types/node': 8.5.2 + '@types/node': 8.5.7 make-fetch-happen: 2.6.0 - dev: false + dev: true engines: node: '>=4' resolution: @@ -1754,7 +1754,7 @@ packages: dependencies: inherits: 2.0.3 readable-stream: 2.3.3 - dev: false + dev: true resolution: integrity: sha1-yBuQ2HRnZvGmCaRoCZRsRd2K5Bc= /for-each/0.3.2: @@ -1804,6 +1804,7 @@ packages: dependencies: inherits: 2.0.3 readable-stream: 2.3.3 + dev: true resolution: integrity: sha1-i/tVAr3kpNNs/e6gB/zKIdfjgq8= /fs-extra/5.0.0: @@ -1820,7 +1821,7 @@ packages: iferr: 0.1.5 imurmurhash: 0.1.4 readable-stream: 2.3.3 - dev: false + dev: true resolution: integrity: sha1-tH31NJPvkR33VzHnCp3tAYnbQMk= /fs.realpath/1.0.0: @@ -1954,6 +1955,7 @@ packages: timed-out: 4.0.1 url-parse-lax: 3.0.0 url-to-options: 1.0.1 + dev: true engines: node: '>=4' resolution: @@ -1967,7 +1969,7 @@ packages: dependencies: execa: 0.8.0 retry: 0.10.1 - dev: false + dev: true engines: node: '>=4' resolution: @@ -2029,11 +2031,13 @@ packages: resolution: integrity: sha1-6CB68cx7MNRGzHC3NLXovhj4jVE= /has-symbol-support-x/1.4.1: + dev: true resolution: integrity: sha512-JkaetveU7hFbqnAC1EV1sF4rlojU2D4Usc5CmS69l6NfmPDnpnFUegzFg33eDkkpNCxZ0mQp65HwUDrNFS/8MA== /has-to-string-tag-x/1.4.1: dependencies: has-symbol-support-x: 1.4.1 + dev: true resolution: integrity: sha512-vdbKfmw+3LoOYVr+mtxHaX5a96+0f3DljYd8JOqvOLsf5mw2Otda2qCDT9qRqLAhrjyQ0h7ual5nOiASpsGNFw== /has-unicode/2.0.1: @@ -2079,6 +2083,7 @@ packages: resolution: integrity: sha512-pNgbURSuab90KbTqvRPsseaTxOJCZBD0a7t+haSN33piP9cCM4l0CqdzAif2hUqm716UovKB2ROmiabGAKVXyg== /http-cache-semantics/3.8.1: + dev: true resolution: integrity: sha512-5ai2iksyV8ZXmnZhHH4rWPoxxistEexSi5936zIQ1bnNTW5VnA85B6P/VpXiRM017IgRvb2kKo1a//y+0wSp3w== /http-errors/1.6.2: @@ -2096,7 +2101,7 @@ packages: dependencies: agent-base: 4.1.2 debug: 2.6.9 - dev: false + dev: true resolution: integrity: sha1-RkgqLwUjpNYIJVFwn0acs+SoX/Q= /http-signature/1.2.0: @@ -2113,16 +2118,17 @@ packages: dependencies: agent-base: 4.1.2 debug: 3.1.0 - dev: false + dev: true resolution: integrity: sha512-LK6tQUR/VOkTI6ygAfWUKKP95I+e6M1h7N3PncGu1CATHCnex+CAv9ttR0lbHu1Uk2PXm/WoAHFo6JCGwMjVMw== /humanize-ms/1.2.1: dependencies: ms: 2.1.1 - dev: false + dev: true resolution: integrity: sha1-xG4xWaKT9riW2ikxbYtv6Lt5u+0= /iconv-lite/0.4.19: + dev: true engines: node: '>=0.10.0' resolution: @@ -2131,7 +2137,7 @@ packages: resolution: integrity: sha1-vjPUCsEO8ZJnAfbwii2G+/0a0+Q= /iferr/0.1.5: - dev: false + dev: true resolution: integrity: sha1-xg7taebY/bazEEofy8ocGS3FtQE= /imurmurhash/0.1.4: @@ -2194,12 +2200,13 @@ packages: dependencies: from2: 2.3.0 p-is-promise: 1.1.0 + dev: true engines: node: '>=4' resolution: integrity: sha1-lvsKk2wSur1v8XUqF9BWFqvQlMY= /ip/1.1.5: - dev: false + dev: true resolution: integrity: sha1-vd7XARQpCCjAoDnnLvJfWq7ENUo= /ipaddr.js/1.4.0: @@ -2291,6 +2298,7 @@ packages: resolution: integrity: sha1-PkcprB9f3gJc19g6iW2rn09n2w8= /is-object/1.0.1: + dev: true resolution: integrity: sha1-iVJojF7C/9awPsyF52ngKQMINHA= /is-plain-obj/1.1.0: @@ -2310,6 +2318,7 @@ packages: resolution: integrity: sha1-VRdIm1RwkbCTDglWVM7SXul+lJE= /is-retry-allowed/1.1.0: + dev: true engines: node: '>=0.10.0' resolution: @@ -2317,7 +2326,7 @@ packages: /is-ssh/1.3.0: dependencies: protocols: 1.4.6 - dev: false + dev: true resolution: integrity: sha1-6+oRaaJhTaOSpjdANmw84EnY3/Y= /is-stream/1.1.0: @@ -2381,6 +2390,7 @@ packages: dependencies: has-to-string-tag-x: 1.4.1 is-object: 1.0.1 + dev: true engines: node: '>= 4' resolution: @@ -2418,6 +2428,7 @@ packages: resolution: integrity: sha1-peZUwuWi3rXyAdls77yoDA7y9RM= /json-buffer/3.0.0: + dev: true resolution: integrity: sha1-Wx85evx11ne96Lz8Dkfh+aPZqJg= /json-parse-better-errors/1.0.1: @@ -2501,6 +2512,7 @@ packages: /keyv/3.0.0: dependencies: json-buffer: 3.0.0 + dev: true resolution: integrity: sha512-eguHnq22OE3uVoSYG0LVWNP+4ppamWr9+zWBe1bsNcovIMy6huUJFPgy4mGwCd/rnl3vOLGW1MTlu4c57CT1xA== /kind-of/3.2.2: @@ -2638,6 +2650,7 @@ packages: resolution: integrity: sha1-W0b4AUft7leIcPCG0Eghz5mOVR8= /lowercase-keys/1.0.0: + dev: true engines: node: '>=0.10.0' resolution: @@ -2666,7 +2679,7 @@ packages: /make-fetch-happen/2.6.0: dependencies: agentkeepalive: 3.3.0 - cacache: 10.0.1 + cacache: 10.0.2 http-cache-semantics: 3.8.1 http-proxy-agent: 2.0.0 https-proxy-agent: 2.1.1 @@ -2676,7 +2689,7 @@ packages: promise-retry: 1.1.1 socks-proxy-agent: 3.0.1 ssri: 5.0.0 - dev: false + dev: true resolution: integrity: sha512-FFq0lNI0ax+n9IWzWpH8A4JdgYiAp2DDYIZ3rsaav8JDe8I+72CzK6PQW/oom15YDZpV5bYW/9INd6nIJ2ZfZw== /map-obj/1.0.1: @@ -2695,10 +2708,10 @@ packages: dev: true resolution: integrity: sha1-5WqpTEyAVaFkBKBnS3jyFffI4ZQ= - /marked/0.3.6: + /marked/0.3.9: dev: true resolution: - integrity: sha1-ssbGGPzOzk74bE/Gy4p8v1rtqNc= + integrity: sha512-nW5u0dxpXxHfkHzzrveY45gCbi+R4PaO4WRZYqZNl+vB0hVGeqlFn0aOg1c8AKL63TrNFn9Bm2UP4AdiZ9TPLw== /media-typer/0.3.0: dev: true engines: @@ -2709,7 +2722,6 @@ packages: dependencies: mimic-fn: 1.1.0 p-is-promise: 1.1.0 - dev: false engines: node: '>=4' resolution: @@ -2797,6 +2809,7 @@ packages: resolution: integrity: sha1-5md4PZLonb00KBi1IwudYqZyrRg= /mimic-response/1.0.0: + dev: true engines: node: '>=4' resolution: @@ -2843,7 +2856,7 @@ packages: pumpify: 1.3.5 stream-each: 1.2.2 through2: 2.0.3 - dev: false + dev: true resolution: integrity: sha1-0gFYPrEjJ+PFwWQqQEqcrPlONPU= /mkdirp-promise/5.0.1: @@ -2870,7 +2883,7 @@ packages: mkdirp: 0.5.1 rimraf: 2.6.2 run-queue: 1.0.3 - dev: false + dev: true resolution: integrity: sha1-viwAX9oy4LKa8fBdfEszIUxwH5I= /ms/0.7.1: @@ -2881,6 +2894,7 @@ packages: resolution: integrity: sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g= /ms/2.1.1: + dev: true resolution: integrity: sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg== /mute-stream/0.0.5: @@ -2928,7 +2942,7 @@ packages: resolution: integrity: sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk= /nerf-dart/1.0.0: - dev: false + dev: true resolution: integrity: sha1-5tq3/r9a2Bbqgc9cYpxaDr3nLBo= /next-path/1.0.0: @@ -2959,7 +2973,7 @@ packages: encoding: 0.1.12 json-parse-better-errors: 1.0.1 safe-buffer: 5.1.1 - dev: false + dev: true engines: node: '>=4' resolution: @@ -3018,7 +3032,6 @@ packages: /normalize-path/2.1.1: dependencies: remove-trailing-separator: 1.1.0 - dev: false engines: node: '>=0.10.0' resolution: @@ -3031,7 +3044,7 @@ packages: dependencies: is-ssh: 1.3.0 parse-url: 1.3.11 - dev: false + dev: true resolution: integrity: sha1-Iqgwj6fNkyvbSa907KxkTPSmGWs= /normalize-url/2.0.1: @@ -3039,6 +3052,7 @@ packages: prepend-http: 2.0.0 query-string: 5.0.1 sort-keys: 2.0.0 + dev: true engines: node: '>=4' resolution: @@ -3148,7 +3162,6 @@ packages: dependencies: define-properties: 1.1.2 es-abstract: 1.10.0 - dev: false engines: node: '>= 0.8' resolution: @@ -3194,13 +3207,11 @@ packages: resolution: integrity: sha1-2j6nRob6IaGaERwybpDrFaAZZoY= /os-homedir/1.0.2: - dev: false engines: node: '>=0.10.0' resolution: integrity: sha1-/7xJiDNuDoM94MFox+8VISGqf7M= /os-tmpdir/1.0.2: - dev: false engines: node: '>=0.10.0' resolution: @@ -3209,10 +3220,10 @@ packages: dependencies: os-homedir: 1.0.2 os-tmpdir: 1.0.2 - dev: false resolution: integrity: sha1-Qv5tWVPfBsgGS+bxdsPQWqqjRkQ= /p-cancelable/0.3.0: + dev: true engines: node: '>=4' resolution: @@ -3220,7 +3231,6 @@ packages: /p-every/1.0.2: dependencies: p-map: 1.2.0 - dev: false engines: node: '>=4' resolution: @@ -3243,21 +3253,22 @@ packages: node: '>=4' resolution: integrity: sha1-nJRWmJ6fZYgBewQ01WCXZ1w9oF4= - /p-limit/1.1.0: + /p-limit/1.2.0: + dependencies: + p-try: 1.0.0 engines: node: '>=4' resolution: - integrity: sha1-sH/y2aXYi+yAYDWJWiurZqJ5iLw= + integrity: sha512-Y/OtIaXtUPr4/YpMv1pCL5L5ed0rumAaAeBSj12F+bSlMdys7i8oQF/GUJmfpTS/QoaRrS/k6pma29haJpsMng== /p-locate/2.0.0: dependencies: - p-limit: 1.1.0 + p-limit: 1.2.0 dev: true engines: node: '>=4' resolution: integrity: sha1-IKAQOyIqcMj9OcwuWAaA893l7EM= /p-map/1.2.0: - dev: false engines: node: '>=4' resolution: @@ -3285,17 +3296,23 @@ packages: /p-timeout/2.0.1: dependencies: p-finally: 1.0.0 + dev: true engines: node: '>=4' resolution: integrity: sha512-88em58dDVB/KzPEx1X0N3LwFfYZPyDc4B6eF38M1rk9VTZMbxXXgjugz8mmwpS9Ox4BDZ+t6t3QP5+/gazweIA== + /p-try/1.0.0: + engines: + node: '>=4' + resolution: + integrity: sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M= /package-preview/1.0.3: dependencies: '@pnpm/exec': 1.1.2 '@types/fs-extra': 4.0.7 '@types/load-json-file': 2.0.7 '@types/mz': 0.0.32 - '@types/node': 8.5.2 + '@types/node': 8.5.7 '@types/write-json-file': 2.2.1 cross-spawn: 5.1.0 find-down: 0.1.4 @@ -3313,20 +3330,20 @@ packages: node: '>=4' resolution: integrity: sha512-nigldHuSWszV5IK53dfOdpgfLsG0++QwNAFIFo5bgv5MPm/F4tiDJX240CJ+wZVzftbPGBmk4bnN/UB8wHFoeA== - /package-store/0.13.0: + /package-store/0.13.1: dependencies: '@pnpm/fs-locker': 1.0.0 - '@pnpm/package-requester': 0.6.1 + '@pnpm/package-requester': 0.6.2 '@pnpm/types': 1.7.0 '@types/load-json-file': 2.0.7 - '@types/node': 8.5.2 + '@types/node': 8.5.7 '@types/ramda': 0.25.13 drive-by-path: 1.0.0 encode-registry: 1.1.0 load-json-file: 4.0.0 os-homedir: 1.0.2 p-filter: 1.0.0 - p-limit: 1.1.0 + p-limit: 1.2.0 path-absolute: 1.0.0 path-exists: 3.0.0 ramda: 0.25.0 @@ -3338,7 +3355,7 @@ packages: peerDependencies: '@pnpm/logger': ^1.0.0 resolution: - integrity: sha512-arrwP6hh3jZ+Z3Mqq1mfuoA0IoTLw+E/pcAMlHVGq7/OMu/SPL74yBDmAoMQltNkDdXljYXzjPOjy3eQTjdy5A== + integrity: sha512-RUVNg1b5BsU4uhEd2nWoaGdI6A2SeeN5wb7psNYNVhY4AaDc4F5EjHa4PhBWaKact0LKkjiGQYoLWhWjXQtRlA== /pako/0.2.9: resolution: integrity: sha1-8/dSL073gjSNqBYbrZ7P1Rv4OnU= @@ -3347,7 +3364,7 @@ packages: cyclist: 0.2.2 inherits: 2.0.3 readable-stream: 2.3.3 - dev: false + dev: true resolution: integrity: sha1-1BDwZbBdojCB/NEPKIVMKb2jOwY= /parse-json/2.2.0: @@ -3376,9 +3393,9 @@ packages: integrity: sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA= /parse-npm-tarball-url/1.0.2: dependencies: - '@types/node': 8.5.2 + '@types/node': 8.5.7 semver-regex: 1.0.0 - dev: false + dev: true engines: node: '>=4' resolution: @@ -3393,7 +3410,7 @@ packages: dependencies: is-ssh: 1.3.0 protocols: 1.4.6 - dev: false + dev: true resolution: integrity: sha1-V8FUKKuKiSsfQ4aWRccR0OFEtVQ= /parseurl/1.3.2: @@ -3523,13 +3540,13 @@ packages: anonymous-npm-registry-client: 0.1.2 cpr: 3.0.1 rimraf: 2.6.2 - verdaccio: 2.7.1 + verdaccio: 2.7.2 dev: true resolution: integrity: sha512-PijlGxk564x1E/3Pw0hzcE6tw9Va/lZ/UVfheq+ld62c8mqOmgC/49DCx+YIV1RAwscDttsVUT3EeAjAZHh55g== /pnpm-shrinkwrap/5.1.0: dependencies: - '@types/node': 8.5.2 + '@types/node': 8.5.7 '@types/ramda': 0.25.13 dependency-path: 1.2.0 js-yaml: 3.10.0 @@ -3567,6 +3584,7 @@ packages: resolution: integrity: sha512-99TyEFYTTkBWANT+mwSptmLb9ZCLQ6qKIUE36fXSIOtShB0JNprL2hzBD8F1yIuT9btjFrFEwbRHXhqDi1HmRA== /prepend-http/2.0.0: + dev: true engines: node: '>=4' resolution: @@ -3581,14 +3599,14 @@ packages: resolution: integrity: sha1-FjjYqONML0QKkduVq5rrZ3/Bhc8= /promise-inflight/1.0.1: - dev: false + dev: true resolution: integrity: sha1-mEcocL8igTL8vdhoEputEsPAKeM= /promise-retry/1.1.1: dependencies: err-code: 1.1.2 retry: 0.10.1 - dev: false + dev: true engines: node: '>=0.12' resolution: @@ -3607,7 +3625,7 @@ packages: resolution: integrity: sha1-IS1b/hMYMGpCD2QCuOJv85ZHqEk= /protocols/1.4.6: - dev: false + dev: true resolution: integrity: sha1-+LsmPqG1/Xp2BNJri+Ob13Z4v4o= /proxy-addr/1.1.5: @@ -3669,6 +3687,7 @@ packages: decode-uri-component: 0.2.0 object-assign: 4.1.1 strict-uri-encode: 1.1.0 + dev: true engines: node: '>=0.10.0' resolution: @@ -3720,7 +3739,6 @@ packages: json-parse-better-errors: 1.0.1 normalize-package-data: 2.4.0 slash: 1.0.0 - dev: false optionalDependencies: graceful-fs: 4.1.11 resolution: @@ -3818,7 +3836,6 @@ packages: resolution: integrity: sha512-h9Pl2xE1ZxYOhlKh0nYeMfzfv0GYUfglE5Eb0ILFFUiDnvVcbKwxGGukETEeIteR0JTVfesOaKqiwrOoUz1ajw== /remove-trailing-separator/1.1.0: - dev: false resolution: integrity: sha1-wkvOKig62tW8P1jg1IJJuSN52O8= /rename-overwrite/1.0.0: @@ -3914,6 +3931,7 @@ packages: /responselike/1.0.2: dependencies: lowercase-keys: 1.0.0 + dev: true resolution: integrity: sha1-kYcg7ztjHFZCvgaPFa3lpG9Loec= /restore-cursor/1.0.1: @@ -3970,7 +3988,7 @@ packages: /run-queue/1.0.3: dependencies: aproba: 1.2.0 - dev: false + dev: true resolution: integrity: sha1-6Eg5bwV9Ij8kOGkkYY4laUFh7Ec= /rx-lite/3.1.2: @@ -3990,7 +4008,7 @@ packages: resolution: integrity: sha512-1HwIYD/8UlOtFS3QO3w7ey+SdSDFE4HRNLZoZRYVQefrOY3l17epswImeB1ijgJFQJodIaHcwkp3r/myBjFVbg== /semver-regex/1.0.0: - dev: false + dev: true engines: node: '>=0.10.0' resolution: @@ -4094,7 +4112,6 @@ packages: resolution: integrity: sha512-c7u0ZuvBRX1eXuB4jN3BRCAOGiUTlM8SE3TxbJHrNiHUKL7wonujMOB6Fi1gQc00U91IscFORQHDga/eccqpbw== /slash/1.0.0: - dev: false engines: node: '>=0.10.0' resolution: @@ -4103,7 +4120,7 @@ packages: resolution: integrity: sha1-VusCfWW00tzmyy4tMsTUr8nh1wc= /smart-buffer/1.1.15: - dev: false + dev: true engines: node: '>= 0.10.15' npm: '>= 1.3.5' @@ -4120,14 +4137,14 @@ packages: dependencies: agent-base: 4.1.2 socks: 1.1.10 - dev: false + dev: true resolution: integrity: sha512-ZwEDymm204mTzvdqyUqOdovVr2YRd2NYskrYrF2LXyZ9qDiMAoFESGK8CRphiO7rtbo2Y757k2Nia3x2hGtalA== /socks/1.1.10: dependencies: ip: 1.1.5 smart-buffer: 1.1.15 - dev: false + dev: true engines: node: '>= 0.10.0' npm: '>= 1.3.5' @@ -4235,13 +4252,14 @@ packages: dependencies: end-of-stream: 1.4.0 stream-shift: 1.0.0 - dev: false + dev: true resolution: integrity: sha512-mc1dbFhGBxvTM3bIWmAAINbqiuAk9TATcfIQC8P+/+HJefgaiTlMn2dHvkX8qlI12KeYKSQ1Ua9RrIqrn1VPoA== /stream-shift/1.0.0: resolution: integrity: sha1-1cdSgl5TZ+eG944Y5EXqIjoVWVI= /strict-uri-encode/1.1.0: + dev: true engines: node: '>=0.10.0' resolution: @@ -4344,7 +4362,7 @@ packages: /symlink-dir/1.1.1: dependencies: '@types/mz': 0.0.32 - '@types/node': 8.5.2 + '@types/node': 8.5.7 graceful-fs: 4.1.11 is-windows: 1.0.1 mkdirp-promise: 5.0.1 @@ -4440,6 +4458,7 @@ packages: resolution: integrity: sha1-AARWmzfHx0ujnEPzzteNGtlBQL4= /timed-out/4.0.1: + dev: true engines: node: '>=0.10.0' resolution: @@ -4566,6 +4585,7 @@ packages: resolution: integrity: sha1-yrEPtJCeRByChC6v4a1kbIGARBA= /typedarray/0.0.6: + dev: true resolution: integrity: sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= /typescript/2.6.2: @@ -4608,13 +4628,13 @@ packages: /unique-filename/1.1.0: dependencies: unique-slug: 2.0.0 - dev: false + dev: true resolution: integrity: sha1-0F8v5AMlYIcfMOk8vnNe6iAVFPM= /unique-slug/2.0.0: dependencies: imurmurhash: 0.1.4 - dev: false + dev: true resolution: integrity: sha1-22Z258fMBimHj/GWCXx4hVrp9Ks= /universalify/0.1.1: @@ -4627,7 +4647,7 @@ packages: integrity: sha1-HAgkFQSBvHoB1J6Y8exmjYJBLzs= /unpack-stream/3.0.0: dependencies: - '@types/node': 8.5.2 + '@types/node': 8.5.7 decompress-maybe: 1.0.0 ssri: 5.0.0 tar-fs: 1.16.0 @@ -4655,11 +4675,13 @@ packages: /url-parse-lax/3.0.0: dependencies: prepend-http: 2.0.0 + dev: true engines: node: '>=4' resolution: integrity: sha1-FrXK/Afb42dsGxmZF3gj1lA6yww= /url-to-options/1.0.1: + dev: true engines: node: '>= 4' resolution: @@ -4671,7 +4693,6 @@ packages: dependencies: define-properties: 1.1.2 object.getownpropertydescriptors: 2.0.3 - dev: false resolution: integrity: sha512-i+6qA2MPhvoKLuxnJNpXAGhg7HphQOSUq2LKMZD0m15EiskXUkMvKdF4Uui0WYeCUGea+o2cw/ZuwehtfsrNkA== /utils-merge/1.0.0: @@ -4709,7 +4730,7 @@ packages: node: '>= 0.8' resolution: integrity: sha1-IpnwLG3tMNSllhsLn3RSShj2NPw= - /verdaccio/2.7.1: + /verdaccio/2.7.2: dependencies: '@verdaccio/file-locking': 0.0.3 '@verdaccio/streams': 0.0.2 @@ -4733,7 +4754,7 @@ packages: lockfile: 1.0.3 lodash: 4.17.4 lunr: 0.7.2 - marked: 0.3.6 + marked: 0.3.9 mime: 1.6.0 minimatch: 3.0.4 mkdirp: 0.5.1 @@ -4746,7 +4767,7 @@ packages: node: '>=4.6.1' npm: '>=2.15.9' resolution: - integrity: sha512-TrgS5O76vOsY5jd3sl3G5PRXTsRjInvAwSxVFw77nguR6NQfUf+1yBH6LAQzmzcf1DxPm7PWp/nD3kfHCm7FsQ== + integrity: sha512-ATuaPlBqdbIghLDy7YBxYPFQ2O1st/27WvXB8uUCm3xgW6F+2THSLPXHsD9Bi7VEY0eJitDgGsUWqaL9hBl8IA== /verror/1.10.0: dependencies: assert-plus: 1.0.0 @@ -4759,7 +4780,6 @@ packages: /version-selector-type/2.0.0: dependencies: semver: 5.4.1 - dev: false engines: node: '>=4' resolution: @@ -4876,7 +4896,7 @@ packages: resolution: integrity: sha1-pcbVMr5lbiPbgg77lDofBJmNY68= /y18n/3.2.1: - dev: false + dev: true resolution: integrity: sha1-bRX7qITAhnnA136I53WegR4H+kE= /yallist/2.1.2: @@ -4906,8 +4926,8 @@ specifiers: '@commitlint/config-angular': ^4.2.0 '@commitlint/prompt-cli': ^4.2.0 '@pnpm/check-package': ^1.0.0 - '@pnpm/default-fetcher': ^0.3.0 - '@pnpm/default-resolver': ^0.1.0 + '@pnpm/default-fetcher': ^0.3.1 + '@pnpm/default-resolver': ^0.1.1 '@pnpm/fs-locker': ^1.0.0 '@pnpm/logger': ^1.0.0 '@pnpm/package-requester': ^0.6.0 @@ -4965,7 +4985,7 @@ specifiers: p-limit: ^1.1.0 p-series: ^1.0.0 package-preview: ^1.0.0 - package-store: ^0.13.0 + package-store: ^0.13.1 path-absolute: ^1.0.0 path-exists: ^3.0.0 path-name: ^1.0.0 diff --git a/src/api/extendInstallOptions.ts b/src/api/extendInstallOptions.ts new file mode 100644 index 0000000000..c6798d8c87 --- /dev/null +++ b/src/api/extendInstallOptions.ts @@ -0,0 +1,171 @@ +import path = require('path') +import logger from '@pnpm/logger' +import pnpmPkgJson from '../pnpmPkgJson' +import {LAYOUT_VERSION} from '../fs/modulesController' +import normalizeRegistryUrl = require('normalize-registry-url') +import {resolveStore, StoreController} from 'package-store' +import { ReporterFunction } from '../types' +import { ReadPackageHook } from '@pnpm/types' + +export type InstallOptions = { + storeController: StoreController, + store: string, + reporter?: ReporterFunction, + shrinkwrapOnly?: boolean, + force?: boolean, + update?: boolean, + depth?: number, + repeatInstallDepth?: number, + prefix?: string, + offline?: boolean, + rawNpmConfig?: object, + verifyStoreIntegrity?: boolean, + engineStrict?: boolean, + nodeVersion?: string, + packageManager?: { + name: string, + version: string, + }, + hooks?: { + readPackage?: ReadPackageHook, + }, + saveExact?: boolean, + savePrefix?: string, + saveDev?: boolean, + saveOptional?: boolean, + global?: boolean, + bin?: string, + production?: boolean, + development?: boolean, + optional?: boolean, + independentLeaves?: boolean, + packageImportMethod?: 'auto' | 'hardlink' | 'copy' | 'reflink', + ignoreScripts?: boolean, + childConcurrency?: number, + userAgent?: string, + unsafePerm?: boolean, + registry?: string, + lock?: boolean, + lockStaleDuration?: number, + tag?: string, + locks?: string, +} + +export type StrictInstallOptions = InstallOptions & { + shrinkwrapOnly: boolean, + force: boolean, + update: boolean, + prefix: string, + depth: number, + repeatInstallDepth: number, + engineStrict: boolean, + nodeVersion: string, + offline: boolean, + rawNpmConfig: object, + verifyStoreIntegrity: boolean, + packageManager: { + name: string, + version: string, + }, + hooks: { + readPackage?: ReadPackageHook, + }, + saveExact: boolean, + savePrefix: string, + saveDev: boolean, + saveOptional: boolean, + global: boolean, + bin: string, + production: boolean, + development: boolean, + optional: boolean, + independentLeaves: boolean, + packageImportMethod: 'auto' | 'hardlink' | 'copy' | 'reflink', + ignoreScripts: boolean, + childConcurrency: number, + userAgent: string, + lock: boolean, + registry: string, + lockStaleDuration: number, + tag: string, + locks: string, +} + +const defaults = async (opts: InstallOptions) => { + const packageManager = opts.packageManager || { + name: pnpmPkgJson.name, + version: pnpmPkgJson.version, + } + const prefix = opts.prefix || process.cwd() + return { + storeController: opts.storeController, + shrinkwrapOnly: false, + saveExact: false, + global: false, + store: opts.store, + locks: path.join(opts.store, '_locks'), + ignoreScripts: false, + tag: 'latest', + production: true, + development: true, + bin: path.join(prefix, 'node_modules', '.bin'), + prefix, + nodeVersion: process.version, + force: false, + depth: 0, + engineStrict: false, + lockStaleDuration: 60 * 1000, // 1 minute + lock: true, + childConcurrency: 5, + offline: false, + registry: 'https://registry.npmjs.org/', + userAgent: `${packageManager.name}/${packageManager.version} npm/? node/${process.version} ${process.platform} ${process.arch}`, + rawNpmConfig: {}, + update: false, + repeatInstallDepth: -1, + optional: typeof opts.production === 'boolean' ? opts.production : true, + independentLeaves: false, + packageManager, + verifyStoreIntegrity: true, + hooks: {}, + savePrefix: '^', + unsafePerm: process.platform === 'win32' || + process.platform === 'cygwin' || + !(process.getuid && process.setuid && + process.getgid && process.setgid) || + process.getuid() !== 0, + packageImportMethod: 'auto', + saveDev: false, + saveOptional: false, + } +} + +export default async ( + opts: InstallOptions, +): Promise => { + if (opts) { + for (const key in opts) { + if (opts[key] === undefined) { + delete opts[key] + } + } + } + const defaultOpts = await defaults(opts) + const extendedOpts = {...defaultOpts, ...opts, store: defaultOpts.store} + if (extendedOpts.force) { + logger.warn('using --force I sure hope you know what you are doing') + } + if (extendedOpts.lock === false) { + logger.warn('using --no-lock I sure hope you know what you are doing') + } + if (extendedOpts.userAgent.startsWith('npm/')) { + extendedOpts.userAgent = `${extendedOpts.packageManager.name}/${extendedOpts.packageManager.version} ${extendedOpts.userAgent}` + } + extendedOpts.registry = normalizeRegistryUrl(extendedOpts.registry) + if (extendedOpts.global) { + const subfolder = LAYOUT_VERSION.toString() + (extendedOpts.independentLeaves ? '_independent_leaves' : '') + extendedOpts.prefix = path.join(extendedOpts.prefix, subfolder) + } + extendedOpts.rawNpmConfig['registry'] = extendedOpts.registry + return extendedOpts +} diff --git a/src/api/extendOptions.ts b/src/api/extendOptions.ts deleted file mode 100644 index da8083eccb..0000000000 --- a/src/api/extendOptions.ts +++ /dev/null @@ -1,101 +0,0 @@ -import path = require('path') -import logger from '@pnpm/logger' -import pnpmPkgJson from '../pnpmPkgJson' -import {LAYOUT_VERSION} from '../fs/modulesController' -import normalizeRegistryUrl = require('normalize-registry-url') -import {resolveStore} from 'package-store' -import { SupiOptions, StrictSupiOptions } from '../types'; - -const defaults = async (opts: SupiOptions) => { - const packageManager = opts.packageManager || { - name: pnpmPkgJson.name, - version: pnpmPkgJson.version, - } - const prefix = opts.prefix || process.cwd() - const store = await resolveStore(opts.store, prefix) - return { - fetchRetries: 2, - fetchRetryFactor: 10, - fetchRetryMintimeout: 1e4, // 10 seconds - fetchRetryMaxtimeout: 6e4, // 1 minute - store, - locks: path.join(store, '_locks'), - ignoreScripts: false, - strictSsl: true, - tag: 'latest', - production: true, - development: true, - bin: path.join(prefix, 'node_modules', '.bin'), - prefix, - nodeVersion: process.version, - force: false, - depth: 0, - engineStrict: false, - metaCache: new Map(), - networkConcurrency: 16, - fetchingConcurrency: 16, - lockStaleDuration: 60 * 1000, // 1 minute - lock: true, - childConcurrency: 5, - offline: false, - registry: 'https://registry.npmjs.org/', - userAgent: `${packageManager.name}/${packageManager.version} npm/? node/${process.version} ${process.platform} ${process.arch}`, - rawNpmConfig: {}, - alwaysAuth: false, - update: false, - repeatInstallDepth: -1, - optional: typeof opts.production === 'boolean' ? opts.production : true, - independentLeaves: false, - packageManager, - verifyStoreIntegrity: true, - hooks: {}, - savePrefix: '^', - unsafePerm: process.platform === 'win32' || - process.platform === 'cygwin' || - !(process.getuid && process.setuid && - process.getgid && process.setgid) || - process.getuid() !== 0, - packageImportMethod: 'auto', - } -} - -export default async ( - opts?: SupiOptions, - // TODO: remove this option. - // extendOptions is now called twice, which should not really be happening - logWarnings?: boolean, -): Promise => { - opts = opts || {} - if (opts) { - for (const key in opts) { - if (opts[key] === undefined) { - delete opts[key] - } - } - } - if (opts.storePath && !opts.store) { - if (logWarnings !== false) { - logger.warn('the `store-path` config is deprecated. Use `store` instead.') - } - opts.store = opts.storePath - } - const defaultOpts = await defaults(opts) - const extendedOpts = {...defaultOpts, ...opts, store: defaultOpts.store} - if (logWarnings !== false && extendedOpts.force) { - logger.warn('using --force I sure hope you know what you are doing') - } - if (logWarnings !== false && extendedOpts.lock === false) { - logger.warn('using --no-lock I sure hope you know what you are doing') - } - if (extendedOpts.userAgent.startsWith('npm/')) { - extendedOpts.userAgent = `${extendedOpts.packageManager.name}/${extendedOpts.packageManager.version} ${extendedOpts.userAgent}` - } - extendedOpts.registry = normalizeRegistryUrl(extendedOpts.registry) - if (extendedOpts.global) { - const subfolder = LAYOUT_VERSION.toString() + (extendedOpts.independentLeaves ? '_independent_leaves' : '') - extendedOpts.prefix = path.join(extendedOpts.prefix, subfolder) - } - extendedOpts.rawNpmConfig['registry'] = extendedOpts.registry - extendedOpts.pending = extendedOpts.rawNpmConfig['pending'] - return extendedOpts -} diff --git a/src/api/extendPruneOptions.ts b/src/api/extendPruneOptions.ts new file mode 100644 index 0000000000..a64e0dfb2c --- /dev/null +++ b/src/api/extendPruneOptions.ts @@ -0,0 +1,77 @@ +import path = require('path') +import logger from '@pnpm/logger' +import pnpmPkgJson from '../pnpmPkgJson' +import {LAYOUT_VERSION} from '../fs/modulesController' +import normalizeRegistryUrl = require('normalize-registry-url') +import {StoreController} from 'package-store' +import { ReporterFunction } from '../types' + +export type PruneOptions = { + prefix?: string, + store: string, + independentLeaves?: boolean, + force?: boolean, + storeController: StoreController, + global?: boolean, + registry?: string, + + reporter?: ReporterFunction, + production?: boolean, + development?: boolean, + optional?: boolean, + bin?: string, +} + +export type StrictPruneOptions = PruneOptions & { + prefix: string, + store: string, + independentLeaves: boolean, + force: boolean, + storeController: StoreController, + global: boolean, + registry: string, + bin: string, + production: boolean, + development: boolean, + optional: boolean, +} + +const defaults = async (opts: PruneOptions) => { + const prefix = opts.prefix || process.cwd() + return { + storeController: opts.storeController, + global: false, + store: opts.store, + bin: path.join(prefix, 'node_modules', '.bin'), + prefix, + force: false, + registry: 'https://registry.npmjs.org/', + independentLeaves: false, + production: true, + development: true, + optional: true, + } +} + +export default async ( + opts: PruneOptions, +): Promise => { + if (opts) { + for (const key in opts) { + if (opts[key] === undefined) { + delete opts[key] + } + } + } + const defaultOpts = await defaults(opts) + const extendedOpts = {...defaultOpts, ...opts, store: defaultOpts.store} + if (extendedOpts.force) { + logger.warn('using --force I sure hope you know what you are doing') + } + extendedOpts.registry = normalizeRegistryUrl(extendedOpts.registry) + if (extendedOpts.global) { + const subfolder = LAYOUT_VERSION.toString() + (extendedOpts.independentLeaves ? '_independent_leaves' : '') + extendedOpts.prefix = path.join(extendedOpts.prefix, subfolder) + } + return extendedOpts +} diff --git a/src/api/extendRebuildOptions.ts b/src/api/extendRebuildOptions.ts new file mode 100644 index 0000000000..a67dd93bd6 --- /dev/null +++ b/src/api/extendRebuildOptions.ts @@ -0,0 +1,97 @@ +import path = require('path') +import logger from '@pnpm/logger' +import pnpmPkgJson from '../pnpmPkgJson' +import {LAYOUT_VERSION} from '../fs/modulesController' +import normalizeRegistryUrl = require('normalize-registry-url') +import {StoreController} from 'package-store' +import { ReporterFunction } from '../types' + +export type RebuildOptions = { + prefix?: string, + store: string, // TODO: remove this property + independentLeaves?: boolean, + force?: boolean, + global?: boolean, + registry?: string, + + reporter?: ReporterFunction, + production?: boolean, + development?: boolean, + optional?: boolean, + bin?: string, + rawNpmConfig?: object, + userAgent?: string, + packageManager?: { + name: string, + version: string, + }, + unsafePerm?: boolean, + pending?: boolean, +} + +export type StrictRebuildOptions = RebuildOptions & { + prefix: string, + store: string, + independentLeaves: boolean, + force: boolean, + global: boolean, + registry: string, + bin: string, + rawNpmConfig: object, + userAgent: string, + packageManager: { + name: string, + version: string, + }, + unsafePerm: boolean, + pending: boolean, +} + +const defaults = async (opts: RebuildOptions) => { + const packageManager = opts.packageManager || { + name: pnpmPkgJson.name, + version: pnpmPkgJson.version, + } + const prefix = opts.prefix || process.cwd() + return { + pending: false, + global: false, + store: opts.store, + bin: path.join(prefix, 'node_modules', '.bin'), + userAgent: `${packageManager.name}/${packageManager.version} npm/? node/${process.version} ${process.platform} ${process.arch}`, + packageManager, + prefix, + force: false, + registry: 'https://registry.npmjs.org/', + rawNpmConfig: {}, + independentLeaves: false, + unsafePerm: process.platform === 'win32' || + process.platform === 'cygwin' || + !(process.getuid && process.setuid && + process.getgid && process.setgid) || + process.getuid() !== 0, + } +} + +export default async ( + opts: RebuildOptions, +): Promise => { + if (opts) { + for (const key in opts) { + if (opts[key] === undefined) { + delete opts[key] + } + } + } + const defaultOpts = await defaults(opts) + const extendedOpts = {...defaultOpts, ...opts, store: defaultOpts.store} + if (extendedOpts.force) { + logger.warn('using --force I sure hope you know what you are doing') + } + extendedOpts.registry = normalizeRegistryUrl(extendedOpts.registry) + if (extendedOpts.global) { + const subfolder = LAYOUT_VERSION.toString() + (extendedOpts.independentLeaves ? '_independent_leaves' : '') + extendedOpts.prefix = path.join(extendedOpts.prefix, subfolder) + } + return extendedOpts +} diff --git a/src/api/extendStoreStatusOptions.ts b/src/api/extendStoreStatusOptions.ts new file mode 100644 index 0000000000..93e8f216a4 --- /dev/null +++ b/src/api/extendStoreStatusOptions.ts @@ -0,0 +1,69 @@ +import path = require('path') +import logger from '@pnpm/logger' +import pnpmPkgJson from '../pnpmPkgJson' +import {LAYOUT_VERSION} from '../fs/modulesController' +import normalizeRegistryUrl = require('normalize-registry-url') +import {resolveStore, StoreController} from 'package-store' +import { ReporterFunction } from '../types' +import { ReadPackageHook } from '@pnpm/types' + +export type StoreStatusOptions = { + prefix?: string, + store: string, + independentLeaves?: boolean, + force?: boolean, + global?: boolean, + registry?: string, + + reporter?: ReporterFunction, + production?: boolean, + development?: boolean, + optional?: boolean, + bin?: string, +} + +export type StrictStoreStatusOptions = StoreStatusOptions & { + prefix: string, + store: string, + independentLeaves: boolean, + force: boolean, + global: boolean, + registry: string, + bin: string, +} + +const defaults = async (opts: StoreStatusOptions) => { + const prefix = opts.prefix || process.cwd() + return { + global: false, + store: opts.store, + bin: path.join(prefix, 'node_modules', '.bin'), + prefix, + force: false, + registry: 'https://registry.npmjs.org/', + independentLeaves: false, + } +} + +export default async ( + opts: StoreStatusOptions, +): Promise => { + if (opts) { + for (const key in opts) { + if (opts[key] === undefined) { + delete opts[key] + } + } + } + const defaultOpts = await defaults(opts) + const extendedOpts = {...defaultOpts, ...opts, store: defaultOpts.store} + if (extendedOpts.force) { + logger.warn('using --force I sure hope you know what you are doing') + } + extendedOpts.registry = normalizeRegistryUrl(extendedOpts.registry) + if (extendedOpts.global) { + const subfolder = LAYOUT_VERSION.toString() + (extendedOpts.independentLeaves ? '_independent_leaves' : '') + extendedOpts.prefix = path.join(extendedOpts.prefix, subfolder) + } + return extendedOpts +} diff --git a/src/api/extendUninstallOptions.ts b/src/api/extendUninstallOptions.ts new file mode 100644 index 0000000000..1cbeb7b02f --- /dev/null +++ b/src/api/extendUninstallOptions.ts @@ -0,0 +1,94 @@ +import path = require('path') +import logger from '@pnpm/logger' +import pnpmPkgJson from '../pnpmPkgJson' +import {LAYOUT_VERSION} from '../fs/modulesController' +import normalizeRegistryUrl = require('normalize-registry-url') +import {StoreController} from 'package-store' +import { ReporterFunction } from '../types' + +export type UninstallOptions = { + prefix?: string, + store: string, + independentLeaves?: boolean, + force?: boolean, + storeController: StoreController, + global?: boolean, + registry?: string, + + reporter?: ReporterFunction, + lock?: boolean, + lockStaleDuration?: number, + locks?: string, + bin?: string, + packageManager?: { + name: string, + version: string, + }, +} + +export type StrictUninstallOptions = UninstallOptions & { + prefix: string, + store: string, + independentLeaves: boolean, + force: boolean, + storeController: StoreController, + global: boolean, + registry: string, + + lock: boolean, + lockStaleDuration: number, + locks: string, + bin: string, + packageManager: { + name: string, + version: string, + }, +} + +const defaults = async (opts: UninstallOptions) => { + const packageManager = opts.packageManager || { + name: pnpmPkgJson.name, + version: pnpmPkgJson.version, + } + const prefix = opts.prefix || process.cwd() + return { + storeController: opts.storeController, + global: false, + store: opts.store, + locks: path.join(opts.store, '_locks'), + bin: path.join(prefix, 'node_modules', '.bin'), + prefix, + force: false, + lockStaleDuration: 60 * 1000, // 1 minute + lock: true, + registry: 'https://registry.npmjs.org/', + independentLeaves: false, + packageManager, + } +} + +export default async ( + opts: UninstallOptions, +): Promise => { + if (opts) { + for (const key in opts) { + if (opts[key] === undefined) { + delete opts[key] + } + } + } + const defaultOpts = await defaults(opts) + const extendedOpts = {...defaultOpts, ...opts, store: defaultOpts.store} + if (extendedOpts.force) { + logger.warn('using --force I sure hope you know what you are doing') + } + if (extendedOpts.lock === false) { + logger.warn('using --no-lock I sure hope you know what you are doing') + } + extendedOpts.registry = normalizeRegistryUrl(extendedOpts.registry) + if (extendedOpts.global) { + const subfolder = LAYOUT_VERSION.toString() + (extendedOpts.independentLeaves ? '_independent_leaves' : '') + extendedOpts.prefix = path.join(extendedOpts.prefix, subfolder) + } + return extendedOpts +} diff --git a/src/api/getContext.ts b/src/api/getContext.ts index 3fd5ae1dd9..17d82dcdeb 100644 --- a/src/api/getContext.ts +++ b/src/api/getContext.ts @@ -2,9 +2,6 @@ import path = require('path') import isCI = require('is-ci') import {fromDir as readPkgFromDir} from '../fs/readPkg' import writePkg = require('write-pkg') -import createStore, { - StoreController, -} from 'package-store' import {StrictSupiOptions} from '../types' import { readWanted as readWantedShrinkwrap, @@ -22,12 +19,9 @@ import removeAllExceptOuterLinks = require('remove-all-except-outer-links') import logger from '@pnpm/logger' import checkCompatibility from './checkCompatibility' import {packageJsonLogger} from '../loggers' -import createFetcher from '@pnpm/default-fetcher' -import createResolver from '@pnpm/default-resolver' export type PnpmContext = { pkg: PackageJson, - storeController: StoreController, storePath: string, root: string, existsWantedShrinkwrap: boolean, @@ -38,7 +32,17 @@ export type PnpmContext = { pendingBuilds: string[], } -export default async function getContext (opts: StrictSupiOptions, installType?: 'named' | 'general'): Promise { +export default async function getContext ( + opts: { + prefix: string, + store: string, + independentLeaves: boolean, + force: boolean, + global: boolean, + registry: string, + }, + installType?: 'named' | 'general', +): Promise { const root = normalizePath(opts.prefix) const storePath = opts.store @@ -74,18 +78,6 @@ export default async function getContext (opts: StrictSupiOptions, installType?: (opts.global ? readGlobalPkgJson(opts.prefix) : readPkgFromDir(opts.prefix)), readWantedShrinkwrap(root, shrOpts), readCurrentShrinkwrap(root, shrOpts), - opts.storeController - ? Promise.resolve(opts.storeController) - : createStore( - createResolver(opts), - createFetcher(opts) as {}, - { - networkConcurrency: opts.networkConcurrency, - store: opts.store, - locks: opts.lock ? opts.locks : undefined, - lockStaleDuration: opts.lockStaleDuration, - } - ), mkdirp(storePath), ]) const ctx: PnpmContext = { @@ -96,7 +88,6 @@ export default async function getContext (opts: StrictSupiOptions, installType?: currentShrinkwrap: files[2] || createShrinkwrap(opts.registry), existsWantedShrinkwrap: !!files[1], existsCurrentShrinkwrap: !!files[2], - storeController: files[3], skipped: new Set(modules && modules.skipped || []), pendingBuilds: modules && modules.pendingBuilds || [], } diff --git a/src/api/install.ts b/src/api/install.ts index 4af981bf77..b67c29f678 100644 --- a/src/api/install.ts +++ b/src/api/install.ts @@ -3,6 +3,7 @@ import { PackageJson, PnpmOptions, StrictPnpmOptions, + ReadPackageHook, } from '@pnpm/types' import * as dp from 'dependency-path' import path = require('path') @@ -24,6 +25,7 @@ import {fromDir as safeReadPkgFromDir} from '../fs/safeReadPkg' import { WantedDependency, SupiOptions, + ReporterFunction, } from '../types' import getContext, {PnpmContext} from './getContext' import installMultiple, {InstalledPackage} from '../install/installMultiple' @@ -32,7 +34,10 @@ import linkPackages from '../link' import save from '../save' import getSaveType from '../getSaveType' import postInstall, {npmRunScript} from '../install/postInstall' -import extendOptions from './extendOptions' +import extendOptions, { + InstallOptions, + StrictInstallOptions, +} from './extendInstallOptions' import lock from './lock' import { write as saveShrinkwrap, @@ -126,7 +131,7 @@ export type InstallContext = { }, } -export async function install (maybeOpts?: SupiOptions) { +export async function install (maybeOpts: InstallOptions) { const reporter = maybeOpts && maybeOpts.reporter if (reporter) { streamParser.on('data', reporter) @@ -227,13 +232,15 @@ function specsToInstallFromPackage( * @example * install({'lodash': '1.0.0', 'foo': '^2.1.0' }, { silent: true }) */ -export async function installPkgs (fuzzyDeps: string[] | Dependencies, maybeOpts?: SupiOptions) { +export async function installPkgs ( + fuzzyDeps: string[] | Dependencies, + maybeOpts: InstallOptions, +) { const reporter = maybeOpts && maybeOpts.reporter if (reporter) { streamParser.on('data', reporter) } - maybeOpts = maybeOpts || {} if (maybeOpts.update === undefined) maybeOpts.update = true const opts = await extendOptions(maybeOpts) @@ -297,7 +304,7 @@ async function installInContext ( selector: string, }, }, - opts: StrictPnpmOptions + opts: StrictInstallOptions, ) { // Unfortunately, the private shrinkwrap file may differ from the public one. // A user might run named installations on a project that has a shrinkwrap.yaml file before running a noop install @@ -354,7 +361,7 @@ async function installInContext ( engineStrict: opts.engineStrict, nodeVersion: opts.nodeVersion, pnpmVersion: opts.packageManager.name === 'pnpm' ? opts.packageManager.version : '', - storeController: ctx.storeController, + storeController: opts.storeController, preferredVersions, } const installOpts = { @@ -524,7 +531,7 @@ async function installInContext ( skipped: ctx.skipped, pkg: newPkg || ctx.pkg, independentLeaves: opts.independentLeaves, - storeController: ctx.storeController, + storeController: opts.storeController, makePartialCurrentShrinkwrap, updateShrinkwrapMinorVersion: installType === 'general' || R.isEmpty(ctx.currentShrinkwrap.packages), outdatedPkgs: installCtx.outdatedPkgs, @@ -616,7 +623,7 @@ async function installInContext ( summaryLogger.info(undefined) - await ctx.storeController.close() + await opts.storeController.close() } function buildTree ( diff --git a/src/api/link.ts b/src/api/link.ts index a3dbb9e336..b6f2d4bdbe 100644 --- a/src/api/link.ts +++ b/src/api/link.ts @@ -6,14 +6,16 @@ import {install} from './install' import pathAbsolute = require('path-absolute') import {linkPkgBins} from '../link/linkBins' import {PnpmOptions} from '@pnpm/types' -import extendOptions from './extendOptions' +import extendOptions, { + InstallOptions, +} from './extendInstallOptions' const linkLogger = logger('link') export default async function link ( linkFrom: string, linkTo: string, - maybeOpts?: PnpmOptions & { + maybeOpts: InstallOptions & { skipInstall?: boolean, linkToBin?: string, } @@ -53,7 +55,7 @@ async function linkToModules (linkFrom: string, modules: string) { export async function linkFromGlobal ( pkgName: string, linkTo: string, - maybeOpts: PnpmOptions & {globalPrefix: string} + maybeOpts: InstallOptions & {globalPrefix: string} ) { const reporter = maybeOpts && maybeOpts.reporter if (reporter) { @@ -71,7 +73,7 @@ export async function linkFromGlobal ( export async function linkToGlobal ( linkFrom: string, - maybeOpts: PnpmOptions & { + maybeOpts: InstallOptions & { globalPrefix: string, globalBin: string, } diff --git a/src/api/prune.ts b/src/api/prune.ts index 900a4d7a7a..357219c414 100644 --- a/src/api/prune.ts +++ b/src/api/prune.ts @@ -3,7 +3,10 @@ import path = require('path') import R = require('ramda') import getContext from './getContext' import {PnpmOptions} from '@pnpm/types' -import extendOptions from './extendOptions' +import extendOptions, { + PruneOptions, + StrictPruneOptions, +} from './extendPruneOptions' import getPkgDirs from '../fs/getPkgDirs' import {fromDir as readPkgFromDir} from '../fs/readPkg' import removeOrphanPkgs from './removeOrphanPkgs' @@ -13,7 +16,9 @@ import { } from 'pnpm-shrinkwrap' import {streamParser} from '@pnpm/logger' -export async function prune(maybeOpts?: PnpmOptions): Promise { +export async function prune ( + maybeOpts: PruneOptions, +): Promise { const reporter = maybeOpts && maybeOpts.reporter if (reporter) { streamParser.on('data', reporter) @@ -39,7 +44,7 @@ export async function prune(maybeOpts?: PnpmOptions): Promise { oldShrinkwrap: ctx.currentShrinkwrap, newShrinkwrap: prunedShr, prefix: ctx.root, - storeController: ctx.storeController, + storeController: opts.storeController, pruneStore: true, bin: opts.bin, }) diff --git a/src/api/rebuild.ts b/src/api/rebuild.ts index 3294a91655..376d16ee0c 100644 --- a/src/api/rebuild.ts +++ b/src/api/rebuild.ts @@ -1,5 +1,8 @@ import {PnpmOptions, StrictPnpmOptions} from '@pnpm/types' -import extendOptions from './extendOptions' +import extendOptions, { + RebuildOptions, + StrictRebuildOptions, +} from './extendRebuildOptions' import getContext from './getContext' import logger, {streamParser} from '@pnpm/logger' import R = require('ramda') @@ -50,14 +53,16 @@ type PackageSelector = string | { range: string, } -export async function rebuildPkgs (pkgSpecs: string[], maybeOpts: PnpmOptions) { +export async function rebuildPkgs ( + pkgSpecs: string[], + maybeOpts: RebuildOptions, +) { const reporter = maybeOpts && maybeOpts.reporter if (reporter) { streamParser.on('data', reporter) } const opts = await extendOptions(maybeOpts) const ctx = await getContext(opts) - await ctx.storeController.close() // TODO: storeController should not be created at all in this case const modules = path.join(opts.prefix, 'node_modules') if (!ctx.currentShrinkwrap || !ctx.currentShrinkwrap.packages) return @@ -97,14 +102,13 @@ function matches ( }) } -export async function rebuild (maybeOpts: PnpmOptions) { +export async function rebuild (maybeOpts: RebuildOptions) { const reporter = maybeOpts && maybeOpts.reporter if (reporter) { streamParser.on('data', reporter) } const opts = await extendOptions(maybeOpts) const ctx = await getContext(opts) - await ctx.storeController.close() // TODO: storeController should not be created at all in this case const modules = path.join(opts.prefix, 'node_modules') let idsToRebuild: string[] = [] @@ -135,7 +139,7 @@ async function _rebuild ( pkgs: PackageToRebuild[], modules: string, registry: string, - opts: StrictPnpmOptions + opts: StrictRebuildOptions, ) { await pSeries( pkgs diff --git a/src/api/storePrune.ts b/src/api/storePrune.ts index 92e53abc12..a61edde5b7 100644 --- a/src/api/storePrune.ts +++ b/src/api/storePrune.ts @@ -1,18 +1,20 @@ -import {PnpmOptions} from '@pnpm/types' -import extendOptions from './extendOptions' -import getContext from './getContext' +import {StoreController} from 'package-store' import {streamParser} from '@pnpm/logger' +import {ReporterFunction} from '../types' -export default async function (maybeOpts: PnpmOptions) { - const reporter = maybeOpts && maybeOpts.reporter +export default async function ( + opts: { + reporter?: ReporterFunction, + storeController: StoreController, + }, +) { + const reporter = opts && opts.reporter if (reporter) { streamParser.on('data', reporter) } - const opts = await extendOptions(maybeOpts) - const ctx = await getContext(opts) - await ctx.storeController.prune() - await ctx.storeController.saveState() - await ctx.storeController.close() + await opts.storeController.prune() + await opts.storeController.saveState() + await opts.storeController.close() if (reporter) { streamParser.removeListener('data', reporter) diff --git a/src/api/storeStatus.ts b/src/api/storeStatus.ts index c16a973654..2bd2cbdd52 100644 --- a/src/api/storeStatus.ts +++ b/src/api/storeStatus.ts @@ -1,20 +1,20 @@ import path = require('path') import pFilter = require('p-filter') -import {PnpmOptions} from '@pnpm/types' -import extendOptions from './extendOptions' +import extendOptions, { + StoreStatusOptions, +} from './extendStoreStatusOptions' import getContext from './getContext' import checkPackage from '@pnpm/check-package' import * as dp from 'dependency-path' import {streamParser} from '@pnpm/logger' -export default async function (maybeOpts: PnpmOptions) { +export default async function (maybeOpts: StoreStatusOptions) { const reporter = maybeOpts && maybeOpts.reporter if (reporter) { streamParser.on('data', reporter) } const opts = await extendOptions(maybeOpts) const ctx = await getContext(opts) - await ctx.storeController.close() // TODO: storeController should not be created at all in this case if (!ctx.wantedShrinkwrap) return [] const pkgPaths = Object.keys(ctx.wantedShrinkwrap.packages || {}) diff --git a/src/api/uninstall.ts b/src/api/uninstall.ts index 55b00428c0..5d72af4d85 100644 --- a/src/api/uninstall.ts +++ b/src/api/uninstall.ts @@ -4,7 +4,10 @@ import * as dp from 'dependency-path' import getContext, {PnpmContext} from './getContext' import getSaveType from '../getSaveType' import removeDeps from '../removeDeps' -import extendOptions from './extendOptions' +import extendOptions, { + UninstallOptions, + StrictUninstallOptions, +} from './extendUninstallOptions' import {PnpmOptions, StrictPnpmOptions} from '@pnpm/types' import lock from './lock' import { @@ -23,7 +26,10 @@ import removeTopDependency from '../removeTopDependency' import shrinkwrapsEqual from './shrinkwrapsEqual' import { SupiOptions, StrictSupiOptions } from '../types'; -export default async function uninstall (pkgsToUninstall: string[], maybeOpts?: SupiOptions) { +export default async function uninstall ( + pkgsToUninstall: string[], + maybeOpts: UninstallOptions, +) { const reporter = maybeOpts && maybeOpts.reporter if (reporter) { streamParser.on('data', reporter) @@ -52,7 +58,11 @@ export default async function uninstall (pkgsToUninstall: string[], maybeOpts?: } } -export async function uninstallInContext (pkgsToUninstall: string[], ctx: PnpmContext, opts: StrictSupiOptions) { +export async function uninstallInContext ( + pkgsToUninstall: string[], + ctx: PnpmContext, + opts: StrictUninstallOptions, +) { const makePartialCurrentShrinkwrap = !shrinkwrapsEqual(ctx.currentShrinkwrap, ctx.wantedShrinkwrap) const pkgJsonPath = path.join(ctx.root, 'package.json') @@ -63,11 +73,11 @@ export async function uninstallInContext (pkgsToUninstall: string[], ctx: PnpmCo oldShrinkwrap: ctx.currentShrinkwrap, newShrinkwrap: newShr, prefix: ctx.root, - storeController: ctx.storeController, + storeController: opts.storeController, bin: opts.bin, }) ctx.pendingBuilds = ctx.pendingBuilds.filter(pkgId => !removedPkgIds.has(dp.resolve(newShr.registry, pkgId))) - await ctx.storeController.close() + await opts.storeController.close() const currentShrinkwrap = makePartialCurrentShrinkwrap ? pruneShrinkwrap(ctx.currentShrinkwrap, pkg) : newShr diff --git a/src/api/unlink.ts b/src/api/unlink.ts index 8d35a22808..51d39a7eb1 100644 --- a/src/api/unlink.ts +++ b/src/api/unlink.ts @@ -1,6 +1,8 @@ import path = require('path') -import {PnpmOptions, StrictPnpmOptions} from '@pnpm/types' -import extendOptions from './extendOptions' +import extendOptions, { + InstallOptions, + StrictInstallOptions, +} from './extendInstallOptions' import isInnerLink = require('is-inner-link') import logger, {streamParser} from '@pnpm/logger' import rimraf = require('rimraf-then') @@ -15,7 +17,7 @@ import isSubdir = require('is-subdir') export async function unlinkPkgs ( pkgNames: string[], - maybeOpts: PnpmOptions + maybeOpts: InstallOptions ) { const reporter = maybeOpts && maybeOpts.reporter if (reporter) { @@ -34,7 +36,7 @@ export async function unlinkPkgs ( export async function _unlinkPkgs ( pkgNames: string[], - opts: StrictPnpmOptions + opts: StrictInstallOptions ) { const modules = path.join(opts.prefix, 'node_modules') const pkg = await readPkgFromDir(opts.prefix) @@ -57,7 +59,7 @@ export async function _unlinkPkgs ( await installPkgs(packagesToInstall, opts) } -export async function unlink (maybeOpts: PnpmOptions) { +export async function unlink (maybeOpts: InstallOptions) { const reporter = maybeOpts && maybeOpts.reporter if (reporter) { streamParser.on('data', reporter) @@ -109,7 +111,7 @@ async function isExternalLink (store: string, modules: string, pkgName: string) return !link.isInner && !isSubdir(store, link.target) } -async function _extendOptions (maybeOpts: PnpmOptions): Promise { +async function _extendOptions (maybeOpts: InstallOptions): Promise { maybeOpts = maybeOpts || {} if (maybeOpts.depth === undefined) maybeOpts.depth = -1 return await extendOptions(maybeOpts) diff --git a/src/index.ts b/src/index.ts index 229c0d5419..88b730bba7 100644 --- a/src/index.ts +++ b/src/index.ts @@ -15,6 +15,11 @@ export { StatsLog, } from './loggers' +export {InstallOptions} from './api/extendInstallOptions' +export {PruneOptions} from './api/extendPruneOptions' +export {RebuildOptions} from './api/extendRebuildOptions' +export {UninstallOptions} from './api/extendUninstallOptions' + import * as supiLogs from './loggers' import * as packageRequesterLogs from '@pnpm/package-requester' diff --git a/src/install/installMultiple.ts b/src/install/installMultiple.ts index 0f639d2024..bdfb704f10 100644 --- a/src/install/installMultiple.ts +++ b/src/install/installMultiple.ts @@ -85,7 +85,6 @@ export default async function installMultiple ( update: boolean, readPackageHook?: ReadPackageHook, hasManifestInShrinkwrap: boolean, - ignoreFile?: (filename: string) => boolean, } ): Promise { const resolvedDependencies = options.resolvedDependencies || {} @@ -118,7 +117,6 @@ export default async function installMultiple ( parentIsInstallable: options.parentIsInstallable, readPackageHook: options.readPackageHook, hasManifestInShrinkwrap: options.hasManifestInShrinkwrap, - ignoreFile: options.ignoreFile, update, proceed, }, @@ -502,7 +500,6 @@ async function installDependencies ( readPackageHook?: ReadPackageHook, hasManifestInShrinkwrap: boolean, useManifestInfoFromShrinkwrap: boolean, - ignoreFile?: (filename: string) => boolean, } ): Promise { diff --git a/src/types.ts b/src/types.ts index 4059062623..8afb143e2b 100644 --- a/src/types.ts +++ b/src/types.ts @@ -17,10 +17,12 @@ export type WantedDependency = { } export type SupiOptions = PnpmOptions & { - storeController?: StoreController + storeController: StoreController } export type StrictSupiOptions = StrictPnpmOptions & { - storeController?: StoreController + storeController: StoreController pending?: boolean } + +export type ReporterFunction = (logObj: LogBase) => void diff --git a/test/api.ts b/test/api.ts index 2ae24da44f..f64a32c881 100644 --- a/test/api.ts +++ b/test/api.ts @@ -1,5 +1,6 @@ import test = require('tape') import * as pnpm from 'supi' +import {testDefaults} from './utils' test('API', t => { t.equal(typeof pnpm.install, 'function', 'exports install()') @@ -18,7 +19,7 @@ test('API', t => { // the dependency will be saved test.skip('install fails when all saving types are false', async (t: test.Test) => { try { - await pnpm.install({save: false, saveDev: false, saveOptional: false}) + await pnpm.install(await testDefaults({save: false, saveDev: false, saveOptional: false})) t.fail('installation should have failed') } catch (err) { t.equal(err.message, 'Cannot install with save/saveDev/saveOptional all being equal false') @@ -28,7 +29,7 @@ test.skip('install fails when all saving types are false', async (t: test.Test) test('install fails on optional = true but production = false', async (t: test.Test) => { try { - await pnpm.install({optional: true, production: false}) + await pnpm.install(await testDefaults({optional: true, production: false})) t.fail('installation should have failed') } catch (err) { t.equal(err.message, 'Optional dependencies cannot be installed without production dependencies') diff --git a/test/breakingChanges.ts b/test/breakingChanges.ts index 9bcf81f283..c39cc24ed3 100644 --- a/test/breakingChanges.ts +++ b/test/breakingChanges.ts @@ -2,20 +2,17 @@ import tape = require('tape') import promisifyTape from 'tape-promise' import fs = require('mz/fs') import mkdirp = require('mkdirp-promise') -import path = require('path') import isCI = require('is-ci') import {prepare, testDefaults} from './utils' import {installPkgs, install} from 'supi' const test = promisifyTape(tape) -const STORE_VERSION = '2' - test('fail on non-compatible node_modules', async t => { const project = prepare(t) - const opts = testDefaults() + const opts = await testDefaults() - await saveModulesYaml('0.50.0', path.join(opts.store, STORE_VERSION)) + await saveModulesYaml('0.50.0', opts.store) try { await installPkgs(['is-negative'], opts) @@ -27,9 +24,9 @@ test('fail on non-compatible node_modules', async t => { test("don't fail on non-compatible node_modules when forced", async t => { const project = prepare(t) - const opts = testDefaults({force: true}) + const opts = await testDefaults({force: true}) - await saveModulesYaml('0.50.0', path.join(opts.store, STORE_VERSION)) + await saveModulesYaml('0.50.0', opts.store) await install(opts) @@ -38,9 +35,9 @@ test("don't fail on non-compatible node_modules when forced", async t => { test('fail on non-compatible node_modules when forced with a named installation', async t => { const project = prepare(t) - const opts = testDefaults({force: true}) + const opts = await testDefaults({force: true}) - await saveModulesYaml('0.50.0', path.join(opts.store, STORE_VERSION)) + await saveModulesYaml('0.50.0', opts.store) try { await installPkgs(['is-negative'], opts) @@ -52,9 +49,9 @@ test('fail on non-compatible node_modules when forced with a named installation' test("don't fail on non-compatible store when forced", async t => { const project = prepare(t) - const opts = testDefaults({force: true}) + const opts = await testDefaults({force: true}) - await saveModulesYaml('0.32.0', path.join(opts.store, STORE_VERSION)) + await saveModulesYaml('0.32.0', opts.store) await install(opts) @@ -63,9 +60,9 @@ test("don't fail on non-compatible store when forced", async t => { test('fail on non-compatible store when forced during named installation', async t => { const project = prepare(t) - const opts = testDefaults({force: true}) + const opts = await testDefaults({force: true}) - await saveModulesYaml('0.32.0', path.join(opts.store, STORE_VERSION)) + await saveModulesYaml('0.32.0', opts.store) try { await installPkgs(['is-negative'], opts) @@ -90,7 +87,7 @@ test('fail on non-compatible shrinkwrap.yaml', async t => { await fs.writeFile('shrinkwrap.yaml', '') try { - await installPkgs(['is-negative'], testDefaults()) + await installPkgs(['is-negative'], await testDefaults()) t.fail('should have failed') } catch (err) { t.equal(err.code, 'SHRINKWRAP_BREAKING_CHANGE', 'shrinkwrap breaking change error is thrown') @@ -101,7 +98,7 @@ test("don't fail on non-compatible shrinkwrap.yaml when forced", async t => { const project = prepare(t) await fs.writeFile('shrinkwrap.yaml', '') - await installPkgs(['is-negative'], testDefaults({force: true})) + await installPkgs(['is-negative'], await testDefaults({force: true})) t.pass('install did not fail') }) diff --git a/test/cache.ts b/test/cache.ts index 504907e417..33166371ae 100644 --- a/test/cache.ts +++ b/test/cache.ts @@ -1,5 +1,9 @@ import {installPkgs, install} from 'supi' -import {prepare, addDistTag, testDefaults} from './utils' +import { + prepare, + addDistTag, + testDefaults, +} from './utils' import tape = require('tape') import promisifyTape from 'tape-promise' import exists = require('path-exists') @@ -14,13 +18,13 @@ test('should fail to update when requests are cached', async function (t) { await addDistTag('dep-of-pkg-with-1-dep', '100.0.0', 'latest') - await installPkgs(['pkg-with-1-dep'], testDefaults({save: true, metaCache})) + await installPkgs(['pkg-with-1-dep'], await testDefaults({save: true, metaCache})) await project.storeHas('dep-of-pkg-with-1-dep', '100.0.0') await addDistTag('dep-of-pkg-with-1-dep', '100.1.0', 'latest') - await install(testDefaults({depth: 1, metaCache, update: true})) + await install(await testDefaults({depth: 1, metaCache, update: true})) await project.storeHas('dep-of-pkg-with-1-dep', '100.0.0') }) @@ -30,13 +34,13 @@ test('should not cache when cache is not used', async (t: tape.Test) => { await addDistTag('dep-of-pkg-with-1-dep', '100.0.0', 'latest') - await installPkgs(['pkg-with-1-dep'], testDefaults({save: true})) + await installPkgs(['pkg-with-1-dep'], await testDefaults({save: true})) await project.storeHas('dep-of-pkg-with-1-dep', '100.0.0') await addDistTag('dep-of-pkg-with-1-dep', '100.1.0', 'latest') - await install(testDefaults({depth: 1, update: true})) + await install(await testDefaults({depth: 1, update: true})) await project.storeHas('dep-of-pkg-with-1-dep', '100.1.0') }) diff --git a/test/install/aliases.ts b/test/install/aliases.ts index cc22e804ab..7c7f0fc923 100644 --- a/test/install/aliases.ts +++ b/test/install/aliases.ts @@ -15,7 +15,7 @@ const test = promisifyTape(tape) test('installing aliased dependency', async (t: tape.Test) => { const project = prepare(t) - await installPkgs(['negative@npm:is-negative@1.0.0'], testDefaults()) + await installPkgs(['negative@npm:is-negative@1.0.0'], await testDefaults()) const m = project.requireModule('negative') t.ok(typeof m === 'function', 'negative() is available') @@ -47,7 +47,7 @@ test('installing aliased dependency', async (t: tape.Test) => { test('a dependency has an aliased subdependency', async (t: tape.Test) => { const project = prepare(t) - await installPkgs(['pkg-with-1-aliased-dep'], testDefaults()) + await installPkgs(['pkg-with-1-aliased-dep'], await testDefaults()) t.equal(project.requireModule('pkg-with-1-aliased-dep')().name, 'dep-of-pkg-with-1-dep', 'can require aliased subdep') diff --git a/test/install/auth.ts b/test/install/auth.ts index 36e16fb0b3..d827d2c86e 100644 --- a/test/install/auth.ts +++ b/test/install/auth.ts @@ -27,10 +27,14 @@ test('a package that need authentication', async function (t: tape.Test) { }, (err: Error, data: Object) => err ? reject(err) : resolve(data)) }) - await installPkgs(['needs-auth'], testDefaults({ - rawNpmConfig: { - '//localhost:4873/:_authToken': data['token'], - }, + let rawNpmConfig = { + registry: 'http://localhost:4873/', + '//localhost:4873/:_authToken': data['token'], + } + await installPkgs(['needs-auth'], await testDefaults({}, { + rawNpmConfig, + }, { + rawNpmConfig, })) const m = project.requireModule('needs-auth') @@ -42,12 +46,15 @@ test('a package that need authentication', async function (t: tape.Test) { await rimraf('node_modules') await rimraf(path.join('..', '.store')) - await installPkgs(['needs-auth'], testDefaults({ + rawNpmConfig = { registry: 'https://registry.npmjs.org/', - rawNpmConfig: { - registry: 'https://registry.npmjs.org/', - '//localhost:4873/:_authToken': data['token'], - }, + '//localhost:4873/:_authToken': data['token'], + } + await installPkgs(['needs-auth'], await testDefaults({}, { + registry: 'https://registry.npmjs.org/', + rawNpmConfig, + }, { + rawNpmConfig, })) await project.has('needs-auth') @@ -68,12 +75,15 @@ test('a package that need authentication, legacy way', async function (t: tape.T }, (err: Error, data: Object) => err ? reject(err) : resolve(data)) }) - await installPkgs(['needs-auth'], testDefaults({ - rawNpmConfig: { - '_auth': 'Zm9vOmJhcg==', // base64 encoded foo:bar - 'always-auth': true, - registry: 'http://localhost:4873', - }, + const rawNpmConfig = { + '_auth': 'Zm9vOmJhcg==', // base64 encoded foo:bar + 'always-auth': true, + registry: 'http://localhost:4873', + } + await installPkgs(['needs-auth'], await testDefaults({}, { + rawNpmConfig, + }, { + rawNpmConfig, })) const m = project.requireModule('needs-auth') @@ -96,13 +106,16 @@ test('a scoped package that need authentication specific to scope', async functi }, (err: Error, data: Object) => err ? reject(err) : resolve(data)) }) - const opts = testDefaults({ + const rawNpmConfig = { registry: 'https://registry.npmjs.org/', - rawNpmConfig: { - registry: 'https://registry.npmjs.org/', - '@private:registry': 'http://localhost:4873/', - '//localhost:4873/:_authToken': data['token'], - }, + '@private:registry': 'http://localhost:4873/', + '//localhost:4873/:_authToken': data['token'], + } + let opts = await testDefaults({}, { + registry: 'https://registry.npmjs.org/', + rawNpmConfig, + }, { + rawNpmConfig, }) await installPkgs(['@private/foo'], opts) @@ -112,6 +125,13 @@ test('a scoped package that need authentication specific to scope', async functi await rimraf('node_modules') await rimraf(path.join('..', '.store')) + // Recreating options to have a new storeController with clean cache + opts = await testDefaults({}, { + registry: 'https://registry.npmjs.org/', + rawNpmConfig, + }, { + rawNpmConfig, + }) await installPkgs(['@private/foo'], opts) await project.has('@private/foo') @@ -132,12 +152,18 @@ test('a package that need authentication reuses authorization tokens for tarball }, (err: Error, data: Object) => err ? reject(err) : resolve(data)) }) - await installPkgs(['needs-auth'], testDefaults({ + const rawNpmConfig = { registry: 'http://127.0.0.1:4873', - rawNpmConfig: { - '//127.0.0.1:4873/:_authToken': data['token'], - '//127.0.0.1:4873/:always-auth': true, - }, + '//127.0.0.1:4873/:_authToken': data['token'], + '//127.0.0.1:4873/:always-auth': true, + } + await installPkgs(['needs-auth'], await testDefaults({ + registry: 'http://127.0.0.1:4873', + }, { + registry: 'http://127.0.0.1:4873', + rawNpmConfig, + }, { + rawNpmConfig, })) const m = project.requireModule('needs-auth') @@ -160,12 +186,18 @@ test('a package that need authentication reuses authorization tokens for tarball }, (err: Error, data: Object) => err ? reject(err) : resolve(data)) }) - const opts = testDefaults({ + const rawNpmConfig = { registry: 'http://127.0.0.1:4873', - rawNpmConfig: { - '//127.0.0.1:4873/:_authToken': data['token'], - '//127.0.0.1:4873/:always-auth': true, - }, + '//127.0.0.1:4873/:_authToken': data['token'], + '//127.0.0.1:4873/:always-auth': true, + } + let opts = await testDefaults({ + registry: 'http://127.0.0.1:4873', + }, { + registry: 'http://127.0.0.1:4873', + rawNpmConfig, + }, { + rawNpmConfig, }) await installPkgs(['needs-auth'], opts) @@ -174,6 +206,15 @@ test('a package that need authentication reuses authorization tokens for tarball await rimraf(path.join('..', '.registry')) await rimraf(path.join('..', '.store')) + // Recreating options to clean store cache + opts = await testDefaults({ + registry: 'http://127.0.0.1:4873', + }, { + registry: 'http://127.0.0.1:4873', + rawNpmConfig, + }, { + rawNpmConfig, + }) await install(opts) const m = project.requireModule('needs-auth') diff --git a/test/install/dedupe.ts b/test/install/dedupe.ts index 6a4e77242c..bd2babc572 100644 --- a/test/install/dedupe.ts +++ b/test/install/dedupe.ts @@ -19,7 +19,7 @@ test('prefer version ranges specified for top dependencies', async (t: tape.Test await addDistTag({ package: 'dep-of-pkg-with-1-dep', version: '100.1.0', distTag: 'latest' }) - await install(testDefaults()) + await install(await testDefaults()) const shr = await project.loadShrinkwrap() t.ok(shr.packages['/dep-of-pkg-with-1-dep/100.0.0']) @@ -35,8 +35,8 @@ test('prefer version ranges specified for top dependencies, when doing named ins await addDistTag({ package: 'dep-of-pkg-with-1-dep', version: '100.1.0', distTag: 'latest' }) - await install(testDefaults()) - await installPkgs(['pkg-with-1-dep'], testDefaults()) + await install(await testDefaults()) + await installPkgs(['pkg-with-1-dep'], await testDefaults()) const shr = await project.loadShrinkwrap() t.ok(shr.packages['/dep-of-pkg-with-1-dep/100.0.0']) @@ -53,7 +53,7 @@ test('prefer version ranges specified for top dependencies, even if they are ali await addDistTag({ package: 'dep-of-pkg-with-1-dep', version: '100.1.0', distTag: 'latest' }) - await install(testDefaults()) + await install(await testDefaults()) const shr = await project.loadShrinkwrap() t.ok(shr.packages['/dep-of-pkg-with-1-dep/100.0.0']) @@ -70,7 +70,7 @@ test('prefer version ranges specified for top dependencies, even if the subdepen await addDistTag({ package: 'dep-of-pkg-with-1-dep', version: '100.1.0', distTag: 'latest' }) - await install(testDefaults()) + await install(await testDefaults()) const shr = await project.loadShrinkwrap() t.ok(shr.packages['/dep-of-pkg-with-1-dep/100.0.0']) @@ -87,7 +87,7 @@ test('ignore version of root dependency when it is incompatible with the indirec await addDistTag({ package: 'dep-of-pkg-with-1-dep', version: '100.0.0', distTag: 'latest' }) - await install(testDefaults()) + await install(await testDefaults()) const shr = await project.loadShrinkwrap() t.ok(shr.packages['/dep-of-pkg-with-1-dep/100.0.0']) @@ -105,7 +105,7 @@ test('prefer dist-tag specified for top dependency', async (t: tape.Test) => { await addDistTag({ package: 'dep-of-pkg-with-1-dep', version: '100.1.0', distTag: 'latest' }) await addDistTag({ package: 'dep-of-pkg-with-1-dep', version: '100.0.0', distTag: 'stable' }) - await install(testDefaults()) + await install(await testDefaults()) const shr = await project.loadShrinkwrap() t.ok(shr.packages['/dep-of-pkg-with-1-dep/100.0.0']) diff --git a/test/install/fromRepo.ts b/test/install/fromRepo.ts index b84364d9c7..f8cbd40c90 100644 --- a/test/install/fromRepo.ts +++ b/test/install/fromRepo.ts @@ -19,7 +19,7 @@ const test = promisifyTape(tape) test('from a github repo', async (t: tape.Test) => { const project = prepare(t) - await installPkgs(['kevva/is-negative'], testDefaults()) + await installPkgs(['kevva/is-negative'], await testDefaults()) const m = project.requireModule('is-negative') @@ -34,7 +34,7 @@ test('from a github repo with different name via named installation', async func const reporter = sinon.spy() - await installPkgs(['say-hi@github:zkochan/hi#4cdebec76b7b9d1f6e219e06c42d92a6b8ea60cd'], testDefaults({reporter})) + await installPkgs(['say-hi@github:zkochan/hi#4cdebec76b7b9d1f6e219e06c42d92a6b8ea60cd'], await testDefaults({reporter})) const m = project.requireModule('say-hi') @@ -73,7 +73,7 @@ test('from a github repo with different name', async function (t: tape.Test) { const reporter = sinon.spy() - await install(testDefaults({reporter})) + await install(await testDefaults({reporter})) const m = project.requireModule('say-hi') @@ -105,7 +105,7 @@ test('from a github repo with different name', async function (t: tape.Test) { test('a subdependency is from a github repo with different name', async function (t: tape.Test) { const project = prepare(t) - await installPkgs(['has-aliased-git-dependency'], testDefaults()) + await installPkgs(['has-aliased-git-dependency'], await testDefaults()) const m = project.requireModule('has-aliased-git-dependency') @@ -130,7 +130,7 @@ test('from a git repo', async (t: tape.Test) => { return t.end() } const project = prepare(t) - await installPkgs(['git+ssh://git@github.com/kevva/is-negative.git'], testDefaults()) + await installPkgs(['git+ssh://git@github.com/kevva/is-negative.git'], await testDefaults()) const m = project.requireModule('is-negative') @@ -140,7 +140,7 @@ test('from a git repo', async (t: tape.Test) => { test('from a non-github git repo', async (t: tape.Test) => { const project = prepare(t) - await installPkgs(['git+http://ikt.pm2.io/ikt.git#3325a3e39a502418dc2e2e4bf21529cbbde96228'], testDefaults()) + await installPkgs(['git+http://ikt.pm2.io/ikt.git#3325a3e39a502418dc2e2e4bf21529cbbde96228'], await testDefaults()) const m = project.requireModule('ikt') diff --git a/test/install/fromTarball.ts b/test/install/fromTarball.ts index 7b0d749f8e..619d81ddc4 100644 --- a/test/install/fromTarball.ts +++ b/test/install/fromTarball.ts @@ -11,7 +11,7 @@ const test = promisifyTape(tape) test('tarball from npm registry', async function (t) { const project = prepare(t) - await installPkgs(['http://registry.npmjs.org/is-array/-/is-array-1.0.1.tgz'], testDefaults()) + await installPkgs(['http://registry.npmjs.org/is-array/-/is-array-1.0.1.tgz'], await testDefaults()) const m = project.requireModule('is-array') @@ -25,7 +25,7 @@ test('tarball from npm registry', async function (t) { test('tarball not from npm registry', async function (t) { const project = prepare(t) - await installPkgs(['https://github.com/hegemonic/taffydb/tarball/master'], testDefaults()) + await installPkgs(['https://github.com/hegemonic/taffydb/tarball/master'], await testDefaults()) const m = project.requireModule('taffydb') @@ -36,7 +36,7 @@ test('tarball not from npm registry', async function (t) { test('tarballs from GitHub (is-negative)', async function (t) { const project = prepare(t) - await installPkgs(['is-negative@https://github.com/kevva/is-negative/archive/1d7e288222b53a0cab90a331f1865220ec29560c.tar.gz'], testDefaults()) + await installPkgs(['is-negative@https://github.com/kevva/is-negative/archive/1d7e288222b53a0cab90a331f1865220ec29560c.tar.gz'], await testDefaults()) const m = project.requireModule('is-negative') diff --git a/test/install/global.ts b/test/install/global.ts index ef28dfe05b..6f7bb9c4cf 100644 --- a/test/install/global.ts +++ b/test/install/global.ts @@ -2,7 +2,11 @@ import tape = require('tape') import promisifyTape from 'tape-promise' import path = require('path') import readPkg = require('read-pkg') -import {prepare, testDefaults, addDistTag} from '../utils' +import { + prepare, + testDefaults, + addDistTag, +} from '../utils' import {installPkgs} from 'supi' const test = promisifyTape(tape) @@ -12,7 +16,7 @@ const LAYOUT_VERSION = '1' test('global installation', async function (t) { prepare(t) const globalPrefix = path.resolve('..', 'global') - const opts = testDefaults({global: true, prefix: globalPrefix}) + const opts = await testDefaults({global: true, prefix: globalPrefix}) await installPkgs(['is-positive'], opts) // there was an issue when subsequent installations were removing everything installed prior @@ -31,7 +35,7 @@ test('always install latest when doing global installation without spec', async const project = prepare(t) const globalPrefix = process.cwd() - const opts = testDefaults({global: true, prefix: globalPrefix}) + const opts = await testDefaults({global: true, prefix: globalPrefix}) await installPkgs(['peer-c@1'], opts) await installPkgs(['peer-c'], opts) diff --git a/test/install/hooks.ts b/test/install/hooks.ts index 0086f5ca81..0f7d3c6aff 100644 --- a/test/install/hooks.ts +++ b/test/install/hooks.ts @@ -22,7 +22,7 @@ test('readPackage hook', async (t: tape.Test) => { return pkg } - await installPkgs(['pkg-with-1-dep'], testDefaults({ + await installPkgs(['pkg-with-1-dep'], await testDefaults({ hooks: {readPackage: readPackageHook} })) diff --git a/test/install/independentLeaves.ts b/test/install/independentLeaves.ts index ee9a40c355..d74d6492b5 100644 --- a/test/install/independentLeaves.ts +++ b/test/install/independentLeaves.ts @@ -11,7 +11,7 @@ const test = promisifyTape(tape) test('install with --independent-leaves', async function (t: tape.Test) { const project = prepare(t) - await installPkgs(['rimraf@2.5.1'], testDefaults({independentLeaves: true})) + await installPkgs(['rimraf@2.5.1'], await testDefaults({independentLeaves: true})) const m = project.requireModule('rimraf') t.ok(typeof m === 'function', 'rimraf() is available') @@ -20,10 +20,10 @@ test('install with --independent-leaves', async function (t: tape.Test) { test('--independent-leaves throws exception when executed on node_modules installed w/o the option', async function (t: tape.Test) { const project = prepare(t) - await installPkgs(['is-positive'], testDefaults({independentLeaves: false})) + await installPkgs(['is-positive'], await testDefaults({independentLeaves: false})) try { - await installPkgs(['is-negative'], testDefaults({independentLeaves: true})) + await installPkgs(['is-negative'], await testDefaults({independentLeaves: true})) t.fail('installation should have failed') } catch (err) { t.ok(err.message.indexOf('This node_modules was not installed with the --independent-leaves option.') === 0) @@ -32,10 +32,10 @@ test('--independent-leaves throws exception when executed on node_modules instal test('--no-independent-leaves throws exception when executed on node_modules installed with --independent-leaves', async function (t: tape.Test) { const project = prepare(t) - await installPkgs(['is-positive'], testDefaults({independentLeaves: true})) + await installPkgs(['is-positive'], await testDefaults({independentLeaves: true})) try { - await installPkgs(['is-negative'], testDefaults({independentLeaves: false})) + await installPkgs(['is-negative'], await testDefaults({independentLeaves: false})) t.fail('installation should have failed') } catch (err) { t.ok(err.message.indexOf('This node_modules was installed with --independent-leaves option.') === 0) @@ -45,7 +45,7 @@ test('--no-independent-leaves throws exception when executed on node_modules ins test('global installation with --independent-leaves', async function (t: tape.Test) { prepare(t) const globalPrefix = path.resolve('..', 'global') - const opts = testDefaults({global: true, prefix: globalPrefix, independentLeaves: true}) + const opts = await testDefaults({global: true, prefix: globalPrefix, independentLeaves: true}) await installPkgs(['is-positive'], opts) // there was an issue when subsequent installations were removing everything installed prior diff --git a/test/install/installationChecks.ts b/test/install/installationChecks.ts index 989a5c3e3e..cb1485f773 100644 --- a/test/install/installationChecks.ts +++ b/test/install/installationChecks.ts @@ -9,7 +9,7 @@ test('fail if installed package does not support the current engine and engine-s const project = prepare(t) try { - await installPkgs(['not-compatible-with-any-os'], testDefaults({ + await installPkgs(['not-compatible-with-any-os'], await testDefaults({ engineStrict: true })) t.fail() @@ -22,7 +22,7 @@ test('fail if installed package does not support the current engine and engine-s test('do not fail if installed package does not support the current engine and engine-strict = false', async function (t: tape.Test) { const project = prepare(t) - await installPkgs(['not-compatible-with-any-os'], testDefaults({ + await installPkgs(['not-compatible-with-any-os'], await testDefaults({ engineStrict: false })) @@ -36,7 +36,7 @@ test('do not fail if installed package does not support the current engine and e test('do not fail if installed package requires the node version that was passed in and engine-strict = true', async function (t: tape.Test) { const project = prepare(t) - await installPkgs(['for-legacy-node'], testDefaults({ + await installPkgs(['for-legacy-node'], await testDefaults({ engineStrict: true, nodeVersion: '0.10.0' })) @@ -51,7 +51,7 @@ test('do not fail if installed package requires the node version that was passed test('save cpu field to shrinkwrap.yaml', async function (t: tape.Test) { const project = prepare(t) - await installPkgs(['has-cpu-specified'], testDefaults()) + await installPkgs(['has-cpu-specified'], await testDefaults()) const shr = await project.loadShrinkwrap() @@ -65,7 +65,7 @@ test('save cpu field to shrinkwrap.yaml', async function (t: tape.Test) { test('engines field is not added to shrinkwrap.yaml when "node": "*" is in "engines" field', async function (t: tape.Test) { const project = prepare(t) - await installPkgs(['jsonify@0.0.0'], testDefaults()) + await installPkgs(['jsonify@0.0.0'], await testDefaults()) const shr = await project.loadShrinkwrap() diff --git a/test/install/lifecycleScripts.ts b/test/install/lifecycleScripts.ts index 96af15ffcc..f650f309a4 100644 --- a/test/install/lifecycleScripts.ts +++ b/test/install/lifecycleScripts.ts @@ -23,7 +23,7 @@ const test = promisifyTape(tape) test('run pre/postinstall scripts', async function (t: tape.Test) { const project = prepare(t) - await installPkgs(['pre-and-postinstall-scripts-example'], testDefaults({saveDev: true})) + await installPkgs(['pre-and-postinstall-scripts-example'], await testDefaults({saveDev: true})) const generatedByPreinstall = project.requireModule('pre-and-postinstall-scripts-example/generated-by-preinstall') t.ok(typeof generatedByPreinstall === 'function', 'generatedByPreinstall() is available') @@ -36,7 +36,7 @@ test('run pre/postinstall scripts', async function (t: tape.Test) { // testing that the packages are not installed even though they are in shrinkwrap // and that their scripts are not tried to be executed - await install(testDefaults({production: true})) + await install(await testDefaults({production: true})) { const generatedByPreinstall = project.requireModule('pre-and-postinstall-scripts-example/generated-by-preinstall') @@ -50,8 +50,8 @@ test('run pre/postinstall scripts', async function (t: tape.Test) { test('testing that the bins are linked when the package with the bins was already in node_modules', async function (t: tape.Test) { const project = prepare(t) - await installPkgs(['hello-world-js-bin'], testDefaults()) - await installPkgs(['pre-and-postinstall-scripts-example'], testDefaults({saveDev: true})) + await installPkgs(['hello-world-js-bin'], await testDefaults()) + await installPkgs(['pre-and-postinstall-scripts-example'], await testDefaults({saveDev: true})) const generatedByPreinstall = project.requireModule('pre-and-postinstall-scripts-example/generated-by-preinstall') t.ok(typeof generatedByPreinstall === 'function', 'generatedByPreinstall() is available') @@ -62,7 +62,7 @@ test('testing that the bins are linked when the package with the bins was alread test('run install scripts', async function (t) { const project = prepare(t) - await installPkgs(['install-script-example'], testDefaults()) + await installPkgs(['install-script-example'], await testDefaults()) const generatedByInstall = project.requireModule('install-script-example/generated-by-install') t.ok(typeof generatedByInstall === 'function', 'generatedByInstall() is available') @@ -76,8 +76,8 @@ test('run install scripts in the current project', async (t: tape.Test) => { postinstall: `node -e "process.stdout.write('postinstall')" | json-append output.json`, } }) - await installPkgs(['json-append@1.1.1'], testDefaults()) - await install(testDefaults()) + await installPkgs(['json-append@1.1.1'], await testDefaults()) + await install(await testDefaults()) const output = await loadJsonFile('output.json') @@ -93,8 +93,8 @@ test('run install scripts in the current project when its name is different than postinstall: `node -e "process.stdout.write('postinstall')" | json-append output.json`, } }) - await installPkgs(['json-append@1.1.1'], testDefaults()) - await install(testDefaults()) + await installPkgs(['json-append@1.1.1'], await testDefaults()) + await install(await testDefaults()) const output = await loadJsonFile('output.json') @@ -110,7 +110,7 @@ test('do not run install scripts if unsafePerm is false', async (t: tape.Test) = postinstall: `node -e "process.stdout.write('postinstall')" | json-append output.json`, } }) - const opts = testDefaults({ unsafePerm: false }) + const opts = await testDefaults({ unsafePerm: false }) await installPkgs(['json-append@1.1.1'], opts) await install(opts) @@ -127,7 +127,7 @@ test('installation fails if lifecycle script fails', async (t: tape.Test) => { }) try { - await install(testDefaults()) + await install(await testDefaults()) t.fail('should have failed') } catch (err) { t.equal(err['code'], 'ELIFECYCLE', 'failed with correct error code') @@ -142,8 +142,8 @@ test['skip']('creates env for scripts', async (t: tape.Test) => { install: `node -e "process.stdout.write(process.env.INIT_CWD)" | json-append output.json`, } }) - await installPkgs(['json-append@1.1.1'], testDefaults()) - await install(testDefaults()) + await installPkgs(['json-append@1.1.1'], await testDefaults()) + await install(await testDefaults()) const output = await loadJsonFile('output.json') @@ -152,7 +152,7 @@ test['skip']('creates env for scripts', async (t: tape.Test) => { test('INIT_CWD is set correctly', async (t: tape.Test) => { const project = prepare(t) - await installPkgs(['write-lifecycle-env'], testDefaults()) + await installPkgs(['write-lifecycle-env'], await testDefaults()) const childEnv = await loadJsonFile(path.resolve('node_modules', 'write-lifecycle-env', 'env.json')) @@ -164,7 +164,7 @@ test("reports child's output", async (t: tape.Test) => { const reporter = sinon.spy() - await installPkgs(['count-to-10'], testDefaults({reporter})) + await installPkgs(['count-to-10'], await testDefaults({reporter})) t.ok(reporter.calledWithMatch({ name: 'pnpm:lifecycle', @@ -199,7 +199,7 @@ test("reports child's close event", async (t: tape.Test) => { const reporter = sinon.spy() try { - await installPkgs(['failing-postinstall'], testDefaults({reporter})) + await installPkgs(['failing-postinstall'], await testDefaults({reporter})) t.fail() } catch (err) { t.ok(reporter.calledWithMatch({ @@ -226,7 +226,7 @@ test('lifecycle scripts have access to node-gyp', async (t: tape.Test) => { .filter((p: string) => !p.includes('node-gyp-bin') && !p.includes('npm')) .join(path.delimiter) - await installPkgs(['drivelist@5.1.8'], testDefaults()) + await installPkgs(['drivelist@5.1.8'], await testDefaults()) process.env[PATH] = initialPath diff --git a/test/install/local.ts b/test/install/local.ts index 726313f10f..af699e4c06 100644 --- a/test/install/local.ts +++ b/test/install/local.ts @@ -18,7 +18,7 @@ const test = promisifyTape(tape) test('scoped modules from a directory', async function (t: tape.Test) { const project = prepare(t) - await installPkgs([local('local-scoped-pkg')], testDefaults()) + await installPkgs([local('local-scoped-pkg')], await testDefaults()) const m = project.requireModule('@scope/local-scoped-pkg') @@ -29,7 +29,7 @@ test('local file', async function (t: tape.Test) { const project = prepare(t) await ncp(pathToLocalPkg('local-pkg'), path.resolve('..', 'local-pkg')) - await installPkgs(['file:../local-pkg'], testDefaults()) + await installPkgs(['file:../local-pkg'], await testDefaults()) const pkgJson = await readPkg() const expectedSpecs = {'local-pkg': `file:..${path.sep}local-pkg`} @@ -54,7 +54,7 @@ test('local file', async function (t: tape.Test) { test('package with a broken symlink', async function (t) { const project = prepare(t) - await installPkgs([pathToLocalPkg('has-broken-symlink/has-broken-symlink.tar.gz')], testDefaults()) + await installPkgs([pathToLocalPkg('has-broken-symlink/has-broken-symlink.tar.gz')], await testDefaults()) const m = project.requireModule('has-broken-symlink') @@ -63,7 +63,7 @@ test('package with a broken symlink', async function (t) { test('tarball local package', async function (t) { const project = prepare(t) - await installPkgs([pathToLocalPkg('tar-pkg/tar-pkg-1.0.0.tgz')], testDefaults()) + await installPkgs([pathToLocalPkg('tar-pkg/tar-pkg-1.0.0.tgz')], await testDefaults()) const m = project.requireModule('tar-pkg') diff --git a/test/install/misc.ts b/test/install/misc.ts index b39a09bff7..467037175a 100644 --- a/test/install/misc.ts +++ b/test/install/misc.ts @@ -40,7 +40,7 @@ if (!caw() && !IS_WINDOWS) { test('small with dependencies (rimraf)', async (t: tape.Test) => { const project = prepare(t) - await installPkgs(['rimraf@2.5.1'], testDefaults()) + await installPkgs(['rimraf@2.5.1'], await testDefaults()) const m = project.requireModule('rimraf') t.ok(typeof m === 'function', 'rimraf() is available') @@ -51,7 +51,7 @@ test('ignoring some files in the dependency', async (t: tape.Test) => { const project = prepare(t) const ignoreFile = (filename: string) => filename === 'readme.md' - await installPkgs(['is-positive@1.0.0'], testDefaults({ignoreFile})) + await installPkgs(['is-positive@1.0.0'], await testDefaults({}, {}, {ignoreFile})) t.ok(await exists(path.resolve('node_modules', 'is-positive', 'package.json')), 'package.json was not ignored') t.notOk(await exists(path.resolve('node_modules', 'is-positive', 'readme.md')), 'readme.md was ignored') @@ -63,7 +63,7 @@ test('no dependencies (lodash)', async (t: tape.Test) => { await addDistTag('lodash', '4.1.0', 'latest') - await installPkgs(['lodash@4.0.0'], testDefaults({reporter})) + await installPkgs(['lodash@4.0.0'], await testDefaults({reporter})) t.ok(reporter.calledWithMatch({ name: 'pnpm:package-json', @@ -120,7 +120,7 @@ test('no dependencies (lodash)', async (t: tape.Test) => { test('scoped modules without version spec (@rstacruz/tap-spec)', async function (t) { const project = prepare(t) - await installPkgs(['@rstacruz/tap-spec'], testDefaults()) + await installPkgs(['@rstacruz/tap-spec'], await testDefaults()) const m = project.requireModule('@rstacruz/tap-spec') t.ok(typeof m === 'function', 'tap-spec is available') @@ -129,7 +129,7 @@ test('scoped modules without version spec (@rstacruz/tap-spec)', async function test('scoped package with custom registry', async function (t) { const project = prepare(t) - await installPkgs(['@scoped/peer'], testDefaults({ + await installPkgs(['@scoped/peer'], await testDefaults({ // setting an incorrect default registry URL registry: 'http://localhost:9999/', rawNpmConfig: { @@ -149,7 +149,7 @@ test('modules without version spec, with custom tag config', async function (t) await addDistTag('dep-of-pkg-with-1-dep', '100.1.0', 'latest') await addDistTag('dep-of-pkg-with-1-dep', '100.0.0', tag) - await installPkgs(['dep-of-pkg-with-1-dep'], testDefaults({tag})) + await installPkgs(['dep-of-pkg-with-1-dep'], await testDefaults({tag})) await project.storeHas('dep-of-pkg-with-1-dep', '100.0.0') }) @@ -160,7 +160,7 @@ test('installing a package by specifying a specific dist-tag', async function (t await addDistTag('dep-of-pkg-with-1-dep', '100.1.0', 'latest') await addDistTag('dep-of-pkg-with-1-dep', '100.0.0', 'beta') - await installPkgs(['dep-of-pkg-with-1-dep@beta'], testDefaults()) + await installPkgs(['dep-of-pkg-with-1-dep@beta'], await testDefaults()) await project.storeHas('dep-of-pkg-with-1-dep', '100.0.0') }) @@ -171,11 +171,11 @@ test('update a package when installing with a dist-tag', async function (t: tape await addDistTag('dep-of-pkg-with-1-dep', '100.0.0', 'latest') await addDistTag('dep-of-pkg-with-1-dep', '100.1.0', 'beta') - await installPkgs(['dep-of-pkg-with-1-dep'], testDefaults({saveDev: true})) + await installPkgs(['dep-of-pkg-with-1-dep'], await testDefaults({saveDev: true})) const reporter = sinon.spy() - await installPkgs(['dep-of-pkg-with-1-dep@beta'], testDefaults({saveDev: true, reporter})) + await installPkgs(['dep-of-pkg-with-1-dep@beta'], await testDefaults({saveDev: true, reporter})) t.ok(reporter.calledWithMatch({ name: 'pnpm:root', @@ -206,7 +206,7 @@ test('update a package when installing with a dist-tag', async function (t: tape test('scoped modules with versions (@rstacruz/tap-spec@4.1.1)', async function (t) { const project = prepare(t) - await installPkgs(['@rstacruz/tap-spec@4.1.1'], testDefaults()) + await installPkgs(['@rstacruz/tap-spec@4.1.1'], await testDefaults()) const m = project.requireModule('@rstacruz/tap-spec') t.ok(typeof m === 'function', 'tap-spec is available') @@ -214,7 +214,7 @@ test('scoped modules with versions (@rstacruz/tap-spec@4.1.1)', async function ( test('scoped modules (@rstacruz/tap-spec@*)', async function (t) { const project = prepare(t) - await installPkgs(['@rstacruz/tap-spec@*'], testDefaults()) + await installPkgs(['@rstacruz/tap-spec@*'], await testDefaults()) const m = project.requireModule('@rstacruz/tap-spec') t.ok(typeof m === 'function', 'tap-spec is available') @@ -222,7 +222,7 @@ test('scoped modules (@rstacruz/tap-spec@*)', async function (t) { test('multiple scoped modules (@rstacruz/...)', async function (t) { const project = prepare(t) - await installPkgs(['@rstacruz/tap-spec@*', '@rstacruz/travis-encrypt@*'], testDefaults()) + await installPkgs(['@rstacruz/tap-spec@*', '@rstacruz/travis-encrypt@*'], await testDefaults()) t.equal(typeof project.requireModule('@rstacruz/tap-spec'), 'function', 'tap-spec is available') t.equal(typeof project.requireModule('@rstacruz/travis-encrypt'), 'function', 'travis-encrypt is available') @@ -230,7 +230,7 @@ test('multiple scoped modules (@rstacruz/...)', async function (t) { test('nested scoped modules (test-pnpm-issue219 -> @zkochan/test-pnpm-issue219)', async function (t) { const project = prepare(t) - await installPkgs(['test-pnpm-issue219@1.0.2'], testDefaults()) + await installPkgs(['test-pnpm-issue219@1.0.2'], await testDefaults()) const m = project.requireModule('test-pnpm-issue219') t.ok(m === 'test-pnpm-issue219,@zkochan/test-pnpm-issue219', 'nested scoped package is available') @@ -239,7 +239,7 @@ test('nested scoped modules (test-pnpm-issue219 -> @zkochan/test-pnpm-issue219)' test('idempotency (rimraf)', async (t: tape.Test) => { const project = prepare(t) const reporter = sinon.spy() - const opts = testDefaults({reporter}) + const opts = await testDefaults({reporter}) await installPkgs(['rimraf@2.5.1'], opts) @@ -273,13 +273,13 @@ test('idempotency (rimraf)', async (t: tape.Test) => { test('reporting adding root package', async (t: tape.Test) => { const project = prepare(t) - await installPkgs(['magic-hook@2.0.0'], testDefaults()) + await installPkgs(['magic-hook@2.0.0'], await testDefaults()) await project.storeHas('flatten', '1.0.2') const reporter = sinon.spy() - await installPkgs(['flatten@1.0.2'], testDefaults({reporter})) + await installPkgs(['flatten@1.0.2'], await testDefaults({reporter})) t.ok(reporter.calledWithMatch({ name: 'pnpm:root', @@ -294,11 +294,11 @@ test('reporting adding root package', async (t: tape.Test) => { test('overwriting (magic-hook@2.0.0 and @0.1.0)', async (t: tape.Test) => { const project = prepare(t) - await installPkgs(['magic-hook@2.0.0'], testDefaults()) + await installPkgs(['magic-hook@2.0.0'], await testDefaults()) await project.storeHas('flatten', '1.0.2') - await installPkgs(['magic-hook@0.1.0'], testDefaults()) + await installPkgs(['magic-hook@0.1.0'], await testDefaults()) // flatten is not removed from store even though it is unreferenced // store should be pruned to have this removed @@ -310,23 +310,23 @@ test('overwriting (magic-hook@2.0.0 and @0.1.0)', async (t: tape.Test) => { test('overwriting (is-positive@3.0.0 with is-positive@latest)', async function (t) { const project = prepare(t) - await installPkgs(['is-positive@3.0.0'], testDefaults({save: true})) + await installPkgs(['is-positive@3.0.0'], await testDefaults({save: true})) await project.storeHas('is-positive', '3.0.0') - await installPkgs(['is-positive@latest'], testDefaults({save: true})) + await installPkgs(['is-positive@latest'], await testDefaults({save: true})) await project.storeHas('is-positive', '3.1.0') }) test('forcing', async function (t) { const project = prepare(t) - await installPkgs(['magic-hook@2.0.0'], testDefaults()) + await installPkgs(['magic-hook@2.0.0'], await testDefaults()) const distPath = path.resolve('node_modules', 'magic-hook', 'dist') await rimraf(distPath) - await installPkgs(['magic-hook@2.0.0'], testDefaults({force: true})) + await installPkgs(['magic-hook@2.0.0'], await testDefaults({force: true})) const distPathExists = await exists(distPath) t.ok(distPathExists, 'magic-hook@2.0.0 dist folder reinstalled') @@ -334,12 +334,12 @@ test('forcing', async function (t) { test('argumentless forcing', async function (t: tape.Test) { const project = prepare(t) - await installPkgs(['magic-hook@2.0.0'], testDefaults()) + await installPkgs(['magic-hook@2.0.0'], await testDefaults()) const distPath = path.resolve('node_modules', 'magic-hook', 'dist') await rimraf(distPath) - await install(testDefaults({force: true})) + await install(await testDefaults({force: true})) const distPathExists = await exists(distPath) t.ok(distPathExists, 'magic-hook@2.0.0 dist folder reinstalled') @@ -347,12 +347,12 @@ test('argumentless forcing', async function (t: tape.Test) { test('no forcing', async function (t) { const project = prepare(t) - await installPkgs(['magic-hook@2.0.0'], testDefaults()) + await installPkgs(['magic-hook@2.0.0'], await testDefaults()) const distPath = path.resolve('node_modules', 'magic-hook', 'dist') await rimraf(distPath) - await installPkgs(['magic-hook@2.0.0'], testDefaults()) + await installPkgs(['magic-hook@2.0.0'], await testDefaults()) const distPathExists = await exists(distPath) t.notOk(distPathExists, 'magic-hook@2.0.0 dist folder not reinstalled') @@ -360,14 +360,14 @@ test('no forcing', async function (t) { test('refetch package to store if it has been modified', async function (t) { const project = prepare(t) - await installPkgs(['magic-hook@2.0.0'], testDefaults()) + await installPkgs(['magic-hook@2.0.0'], await testDefaults()) const distPathInStore = await project.resolve('magic-hook', '2.0.0', 'dist') await rimraf(distPathInStore) await rimraf('node_modules') const distPath = path.resolve('node_modules', 'magic-hook', 'dist') - await installPkgs(['magic-hook@2.0.0'], testDefaults()) + await installPkgs(['magic-hook@2.0.0'], await testDefaults()) const distPathExists = await exists(distPath) t.ok(distPathExists, 'magic-hook@2.0.0 dist folder reinstalled') @@ -375,7 +375,7 @@ test('refetch package to store if it has been modified', async function (t) { test("don't refetch package to store if it has been modified and verify-store-integrity = false", async (t: tape.Test) => { const project = prepare(t) - const opts = testDefaults({verifyStoreIntegrity: false}) + const opts = await testDefaults({verifyStoreIntegrity: false}) await installPkgs(['magic-hook@2.0.0'], opts) await writeJsonFile(path.join(await project.getStorePath(), 'localhost+4873', 'magic-hook', '2.0.0', 'node_modules', 'magic-hook', 'package.json'), {}) @@ -390,7 +390,7 @@ test("don't refetch package to store if it has been modified and verify-store-in // TODO: decide what to do with this case test['skip']('relink package to project if the dependency is not linked from store', async function (t: tape.Test) { const project = prepare(t) - await installPkgs(['magic-hook@2.0.0'], testDefaults({save: true, saveExact: true})) + await installPkgs(['magic-hook@2.0.0'], await testDefaults({save: true, saveExact: true})) const pkgJsonPath = path.resolve('node_modules', 'magic-hook', 'package.json') @@ -407,14 +407,14 @@ test['skip']('relink package to project if the dependency is not linked from sto t.ok(storeInode !== await getInode(), 'package.json inode changed') - await install(testDefaults({repeatInstallDepth: 0})) + await install(await testDefaults({repeatInstallDepth: 0})) t.ok(storeInode === await getInode(), 'package.json inode matches the one that is in store') }) test('circular deps', async function (t: tape.Test) { const project = prepare(t) - await installPkgs(['circular-deps-1-of-2'], testDefaults()) + await installPkgs(['circular-deps-1-of-2'], await testDefaults()) const m = project.requireModule('circular-deps-1-of-2/mirror') @@ -430,7 +430,7 @@ test('concurrent circular deps', async (t: tape.Test) => { await addDistTag('es6-iterator', '2.0.1', 'latest') const project = prepare(t) - await installPkgs(['es6-iterator@2.0.0'], testDefaults()) + await installPkgs(['es6-iterator@2.0.0'], await testDefaults()) const m = project.requireModule('es6-iterator') @@ -446,7 +446,7 @@ test('concurrent installation of the same packages', async function (t) { // the same version of core-js is required by two different dependencies // of babek-core - await installPkgs(['babel-core@6.21.0'], testDefaults()) + await installPkgs(['babel-core@6.21.0'], await testDefaults()) const m = project.requireModule('babel-core') @@ -455,7 +455,7 @@ test('concurrent installation of the same packages', async function (t) { test('big with dependencies and circular deps (babel-preset-2015)', async function (t) { const project = prepare(t) - await installPkgs(['babel-preset-es2015@6.3.13'], testDefaults()) + await installPkgs(['babel-preset-es2015@6.3.13'], await testDefaults()) const m = project.requireModule('babel-preset-es2015') t.ok(typeof m === 'object', 'babel-preset-es2015 is available') @@ -464,7 +464,7 @@ test('big with dependencies and circular deps (babel-preset-2015)', async functi test('bundledDependencies (pkg-with-bundled-dependencies@1.0.0)', async function (t: tape.Test) { const project = prepare(t) - await installPkgs(['pkg-with-bundled-dependencies@1.0.0'], testDefaults()) + await installPkgs(['pkg-with-bundled-dependencies@1.0.0'], await testDefaults()) await project.isExecutable('pkg-with-bundled-dependencies/node_modules/.bin/hello-world-js-bin') @@ -479,7 +479,7 @@ test('bundledDependencies (pkg-with-bundled-dependencies@1.0.0)', async function test('bundleDependencies (pkg-with-bundle-dependencies@1.0.0)', async function (t: tape.Test) { const project = prepare(t) - await installPkgs(['pkg-with-bundle-dependencies@1.0.0'], testDefaults()) + await installPkgs(['pkg-with-bundle-dependencies@1.0.0'], await testDefaults()) await project.isExecutable('pkg-with-bundle-dependencies/node_modules/.bin/hello-world-js-bin') @@ -499,7 +499,7 @@ test('compiled modules (ursa@0.9.1)', async function (t) { } const project = prepare(t) - await installPkgs(['ursa@0.9.1'], testDefaults()) + await installPkgs(['ursa@0.9.1'], await testDefaults()) const m = project.requireModule('ursa') t.ok(typeof m === 'object', 'ursa() is available') @@ -512,7 +512,7 @@ test('shrinkwrap compatibility', async function (t) { } const project = prepare(t, { dependencies: { rimraf: '*' } }) - await installPkgs(['rimraf@2.5.1'], testDefaults()) + await installPkgs(['rimraf@2.5.1'], await testDefaults()) return new Promise((resolve, reject) => { const proc = crossSpawn.spawn('npm', ['shrinkwrap']) @@ -534,11 +534,11 @@ const wait = (ms: number) => new Promise(resolve => setTimeout(resolve, ms)) test('support installing into the same store simultaneously', async t => { const project = prepare(t) await Promise.all([ - installPkgs(['pkg-that-installs-slowly'], testDefaults()), + installPkgs(['pkg-that-installs-slowly'], await testDefaults()), wait(500) // to be sure that lock was created .then(async () => { await project.storeHasNot('pkg-that-installs-slowly') - await installPkgs(['rimraf@2.5.1'], testDefaults()) + await installPkgs(['rimraf@2.5.1'], await testDefaults()) }) .then(async () => { await project.has('pkg-that-installs-slowly') @@ -551,11 +551,11 @@ test('support installing into the same store simultaneously', async t => { test('support installing and uninstalling from the same store simultaneously', async t => { const project = prepare(t) await Promise.all([ - installPkgs(['pkg-that-installs-slowly'], testDefaults()), + installPkgs(['pkg-that-installs-slowly'], await testDefaults()), wait(500) // to be sure that lock was created .then(async () => { await project.storeHasNot('pkg-that-installs-slowly') - await uninstall(['rimraf@2.5.1'], testDefaults()) + await uninstall(['rimraf@2.5.1'], await testDefaults()) }) .then(async () => { await project.has('pkg-that-installs-slowly') @@ -571,7 +571,7 @@ test('top-level packages should find the plugins they use', async function (t) { test: 'pkg-that-uses-plugins' } }) - await installPkgs(['pkg-that-uses-plugins', 'plugin-example'], testDefaults({ save: true })) + await installPkgs(['pkg-that-uses-plugins', 'plugin-example'], await testDefaults({ save: true })) const result = spawnSync('npm', ['test']) t.ok(result.stdout.toString().indexOf('My plugin is plugin-example') !== -1, 'package executable have found its plugin') t.equal(result.status, 0, 'executable exited with success') @@ -584,7 +584,7 @@ test('not top-level packages should find the plugins they use', async function ( test: 'standard' } }) - await installPkgs(['standard@8.6.0'], testDefaults({ save: true })) + await installPkgs(['standard@8.6.0'], await testDefaults({ save: true })) const result = spawnSync('npm', ['test']) t.equal(result.status, 0, 'standard exited with success') }) @@ -592,7 +592,7 @@ test('not top-level packages should find the plugins they use', async function ( test('bin specified in the directories property linked to .bin folder', async function (t) { const project = prepare(t) - await installPkgs(['pkg-with-directories-bin'], testDefaults()) + await installPkgs(['pkg-with-directories-bin'], await testDefaults()) await project.isExecutable('.bin/pkg-with-directories-bin') }) @@ -603,7 +603,7 @@ test('run js bin file', async function (t) { test: 'hello-world-js-bin' } }) - await installPkgs(['hello-world-js-bin'], testDefaults({ save: true })) + await installPkgs(['hello-world-js-bin'], await testDefaults({ save: true })) const result = spawnSync('npm', ['test']) t.ok(result.stdout.toString().indexOf('Hello world!') !== -1, 'package executable printed its message') @@ -613,7 +613,7 @@ test('run js bin file', async function (t) { test('building native addons', async function (t) { const project = prepare(t) - await installPkgs(['runas@3.1.1'], testDefaults()) + await installPkgs(['runas@3.1.1'], await testDefaults()) t.ok(await exists(path.join('node_modules', 'runas', 'build')), 'build folder created') }) @@ -623,7 +623,7 @@ test('should update subdep on second install', async (t: tape.Test) => { await addDistTag('dep-of-pkg-with-1-dep', '100.0.0', 'latest') - await installPkgs(['pkg-with-1-dep'], testDefaults({save: true})) + await installPkgs(['pkg-with-1-dep'], await testDefaults({save: true})) await project.storeHas('dep-of-pkg-with-1-dep', '100.0.0') @@ -635,7 +635,7 @@ test('should update subdep on second install', async (t: tape.Test) => { const reporter = sinon.spy() - await install(testDefaults({depth: 1, update: true, reporter})) + await install(await testDefaults({depth: 1, update: true, reporter})) t.ok(reporter.calledWithMatch({ name: 'pnpm:stats', @@ -658,7 +658,7 @@ test('should not update subdep when depth is smaller than depth of package', asy await addDistTag('dep-of-pkg-with-1-dep', '100.0.0', 'latest') - await installPkgs(['pkg-with-1-dep'], testDefaults({save: true})) + await installPkgs(['pkg-with-1-dep'], await testDefaults({save: true})) await project.storeHas('dep-of-pkg-with-1-dep', '100.0.0') @@ -668,7 +668,7 @@ test('should not update subdep when depth is smaller than depth of package', asy await addDistTag('dep-of-pkg-with-1-dep', '100.1.0', 'latest') - await install(testDefaults({depth: 0, update: true})) + await install(await testDefaults({depth: 0, update: true})) await project.storeHas('dep-of-pkg-with-1-dep', '100.0.0') @@ -683,12 +683,12 @@ test('should not update subdep when depth is smaller than depth of package', asy test('should install dependency in second project', async function (t) { const project1 = prepare(t) - await installPkgs(['pkg-with-1-dep'], testDefaults({save: true, store: '../store'})) + await installPkgs(['pkg-with-1-dep'], await testDefaults({save: true, store: '../store'})) t.equal(project1.requireModule('pkg-with-1-dep')().name, 'dep-of-pkg-with-1-dep', 'can require in 1st pkg') const project2 = prepare(t) - await installPkgs(['pkg-with-1-dep'], testDefaults({save: true, store: '../store'})) + await installPkgs(['pkg-with-1-dep'], await testDefaults({save: true, store: '../store'})) t.equal(project2.requireModule('pkg-with-1-dep')().name, 'dep-of-pkg-with-1-dep', 'can require in 2nd pkg') }) @@ -696,10 +696,10 @@ test('should install dependency in second project', async function (t) { test('should throw error when trying to install using a different store then the previous one', async function(t) { const project = prepare(t) - await installPkgs(['rimraf@2.5.1'], testDefaults({store: 'node_modules/.store1'})) + await installPkgs(['rimraf@2.5.1'], await testDefaults({store: 'node_modules/.store1'})) try { - await installPkgs(['is-negative'], testDefaults({store: 'node_modules/.store2'})) + await installPkgs(['is-negative'], await testDefaults({store: 'node_modules/.store2'})) t.fail('installation should have failed') } catch (err) { t.equal(err.code, 'UNEXPECTED_STORE', 'failed with correct error code') @@ -716,7 +716,7 @@ test('shrinkwrap locks npm dependencies', async function (t: tape.Test) { await addDistTag('dep-of-pkg-with-1-dep', '100.0.0', 'latest') - await installPkgs(['pkg-with-1-dep'], testDefaults({save: true, reporter})) + await installPkgs(['pkg-with-1-dep'], await testDefaults({save: true, reporter})) t.ok(reporter.calledWithMatch({ name: 'pnpm:progress', @@ -737,7 +737,7 @@ test('shrinkwrap locks npm dependencies', async function (t: tape.Test) { await rimraf('node_modules') reporter.reset() - await install(testDefaults({reporter})) + await install(await testDefaults({reporter})) t.ok(reporter.calledWithMatch({ level: 'debug', @@ -758,7 +758,7 @@ test('shrinkwrap locks npm dependencies', async function (t: tape.Test) { test('self-require should work', async function (t) { const project = prepare(t) - await installPkgs(['uses-pkg-with-self-usage'], testDefaults()) + await installPkgs(['uses-pkg-with-self-usage'], await testDefaults()) t.ok(project.requireModule('uses-pkg-with-self-usage')) }) @@ -766,11 +766,11 @@ test('self-require should work', async function (t) { test('install on project with lockfile and no node_modules', async (t: tape.Test) => { const project = prepare(t) - await installPkgs(['is-negative'], testDefaults()) + await installPkgs(['is-negative'], await testDefaults()) await rimraf('node_modules') - await installPkgs(['is-positive'], testDefaults()) + await installPkgs(['is-positive'], await testDefaults()) t.ok(project.requireModule('is-positive'), 'installed new dependency') @@ -785,7 +785,7 @@ test('install a dependency with * range', async (t: tape.Test) => { }) const reporter = sinon.spy() - await install(testDefaults({reporter})) + await install(await testDefaults({reporter})) await project.has('has-beta-only') diff --git a/test/install/only.ts b/test/install/only.ts index 20e0b89045..4ee87d9252 100644 --- a/test/install/only.ts +++ b/test/install/only.ts @@ -21,7 +21,7 @@ test('production install (with --production flag)', async (t: tape.Test) => { }, }) - await install(testDefaults({ development: false })) + await install(await testDefaults({ development: false })) const rimraf = project.requireModule('rimraf') @@ -47,7 +47,7 @@ test('install dev dependencies only', async (t: tape.Test) => { }, }) - await install(testDefaults({ production: false })) + await install(await testDefaults({ production: false })) const inflight = project.requireModule('inflight') t.equal(typeof inflight, 'function', 'dev dependency is available') @@ -65,7 +65,7 @@ test('install dev dependencies only', async (t: tape.Test) => { } // Repeat normal installation adds missing deps to node_modules - await install(testDefaults()) + await install(await testDefaults()) await project.has('once') diff --git a/test/install/optionalDependencies.ts b/test/install/optionalDependencies.ts index 216c755784..97f2ecc435 100644 --- a/test/install/optionalDependencies.ts +++ b/test/install/optionalDependencies.ts @@ -19,12 +19,12 @@ const test = promisifyTape(tape) test('successfully install optional dependency with subdependencies', async function (t) { const project = prepare(t) - await installPkgs(['fsevents@1.0.14'], testDefaults({saveOptional: true})) + await installPkgs(['fsevents@1.0.14'], await testDefaults({saveOptional: true})) }) test('skip failing optional dependencies', async (t: tape.Test) => { const project = prepare(t) - await installPkgs(['pkg-with-failing-optional-dependency@1.0.1'], testDefaults()) + await installPkgs(['pkg-with-failing-optional-dependency@1.0.1'], await testDefaults()) const m = project.requireModule('pkg-with-failing-optional-dependency') t.ok(m(-1), 'package with failed optional dependency has the dependencies installed correctly') @@ -38,7 +38,7 @@ test('skip optional dependency that does not support the current OS', async (t: }) const reporter = sinon.spy() - await install(testDefaults({reporter})) + await install(await testDefaults({reporter})) await project.hasNot('not-compatible-with-any-os') await project.storeHas('not-compatible-with-any-os', '1.0.0') @@ -70,7 +70,7 @@ test('skip optional dependency that does not support the current Node version', }) const reporter = sinon.spy() - await install(testDefaults({reporter})) + await install(await testDefaults({reporter})) await project.hasNot('for-legacy-node') await project.storeHas('for-legacy-node', '1.0.0') @@ -91,7 +91,7 @@ test('skip optional dependency that does not support the current pnpm version', }) const reporter = sinon.spy() - await install(testDefaults({reporter})) + await install(await testDefaults({reporter})) await project.hasNot('for-legacy-pnpm') await project.storeHas('for-legacy-pnpm', '1.0.0') @@ -111,7 +111,7 @@ test('don\'t skip optional dependency that does not support the current OS when } }) - await install(testDefaults({ + await install(await testDefaults({ force: true })) @@ -123,7 +123,7 @@ test('optional subdependency is skipped', async (t: tape.Test) => { const project = prepare(t) const reporter = sinon.spy() - await installPkgs(['pkg-with-optional', 'dep-of-optional-pkg'], testDefaults({reporter})) + await installPkgs(['pkg-with-optional', 'dep-of-optional-pkg'], await testDefaults({reporter})) const modulesInfo = await loadYamlFile<{skipped: string[]}>(path.join('node_modules', '.modules.yaml')) @@ -147,7 +147,7 @@ test('not installing optional dependencies when optional is false', async (t: ta }, }) - await install(testDefaults({optional: false})) + await install(await testDefaults({optional: false})) await project.hasNot('is-positive') await project.has('pkg-with-good-optional') @@ -166,7 +166,7 @@ test('optional dependency has bigger priority than regular dependency', async (t }, }) - await install(testDefaults()) + await install(await testDefaults()) t.ok(deepRequireCwd(['is-positive', './package.json']).version, '3.1.0') }) diff --git a/test/install/peerDependencies.ts b/test/install/peerDependencies.ts index fb918998b8..c9e33e58fc 100644 --- a/test/install/peerDependencies.ts +++ b/test/install/peerDependencies.ts @@ -15,27 +15,27 @@ import loadJsonFile = require('load-json-file') const test = promisifyTape(tape) const NM = 'node_modules' -test("don't fail when peer dependency is fetched from GitHub", t => { +test("don't fail when peer dependency is fetched from GitHub", async t => { const project = prepare(t) - return installPkgs(['test-pnpm-peer-deps'], testDefaults()) + await installPkgs(['test-pnpm-peer-deps'], await testDefaults()) }) test('peer dependency is grouped with dependency when peer is resolved not from a top dependency', async (t: tape.Test) => { const project = prepare(t) - const opts = testDefaults() + const opts = await testDefaults() await installPkgs(['using-ajv'], opts) t.ok(await exists(path.join(NM, '.localhost+4873', 'ajv-keywords', '1.5.0', 'ajv@4.10.4', NM, 'ajv')), 'peer dependency is linked') t.equal(deepRequireCwd(['using-ajv', 'ajv-keywords', 'ajv', './package.json']).version, '4.10.4') - const storeIndex = await loadJsonFile(path.join(opts.store, '2', 'store.json')) + const storeIndex = await loadJsonFile(path.join(opts.store, 'store.json')) t.ok(storeIndex['localhost+4873/ajv-keywords/1.5.0'], 'localhost+4873/ajv-keywords/1.5.0 added to store index') t.ok(storeIndex['localhost+4873/using-ajv/1.0.0'], 'localhost+4873/using-ajv/1.0.0 added to store index') // testing that peers are reinstalled correctly using info from the shrinkwrap file await rimraf('node_modules') await rimraf(path.resolve('..', '.store')) - await install(opts) + await install(await testDefaults()) t.ok(await exists(path.join(NM, '.localhost+4873', 'ajv-keywords', '1.5.0', 'ajv@4.10.4', NM, 'ajv')), 'peer dependency is linked') t.equal(deepRequireCwd(['using-ajv', 'ajv-keywords', 'ajv', './package.json']).version, '4.10.4') @@ -46,7 +46,7 @@ test('peer dependency is not grouped with dependent when the peer is a top depen const reporter = sinon.spy() - await installPkgs(['ajv@4.10.4', 'ajv-keywords@1.5.0'], testDefaults({reporter})) + await installPkgs(['ajv@4.10.4', 'ajv-keywords@1.5.0'], await testDefaults({reporter})) t.notOk(reporter.calledWithMatch({ message: 'localhost+4873/ajv-keywords/1.5.0 requires a peer of ajv@>=4.10.0 but none was installed.', @@ -60,7 +60,7 @@ test('warning is reported when cannot resolve peer dependency for top-level depe const reporter = sinon.spy() - await installPkgs(['ajv-keywords@1.5.0'], testDefaults({reporter})) + await installPkgs(['ajv-keywords@1.5.0'], await testDefaults({reporter})) const logMatcher = sinon.match({ message: 'ajv-keywords@1.5.0 requires a peer of ajv@>=4.10.0 but none was installed.', @@ -75,7 +75,7 @@ test('warning is reported when cannot resolve peer dependency for non-top-level const reporter = sinon.spy() - await installPkgs(['abc-grand-parent-without-c'], testDefaults({reporter})) + await installPkgs(['abc-grand-parent-without-c'], await testDefaults({reporter})) const logMatcher = sinon.match({ message: 'abc-grand-parent-without-c > abc-parent-with-ab: abc@1.0.0 requires a peer of peer-c@^1.0.0 but none was installed.', @@ -90,7 +90,7 @@ test('warning is reported when bad version of resolved peer dependency for non-t const reporter = sinon.spy() - await installPkgs(['abc-grand-parent-without-c', 'peer-c@2'], testDefaults({reporter})) + await installPkgs(['abc-grand-parent-without-c', 'peer-c@2'], await testDefaults({reporter})) const logMatcher = sinon.match({ message: 'abc-grand-parent-without-c > abc-parent-with-ab: abc@1.0.0 requires a peer of peer-c@^1.0.0 but version 2.0.0 was installed.', @@ -103,9 +103,9 @@ test('warning is reported when bad version of resolved peer dependency for non-t test('top peer dependency is not linked on subsequent install', async (t: tape.Test) => { const project = prepare(t) - await installPkgs(['ajv@4.10.4'], testDefaults()) + await installPkgs(['ajv@4.10.4'], await testDefaults()) - await installPkgs(['ajv-keywords@1.5.0'], testDefaults()) + await installPkgs(['ajv-keywords@1.5.0'], await testDefaults()) t.ok(await exists(path.join(NM, '.localhost+4873', 'ajv-keywords', '1.5.0', NM, 'ajv-keywords')), 'dependent is at the normal location') t.notOk(await exists(path.join(NM, '.localhost+4873', 'ajv-keywords', '1.5.0', 'ajv@4.10.4', NM, 'ajv')), 'peer dependency is not linked') @@ -119,7 +119,7 @@ async function okFile (t: tape.Test, filename: string) { test('peer dependencies are linked when running one named installation', async (t: tape.Test) => { const project = prepare(t) - await installPkgs(['abc-grand-parent-with-c', 'abc-parent-with-ab', 'peer-c@2.0.0'], testDefaults()) + await installPkgs(['abc-grand-parent-with-c', 'abc-parent-with-ab', 'peer-c@2.0.0'], await testDefaults()) const pkgVariationsDir = path.join(NM, '.localhost+4873', 'abc', '1.0.0') @@ -142,8 +142,8 @@ test('peer dependencies are linked when running one named installation', async ( test('peer dependencies are linked when running two separate named installations', async (t: tape.Test) => { const project = prepare(t) - await installPkgs(['abc-grand-parent-with-c', 'peer-c@2.0.0'], testDefaults()) - await installPkgs(['abc-parent-with-ab'], testDefaults()) + await installPkgs(['abc-grand-parent-with-c', 'peer-c@2.0.0'], await testDefaults()) + await installPkgs(['abc-parent-with-ab'], await testDefaults()) const pkgVariationsDir = path.join(NM, '.localhost+4873', 'abc', '1.0.0') @@ -174,7 +174,7 @@ test['skip']('peer dependencies are linked', async (t: tape.Test) => { 'abc-parent-with-ab': '*', }, }) - await install(testDefaults()) + await install(await testDefaults()) const pkgVariationsDir = path.join(NM, '.localhost+4873', 'abc', '1.0.0') @@ -200,7 +200,7 @@ test['skip']('peer dependencies are linked', async (t: tape.Test) => { test('scoped peer dependency is linked', async (t: tape.Test) => { const project = prepare(t) - await installPkgs(['for-testing-scoped-peers'], testDefaults()) + await installPkgs(['for-testing-scoped-peers'], await testDefaults()) const pkgVariation = path.join(NM, '.localhost+4873', '@having', 'scoped-peer', '1.0.0', '@scoped!peer@1.0.0', NM) await okFile(t, path.join(pkgVariation, '@having', 'scoped-peer')) @@ -210,7 +210,7 @@ test('scoped peer dependency is linked', async (t: tape.Test) => { test('peer bins are linked', async (t: tape.Test) => { const project = prepare(t) - await installPkgs(['for-testing-peers-having-bins'], testDefaults()) + await installPkgs(['for-testing-peers-having-bins'], await testDefaults()) const pkgVariation = path.join('.localhost+4873', 'pkg-with-peer-having-bin', '1.0.0', 'peer-with-bin@1.0.0', NM) @@ -221,7 +221,7 @@ test('peer bins are linked', async (t: tape.Test) => { test('run pre/postinstall scripts of each variations of packages with peer dependencies', async (t: tape.Test) => { const project = prepare(t) - await installPkgs(['parent-of-pkg-with-events-and-peers', 'pkg-with-events-and-peers', 'peer-c@2.0.0'], testDefaults()) + await installPkgs(['parent-of-pkg-with-events-and-peers', 'pkg-with-events-and-peers', 'peer-c@2.0.0'], await testDefaults()) const pkgVariation1 = path.join(NM, '.localhost+4873', 'pkg-with-events-and-peers', '1.0.0', 'peer-c@1.0.0', NM) await okFile(t, path.join(pkgVariation1, 'pkg-with-events-and-peers', 'generated-by-preinstall.js')) @@ -238,7 +238,7 @@ test('package that resolves its own peer dependency', async (t: tape.Test) => { // does it currently print a warning that peer dependency is not resolved? const project = prepare(t) - await installPkgs(['pkg-with-resolved-peer', 'peer-c@2.0.0'], testDefaults()) + await installPkgs(['pkg-with-resolved-peer', 'peer-c@2.0.0'], await testDefaults()) t.equal(deepRequireCwd(['pkg-with-resolved-peer', 'peer-c', './package.json']).version, '1.0.0') @@ -254,7 +254,7 @@ test('package that resolves its own peer dependency', async (t: tape.Test) => { test('own peer installed in root as well is linked to root', async function (t: tape.Test) { const project = prepare(t) - await installPkgs(['is-negative@kevva/is-negative#2.1.0', 'peer-deps-in-child-pkg'], testDefaults()) + await installPkgs(['is-negative@kevva/is-negative#2.1.0', 'peer-deps-in-child-pkg'], await testDefaults()) t.ok(deepRequireCwd.silent(['is-negative', './package.json']), 'is-negative is linked to root') }) diff --git a/test/install/reporting.ts b/test/install/reporting.ts index d7e2d550bc..522de6e58b 100644 --- a/test/install/reporting.ts +++ b/test/install/reporting.ts @@ -15,7 +15,7 @@ test('reports warning when installing deprecated packages', async (t: tape.Test) const reporter = sinon.spy() - await installPkgs(['jade@1.11.0'], testDefaults({reporter})) + await installPkgs(['jade@1.11.0'], await testDefaults({reporter})) t.ok(reporter.calledWithMatch({ name: 'pnpm:deprecation', diff --git a/test/install/shrinkwrapOnly.ts b/test/install/shrinkwrapOnly.ts index a71499c2ed..24eabfe272 100644 --- a/test/install/shrinkwrapOnly.ts +++ b/test/install/shrinkwrapOnly.ts @@ -16,7 +16,7 @@ const test = promisifyTape(tape) test('install with shrinkwrapOnly = true', async (t: tape.Test) => { const project = prepare(t) - await installPkgs(['rimraf@2.5.1'], testDefaults({shrinkwrapOnly: true})) + await installPkgs(['rimraf@2.5.1'], await testDefaults({shrinkwrapOnly: true})) await project.storeHasNot('rimraf', '2.5.1') await project.hasNot('rimraf') @@ -37,8 +37,8 @@ test('warn when installing with shrinkwrapOnly = true and node_modules exists', const project = prepare(t) const reporter = sinon.spy() - await installPkgs(['is-positive'], testDefaults()) - await installPkgs(['rimraf@2.5.1'], testDefaults({ + await installPkgs(['is-positive'], await testDefaults()) + await installPkgs(['rimraf@2.5.1'], await testDefaults({ shrinkwrapOnly: true, reporter, })) diff --git a/test/install/store.ts b/test/install/store.ts index b9c0c5e281..1b5b26eed2 100644 --- a/test/install/store.ts +++ b/test/install/store.ts @@ -11,7 +11,7 @@ const test = promisifyTape(tape) test('repeat install with corrupted `store.json` should work', async (t: tape.Test) => { const project = prepare(t) - const opts = testDefaults() + const opts = await testDefaults() await installPkgs(['is-negative@1.0.0'], opts) await rimraf('node_modules') diff --git a/test/install/update.ts b/test/install/update.ts index 7f2c08912a..8a5b676abc 100644 --- a/test/install/update.ts +++ b/test/install/update.ts @@ -18,7 +18,7 @@ test('preserve subdeps on update', async (t: tape.Test) => { addDistTag('bar', '100.0.0', 'latest'), ]) - await installPkgs(['foobarqar'], testDefaults()) + await installPkgs(['foobarqar'], await testDefaults()) await Promise.all([ addDistTag('foobarqar', '1.0.1', 'latest'), @@ -26,7 +26,7 @@ test('preserve subdeps on update', async (t: tape.Test) => { addDistTag('bar', '100.1.0', 'latest'), ]) - await install(testDefaults({update: true, depth: 0})) + await install(await testDefaults({update: true, depth: 0})) const shr = await project.loadShrinkwrap() @@ -42,9 +42,9 @@ test('preserve subdeps on update', async (t: tape.Test) => { test('update does not fail when package has only peer dependencies', async (t: tape.Test) => { prepare(t) - await installPkgs(['has-pkg-with-peer-only'], testDefaults()) + await installPkgs(['has-pkg-with-peer-only'], await testDefaults()) - await install(testDefaults({update: true, depth: Infinity})) + await install(await testDefaults({update: true, depth: Infinity})) t.pass('did not fail') }) diff --git a/test/install/updatingPkgJson.ts b/test/install/updatingPkgJson.ts index 8e3e9ec347..fd4609bf49 100644 --- a/test/install/updatingPkgJson.ts +++ b/test/install/updatingPkgJson.ts @@ -12,7 +12,7 @@ const test = promisifyTape(tape) test('save to package.json (rimraf@2.5.1)', async function (t) { const project = prepare(t) - await installPkgs(['rimraf@2.5.1'], testDefaults({ save: true })) + await installPkgs(['rimraf@2.5.1'], await testDefaults({ save: true })) const m = project.requireModule('rimraf') t.ok(typeof m === 'function', 'rimraf() is available') @@ -30,9 +30,9 @@ test("don't override existing spec in package.json on named installation", async sec: 'sindresorhus/sec', } }) - await installPkgs(['is-positive'], testDefaults()) - await installPkgs(['is-negative'], testDefaults()) - await installPkgs(['sec'], testDefaults()) + await installPkgs(['is-positive'], await testDefaults()) + await installPkgs(['is-negative'], await testDefaults()) + await installPkgs(['sec'], await testDefaults()) t.equal(project.requireModule('is-positive/package.json').version, '2.0.0') t.equal(project.requireModule('is-negative/package.json').version, '1.0.1') @@ -47,7 +47,7 @@ test("don't override existing spec in package.json on named installation", async test('saveDev scoped module to package.json (@rstacruz/tap-spec)', async function (t) { const project = prepare(t) - await installPkgs(['@rstacruz/tap-spec'], testDefaults({ saveDev: true })) + await installPkgs(['@rstacruz/tap-spec'], await testDefaults({ saveDev: true })) const m = project.requireModule('@rstacruz/tap-spec') t.ok(typeof m === 'function', 'tapSpec() is available') @@ -68,7 +68,7 @@ test('dependency should not be added to package.json if it is already there', as bar: '^100.0.0', }, }) - await installPkgs(['foo', 'bar'], testDefaults()) + await installPkgs(['foo', 'bar'], await testDefaults()) const pkgJson = await readPkg({normalize: false}) t.deepEqual(pkgJson, { @@ -103,7 +103,7 @@ test('dependencies should be updated in the fields where they already are', asyn bar: '^100.0.0', }, }) - await installPkgs(['foo@latest', 'bar@latest'], testDefaults()) + await installPkgs(['foo@latest', 'bar@latest'], await testDefaults()) const pkgJson = await readPkg({normalize: false}) t.deepEqual(pkgJson, { @@ -134,9 +134,9 @@ test('dependency should be removed from the old field when installing it as a di qar: '^100.0.0', }, }) - await installPkgs(['foo'], testDefaults({saveOptional: true})) - await installPkgs(['bar'], testDefaults({saveProd: true})) - await installPkgs(['qar'], testDefaults({saveDev: true})) + await installPkgs(['foo'], await testDefaults({saveOptional: true})) + await installPkgs(['bar'], await testDefaults({saveProd: true})) + await installPkgs(['qar'], await testDefaults({saveDev: true})) const pkgJson = await readPkg({normalize: false}) t.deepEqual(pkgJson, { @@ -156,7 +156,7 @@ test('dependency should be removed from the old field when installing it as a di test('multiple save to package.json with `exact` versions (@rstacruz/tap-spec & rimraf@2.5.1) (in sorted order)', async function (t: tape.Test) { const project = prepare(t) - await installPkgs(['rimraf@2.5.1', '@rstacruz/tap-spec@latest'], testDefaults({ save: true, saveExact: true })) + await installPkgs(['rimraf@2.5.1', '@rstacruz/tap-spec@latest'], await testDefaults({ save: true, saveExact: true })) const m1 = project.requireModule('@rstacruz/tap-spec') t.ok(typeof m1 === 'function', 'tapSpec() is available') @@ -175,7 +175,7 @@ test('multiple save to package.json with `exact` versions (@rstacruz/tap-spec & test('save to package.json with save-prefix=~', async (t: tape.Test) => { const project = prepare(t) - await installPkgs(['rimraf@2.5.1'], testDefaults({ savePrefix: '~' })) + await installPkgs(['rimraf@2.5.1'], await testDefaults({ savePrefix: '~' })) const pkgJson = await readPkg() t.deepEqual(pkgJson.dependencies, {rimraf: '~2.5.1'}, 'rimraf have been added to dependencies') diff --git a/test/link.ts b/test/link.ts index 12ac612fe3..023e833571 100644 --- a/test/link.ts +++ b/test/link.ts @@ -29,7 +29,7 @@ test('relative link', async (t: tape.Test) => { const linkedPkgPath = path.resolve('..', linkedPkgName) await ncp(pathToLocalPkg(linkedPkgName), linkedPkgPath) - await link(`../${linkedPkgName}`, process.cwd(), testDefaults()) + await link(`../${linkedPkgName}`, process.cwd(), await testDefaults()) isExecutable(t, path.resolve('node_modules', '.bin', 'hello-world-js-bin')) @@ -45,11 +45,11 @@ test('relative link is not rewritten by install', async (t: tape.Test) => { const linkedPkgPath = path.resolve('..', linkedPkgName) await ncp(pathToLocalPkg(linkedPkgName), linkedPkgPath) - await link(`../${linkedPkgName}`, process.cwd(), testDefaults()) + await link(`../${linkedPkgName}`, process.cwd(), await testDefaults()) const reporter = sinon.spy() - await installPkgs(['hello-world-js-bin'], testDefaults({reporter})) + await installPkgs(['hello-world-js-bin'], await testDefaults({reporter})) t.ok(project.requireModule('hello-world-js-bin/package.json').isLocal) @@ -77,7 +77,7 @@ test('global link', async function (t: tape.Test) { process.chdir(linkedPkgPath) const globalPrefix = path.resolve('..', 'global') const globalBin = path.resolve('..', 'global', 'bin') - await linkToGlobal(process.cwd(), Object.assign(testDefaults(), {globalPrefix, globalBin})) + await linkToGlobal(process.cwd(), await testDefaults({globalPrefix, globalBin})) isExecutable(t, path.join(globalBin, 'hello-world-js-bin')) @@ -87,7 +87,7 @@ test('global link', async function (t: tape.Test) { process.chdir(projectPath) - await linkFromGlobal(linkedPkgName, process.cwd(), Object.assign(testDefaults(), {globalPrefix})) + await linkFromGlobal(linkedPkgName, process.cwd(), await testDefaults({globalPrefix})) isExecutable(t, path.resolve('node_modules', '.bin', 'hello-world-js-bin')) }) @@ -98,7 +98,7 @@ test('failed linking should not create empty folder', async (t: tape.Test) => { const globalPrefix = path.resolve('..', 'global') try { - await linkFromGlobal('does-not-exist', process.cwd(), Object.assign(testDefaults(), {globalPrefix})) + await linkFromGlobal('does-not-exist', process.cwd(), await testDefaults({globalPrefix})) t.fail('should have failed') } catch (err) { t.notOk(await exists(path.join(globalPrefix, 'node_modules', 'does-not-exist'))) diff --git a/test/offline.ts b/test/offline.ts index f032f65cb4..9d776cd35a 100644 --- a/test/offline.ts +++ b/test/offline.ts @@ -13,7 +13,7 @@ test('offline installation fails when package meta not found in local registry m const project = prepare(t) try { - await installPkgs(['is-positive@3.0.0'], testDefaults({offline: true})) + await installPkgs(['is-positive@3.0.0'], await testDefaults({}, {offline: true}, {offline: true})) t.fail('installation should have failed') } catch (err) { t.equal(err.code, 'NO_OFFLINE_META', 'failed with correct error code') @@ -23,12 +23,12 @@ test('offline installation fails when package meta not found in local registry m test('offline installation fails when package tarball not found in local registry mirror', async function (t) { const project = prepare(t) - await installPkgs(['is-positive@3.0.0'], testDefaults()) + await installPkgs(['is-positive@3.0.0'], await testDefaults()) await rimraf('node_modules') try { - await installPkgs(['is-positive@3.1.0'], testDefaults({offline: true})) + await installPkgs(['is-positive@3.1.0'], await testDefaults({}, {offline: true}, {offline: true})) t.fail('installation should have failed') } catch (err) { t.equal(err.code, 'NO_OFFLINE_TARBALL', 'failed with correct error code') @@ -38,11 +38,11 @@ test('offline installation fails when package tarball not found in local registr test('successful offline installation', async function (t) { const project = prepare(t) - await installPkgs(['is-positive@3.0.0'], testDefaults({save: true})) + await installPkgs(['is-positive@3.0.0'], await testDefaults({save: true})) await rimraf('node_modules') - await install(testDefaults({offline: true})) + await install(await testDefaults({}, {offline: true}, {offline: true})) const m = project.requireModule('is-positive') t.ok(typeof m === 'function', 'module is available') diff --git a/test/packageImportMethods.ts b/test/packageImportMethods.ts index dfbb9c7b11..b28dd6ed24 100644 --- a/test/packageImportMethods.ts +++ b/test/packageImportMethods.ts @@ -3,7 +3,11 @@ import tape = require('tape') import promisifyTape from 'tape-promise' import writeYamlFile = require('write-yaml-file') import exists = require('path-exists') -import {prepare, testDefaults, addDistTag} from './utils' +import { + prepare, + testDefaults, + addDistTag, +} from './utils' import { installPkgs, install, @@ -21,7 +25,7 @@ const test = promisifyTape(tape) test('packageImportMethod can be set to copy', async (t: tape.Test) => { const project = prepare(t) - await installPkgs(['is-negative'], testDefaults({packageImportMethod: 'copy'})) + await installPkgs(['is-negative'], await testDefaults({packageImportMethod: 'copy'})) const m = project.requireModule('is-negative') t.ok(m, 'is-negative is available with packageImportMethod = copy') diff --git a/test/prune.ts b/test/prune.ts index f7d828135f..731d852af6 100644 --- a/test/prune.ts +++ b/test/prune.ts @@ -12,10 +12,10 @@ import writePkg = require('write-pkg') test('prune removes extraneous packages', async (t: tape.Test) => { const project = prepare(t) - await installPkgs(['is-negative@2.1.0'], testDefaults({save: true})) - await installPkgs(['applyq@0.2.1'], testDefaults({saveDev: true})) - await installPkgs(['fnumber@0.1.0'], testDefaults({saveOptional: true})) - await installPkgs(['is-positive@2.0.0', '@zkochan/logger@0.1.0'], testDefaults()) + await installPkgs(['is-negative@2.1.0'], await testDefaults({save: true})) + await installPkgs(['applyq@0.2.1'], await testDefaults({saveDev: true})) + await installPkgs(['fnumber@0.1.0'], await testDefaults({saveOptional: true})) + await installPkgs(['is-positive@2.0.0', '@zkochan/logger@0.1.0'], await testDefaults()) const pkg = await readPkg() @@ -24,7 +24,7 @@ test('prune removes extraneous packages', async (t: tape.Test) => { await writePkg(pkg) - await prune(testDefaults()) + await prune(await testDefaults()) await project.storeHasNot('is-positive', '2.0.0') await project.hasNot('is-positive') @@ -45,10 +45,10 @@ test('prune removes extraneous packages', async (t: tape.Test) => { test('prune removes dev dependencies in production', async (t: tape.Test) => { const project = prepare(t) - await installPkgs(['is-positive@2.0.0'], testDefaults({saveDev: true})) - await installPkgs(['is-negative@2.1.0'], testDefaults({save: true})) - await installPkgs(['fnumber@0.1.0'], testDefaults({saveOptional: true})) - await prune(testDefaults({ + await installPkgs(['is-positive@2.0.0'], await testDefaults({saveDev: true})) + await installPkgs(['is-negative@2.1.0'], await testDefaults({save: true})) + await installPkgs(['fnumber@0.1.0'], await testDefaults({saveOptional: true})) + await prune(await testDefaults({ production: true, development: false, })) diff --git a/test/rebuild.ts b/test/rebuild.ts index 835c0c94c6..9a925395ec 100644 --- a/test/rebuild.ts +++ b/test/rebuild.ts @@ -16,9 +16,9 @@ const test = promisifyTape(tape) test('rebuilds dependencies', async function (t: tape.Test) { const project = prepare(t) - await installPkgs(['pre-and-postinstall-scripts-example', 'zkochan/install-scripts-example'], testDefaults({saveDev: true, ignoreScripts: true})) + await installPkgs(['pre-and-postinstall-scripts-example', 'zkochan/install-scripts-example'], await testDefaults({saveDev: true, ignoreScripts: true})) - await rebuild(testDefaults()) + await rebuild(await testDefaults()) { const generatedByPreinstall = project.requireModule('pre-and-postinstall-scripts-example/generated-by-preinstall') @@ -39,9 +39,9 @@ test('rebuilds dependencies', async function (t: tape.Test) { test('rebuilds specific dependencies', async function (t: tape.Test) { const project = prepare(t) - await installPkgs(['pre-and-postinstall-scripts-example', 'zkochan/install-scripts-example'], testDefaults({saveDev: true, ignoreScripts: true})) + await installPkgs(['pre-and-postinstall-scripts-example', 'zkochan/install-scripts-example'], await testDefaults({saveDev: true, ignoreScripts: true})) - await rebuildPkgs(['install-scripts-example-for-pnpm'], testDefaults()) + await rebuildPkgs(['install-scripts-example-for-pnpm'], await testDefaults()) await project.hasNot('pre-and-postinstall-scripts-example/generated-by-preinstall') await project.hasNot('pre-and-postinstall-scripts-example/generated-by-postinstall') @@ -55,8 +55,8 @@ test('rebuilds specific dependencies', async function (t: tape.Test) { test('rebuild with pending option', async function (t: tape.Test) { const project = prepare(t) - await installPkgs(['pre-and-postinstall-scripts-example'], testDefaults({ignoreScripts: true})) - await installPkgs(['zkochan/install-scripts-example'], testDefaults({ignoreScripts: true})) + await installPkgs(['pre-and-postinstall-scripts-example'], await testDefaults({ignoreScripts: true})) + await installPkgs(['zkochan/install-scripts-example'], await testDefaults({ignoreScripts: true})) let modules = await project.loadModules() t.doesNotEqual(modules['pendingBuilds'].length, 0) @@ -67,7 +67,7 @@ test('rebuild with pending option', async function (t: tape.Test) { await project.hasNot('install-scripts-example-for-pnpm/generated-by-preinstall') await project.hasNot('install-scripts-example-for-pnpm/generated-by-postinstall') - await rebuild(testDefaults({rawNpmConfig: {'pending': true}})) + await rebuild(await testDefaults({rawNpmConfig: {'pending': true}})) modules = await project.loadModules() t.equal(modules['pendingBuilds'].length, 0) diff --git a/test/shrinkwrap.ts b/test/shrinkwrap.ts index ce3dbdf29d..20f6f8e524 100644 --- a/test/shrinkwrap.ts +++ b/test/shrinkwrap.ts @@ -3,7 +3,11 @@ import tape = require('tape') import promisifyTape from 'tape-promise' import writeYamlFile = require('write-yaml-file') import exists = require('path-exists') -import {prepare, testDefaults, addDistTag} from './utils' +import { + prepare, + testDefaults, + addDistTag, +} from './utils' import { installPkgs, install, @@ -21,7 +25,7 @@ const test = promisifyTape(tape) test('shrinkwrap file has correct format', async (t: tape.Test) => { const project = prepare(t) - await installPkgs(['pkg-with-1-dep', '@rstacruz/tap-spec@4.1.1', 'kevva/is-negative#1d7e288222b53a0cab90a331f1865220ec29560c'], testDefaults({save: true})) + await installPkgs(['pkg-with-1-dep', '@rstacruz/tap-spec@4.1.1', 'kevva/is-negative#1d7e288222b53a0cab90a331f1865220ec29560c'], await testDefaults({save: true})) const modules = await project.loadModules() t.equal(modules['pendingBuilds'].length, 0) @@ -59,7 +63,7 @@ test('shrinkwrap file has dev deps even when installing for prod only', async (t }, }) - await install(testDefaults({production: true})) + await install(await testDefaults({production: true})) const shr = await project.loadShrinkwrap() const id = '/is-negative/2.1.0' @@ -93,7 +97,7 @@ test('shrinkwrap with scoped package', async t => { version: 3, }) - await install(testDefaults()) + await install(await testDefaults()) }) test('fail when shasum from shrinkwrap does not match with the actual one', async (t: tape.Test) => { @@ -120,7 +124,7 @@ test('fail when shasum from shrinkwrap does not match with the actual one', asyn }) try { - await install(testDefaults()) + await install(await testDefaults()) t.fail('installation should have failed') } catch (err) { t.equal(err.code, 'EINTEGRITY') @@ -131,10 +135,10 @@ test("shrinkwrap doesn't lock subdependencies that don't satisfy the new specs", const project = prepare(t) // dependends on react-onclickoutside@5.9.0 - await installPkgs(['react-datetime@2.8.8'], testDefaults({save: true})) + await installPkgs(['react-datetime@2.8.8'], await testDefaults({save: true})) // dependends on react-onclickoutside@0.3.4 - await installPkgs(['react-datetime@1.3.0'], testDefaults({save: true})) + await installPkgs(['react-datetime@1.3.0'], await testDefaults({save: true})) t.equal( project.requireModule('.localhost+4873/react-datetime/1.3.0/node_modules/react-onclickoutside/package.json').version, @@ -149,7 +153,7 @@ test("shrinkwrap doesn't lock subdependencies that don't satisfy the new specs", test('shrinkwrap not created when no deps in package.json', async (t: tape.Test) => { const project = prepare(t) - await install(testDefaults()) + await install(await testDefaults()) t.notOk(await project.loadShrinkwrap(), 'shrinkwrap file not created') t.notOk(await exists('node_modules'), 'empty node_modules not created') @@ -173,7 +177,7 @@ test('shrinkwrap removed when no deps in package.json', async t => { }, }) - await install(testDefaults()) + await install(await testDefaults()) t.notOk(await project.loadShrinkwrap(), 'shrinkwrap file removed') }) @@ -221,7 +225,7 @@ test('shrinkwrap is fixed when it does not match package.json', async (t: tape.T }) const reporter = sinon.spy() - await install(testDefaults({reporter})) + await install(await testDefaults({reporter})) const progress = sinon.match({ name: 'pnpm:progress', @@ -278,8 +282,8 @@ test('doing named installation when shrinkwrap.yaml exists already', async (t: t } }) - await installPkgs(['is-positive'], testDefaults()) - await install(testDefaults()) + await installPkgs(['is-positive'], await testDefaults()) + await install(await testDefaults()) await project.has('is-negative') }) @@ -298,11 +302,11 @@ test('respects shrinkwrap.yaml for top dependencies', async (t: tape.Test) => { const pkgs = ['foo', 'bar', 'qar'] await Promise.all(pkgs.map(pkgName => addDistTag(pkgName, '100.0.0', 'latest'))) - await installPkgs(['foo'], testDefaults({save: true, reporter})) + await installPkgs(['foo'], await testDefaults({save: true, reporter})) // t.equal(reporter.withArgs(fooProgress).callCount, 1, 'reported foo once') - await installPkgs(['bar'], testDefaults({saveOptional: true})) - await installPkgs(['qar'], testDefaults({saveDev: true})) - await installPkgs(['foobar'], testDefaults({save: true})) + await installPkgs(['bar'], await testDefaults({saveOptional: true})) + await installPkgs(['qar'], await testDefaults({saveDev: true})) + await installPkgs(['foobar'], await testDefaults({save: true})) t.equal((await loadJsonFile(path.resolve('node_modules', 'foo', 'package.json'))).version, '100.0.0') t.equal((await loadJsonFile(path.resolve('node_modules', 'bar', 'package.json'))).version, '100.0.0') @@ -319,7 +323,7 @@ test('respects shrinkwrap.yaml for top dependencies', async (t: tape.Test) => { // shouldn't care about what the registry in npmrc is // the one in shrinkwrap should be used - await install(testDefaults({ + await install(await testDefaults({ registry: 'https://registry.npmjs.org', rawNpmConfig: { registry: 'https://registry.npmjs.org', @@ -342,7 +346,7 @@ test('subdeps are updated on repeat install if outer shrinkwrap.yaml does not ma await addDistTag('dep-of-pkg-with-1-dep', '100.0.0', 'latest') - await installPkgs(['pkg-with-1-dep'], testDefaults()) + await installPkgs(['pkg-with-1-dep'], await testDefaults()) await project.storeHas('dep-of-pkg-with-1-dep', '100.0.0') @@ -362,7 +366,7 @@ test('subdeps are updated on repeat install if outer shrinkwrap.yaml does not ma await writeYamlFile('shrinkwrap.yaml', shr) - await install(testDefaults()) + await install(await testDefaults()) await project.storeHas('dep-of-pkg-with-1-dep', '100.1.0') }) @@ -370,9 +374,9 @@ test('subdeps are updated on repeat install if outer shrinkwrap.yaml does not ma test("recreates shrinkwrap file if it doesn't match the dependencies in package.json", async (t: tape.Test) => { const project = prepare(t) - await installPkgs(['is-negative@1.0.0'], testDefaults({saveExact: true, saveProd: true})) - await installPkgs(['is-positive@1.0.0'], testDefaults({saveExact: true, saveDev: true})) - await installPkgs(['map-obj@1.0.0'], testDefaults({saveExact: true, saveOptional: true})) + await installPkgs(['is-negative@1.0.0'], await testDefaults({saveExact: true, saveProd: true})) + await installPkgs(['is-positive@1.0.0'], await testDefaults({saveExact: true, saveDev: true})) + await installPkgs(['map-obj@1.0.0'], await testDefaults({saveExact: true, saveOptional: true})) const shr1 = await project.loadShrinkwrap() t.equal(shr1.dependencies['is-negative'], '1.0.0') @@ -386,7 +390,7 @@ test("recreates shrinkwrap file if it doesn't match the dependencies in package. await writePkg(pkg) - await install(testDefaults()) + await install(await testDefaults()) const shr = await project.loadShrinkwrap() @@ -403,7 +407,7 @@ test("recreates shrinkwrap file if it doesn't match the dependencies in package. test('repeat install with shrinkwrap should not mutate shrinkwrap when dependency has version specified with v prefix', async (t: tape.Test) => { const project = prepare(t) - await installPkgs(['highmaps-release@5.0.11'], testDefaults()) + await installPkgs(['highmaps-release@5.0.11'], await testDefaults()) const shr1 = await project.loadShrinkwrap() @@ -411,7 +415,7 @@ test('repeat install with shrinkwrap should not mutate shrinkwrap when dependenc await rimraf('node_modules') - await install(testDefaults()) + await install(await testDefaults()) const shr2 = await project.loadShrinkwrap() @@ -423,11 +427,11 @@ test('package is not marked dev if it is also a subdep of a regular dependency', await addDistTag('dep-of-pkg-with-1-dep', '100.0.0', 'latest') - await installPkgs(['pkg-with-1-dep'], testDefaults()) + await installPkgs(['pkg-with-1-dep'], await testDefaults()) t.pass('installed pkg-with-1-dep') - await installPkgs(['dep-of-pkg-with-1-dep'], testDefaults({saveDev: true})) + await installPkgs(['dep-of-pkg-with-1-dep'], await testDefaults({saveDev: true})) t.pass('installed optional dependency which is also a dependency of pkg-with-1-dep') @@ -441,8 +445,8 @@ test('package is not marked optional if it is also a subdep of a regular depende await addDistTag('dep-of-pkg-with-1-dep', '100.0.0', 'latest') - await installPkgs(['pkg-with-1-dep'], testDefaults()) - await installPkgs(['dep-of-pkg-with-1-dep'], testDefaults({saveOptional: true})) + await installPkgs(['pkg-with-1-dep'], await testDefaults()) + await installPkgs(['dep-of-pkg-with-1-dep'], await testDefaults({saveOptional: true})) const shr = await project.loadShrinkwrap() @@ -451,7 +455,7 @@ test('package is not marked optional if it is also a subdep of a regular depende test('scoped module from different registry', async function (t: tape.Test) { const project = prepare(t) - await installPkgs(['@zkochan/foo', 'is-positive'], testDefaults({ + await installPkgs(['@zkochan/foo', 'is-positive'], await testDefaults({ rawNpmConfig: { '@zkochan:registry': 'https://registry.npmjs.org/' } @@ -501,11 +505,11 @@ test('scoped module from different registry', async function (t: tape.Test) { test('repeat install with no inner shrinkwrap should not rewrite packages in node_modules', async (t: tape.Test) => { const project = prepare(t) - await installPkgs(['is-negative@1.0.0'], testDefaults()) + await installPkgs(['is-negative@1.0.0'], await testDefaults()) await rimraf('node_modules/.shrinkwrap.yaml') - await install(testDefaults()) + await install(await testDefaults()) const m = project.requireModule('is-negative') t.ok(m) @@ -516,7 +520,7 @@ test('repeat install with no inner shrinkwrap should not rewrite packages in nod test['skip']('installing from shrinkwrap when using npm enterprise', async (t: tape.Test) => { const project = prepare(t) - const opts = testDefaults({registry: 'https://npm-registry.compass.com/'}) + const opts = await testDefaults({registry: 'https://npm-registry.compass.com/'}) await installPkgs(['is-positive@3.1.0'], opts) @@ -565,7 +569,7 @@ test('packages are placed in devDependencies even if they are present as non-dev await addDistTag('dep-of-pkg-with-1-dep', '1.1.0', 'latest') const reporter = sinon.spy() - await install(testDefaults({reporter})) + await install(await testDefaults({reporter})) const shr = await project.loadShrinkwrap() @@ -597,8 +601,8 @@ test('packages are placed in devDependencies even if they are present as non-dev test('updating package that has a github-hosted dependency', async (t: tape.Test) => { const project = prepare(t) - await installPkgs(['has-github-dep@1'], testDefaults()) - await installPkgs(['has-github-dep@latest'], testDefaults()) + await installPkgs(['has-github-dep@1'], await testDefaults()) + await installPkgs(['has-github-dep@latest'], await testDefaults()) t.pass('installation of latest did not fail') }) @@ -606,8 +610,8 @@ test('updating package that has a github-hosted dependency', async (t: tape.Test test('updating package that has deps with peers', async (t: tape.Test) => { const project = prepare(t) - await installPkgs(['abc-grand-parent-with-c@0'], testDefaults()) - await installPkgs(['abc-grand-parent-with-c@1'], testDefaults()) + await installPkgs(['abc-grand-parent-with-c@0'], await testDefaults()) + await installPkgs(['abc-grand-parent-with-c@1'], await testDefaults()) t.pass('installation of latest did not fail') }) @@ -666,7 +670,7 @@ test('updating shrinkwrap version 3 to 3.1', async (t: tape.Test) => { await fs.writeFile('shrinkwrap.yaml', shrV3Content, 'utf8') - await install(testDefaults()) + await install(await testDefaults()) const shr = await project.loadShrinkwrap() @@ -682,14 +686,14 @@ test('pendingBuilds gets updated if install removes packages', async (t: tape.Te }, }) - await install(testDefaults({ ignoreScripts: true })) + await install(await testDefaults({ ignoreScripts: true })) const modules1 = await project.loadModules() await project.rewriteDependencies({ 'is-negative': '2.1.0', }) - await install(testDefaults({ ignoreScripts: true })) + await install(await testDefaults({ ignoreScripts: true })) const modules2 = await project.loadModules() t.ok(modules1['pendingBuilds'].length > modules2['pendingBuilds'].length, 'pendingBuilds gets updated when install removes packages') diff --git a/test/storePrune.ts b/test/storePrune.ts index c5248c942c..50fa3b4653 100644 --- a/test/storePrune.ts +++ b/test/storePrune.ts @@ -17,13 +17,13 @@ const test = promisifyTape(tape) test('remove unreferenced packages', async (t: tape.Test) => { const project = prepare(t) - await installPkgs(['is-negative@2.1.0'], testDefaults({ save: true })) - await uninstall(['is-negative'], testDefaults({ save: true })) + await installPkgs(['is-negative@2.1.0'], await testDefaults({ save: true })) + await uninstall(['is-negative'], await testDefaults({ save: true })) await project.storeHas('is-negative', '2.1.0') const reporter = sinon.spy() - await storePrune(testDefaults({reporter})) + await storePrune(await testDefaults({reporter})) t.ok(reporter.calledWithMatch({ level: 'info', @@ -33,7 +33,7 @@ test('remove unreferenced packages', async (t: tape.Test) => { await project.storeHasNot('is-negative', '2.1.0') reporter.reset() - await storePrune(testDefaults({reporter})) + await storePrune(await testDefaults({reporter})) t.notOk(reporter.calledWithMatch({ level: 'info', @@ -44,7 +44,7 @@ test('remove unreferenced packages', async (t: tape.Test) => { test('remove packages that are used by project that no longer exist', async (t: tape.Test) => { const project = prepare(t) - await installPkgs(['is-negative@2.1.0'], testDefaults({ save: true })) + await installPkgs(['is-negative@2.1.0'], await testDefaults({ save: true })) const pkgInStore = await project.resolve('is-negative', '2.1.0') @@ -53,7 +53,7 @@ test('remove packages that are used by project that no longer exist', async (t: t.ok(await exists(pkgInStore)) const reporter = sinon.spy() - await storePrune(testDefaults({reporter})) + await storePrune(await testDefaults({reporter})) t.ok(reporter.calledWithMatch({ level: 'info', @@ -65,9 +65,9 @@ test('remove packages that are used by project that no longer exist', async (t: test('keep dependencies used by others', async function (t: tape.Test) { const project = prepare(t) - await installPkgs(['camelcase-keys@3.0.0'], testDefaults({ save: true })) - await installPkgs(['hastscript@3.0.0'], testDefaults({ saveDev: true })) - await uninstall(['camelcase-keys'], testDefaults({ save: true })) + await installPkgs(['camelcase-keys@3.0.0'], await testDefaults({ save: true })) + await installPkgs(['hastscript@3.0.0'], await testDefaults({ saveDev: true })) + await uninstall(['camelcase-keys'], await testDefaults({ save: true })) await project.storeHas('camelcase-keys', '3.0.0') await project.hasNot('camelcase-keys') @@ -86,7 +86,7 @@ test('keep dependencies used by others', async function (t: tape.Test) { R.toPairs(shr.packages).forEach(pair => t.ok(pair[1]['dev'], `${pair[0]} is dev`)) - await storePrune(testDefaults()) + await storePrune(await testDefaults()) await project.storeHasNot('camelcase-keys', '3.0.0') await project.storeHasNot('map-obj', '1.0.1') @@ -95,10 +95,10 @@ test('keep dependencies used by others', async function (t: tape.Test) { test('keep dependency used by package', async (t: tape.Test) => { const project = prepare(t) - await installPkgs(['is-not-positive@1.0.0', 'is-positive@3.1.0'], testDefaults({ save: true })) - await uninstall(['is-not-positive'], testDefaults({ save: true })) + await installPkgs(['is-not-positive@1.0.0', 'is-positive@3.1.0'], await testDefaults({ save: true })) + await uninstall(['is-not-positive'], await testDefaults({ save: true })) - await storePrune(testDefaults()) + await storePrune(await testDefaults()) await project.storeHas('is-positive', '3.1.0') }) diff --git a/test/storeStatus.ts b/test/storeStatus.ts index 472a299858..f45fffce94 100644 --- a/test/storeStatus.ts +++ b/test/storeStatus.ts @@ -9,7 +9,7 @@ const test = promisifyTape(tape) test('store status returns empty array when store was not modified', async function (t: tape.Test) { const project = prepare(t) - const opts = testDefaults() + const opts = await testDefaults() await installPkgs(['is-positive@3.1.0'], opts) const mutatedPkgs = await storeStatus(opts) @@ -20,7 +20,7 @@ test('store status returns empty array when store was not modified', async funct test('store status does not fail on not installed optional dependencies', async function (t: tape.Test) { const project = prepare(t) - const opts = testDefaults({saveOptional: true}) + const opts = await testDefaults({saveOptional: true}) await installPkgs(['not-compatible-with-any-os'], opts) const mutatedPkgs = await storeStatus(opts) @@ -31,7 +31,7 @@ test('store status does not fail on not installed optional dependencies', async test('store status returns path to the modified package', async function (t: tape.Test) { const project = prepare(t) - const opts = testDefaults() + const opts = await testDefaults() await installPkgs(['is-positive@3.1.0'], opts) const isPositive = await project.resolve('is-positive', '3.1.0', 'index.js') diff --git a/test/uninstall.ts b/test/uninstall.ts index 863576fbc5..18da1c1a2b 100644 --- a/test/uninstall.ts +++ b/test/uninstall.ts @@ -30,8 +30,8 @@ test('uninstall package with no dependencies', async (t: tape.Test) => { const project = prepare(t) const reporter = sinon.spy() - await installPkgs(['is-negative@2.1.0'], testDefaults({ save: true })) - await uninstall(['is-negative'], testDefaults({ save: true, reporter })) + await installPkgs(['is-negative@2.1.0'], await testDefaults({ save: true })) + await uninstall(['is-negative'], await testDefaults({ save: true, reporter })) t.ok(reporter.calledWithMatch({ name: 'pnpm:stats', @@ -60,8 +60,8 @@ test('uninstall package with no dependencies', async (t: tape.Test) => { test('uninstall scoped package', async function (t) { const project = prepare(t) - await installPkgs(['@zkochan/logger@0.1.0'], testDefaults({ save: true })) - await uninstall(['@zkochan/logger'], testDefaults({ save: true })) + await installPkgs(['@zkochan/logger@0.1.0'], await testDefaults({ save: true })) + await uninstall(['@zkochan/logger'], await testDefaults({ save: true })) await project.storeHas('@zkochan/logger', '0.1.0') @@ -73,8 +73,8 @@ test('uninstall scoped package', async function (t) { test('uninstall tarball dependency', async (t: tape.Test) => { const project = prepare(t) - await installPkgs(['http://registry.npmjs.org/is-array/-/is-array-1.0.1.tgz'], testDefaults({ save: true })) - await uninstall(['is-array'], testDefaults({ save: true })) + await installPkgs(['http://registry.npmjs.org/is-array/-/is-array-1.0.1.tgz'], await testDefaults({ save: true })) + await uninstall(['is-array'], await testDefaults({ save: true })) t.ok(await exists(path.join(await project.getStorePath(), 'registry.npmjs.org', 'is-array', '1.0.1'))) @@ -86,10 +86,10 @@ test('uninstall tarball dependency', async (t: tape.Test) => { test('uninstall package with dependencies and do not touch other deps', async function (t) { const project = prepare(t) - await installPkgs(['is-negative@2.1.0', 'camelcase-keys@3.0.0'], testDefaults({ save: true })) - await uninstall(['camelcase-keys'], testDefaults({ save: true })) + await installPkgs(['is-negative@2.1.0', 'camelcase-keys@3.0.0'], await testDefaults({ save: true })) + await uninstall(['camelcase-keys'], await testDefaults({ save: true })) - await storePrune(testDefaults()) + await storePrune(await testDefaults()) await project.storeHasNot('camelcase-keys', '3.0.0') await project.hasNot('camelcase-keys') @@ -117,8 +117,8 @@ test('uninstall package with dependencies and do not touch other deps', async fu test('uninstall package with its bin files', async function (t) { prepare(t) - await installPkgs(['sh-hello-world@1.0.1'], testDefaults({ save: true })) - await uninstall(['sh-hello-world'], testDefaults({ save: true })) + await installPkgs(['sh-hello-world@1.0.1'], await testDefaults({ save: true })) + await uninstall(['sh-hello-world'], await testDefaults({ save: true })) // check for both a symlink and a file because in some cases the file will be a proxied not symlinked let stat = await existsSymlink(path.resolve('node_modules', '.bin', 'sh-hello-world')) @@ -135,8 +135,8 @@ test('relative link is uninstalled', async (t: tape.Test) => { const linkedPkgPath = path.resolve('..', linkedPkgName) await ncp(pathToLocalPkg(linkedPkgName), linkedPkgPath) - await link(`../${linkedPkgName}`, process.cwd(), testDefaults()) - await uninstall([linkedPkgName], testDefaults()) + await link(`../${linkedPkgName}`, process.cwd(), await testDefaults()) + await uninstall([linkedPkgName], await testDefaults()) await project.hasNot(linkedPkgName) }) @@ -144,12 +144,12 @@ test('relative link is uninstalled', async (t: tape.Test) => { test('pendingBuilds gets updated after uninstall', async (t: tape.Test) => { const project = prepare(t) - await installPkgs(['is-negative@2.1.0', 'sh-hello-world@1.0.1'], testDefaults({save: true, ignoreScripts: true})) + await installPkgs(['is-negative@2.1.0', 'sh-hello-world@1.0.1'], await testDefaults({save: true, ignoreScripts: true})) const modules1 = await project.loadModules() t.doesNotEqual(modules1['pendingBuilds'].length, 0, 'installPkgs should update pendingBuilds') - await uninstall(['sh-hello-world'], testDefaults({save: true})) + await uninstall(['sh-hello-world'], await testDefaults({save: true})) const modules2 = await project.loadModules() t.doesNotEqual(modules2['pendingBuilds'].length, 0, 'uninstall should not remove all the pendingBuilds') diff --git a/test/unlink.ts b/test/unlink.ts index 387a91a9c7..e7833c0e13 100644 --- a/test/unlink.ts +++ b/test/unlink.ts @@ -43,11 +43,11 @@ test('unlink 1 package that exists in package.json', async (t: tape.Test) => { }), ]) - await link('is-subdir', 'project') - await link('is-positive', 'project') + await link('is-subdir', 'project', await testDefaults()) + await link('is-positive', 'project', await testDefaults()) process.chdir('project') - await unlinkPkgs(['is-subdir'], testDefaults()) + await unlinkPkgs(['is-subdir'], await testDefaults()) t.equal(typeof project.requireModule('is-subdir'), 'function', 'is-subdir installed after unlinked') t.notOk((await isInnerLink('node_modules', 'is-positive')).isInner, 'is-positive left linked') @@ -57,7 +57,7 @@ test("don't update package when unlinking", async (t: tape.Test) => { const project = prepare(t) await addDistTag('foo', '100.0.0', 'latest') - await installPkgs(['foo'], testDefaults()) + await installPkgs(['foo'], await testDefaults()) process.chdir('..') @@ -66,11 +66,11 @@ test("don't update package when unlinking", async (t: tape.Test) => { version: '100.0.0', }) - await link('foo', 'project') + await link('foo', 'project', await testDefaults()) await addDistTag('foo', '100.1.0', 'latest') process.chdir('project') - await unlinkPkgs(['foo'], testDefaults()) + await unlinkPkgs(['foo'], await testDefaults()) t.equal(project.requireModule('foo/package.json').version, '100.0.0', 'foo not updated after unlink') }) @@ -97,11 +97,11 @@ test('unlink 2 packages. One of them exists in package.json', async (t: tape.Tes }), ]) - await link('is-subdir', 'project') - await link('is-positive', 'project') + await link('is-subdir', 'project', await testDefaults()) + await link('is-positive', 'project', await testDefaults()) process.chdir('project') - await unlinkPkgs(['is-subdir', 'is-positive'], testDefaults()) + await unlinkPkgs(['is-subdir', 'is-positive'], await testDefaults()) t.equal(typeof project.requireModule('is-subdir'), 'function', 'is-subdir installed after unlinked') t.notOk(await exists(path.join('node_modules', 'is-positive')), 'is-positive removed as it is not in package.json') @@ -130,11 +130,11 @@ test('unlink all packages', async (t: tape.Test) => { }), ]) - await link('is-subdir', 'project') - await link('logger', 'project') + await link('is-subdir', 'project', await testDefaults()) + await link('logger', 'project', await testDefaults()) process.chdir('project') - await unlink(testDefaults()) + await unlink(await testDefaults()) t.equal(typeof project.requireModule('is-subdir'), 'function', 'is-subdir installed after unlinked') t.equal(typeof project.requireModule('@zkochan/logger'), 'object', '@zkochan/logger installed after unlinked') @@ -143,10 +143,10 @@ test('unlink all packages', async (t: tape.Test) => { test("don't warn about scoped packages when running unlink w/o params", async (t: tape.Test) => { const project = prepare(t) - await installPkgs(['@zkochan/logger'], testDefaults()) + await installPkgs(['@zkochan/logger'], await testDefaults()) const reporter = sinon.spy() - await unlink(testDefaults({reporter})) + await unlink(await testDefaults({reporter})) t.notOk(reporter.calledWithMatch({ level: 'warn', @@ -159,9 +159,9 @@ test("don't unlink package that is not a link", async (t: tape.Test) => { const reporter = sinon.spy() - await installPkgs(['is-positive'], testDefaults()) + await installPkgs(['is-positive'], await testDefaults()) - await unlinkPkgs(['is-positive'], testDefaults({reporter})) + await unlinkPkgs(['is-positive'], await testDefaults({reporter})) t.ok(reporter.calledWithMatch({ level: 'warn', @@ -174,9 +174,9 @@ test("don't unlink package that is not a link when independent-leaves = true", a const reporter = sinon.spy() - await installPkgs(['is-positive'], testDefaults({independentLeaves: true})) + await installPkgs(['is-positive'], await testDefaults({independentLeaves: true})) - await unlinkPkgs(['is-positive'], testDefaults({independentLeaves: true, reporter})) + await unlinkPkgs(['is-positive'], await testDefaults({independentLeaves: true, reporter})) t.ok(reporter.calledWithMatch({ level: 'warn', diff --git a/test/utils/prepare.ts b/test/utils/prepare.ts index e93f56b216..f59bbc7d16 100644 --- a/test/utils/prepare.ts +++ b/test/utils/prepare.ts @@ -59,11 +59,13 @@ export default function prepare (t: Test, pkg?: Object) { return path.join(await project.getStorePath(), pkgFolder, 'package') }, storeHas: async function (pkgName: string, version?: string) { - t.ok(await exists(await project.resolve(pkgName, version)), `${pkgName}@${version} is in store`) + const pathToCheck = await project.resolve(pkgName, version) + t.ok(await exists(pathToCheck), `${pkgName}@${version} is in store (at ${pathToCheck})`) }, storeHasNot: async function (pkgName: string, version?: string) { try { - t.notOk(await exists(await project.resolve(pkgName, version)), `${pkgName}@${version} is not in store`) + const pathToCheck = await project.resolve(pkgName, version) + t.notOk(await exists(pathToCheck), `${pkgName}@${version} is not in store (at ${pathToCheck})`) } catch (err) { if (err.message === 'Cannot find module store') { t.pass(`${pkgName}@${version} is not in store`) diff --git a/test/utils/testDefaults.ts b/test/utils/testDefaults.ts index 6e61e8a39b..dad7f5e449 100644 --- a/test/utils/testDefaults.ts +++ b/test/utils/testDefaults.ts @@ -1,9 +1,41 @@ -import {PnpmOptions} from 'supi' +import {InstallOptions} from 'supi' import path = require('path') +import createStore, {resolveStore} from 'package-store' +import createFetcher from '@pnpm/default-fetcher' +import createResolver from '@pnpm/default-resolver' -export default function testDefaults (opts?: PnpmOptions): PnpmOptions & {store: string} { +const registry = 'http://localhost:4873/' + +export default async function testDefaults ( + opts?: any, + resolveOpts?: any, + fetchOpts?: any, +): Promise { + let store = opts && opts.store || path.resolve('..', '.store') + store = await resolveStore(store, opts && opts.prefix || process.cwd()) + const rawNpmConfig = {registry} + const storeController = await createStore( + createResolver({ + metaCache: new Map(), + rawNpmConfig, + store, + strictSsl: true, + ...resolveOpts, + }), + createFetcher({ + alwaysAuth: true, + registry, + rawNpmConfig, + ...fetchOpts, + }) as {}, + { + store, + locks: path.join(store, '_locks'), + } + ) return Object.assign({ - store: path.resolve('..', '.store'), - registry: 'http://localhost:4873/', + store, + storeController, + registry, }, opts) }