Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(nextjs): add examples to generators (#12638)
- Loading branch information
Showing
11 changed files
with
121 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
## Examples | ||
|
||
{% tabs %} | ||
{% tab label="Create app in a directory" %} | ||
|
||
```shell | ||
nx g app myapp --directory | ||
``` | ||
|
||
{% /tab %} | ||
{% tab label="Use a custom Express server" %} | ||
|
||
```shell | ||
nx g app myapp --custom-server | ||
``` | ||
|
||
{% /tab %} | ||
{% tab label="Use plain JavaScript (not TypeScript)" %} | ||
|
||
```shell | ||
nx g app myapp --js | ||
``` | ||
|
||
{% /tab %} | ||
{% /tabs %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
## Examples | ||
|
||
{% tabs %} | ||
{% tab label="Create an app component" %} | ||
|
||
```shell | ||
nx g component my-cmp --project=my-app | ||
``` | ||
|
||
{% /tab %} | ||
{% tab label="Create a component without its own folder" %} | ||
|
||
Running the following will create a component under `apps/my-app/components/my-cmp.tsx` rather than `apps/my-app/components/my-cmp/my-cmp.tsx`. | ||
|
||
```shell | ||
nx g component my-cmp --directory=foo --flat --project=my-app | ||
``` | ||
|
||
{% /tab %} | ||
{% tab label="Create component in a custom directory" %} | ||
|
||
Running the following will create a component under `apps/my-app/foo/my-cmp.tsx` rather than `apps/my-app/my-cmp/my-cmp.tsx`. | ||
|
||
```shell | ||
nx g component my-cmp --directory=foo --flat --project=my-app | ||
``` | ||
|
||
{% /tab %} | ||
{% /tabs %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
## Examples | ||
|
||
{% tabs %} | ||
{% tab label="Add a custom server to existing app" %} | ||
|
||
```shell | ||
nx g custom-server my-app | ||
``` | ||
|
||
{% /tab %} | ||
{% /tabs %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
## Examples | ||
|
||
{% tabs %} | ||
{% tab label="Create a new lib" %} | ||
|
||
```shell | ||
nx g lib my-lib | ||
``` | ||
|
||
{% /tab %} | ||
{% tab label="Create a new lib under a directory" %} | ||
|
||
The following will create a library at `libs/shared/my-lib`. | ||
|
||
```shell | ||
nx g lib my-lib --directory=shared | ||
``` | ||
|
||
{% /tab %} | ||
{% /tabs %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
## Examples | ||
|
||
{% tabs %} | ||
{% tab label="Create static page in an app" %} | ||
|
||
```shell | ||
nx g page my-page --project=my-app | ||
``` | ||
|
||
{% /tab %} | ||
{% tab label="Create dynamic page in an app" %} | ||
|
||
The following creates a page under `apps/my-app/pages/products/[id].tsx`. | ||
|
||
```shell | ||
nx g page "[id]" --project=my-app --directory=products | ||
``` | ||
|
||
{% /tab %} | ||
|
||
{% /tabs %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
204c5cb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
nx-dev – ./
nx-dev-nrwl.vercel.app
nx-five.vercel.app
nx-dev-git-master-nrwl.vercel.app
nx.dev