Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
6f72e16
clean slate
siddharthkp Mar 4, 2017
e973448
npm init
siddharthkp Mar 4, 2017
246cc96
Add 3 dummy pages + header
siddharthkp Mar 4, 2017
71adab5
rename nav to header
siddharthkp Mar 4, 2017
e5acfd1
Add component for showing helper text
siddharthkp Mar 4, 2017
87ecae3
Move logo into its own component
siddharthkp Mar 4, 2017
9ffebf0
Input component
siddharthkp Mar 4, 2017
b97d3da
Add flexbox grid
siddharthkp Mar 4, 2017
a826801
Canonical card component
siddharthkp Mar 4, 2017
e02e833
Add request layer
siddharthkp Mar 4, 2017
5dcef2f
Add lato font
siddharthkp Mar 4, 2017
b62eebe
Remove useless text from index
siddharthkp Mar 4, 2017
5869454
Add modules for user
siddharthkp Mar 4, 2017
f7b0744
Add transition between data loading
siddharthkp Mar 5, 2017
57139e0
delete module page for now
siddharthkp Mar 5, 2017
a6112ad
code comment at the right spot
siddharthkp Mar 5, 2017
1abfaba
modules instead of data
siddharthkp Mar 5, 2017
af14681
add simple loader
siddharthkp Mar 5, 2017
2590148
Loader on point :rocket:
siddharthkp Mar 5, 2017
8ea17d7
pluck out bold + link into components
siddharthkp Mar 5, 2017
75d1a07
rename recommendations to suggestions
siddharthkp Mar 5, 2017
8148899
Neat suggestions
siddharthkp Mar 5, 2017
0dab11b
Move code component out
siddharthkp Mar 5, 2017
62bbdcd
use api hosted on now
siddharthkp Mar 5, 2017
2c8a0e7
Add build script in package.json
siddharthkp Mar 5, 2017
1333eed
Missing dep! styled-components
siddharthkp Mar 5, 2017
4bf07a2
First level of tests
siddharthkp Mar 5, 2017
a8ddab9
Add .travis file
siddharthkp Mar 5, 2017
2d1bf5e
Fix bug in tips
siddharthkp Mar 5, 2017
4887bfd
100% coverage :100:
siddharthkp Mar 5, 2017
e0823c9
add empty state for no modules
siddharthkp Mar 5, 2017
2e28c4c
Add more transitions
siddharthkp Mar 5, 2017
639f58d
rename tip to hint
siddharthkp Mar 5, 2017
2b8408a
handle no username
siddharthkp Mar 5, 2017
9da90cb
test for empty username
siddharthkp Mar 5, 2017
1845ac4
not so ugly invalid module
siddharthkp Mar 5, 2017
08afcec
update tests
siddharthkp Mar 5, 2017
a9a0829
add full :100: text
siddharthkp Mar 5, 2017
6a3acd5
cleaned up the logo
siddharthkp Mar 5, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"presets": ["es2015", "next/babel"],
"plugins": ["styled-components-require"]
}
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
build
node_modules
coverage
50 changes: 50 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"parser": "babel-eslint",
"plugins": [
"react"
],
"ecmaFeatures": {
"modules": true,
"jsx": true,
"experimentalObjectRestSpread": true
},
"env": {
"amd": true,
"browser": true,
"es6": true,
"jquery": true,
"node": true
},
"rules": {
"comma-dangle": [2, "never"],
"no-cond-assign": 2,
"no-debugger": 2,
"no-dupe-args": 2,
"no-dupe-keys": 2,
"no-duplicate-case": 2,
"no-empty": 2,
"no-empty-function": 2,
"no-func-assign": 2,
"no-sparse-arrays": 2,
"eqeqeq": 2,
"no-eval": 2,
"no-magic-numbers": 0,
"no-lone-blocks": 2,
"no-redeclare": 2,
"no-unused-expressions": 0,
"no-useless-concat": 2,
"no-unused-vars": 2,
"no-use-before-define": 2,
"no-lonely-if": 2,
"no-mixed-spaces-and-tabs": 2,
"new-cap": 2,
"indent": [2, 2],
"vars-on-top": 2,
"semi": [2, "never"],
"react/jsx-uses-vars": 2,
"react/jsx-uses-react": 2
},
"parserOptions": {
"sourceType": "module",
}
}
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ build/Release
# https://docs.npmjs.com/misc/faq#should-i-check-my-node-modules-folder-into-git
node_modules

