diff --git a/__tests__/__snapshots__/fetchers.js.snap b/__tests__/__snapshots__/fetchers.js.snap index 8bb05b8e1e..3d46fd719d 100644 --- a/__tests__/__snapshots__/fetchers.js.snap +++ b/__tests__/__snapshots__/fetchers.js.snap @@ -1 +1 @@ -exports[`test TarballFetcher.fetch throws 1`] = `"https://github.com/PolymerElements/font-roboto/archive/2fd5c7bd715a24fb5b250298a140a3ba1b71fe46.tar.gz: Bad hash. Expected foo but got 9689b3b48d63ff70f170a192bec3c01b04f58f45 "`; +exports[`test TarballFetcher.fetch throws on invalid hash 1`] = `"https://github.com/sindresorhus/beeper/archive/master.tar.gz: Bad hash. Expected foo but got a32262ca1e22a3746b970936d3944b4bfd6cb9e9 "`; diff --git a/__tests__/fetchers.js b/__tests__/fetchers.js index ef1551ce99..b172f15472 100644 --- a/__tests__/fetchers.js +++ b/__tests__/fetchers.js @@ -59,37 +59,37 @@ test('GitFetcher.fetch', async () => { const dir = await mkdir('git-fetcher'); const fetcher = new GitFetcher(dir, { type: 'git', - reference: 'https://github.com/PolymerElements/font-roboto', - hash: '2fd5c7bd715a24fb5b250298a140a3ba1b71fe46', - registry: 'bower', + reference: 'https://github.com/sindresorhus/beeper', + hash: '8beb0413a8028ca2d52dbb86c75f42069535591b', + registry: 'npm', }, await createConfig()); await fetcher.fetch(); - const name = (await fs.readJson(path.join(dir, 'bower.json'))).name; - expect(name).toBe('font-roboto'); + const name = (await fs.readJson(path.join(dir, 'package.json'))).name; + expect(name).toBe('beeper'); }); test('TarballFetcher.fetch', async () => { const dir = await mkdir('tarball-fetcher'); const fetcher = new TarballFetcher(dir, { type: 'tarball', - hash: '9689b3b48d63ff70f170a192bec3c01b04f58f45', - reference: 'https://github.com/PolymerElements/font-roboto/archive/2fd5c7bd715a24fb5b250298a140a3ba1b71fe46.tar.gz', - registry: 'bower', + hash: 'a32262ca1e22a3746b970936d3944b4bfd6cb9e9', + reference: 'https://github.com/sindresorhus/beeper/archive/master.tar.gz', + registry: 'npm', }, await createConfig()); await fetcher.fetch(); - const name = (await fs.readJson(path.join(dir, 'bower.json'))).name; - expect(name).toBe('font-roboto'); + const name = (await fs.readJson(path.join(dir, 'package.json'))).name; + expect(name).toBe('beeper'); }); -test('TarballFetcher.fetch throws', async () => { +test('TarballFetcher.fetch throws on invalid hash', async () => { const dir = await mkdir('tarball-fetcher'); - const url = 'https://github.com/PolymerElements/font-roboto/archive/2fd5c7bd715a24fb5b250298a140a3ba1b71fe46.tar.gz'; + const url = 'https://github.com/sindresorhus/beeper/archive/master.tar.gz'; const fetcher = new TarballFetcher(dir, { type: 'tarball', hash: 'foo', reference: url, - registry: 'bower', + registry: 'npm', }, await createConfig()); let error; try { @@ -104,11 +104,11 @@ test('TarballFetcher.fetch supports local ungzipped tarball', async () => { const dir = await mkdir('tarball-fetcher'); const fetcher = new LocalTarballFetcher(dir, { type: 'tarball', - hash: '76d4316a3965259f7074f167f44a7a7a393884be', + hash: '25c5098052a7bd322c7db80c26852e9209f98d4f', reference: path.join(__dirname, 'fixtures', 'fetchers', 'tarball', 'ungzipped.tar'), - registry: 'bower', + registry: 'npm', }, await createConfig()); await fetcher.fetch(); - const name = (await fs.readJson(path.join(dir, 'bower.json'))).name; - expect(name).toBe('font-roboto'); + const name = (await fs.readJson(path.join(dir, 'package.json'))).name; + expect(name).toBe('beeper'); }); diff --git a/__tests__/fixtures/fetchers/tarball/ungzipped.tar b/__tests__/fixtures/fetchers/tarball/ungzipped.tar index b929ea49b2..3f1d0252c9 100644 Binary files a/__tests__/fixtures/fetchers/tarball/ungzipped.tar and b/__tests__/fixtures/fetchers/tarball/ungzipped.tar differ diff --git a/__tests__/fixtures/request-cache/GET/codeload.github.com/sindresorhus/beeper/tar.gz/master.bin b/__tests__/fixtures/request-cache/GET/codeload.github.com/sindresorhus/beeper/tar.gz/master.bin new file mode 100644 index 0000000000..e55a3e24ad Binary files /dev/null and b/__tests__/fixtures/request-cache/GET/codeload.github.com/sindresorhus/beeper/tar.gz/master.bin differ diff --git a/__tests__/fixtures/request-cache/GET/github.com/sindresorhus/beeper/archive/master.tar.gz.bin b/__tests__/fixtures/request-cache/GET/github.com/sindresorhus/beeper/archive/master.tar.gz.bin new file mode 100644 index 0000000000..4468f8d629 --- /dev/null +++ b/__tests__/fixtures/request-cache/GET/github.com/sindresorhus/beeper/archive/master.tar.gz.bin @@ -0,0 +1,28 @@ +HTTP/1.1 302 Found +Server: GitHub.com +Date: Wed, 26 Oct 2016 15:11:17 GMT +Content-Type: text/html; charset=utf-8 +Transfer-Encoding: chunked +Status: 302 Found +Cache-Control: no-cache +Vary: X-PJAX +Location: https://codeload.github.com/sindresorhus/beeper/tar.gz/master +X-UA-Compatible: IE=Edge,chrome=1 +Set-Cookie: logged_in=no; domain=.github.com; path=/; expires=Sun, 26 Oct 2036 15:11:17 -0000; secure; HttpOnly +Set-Cookie: _gh_sess=eyJzZXNzaW9uX2lkIjoiY2FkM2U3MzA5YWNjZGQyMmFmMjNhOWM0Nzk5OGNhNDciLCJzcHlfcmVwbyI6InNpbmRyZXNvcmh1cy9iZWVwZXIiLCJzcHlfcmVwb19hdCI6MTQ3NzQ5NDY3N30%3D--3b520aa753547a6a6f489fc7740d05e7d735bde8; path=/; secure; HttpOnly +X-Request-Id: 45b91d50058c9f0ad6a1b5de1e42ee4a +X-Runtime: 0.018190 +Content-Security-Policy: default-src 'none'; base-uri 'self'; block-all-mixed-content; child-src render.githubusercontent.com; connect-src 'self' uploads.github.com status.github.com api.github.com www.google-analytics.com github-cloud.s3.amazonaws.com wss://live.github.com; font-src assets-cdn.github.com; form-action 'self' github.com gist.github.com; frame-ancestors 'none'; frame-src render.githubusercontent.com; img-src 'self' data: assets-cdn.github.com identicons.github.com collector.githubapp.com github-cloud.s3.amazonaws.com *.githubusercontent.com; media-src 'none'; script-src assets-cdn.github.com; style-src 'unsafe-inline' assets-cdn.github.com +Strict-Transport-Security: max-age=31536000; includeSubdomains; preload +Public-Key-Pins: max-age=5184000; pin-sha256="WoiWRyIOVNa9ihaBciRSC7XHjliYS9VwUGOIud4PB18="; pin-sha256="RRM1dGqnDFsCJXBTHky16vi1obOlCgFFn/yOhI/y+ho="; pin-sha256="k2v657xBsOVe1PQRwOsHsw3bsGT2VzIqz5K+59sNQws="; pin-sha256="K87oWBWM9UZfyddvDfoxL+8lpNyoUB2ptGtn0fv6G2Q="; pin-sha256="IQBnNBEiFuhj+8x6X8XLgh01V9Ic5/V3IRQLNFFc7v4="; pin-sha256="iie1VXtL7HzAMF+/PVPR9xzT80kQxdZeJ+zduCB3uj0="; pin-sha256="LvRiGEjRqfzurezaWuj8Wie2gyHMrW5Q06LspMnox7A="; includeSubDomains +X-Content-Type-Options: nosniff +X-Frame-Options: deny +X-XSS-Protection: 1; mode=block +Vary: Accept-Encoding +X-Served-By: ea1e1d06ad877450adf08d122b863cf0 +X-GitHub-Request-Id: 5284F033:6C7B:A1155BE:5810C795 + +7f +
You are being redirected. +0 + diff --git a/__tests__/lockfile.js b/__tests__/lockfile.js index 6f9a7a2a0c..419b7a4822 100644 --- a/__tests__/lockfile.js +++ b/__tests__/lockfile.js @@ -118,7 +118,7 @@ test("Lockfile.getLockfile", () => { }, _remote: { resolved: "http://example.com/barfoo", - registry: "bower", + registry: "yarn", }, }, @@ -144,7 +144,7 @@ test("Lockfile.getLockfile", () => { version: "0.0.1", uid: "0.1.0", resolved: "http://example.com/barfoo", - registry: "bower", + registry: "yarn", dependencies: {yes: "no"}, optionalDependencies: {no: "yes"}, permissions: {foo: "bar"}, diff --git a/__tests__/package-resolver.js b/__tests__/package-resolver.js index 0aec435c37..9e5691dc0d 100644 --- a/__tests__/package-resolver.js +++ b/__tests__/package-resolver.js @@ -35,8 +35,6 @@ function addTest(pattern, registry = 'npm') { }); } -addTest('github:PolymerElements/paper-elements', 'bower'); // github url -addTest('https://github.com/PolymerElements/font-roboto.git', 'bower'); // hosted git url addTest('https://github.com/npm-ml/re'); // git url with no .git addTest('https://bitbucket.org/hgarcia/node-bitbucket-api.git'); // hosted git url addTest('https://github.com/PolymerElements/font-roboto/archive/2fd5c7bd715a24fb5b250298a140a3ba1b71fe46.tar.gz'); // tarball diff --git a/src/cli/commands/generate-lock-entry.js b/src/cli/commands/generate-lock-entry.js index d305a28eec..456fc17a56 100644 --- a/src/cli/commands/generate-lock-entry.js +++ b/src/cli/commands/generate-lock-entry.js @@ -52,6 +52,5 @@ export function setFlags(commander: Object) { export const examples = [ 'generate-lock-entry', 'generate-lock-entry --use-manifest ./package.json', - 'generate-lock-entry --registry bower', 'generate-lock-entry --resolved local-file.tgz#hash', ]; diff --git a/src/config.js b/src/config.js index 4f3235d5de..9307be8ccd 100644 --- a/src/config.js +++ b/src/config.js @@ -348,7 +348,7 @@ export default class Config { if (manifest) { return manifest; } else { - throw new MessageError(`Couldn't find a package.json (or bower.json) file in ${dir}`); + throw new MessageError(`Couldn't find a package.json file in ${dir}`); } } diff --git a/src/registries/base-registry.js b/src/registries/base-registry.js index e784889e0b..be3a0cc927 100644 --- a/src/registries/base-registry.js +++ b/src/registries/base-registry.js @@ -101,7 +101,7 @@ export default class BaseRegistry { const val = process.env[key]; - // remove bower prefix + // remove config prefix key = removePrefix(key, prefix); // replace dunders with dots diff --git a/src/registries/bower-registry.js b/src/registries/bower-registry.js deleted file mode 100644 index c7c1584b67..0000000000 --- a/src/registries/bower-registry.js +++ /dev/null @@ -1,41 +0,0 @@ -/* @flow */ - -import Registry from './base-registry.js'; -import * as fs from '../util/fs.js'; - -const defaults = require('defaults'); -const userHome = require('user-home'); -const path = require('path'); - -export default class BowerRegistry extends Registry { - static filename = 'bower.json'; - - async loadConfig(): Promise