Skip to content

Commit

Permalink
remove bower (#1441)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian McKenzie authored Oct 26, 2016
1 parent ec6a450 commit af9d80c
Show file tree
Hide file tree
Showing 15 changed files with 51 additions and 100 deletions.
2 changes: 1 addition & 1 deletion __tests__/__snapshots__/fetchers.js.snap
Original file line number Diff line number Diff line change
@@ -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 "`;
34 changes: 17 additions & 17 deletions __tests__/fetchers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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');
});
Binary file modified __tests__/fixtures/fetchers/tarball/ungzipped.tar
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -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
<html><body>You are being <a href="https://codeload.github.com/sindresorhus/beeper/tar.gz/master">redirected</a>.</body></html>
0

4 changes: 2 additions & 2 deletions __tests__/lockfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ test("Lockfile.getLockfile", () => {
},
_remote: {
resolved: "http://example.com/barfoo",
registry: "bower",
registry: "yarn",
},
},

Expand All @@ -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"},
Expand Down
2 changes: 0 additions & 2 deletions __tests__/package-resolver.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion src/cli/commands/generate-lock-entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
];
2 changes: 1 addition & 1 deletion src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/registries/base-registry.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
41 changes: 0 additions & 41 deletions src/registries/bower-registry.js

This file was deleted.

3 changes: 0 additions & 3 deletions src/registries/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@

import YarnRegistry from './yarn-registry.js';
import NpmRegistry from './npm-registry.js';
import BowerRegistry from './bower-registry.js';

export const registries = {
npm: NpmRegistry,
yarn: YarnRegistry,
bower: BowerRegistry,
};

export const registryNames = Object.keys(registries);
Expand All @@ -16,5 +14,4 @@ export type RegistryNames = $Keys<typeof registries>;
export type ConfigRegistries = {
npm: NpmRegistry,
yarn: YarnRegistry,
bower: BowerRegistry
};
2 changes: 0 additions & 2 deletions src/resolvers/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
/* @flow */

import RegistryNpm from './registries/npm-resolver.js';
import RegistryBower from './registries/bower-resolver.js';
import RegistryYarn from './registries/yarn-resolver.js';

export const registries = {
bower: RegistryBower,
npm: RegistryNpm,
yarn: RegistryYarn,
};
Expand Down
28 changes: 0 additions & 28 deletions src/resolvers/registries/bower-resolver.js

This file was deleted.

2 changes: 1 addition & 1 deletion src/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ type Dependencies = {
[key: string]: string
};

// package.json/bower.json etc
// package.json
export type Manifest = {
_registry?: ?RegistryNames,
_loc?: ?string,
Expand Down

0 comments on commit af9d80c

Please sign in to comment.