npm-janitor/bundle.js
.next
8 changes: 8 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
language: node_js
node_js:
- "7"
cache:
directories:
- node_modules
notifications:
email: false
14 changes: 14 additions & 0 deletions api/__mocks__/user.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
let modules = [{
name: 'npm-janitor-web',
valid: true,
errors: [],
warnings: ['Add recommended field: contributors'],
suggestions: ['Add optional field: homepage']
}]

const get = username => new Promise(resolve => {
if (username) resolve({modules: modules})
else resolve({modules: []})
})

export default get
20 changes: 20 additions & 0 deletions api/user.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import axios from 'axios'

const get = (username) => {
if (!username) return {modules: []}
return axios.get(`https://npm-janitor-api.now.sh/${username}`)
.then(response => {
let modules = response.data
modules = modules.map(module => ({
name: module.module,
valid: module.info.valid,
errors: module.info.errors || [],
warnings: module.info.warnings || [],
suggestions: module.info.recommendations || []
}))
return {modules: modules}
})
.catch(error => ({error: error.response.data.message}))
}

export default get
27 changes: 0 additions & 27 deletions components/HotLink.jsx

This file was deleted.

7 changes: 7 additions & 0 deletions components/__snapshots__/card.test.js.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`renders correctly 1`] = `
<span
className="gKGDvl"
/>
`;
7 changes: 7 additions & 0 deletions components/__snapshots__/code.test.js.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`renders correctly 1`] = `
<span
className="lhecVm"
/>
`;
17 changes: 17 additions & 0 deletions components/__snapshots__/grid.test.js.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`renders correctly 1`] = `
<div
className="lIpXm"
>
<div>
1
</div>
<div>
2
</div>
<div>
3
</div>
</div>
`;
33 changes: 33 additions & 0 deletions components/__snapshots__/header.test.js.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`renders correctly 1`] = `
<div
className="evniLY"
>
<div>
<img
className="cMyKIV"
src="static/logo.png"
/>
<div>
<input
autoFocus={true}
className="IoGtR"
defaultValue={undefined}
onChange={[Function]}
onKeyUp={[Function]}
placeholder="enter your npm username"
type="text"
/>
<span
className="ekknR"
>
</span>
<div
className="kfVcvr"
/>
</div>
</div>
</div>
`;
9 changes: 9 additions & 0 deletions components/__snapshots__/heavy.test.js.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`renders correctly 1`] = `
<div
className="jgJsZQ"
>
This is some bold text
</div>
`;
8 changes: 8 additions & 0 deletions components/__snapshots__/hint.test.js.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`renders correctly 1`] = `
<span
className="iBvdDm"
type="text"
/>
`;
8 changes: 8 additions & 0 deletions components/__snapshots__/input.test.js.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`renders correctly 1`] = `
<input
className="IoGtR"
type="text"
/>
`;
8 changes: 8 additions & 0 deletions components/__snapshots__/link.test.js.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`renders correctly 1`] = `
<a
className="igpMrq"
src="http://npm-janitor.now.sh"
/>
`;
7 changes: 7 additions & 0 deletions components/__snapshots__/loading.test.js.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`renders correctly 1`] = `
<div
className="jGuHrJ"
/>
`;
15 changes: 15 additions & 0 deletions components/__snapshots__/logo.test.js.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`renders big version 1`] = `
<img
className="cMyKIV"
src="static/logo.png"
/>
`;

exports[`renders small version 1`] = `
<img
className="etfsU"
src="static/logo.png"
/>
`;
67 changes: 67 additions & 0 deletions components/__snapshots__/module.test.js.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`renders invalid module 1`] = `
<span
className="TpbjZ"
>
<a
className="igpMrq"
href="https://npmjs.com/module"
target="blank"
>
<div
className="gclOdG"
color="#c0392b"
>
module
</div>
</a>
<div>
<div>
<div>

1

error
</div>
<div>
-
name is not allowed
</div>
<br />
</div>


</div>
<div
className="kUklBY"
/>
</span>
`;

exports[`renders valid module 1`] = `
<span
className="gXtLUw"
>
<a
className="igpMrq"
href="https://npmjs.com/module"
target="blank"
>
<div
className="jgJsZQ"
color=""
>
module
</div>
</a>
<div>



</div>
<div
className="huXapt"
/>
</span>
`;
19 changes: 19 additions & 0 deletions components/__snapshots__/score.test.js.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`renders correctly when module has errors 1`] = `
<div
className="kUklBY"
/>
`;

exports[`renders correctly when score <= 6 1`] = `
<div
className="jyRNRQ"
/>
`;

exports[`renders correctly when score > 6 1`] = `
<div
className="huXapt"
/>
`;
Loading