Skip to content

Commit

Permalink
fix: restructured
Browse files Browse the repository at this point in the history
  • Loading branch information
JureSotosek committed Sep 16, 2018
1 parent e108a13 commit af4a186
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 4 deletions.
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@
"ink-text-input": "^1.1.1",
"meow": "^4.0.0",
"opencollective": "^1.0.3",
"react": "^16.5.1",
"react-apollo": "^2.1.11",
"react-dom": "^16.5.1",
"term-size": "^1.2.0",
"update-notifier": "^2.3.0",
"yargs": "^11.0.0"
Expand Down
12 changes: 11 additions & 1 deletion src/libs/npm-suggestions.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,16 @@ export const suggestionsQuery = gql`
humanDownloadsLast30Days
objectID
}
}
}
`;

export const devSuggestionsQuery = gql`
query Suggestions($dependencies: [String!]!, $devDependencies: [String!]!) {
suggestions(
dependencies: $dependencies
devDependencies: $devDependencies
) {
devSuggestions {
name
description
Expand All @@ -44,7 +54,7 @@ export const suggestionsQuery = gql`

export async function getSuggestions(dependencies, dev) {
const res = await client.query({
query: suggestionsQuery,
query: dev ? devSuggestionsQuery : suggestionsQuery,
variables: {
dependencies: dev ? [] : dependencies,
devDependencies: dev ? dependencies : []
Expand Down
6 changes: 3 additions & 3 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ export const notEmpty = x => x.length !== 0;

export const isEmpty = x => x.length === 0;

const getCellPadding = (pkgs, pkg) => attr => {
const cells = pkgs.map(_pkg => dot.get(_pkg, attr));
const getCellPadding = (hits, hit) => attr => {
const cells = hits.map(_hit => dot.get(_hit, attr));

const cellWidth = Math.max(...cells.map(cell => (cell ? cell.length : 0)));

const cellValueWidth =
dot.get(pkg, attr) === null ? 0 : dot.get(pkg, attr).length;
dot.get(hit, attr) === null ? 0 : dot.get(hit, attr).length;
const width = cellWidth - cellValueWidth;

return ` `.repeat(width);
Expand Down
59 changes: 59 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1827,6 +1827,10 @@ hoek@4.x.x:
version "4.2.1"
resolved "https://registry.yarnpkg.com/hoek/-/hoek-4.2.1.tgz#9634502aa12c445dd5a7c5734b572bb8738aacbb"

hoist-non-react-statics@^2.5.0:
version "2.5.5"
resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-2.5.5.tgz#c5903cf409c0dfd908f388e619d86b9c1174cb47"

hook-std@^0.4.0:
version "0.4.0"
resolved "https://registry.yarnpkg.com/hook-std/-/hook-std-0.4.0.tgz#fa8b2f84d358763137cb7d17e3308b28714bd174"
Expand Down Expand Up @@ -2154,6 +2158,10 @@ js-tokens@^3.0.0:
version "3.0.2"
resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b"

"js-tokens@^3.0.0 || ^4.0.0":
version "4.0.0"
resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499"

js-yaml@^3.9.0:
version "3.11.0"
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.11.0.tgz#597c1a8bd57152f26d622ce4117851a51f5ebaef"
Expand Down Expand Up @@ -2286,6 +2294,10 @@ lodash.toarray@^4.4.0:
version "4.4.0"
resolved "https://registry.yarnpkg.com/lodash.toarray/-/lodash.toarray-4.4.0.tgz#24c4bfcd6b2fba38bfd0594db1179d8e9b656561"

lodash@^4.17.10:
version "4.17.11"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.11.tgz#b39ea6229ef607ecd89e2c8df12536891cac9b8d"

lodash@^4.17.4, lodash@^4.2.0, lodash@^4.2.1, lodash@^4.3.0:
version "4.17.5"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.5.tgz#99a92d65c0272debe8c96b6057bc8fbfa3bed511"
Expand All @@ -2308,6 +2320,12 @@ loose-envify@^1.0.0, loose-envify@^1.3.1:
dependencies:
js-tokens "^3.0.0"

loose-envify@^1.1.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf"
dependencies:
js-tokens "^3.0.0 || ^4.0.0"

loud-rejection@^1.0.0:
version "1.6.0"
resolved "https://registry.yarnpkg.com/loud-rejection/-/loud-rejection-1.6.0.tgz#5b46f80147edee578870f086d04821cf998e551f"
Expand Down Expand Up @@ -2831,6 +2849,13 @@ prop-types@^15.5.10:
loose-envify "^1.3.1"
object-assign "^4.1.1"

prop-types@^15.6.0, prop-types@^15.6.2:
version "15.6.2"
resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.6.2.tgz#05d5ca77b4453e985d60fc7ff8c859094a497102"
dependencies:
loose-envify "^1.3.1"
object-assign "^4.1.1"

proto-list@~1.2.1:
version "1.2.4"
resolved "https://registry.yarnpkg.com/proto-list/-/proto-list-1.2.4.tgz#212d5bfe1318306a420f6402b8e26ff39647a849"
Expand Down Expand Up @@ -2891,6 +2916,34 @@ rc@^1.0.1, rc@^1.1.6, rc@^1.1.7:
minimist "^1.2.0"
strip-json-comments "~2.0.1"

react-apollo@^2.1.11:
version "2.1.11"
resolved "https://registry.yarnpkg.com/react-apollo/-/react-apollo-2.1.11.tgz#ef4805f07af1d732ec94caebf7ba0728e2d162ca"
dependencies:
fbjs "^0.8.16"
hoist-non-react-statics "^2.5.0"
invariant "^2.2.2"
lodash "^4.17.10"
prop-types "^15.6.0"

react-dom@^16.5.1:
version "16.5.1"
resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-16.5.1.tgz#29d0c5a01ed3b6b4c14309aa91af6ec4eb4f292c"
dependencies:
loose-envify "^1.1.0"
object-assign "^4.1.1"
prop-types "^15.6.2"
schedule "^0.4.0"

react@^16.5.1:
version "16.5.1"
resolved "https://registry.yarnpkg.com/react/-/react-16.5.1.tgz#8cb8e9f8cdcb4bde41c9a138bfbf907e66132372"
dependencies:
loose-envify "^1.1.0"
object-assign "^4.1.1"
prop-types "^15.6.2"
schedule "^0.4.0"

read-pkg-up@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-3.0.0.tgz#3ed496685dba0f8fe118d0691dc51f4a1ff96f07"
Expand Down Expand Up @@ -3139,6 +3192,12 @@ safe-buffer@^5.0.1, safe-buffer@^5.1.1, safe-buffer@~5.1.0, safe-buffer@~5.1.1:
version "5.1.1"
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.1.tgz#893312af69b2123def71f57889001671eeb2c853"

schedule@^0.4.0:
version "0.4.0"
resolved "https://registry.yarnpkg.com/schedule/-/schedule-0.4.0.tgz#fa20cfd0bfbf91c47d02272fd7096780d3170bbb"
dependencies:
object-assign "^4.1.1"

semantic-release@^12.4.1:
version "12.4.1"
resolved "https://registry.yarnpkg.com/semantic-release/-/semantic-release-12.4.1.tgz#4faeee44fe7fbebbc7af8cc9e3522eb7877a0260"
Expand Down

0 comments on commit af4a186

Please sign in to comment.