Skip to content

Commit

Permalink
Prettier fix (#8754)
Browse files Browse the repository at this point in the history
  • Loading branch information
huv1k authored and timneutkens committed Sep 16, 2019
1 parent a0341ea commit 7863b60
Show file tree
Hide file tree
Showing 31 changed files with 148 additions and 248 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ jobs:
name: PR Stats
runs-on: ubuntu-latest
steps:
- name: PR Stats
uses: zeit/next-stats-action@master
env:
COMMENT_ENDPOINT: https://next-stats.jjsweb.site/api/comment
- name: PR Stats
uses: zeit/next-stats-action@master
env:
COMMENT_ENDPOINT: https://next-stats.jjsweb.site/api/comment
8 changes: 4 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ jobs:
name: PR Stats
runs-on: ubuntu-latest
steps:
- name: PR Stats
uses: zeit/next-stats-action@master
env:
PR_STATS_COMMENT_TOKEN: ${{ secrets.PR_STATS_COMMENT_TOKEN }}
- name: PR Stats
uses: zeit/next-stats-action@master
env:
PR_STATS_COMMENT_TOKEN: ${{ secrets.PR_STATS_COMMENT_TOKEN }}
2 changes: 2 additions & 0 deletions errors/app-container-deprecated.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ This handling has been moved up the tree so the `<Container>` component is no lo
Remove the `<Container>` component from your Custom `<App>` (`./pages/_app.js`).

**Before**

```jsx
import React from 'react'
import App, { Container } from 'next/app'
Expand All @@ -29,6 +30,7 @@ export default MyApp
```

**After**

```jsx
import React from 'react'
import App from 'next/app'
Expand Down
6 changes: 4 additions & 2 deletions errors/incompatible-href-as.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,27 @@ Somewhere you are utilizing the `next/link` component, `Router#push`, or `Router
Note: this error will only show when the `next/link` component is clicked not when only rendered.

**Incompatible `href` and `as`**

```jsx
import Link from 'next/link'

export default () => (
<>
<Link href='/[post]' as='/post-1/comments'>
<Link href="/[post]" as="/post-1/comments">
<a>Invalid link</a>
</Link>
</>
)
```

**Compatible `href` and `as`**

```jsx
import Link from 'next/link'

export default () => (
<>
<Link href='/[post]' as='/post-1'>
<Link href="/[post]" as="/post-1">
<a>Valid link</a>
</Link>
</>
Expand Down
2 changes: 1 addition & 1 deletion errors/invalid-href-passed.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#### Why This Error Occurred

Next.js provides a router which can be utilized via a component imported via `next/link`, a wrapper `withRouter(Component)`, and now a hook `useRouter()`.
Next.js provides a router which can be utilized via a component imported via `next/link`, a wrapper `withRouter(Component)`, and now a hook `useRouter()`.
When using any of these, it is expected they are only used for internal navigation, i.e. navigating between pages in the same Next.js application.

Either you passed a non-internal `href` to a `next/link` component or you called `Router#push` or `Router#replace` with one.
Expand Down
1 change: 0 additions & 1 deletion errors/minification-disabled.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,3 @@ This severely degrades your application's performance at runtime. It can also re
Be sure your `next.config.js` has not modified `optimization.minimize` or `optimization.minimizer`.

You can file an issue on our GitHub if you do not understand why minification is being disabled by your `next.config.js`.

18 changes: 3 additions & 15 deletions examples/custom-server-typescript/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
"target": "esnext",
"module": "esnext",
"jsx": "preserve",
"lib": [
"dom",
"es2017"
],
"lib": ["dom", "es2017"],
"baseUrl": ".",
"moduleResolution": "node",
"strict": true,
Expand All @@ -24,15 +21,6 @@
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true
},
"exclude": [
"dist",
".next",
"out",
"next.config.js"
],
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx"
]
"exclude": ["dist", ".next", "out", "next.config.js"],
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"]
}
47 changes: 25 additions & 22 deletions examples/with-aws-amplify-typescript/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,21 @@ cd with-aws-amplify-typescript

#### Install & Configure Amplify

