Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
3910b6de
Commit
3910b6de
authored
Jul 08, 2019
by
Yuki Takemoto
Committed by
Joe Haddad
Jul 08, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upgrade next of with-typescript-styled-components sample (#7788)
parent
7da546a3
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
35 additions
and
20 deletions
+35
-20
.babelrc
examples/with-typescript-styled-components/.babelrc
+1
-1
next-env.d.ts
examples/with-typescript-styled-components/next-env.d.ts
+2
-0
next.config.js
examples/with-typescript-styled-components/next.config.js
+0
-2
package.json
examples/with-typescript-styled-components/package.json
+10
-9
_document.tsx
...les/with-typescript-styled-components/pages/_document.tsx
+5
-5
tsconfig.json
examples/with-typescript-styled-components/tsconfig.json
+17
-3
No files found.
examples/with-typescript-styled-components/.babelrc
View file @
3910b6de
{
{
"presets": ["next/babel"
, "@zeit/next-typescript/babel"
],
"presets": ["next/babel"],
"plugins": [["styled-components", { "ssr": true }]]
"plugins": [["styled-components", { "ssr": true }]]
}
}
examples/with-typescript-styled-components/next-env.d.ts
0 → 100644
View file @
3910b6de
/// <reference types="next" />
/// <reference types="next/types/global" />
examples/with-typescript-styled-components/next.config.js
deleted
100644 → 0
View file @
7da546a3
const
withTypescript
=
require
(
'@zeit/next-typescript'
)
module
.
exports
=
withTypescript
()
examples/with-typescript-styled-components/package.json
View file @
3910b6de
...
@@ -7,17 +7,18 @@
...
@@ -7,17 +7,18 @@
"start"
:
"next start"
"start"
:
"next start"
},
},
"dependencies"
:
{
"dependencies"
:
{
"@types/next"
:
"^8.0.1"
,
"next"
:
"9.0.0"
,
"@types/react"
:
"^16.8.6"
,
"react"
:
"16.8.6"
,
"@types/styled-components"
:
"^4.1.11"
,
"react-dom"
:
"16.8.6"
,
"@zeit/next-typescript"
:
"^1.1.1"
,
"next"
:
"^8.0.3"
,
"react"
:
"^16.8.3"
,
"react-dom"
:
"^16.8.3"
,
"styled-components"
:
"^4.1.3"
"styled-components"
:
"^4.1.3"
},
},
"devDependencies"
:
{
"devDependencies"
:
{
"babel-plugin-styled-components"
:
"^1.10.0"
"@types/node"
:
"12.0.12"
,
"@types/react"
:
"16.8.23"
,
"@types/react-dom"
:
"16.8.4"
,
"@types/styled-components"
:
"4.1.16"
,
"babel-plugin-styled-components"
:
"^1.10.0"
,
"typescript"
:
"3.5.2"
},
},
"license"
:
"ISC"
"license"
:
"ISC"
}
}
\ No newline at end of file
examples/with-typescript-styled-components/pages/_document.tsx
View file @
3910b6de
import
Document
,
{
Next
DocumentContext
}
from
'next/document'
import
Document
,
{
DocumentContext
}
from
'next/document'
import
{
ServerStyleSheet
}
from
'styled-components'
import
{
ServerStyleSheet
}
from
'styled-components'
export
default
class
MyDocument
extends
Document
{
export
default
class
MyDocument
extends
Document
{
static
async
getInitialProps
(
ctx
:
Next
DocumentContext
)
{
static
async
getInitialProps
(
ctx
:
DocumentContext
)
{
const
sheet
=
new
ServerStyleSheet
()
const
sheet
=
new
ServerStyleSheet
()
const
originalRenderPage
=
ctx
.
renderPage
const
originalRenderPage
=
ctx
.
renderPage
...
@@ -15,12 +15,12 @@ export default class MyDocument extends Document {
...
@@ -15,12 +15,12 @@ export default class MyDocument extends Document {
const
initialProps
=
await
Document
.
getInitialProps
(
ctx
)
const
initialProps
=
await
Document
.
getInitialProps
(
ctx
)
return
{
return
{
...
initialProps
,
...
initialProps
,
styles
:
(
styles
:
[
<>
<>
{
initialProps
.
styles
}
{
initialProps
.
styles
}
{
sheet
.
getStyleElement
()
}
{
sheet
.
getStyleElement
()
}
</>
</>
,
)
,
]
,
}
}
}
finally
{
}
finally
{
sheet
.
seal
()
sheet
.
seal
()
...
...
examples/with-typescript-styled-components/tsconfig.json
View file @
3910b6de
...
@@ -3,7 +3,10 @@
...
@@ -3,7 +3,10 @@
"target"
:
"esnext"
,
"target"
:
"esnext"
,
"module"
:
"esnext"
,
"module"
:
"esnext"
,
"jsx"
:
"preserve"
,
"jsx"
:
"preserve"
,
"lib"
:
[
"dom"
,
"es2017"
],
"lib"
:
[
"dom"
,
"es2017"
],
"moduleResolution"
:
"node"
,
"moduleResolution"
:
"node"
,
"allowJs"
:
true
,
"allowJs"
:
true
,
"noEmit"
:
true
,
"noEmit"
:
true
,
...
@@ -15,6 +18,17 @@
...
@@ -15,6 +18,17 @@
"removeComments"
:
false
,
"removeComments"
:
false
,
"preserveConstEnums"
:
true
,
"preserveConstEnums"
:
true
,
"sourceMap"
:
true
,
"sourceMap"
:
true
,
"esModuleInterop"
:
true
"esModuleInterop"
:
true
,
}
"forceConsistentCasingInFileNames"
:
true
,
"resolveJsonModule"
:
true
,
"isolatedModules"
:
true
},
"exclude"
:
[
"node_modules"
],
"include"
:
[
"next-env.d.ts"
,
"**/*.ts"
,
"**/*.tsx"
]
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment