Skip to content

Commit 1fbf4d9

Browse files
committed
feat: initial
1 parent 48b50e9 commit 1fbf4d9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+10802
-0
lines changed

.circleci/config.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
version: 2
2+
jobs:
3+
test:
4+
docker:
5+
- image: circleci/node:12.0
6+
7+
working_directory: ~/repo
8+
9+
steps:
10+
- checkout
11+
12+
- restore_cache:
13+
keys:
14+
- v2-dependencies-{{ checksum "package.json" }}
15+
- v2-dependencies-
16+
17+
- run: yarn
18+
19+
- save_cache:
20+
paths:
21+
- node_modules
22+
key: v2-dependencies-{{ checksum "package.json" }}
23+
24+
- run: yarn run lint
25+
- run: yarn test -w 1 --coverage
26+
- run: bash <(curl -s https://codecov.io/bash)
27+
28+
build:
29+
docker:
30+
- image: circleci/node:12.0
31+
32+
working_directory: ~/repo
33+
34+
steps:
35+
- checkout
36+
37+
- restore_cache:
38+
keys:
39+
- v2-dependencies-{{ checksum "package.json" }}
40+
- v2-dependencies-
41+
42+
- run: yarn
43+
44+
- save_cache:
45+
paths:
46+
- node_modules
47+
key: v2-dependencies-{{ checksum "package.json" }}
48+
49+
- run: yarn run build
50+
workflows:
51+
version: 2
52+
build_and_test:
53+
jobs:
54+
- test
55+
- build

.codecov.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
codecov:
2+
require_ci_to_pass: yes
3+
comment:
4+
layout: "reach, diff, flags, files"
5+
behavior: default
6+
require_changes: false
7+
branches:
8+
- "master"

.eslintignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.now/*
2+
.next/*
3+
examples/*
4+
dist/*
5+
public/*
6+
scripts/*
7+
tests/*
8+
*.config.js

.gitignore

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.js
7+
8+
# testing
9+
/coverage
10+
11+
# next.js
12+
/.next/
13+
/out/
14+
15+
# production
16+
/build
17+
18+
# misc
19+
.DS_Store
20+
.env*
21+
22+
# debug
23+
npm-debug.log*
24+
yarn-debug.log*
25+
yarn-error.log*
26+
27+
.now
28+
dist

.jest.config.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
module.exports = {
2+
verbose: true,
3+
4+
setupFiles: ['./tests/setup.js'],
5+
6+
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
7+
8+
testPathIgnorePatterns: ['/pages/', '/dist/', '/lib/', '/.next/'],
9+
10+
transform: {
11+
'^.+\\.tsx?$': ['babel-jest', { configFile: './tests/.babelrc.js' }],
12+
},
13+
14+
// testRegex: '.*\\.test\\.(j|t)sx?$',
15+
testRegex: '.*update\\.test\\.(j|t)sx?$',
16+
17+
collectCoverageFrom: ['packages/**/*.{ts,tsx}'],
18+
19+
moduleNameMapper: {
20+
'tests/(.*)$': '<rootDir>/tests/$1',
21+
packages: '<rootDir>/packages/index.ts',
22+
},
23+
}

.nowignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.idea
2+
.git
3+
.DS_Store
4+
.env
5+
.circleci

.prettierignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
.github
2+
.next
3+
.now
4+
.circleci
5+
dist
6+
coverage
7+
*.json
8+
*.yml
9+
*.snap

.prettierrc.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
module.exports = {
2+
semi: false,
3+
tabWidth: 2,
4+
printWidth: 100,
5+
trailingComma: 'all',
6+
arrowParens: 'avoid',
7+
singleQuote: true,
8+
jsxBracketSameLine: true,
9+
endOfLine: 'lf',
10+
}

.travis.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
language: node_js
2+
3+
node_js:
4+
- 13.9.0
5+
6+
cache:
7+
directories:
8+
- "node_modules"
9+
10+
notifications:
11+
email:
12+
on_success: never
13+
14+
branches:
15+
only:
16+
- master
17+
18+
install:
19+
- yarn
20+
21+
script:
22+
- yarn run build

lib/components/active-link.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { useRouter } from 'next/router'
2+
import Link from 'next/link'
3+
import React, { Children, ReactHTMLElement } from 'react'
4+
5+
const ActiveLink: React.FC<React.PropsWithChildren<{ href: string }>> = ({ children, href }) => {
6+
const { pathname } = useRouter()
7+
const child = Children.only(children) as ReactHTMLElement<any>
8+
const className = pathname === href ? 'active' : ''
9+
10+
return <Link href={href}>{React.cloneElement(child, { className })}</Link>
11+
}
12+
13+
export default ActiveLink

0 commit comments

Comments
 (0)