1. [Sign up](https://portal.aws.amazon.com/billing/signup#/start) for an AWS account
2. Install the AWS Amplify cli:
```sh
1. [Sign up](https://portal.aws.amazon.com/billing/signup#/start) for an AWS account
2. Install the AWS Amplify cli:

```sh
npm install -g @aws-amplify/cli
```
3. Configure the Amplify cli
```sh
```

3. Configure the Amplify cli

```sh
amplify configure
```
[Read More](https://aws-amplify.github.io/docs/cli-toolchain/quickstart?sdk=js)
```

[Read More](https://aws-amplify.github.io/docs/cli-toolchain/quickstart?sdk=js)

</details>

#### Initialize Amplify
Expand All @@ -52,9 +57,9 @@ $ amplify init
? Enter a name for the environment: dev (or whatever you would like to call this env)
? Choose your default editor: <YOUR_EDITOR_OF_CHOICE>
? Choose the type of app that you're building (Use arrow keys)
android
ios
❯ javascript
android
ios
❯ javascript
? What javascript framework are you using react
? Source Directory Path: src
? Distribution Directory Path: out
Expand All @@ -71,11 +76,11 @@ $ amplify init
$ amplify add api
# <Interactive>
? Please select from one of the below mentioned services (Use arrow keys)
❯ GraphQL
REST
❯ GraphQL
REST
? Provide API name: <API_NAME>
? Choose an authorization type for the API (Use arrow keys)
❯ API key
❯ API key
Amazon Cognito User Pool
? Do you have an annotated GraphQL schema? (y/N) y
? Provide your schema file path: ./schema.graphql
Expand All @@ -90,12 +95,12 @@ $ amplify push
? Are you sure you want to continue? Y
? Do you want to generate code for your newly created GraphQL API? Y
? Choose the code generation language target (Use arrow keys)
javascript
❯ typescript
javascript
❯ typescript
flow
? Enter the file name pattern of graphql queries, mutations and subscriptions (src/graphql/**/*.js)
? Enter the file name pattern of graphql queries, mutations and subscriptions (src/graphql/**/*.js)
? Do you want to generate/update all possible GraphQL operations - queries, mutations and subscriptions (Y/n) Y
? Enter maximum statement depth [increase from default if your schema is deeply nested] (2)
? Enter maximum statement depth [increase from default if your schema is deeply nested] (2)
# </Interactive>
```
Expand All @@ -114,7 +119,7 @@ yarn dev
1. Open [`amplify/backend/api/nextjswithamplifyts/schema.graphql`](amplify/backend/api/nextjswithamplifyts/schema.graphql) and change what you need to.
2. Run `amplify push`
3. 👍
3. 👍
## The idea behind the example
Expand All @@ -124,10 +129,8 @@ We use AWS Amplify to generate code and to manage and consume the AWS cloud reso
The NextJS app has dynamic and static routes to demonstrate how to load data on the server based on the incoming request.
Two routes are implemented :
Two routes are implemented :
- `/` : A static route that uses getInitialProps to load data from AppSync and renders it on the server (Code in [pages/index.tsx](/pages/index.tsx))
- `/todo/[id]` : A dynamic route that uses getInitialProps and the id from the provided context to load a single todo from AppSync and render it on the server. (Code in [pages/todo/:[id].tsx](/pages/todo/[id].tsx))
16 changes: 3 additions & 13 deletions examples/with-aws-amplify-typescript/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
{
"compilerOptions": {
"target": "es5",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": false,
Expand All @@ -18,12 +14,6 @@
"isolatedModules": true,
"jsx": "preserve"
},
"exclude": [
"node_modules"
],
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx"
]
"exclude": ["node_modules"],
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"]
}
51 changes: 27 additions & 24 deletions examples/with-aws-amplify/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,21 @@ cd with-aws-amplify

#### Install & Configure Amplify

1. [Sign up](https://portal.aws.amazon.com/billing/signup#/start) for an AWS account
2. Install the AWS Amplify cli:
```sh
1. [Sign up](https://portal.aws.amazon.com/billing/signup#/start) for an AWS account
2. Install the AWS Amplify cli:

```sh
npm install -g @aws-amplify/cli
```
3. Configure the Amplify cli
```sh
```

3. Configure the Amplify cli

```sh
amplify configure
```
[Read More](https://aws-amplify.github.io/docs/cli-toolchain/quickstart?sdk=js)
```

[Read More](https://aws-amplify.github.io/docs/cli-toolchain/quickstart?sdk=js)

</details>

#### Initialize Amplify
Expand All @@ -52,9 +57,9 @@ $ amplify init
? Enter a name for the environment: dev (or whatever you would like to call this env)
? Choose your default editor: <YOUR_EDITOR_OF_CHOICE>
? Choose the type of app that you're building (Use arrow keys)
android
ios
❯ javascript
android
ios
❯ javascript
? What javascript framework are you using react
? Source Directory Path: src
? Distribution Directory Path: out
Expand All @@ -71,11 +76,11 @@ $ amplify init
$ amplify add api
# <Interactive>
? Please select from one of the below mentioned services (Use arrow keys)
❯ GraphQL
REST
❯ GraphQL
REST
? Provide API name: <API_NAME>
? Choose an authorization type for the API (Use arrow keys)
❯ API key
❯ API key
Amazon Cognito User Pool
? Do you have an annotated GraphQL schema? (y/N) y
? Provide your schema file path: ./schema.graphql
Expand All @@ -90,12 +95,12 @@ $ amplify push
? Are you sure you want to continue? Y
? Do you want to generate code for your newly created GraphQL API? Y
? Choose the code generation language target (Use arrow keys)
❯ javascript
typescript
❯ javascript
typescript
flow
? Enter the file name pattern of graphql queries, mutations and subscriptions (src/graphql/**/*.js)
? Enter the file name pattern of graphql queries, mutations and subscriptions (src/graphql/**/*.js)
? Do you want to generate/update all possible GraphQL operations - queries, mutations and subscriptions (Y/n) Y
? Enter maximum statement depth [increase from default if your schema is deeply nested] (2)
? Enter maximum statement depth [increase from default if your schema is deeply nested] (2)
# </Interactive>
```
Expand All @@ -114,7 +119,7 @@ yarn dev
1. Open `amplify/backend/api/projectname/schema.graphql` and change what you need to.
2. Run `amplify push`
3. 👍
3. 👍
### Use with new Amplify project
Expand All @@ -123,8 +128,8 @@ Make sure to commit your changes before doing this.
```sh
mv amplify/backend/api/nextjswithawsamplify/schema.graphql ./schema.graphql
rm -rf amplify/ src/
amplify init
amplify add api
amplify init
amplify add api
rm ./schema.graphql
amplify push
```
Expand All @@ -137,10 +142,8 @@ We use AWS Amplify to generate code and to manage and consume the AWS cloud reso
The NextJS app has dynamic and static routes to demonstrate how to load data on the server based on the incoming request.
Two routes are implemented :
Two routes are implemented :
- `/` : A static route that uses getInitialProps to load data from AppSync and renders it on the server (Code in [pages/index.js](/pages/index.js))
- `/todo/[id]` : A dynamic route that uses getInitialProps and the id from the provided context to load a single todo from AppSync and render it on the server. (Code in [pages/todo/:[id].js](/pages/todo/[id].js))
18 changes: 10 additions & 8 deletions examples/with-electron-typescript/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ cd with-electron-typescript
```

To install and start dev build:

```bash
yarn install && yarn build && yarn start
```
Expand All @@ -43,17 +44,18 @@ Available commands:

This example show how you can use Next.js inside an Electron application to avoid a lot of configuration, use Next.js router as view and use server-render to speed up the initial render of the application. Both Next.js and Electron layers are written in TypeScript and compiled to JavaScript during the build process.

| Part| Source code (Typescript) | Builds (JavaScript) |
| -- | -- | -- |
| Next.js | `/renderer` | `/renderer` |
| Electron | `/electron-src` | `/main` |
| Production | | `/dist` |
| Part | Source code (Typescript) | Builds (JavaScript) |
| ---------- | ------------------------ | ------------------- |
| Next.js | `/renderer` | `/renderer` |
| Electron | `/electron-src` | `/main` |
| Production | | `/dist` |

For development it's going to run a HTTP server and let Next.js handle routing. In production it use `next export` to pre-generate HTML static files and use them in your app instead of running an HTTP server.

You can create the production app using `npm run dist`.

_note regarding types:_
* Electron provides its own type definitions, so you don't need @types/electron installed!
source: https://www.npmjs.com/package/@types/electron
* There were no types available for `electron-next` at the time of creating this example, so until they are available there is a file `electron-next.d.ts` in `electron-src` directory.

- Electron provides its own type definitions, so you don't need @types/electron installed!
source: https://www.npmjs.com/package/@types/electron
- There were no types available for `electron-next` at the time of creating this example, so until they are available there is a file `electron-next.d.ts` in `electron-src` directory.

0 comments on commit 7863b60

Please sign in to comment.