Commit graph

38 commits

Author SHA1 Message Date
Najmus Sakib
084a0ca929
Removed unnecessary React Fragment (#36331)
## Update
[-] Removed React fragment from index
2022-04-21 08:37:37 +00:00
Steven
9f9214abe5
Updated create-next-app docs to include pnpm usage (#35755)
This PR updates the docs and examples for `create-next-app` to include pnpm usage.

The following script was used to update every example README:

```js
const fs = require('fs')
const examples = fs.readdirSync('./examples')

for (let example of examples) {
    const filename = `./examples/${example}/README.md`
    const markdown = fs.readFileSync(filename, 'utf8')
    const regex = new RegExp(`^yarn create next-app --example (.*)$`, 'gm')
    const output = markdown.replace(regex, (yarn, group) => {
        const pnpm = `pnpm create next-app -- --example ${group}`
        return `${yarn}\n# or\n${pnpm}`
    })
    fs.writeFileSync(filename, output)
}
```
2022-03-30 21:03:21 +00:00
Lydia Hallie
abe4936701
Update cms-wordpress example (#34944)
Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2022-03-02 01:48:05 +00:00
Cody Olsen
6b37d6c39e
docs: update CMS examples to use the new tw grid gaps (#34917) 2022-03-01 07:47:28 -06:00
Lee Robinson
01e174e5fa
Update all CMS examples dependencies. (#33580)
Updates all CMS updates to use:

- Tailwind 3 (and the corresponding `tailwind.config.js` and PostCSS changes)
- `remark@14` and `remark-html@15` (and the corresponding ESM breaking changes)
- `date-fns` minor bump

Ensured all CMS examples were:

- Using `next/image`
- Not using `as` for `next/link` (no longer needed)
2022-02-04 00:07:35 +00:00
Aziz Abbas
de54ad895c
[examples] Add a statically generated blog example using Next.js and Builder.io (#22094)
A statically generated blog example using Next.js and [Builder.io](https://builder.io), demo on [https://cms-builder-io.vercel.app/](https://cms-builder-blog.vercel.app/)
2022-01-12 21:58:43 +00:00
Oscar Busk
077097b7f8
Remove licence from all example/package.json that has them (#28007)
* Add licences to all example/package.json that lack them

* Revert "Add licences to all example/package.json that lack them"

This reverts commit 5d4e25012f7334772b8ef5924bc355277e827cba.

* Update check-examples to remove `license` field from examples

* Remove `license` from all examples.

This was mentioned in vercel/next.js#27121 but it looks like it didn't end up being in the merge?

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2021-08-14 10:48:39 -05:00
André
057d338db4
Update cms-wordpress readme file (#27234)
## Documentation / Examples

- [x] Make sure the linting passes

- Removed references to [WPGraphiQL](https://github.com/wp-graphql/wp-graphiql) as it is now part of [WPGraphQL](https://github.com/wp-graphql/wp-graphql) plugin.
2021-07-16 15:17:27 +00:00
Didi Keke
dc5bc3f2ff
Fix Prop href did not match error (#27183)
Resolve Prop `href` did not match error.
2021-07-15 01:04:05 +00:00
Didi Keke
1d08687b93
Fix Image is missing required "src" property error (#27180)
Add safety check for `CoverImage` in `/components/post-preview.js` so as to prevent error occurring in the absence of cover image for on posts listed for preview - fixes #23742.
2021-07-14 23:19:42 +00:00
Luc Leray
f52955ec94
Clean up examples package.json (#27121)
Clean up package.json files in the `examples` directory:
- Add `private: true`
- Remove `version` (because they are irrelevant for packages that are not meant to be published)
- Remove `name` (because they are optional for packages that are not meant to be published, and when someone clones an example, they often rename it and the property becomes stale)
- Remove `author`
- Remove `description`
- Remove `license`

Also remove `with-dynamic-app-layout` example completely, since it does the same as `layout-component` (https://github.com/vercel/next.js/pull/27121#discussion_r668178408).

## Documentation / Examples

- [x] Make sure the linting passes
2021-07-12 19:58:03 +00:00
Lee Robinson
9f1d5d7fca
Update dependencies of all CMS examples. (#27001) 2021-07-09 14:43:56 +02:00
Nick Babcock
5629223407
Update examples to use React 17 (#26133)
[With next 11 requiring react 17](https://nextjs.org/blog/next-11#upgrade-guide), most of the examples
need to be updated, so the following snippet updated all the examples to
a compatible react version.

```bash
cd examples/
fd -g 'package.json' | xargs sed -r -i 's/"react": ".*"/"react": "^17.0.2"/
fd -g 'package.json' | xargs sed -r -i 's/"react-dom": ".*"/"react-dom": "^17.0.2"/'

# exclude experimental react version
git checkout with-reason-relay/package.json
```
2021-06-16 16:43:26 +00:00
Cauan Cabral
722d08ee13
[examples/cms-wordpress] fix typo on alert message (#26115) 2021-06-16 10:31:50 -05:00
Lee Robinson
279e105279
Update .now.sh to .vercel.app. (#22359) 2021-04-14 09:46:06 -05:00
Joost Jansky
e69a4d7a23
[examples] Added blog-starter example using Ghost CMS (#19990) 2021-02-07 12:27:47 -06:00
Luc Leray
b442acbe1c
Replace zeit/next.js with vercel/next.js (#20849) 2021-01-07 08:41:04 -05:00
Luc Leray
8eaabe2fb0
Fix deploy buttons URLs (#20834)
Fix all deploy button URLs in the Next.js repo to follow the following format:
```
https://vercel.com/new/git/external?repository-url=https://github.com/vercel/next.js/tree/canary/examples/<EXAMPLE_NAME>&project-name=<EXAMPLE_NAME>&repository-name=<EXAMPLE_NAME>
```

The detailed docs for the Deploy Button can be found here: https://vercel.com/docs/more/deploy-button.

Also updates legacy Vercel import flow URLs (starting with vercel.com/import or with vercel.com/new/project), to use the new vercel.com/new URLs.

---

For example, for the `hello-world` example:

The URL is https://vercel.com/new/git/external?repository-url=https://github.com/vercel/next.js/tree/canary/examples/hello-world&project-name=hello-world&repository-name=hello-world

And the deploy button looks like this:
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/git/external?repository-url=https://github.com/vercel/next.js/tree/canary/examples/hello-world&project-name=hello-world&repository-name=hello-world)

---

For reference, I used the following regexes to search for the incorrect URLs

```
\(https://vercel.com/import/git\?s=https://github.com/vercel/next.js/tree/canary/examples/(.*)\)
\(https://vercel.com/import/git\?c=1&s=https://github.com/vercel/next.js/tree/canary/examples/([^&]*)(.*)\)
\(https://vercel.com/import/project\?template=https://github.com/vercel/next.js/tree/canary/examples/(.*)\)
https://vercel.com/import/git
https://vercel.com/import/select-scope
https://vercel.com/import
https://vercel.com/new/project
```
2021-01-07 01:40:29 +00:00
ospira
3bbb35c323
small tweaks for those testing on an existing site with missing autho… (#18506)
* small tweaks for those testing on an existing site with missing author or featured image on posts

When migrating WordPress or using an exisitng site, sometimes you have published posts wth missing data. The graphql plugin will properly resolve these to null, but some of existing code accessing tries to access the node property on these null values. I've made these properties optional in the pages and also tweaked some of the components along similar lines.

* Lint fix

Co-authored-by: Luis Alvarez <luis@vercel.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2020-10-30 13:45:18 -05:00
Joe Haddad
f17d435166
Ensure all examples are MIT licensed (#16691) 2020-08-29 22:32:35 -04:00
NorbertLuszkiewicz
c03d4931de
Simplify example usage instructions (#16678)
Co-authored-by: Joe Haddad <joe.haddad@zeit.co>
2020-08-29 22:22:02 -04:00
Ondřej Chrastina
a856097402
Add Kontent example (#16034)
Hello everyone!

I would like to add the example using [Kentico Kontent](https://kontent.ai) as a data source for your example.
I have tried to be consistent with the other examples and showcase the preview as well.

I have tried to keep up with [Contribution guidelines](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples).

Thank you.
2020-08-24 22:58:53 +00:00
Todor Totev
b0d2a80a18
[Examples] Remove horizontal scroll in CMS examples (#16295) 2020-08-18 11:31:20 -04:00
Luis Alvarez D
c11ee1d857
[Examples] Remove horizontal scroll in CMS examples (#15921)
This is the same fix from https://github.com/vercel/next.js/pull/15729 - Adding it in a new PR as I can't update the current one.

Closes #15729
Fixes #15676
2020-08-05 22:39:44 +00:00
Tanmay Laud
f00ad581a1
Added .gitignore to examples that are deployed to vercel (#15127)
Co-authored-by: Joe Haddad <joe.haddad@zeit.co>
2020-07-16 10:52:23 -04:00
JP Lew
f53ee47b73
[cms-wordpress] Nest one-to-one relationships (#15007)
There is a bug in the cms-wordpress example due to a Wordpress plugin dependency. After running `npm install`, then either `npm run dev` or `npm run build`, the following errors appear in the console:

```shell
> cms-wordpress@1.0.0 dev /Users/jplew/Sites/projects/next.js/examples/cms-wordpress
> next

ready - started server on http://localhost:3000
info  - Loaded env from /Users/jplew/Sites/projects/next.js/examples/cms-wordpress/.env.local
event - compiled successfully
event - build page: /
wait  - compiling...
event - build page: /next/dist/pages/_error
event - compiled successfully
[
  {
    message: 'Cannot query field "name" on type "NodeWithAuthorToUserConnectionEdge". Did you mean "node"?',
    extensions: { category: 'graphql' },
    locations: [ [Object] ]
  },
  {
    message: 'Cannot query field "firstName" on type "NodeWithAuthorToUserConnectionEdge".',
    extensions: { category: 'graphql' },
    locations: [ [Object] ]
  },
  {
    message: 'Cannot query field "lastName" on type "NodeWithAuthorToUserConnectionEdge".',
    extensions: { category: 'graphql' },
    locations: [ [Object] ]
  },
  {
    message: 'Cannot query field "avatar" on type "NodeWithAuthorToUserConnectionEdge".',
    extensions: { category: 'graphql' },
    locations: [ [Object] ]
  }
]
Error: Failed to fetch API
    at fetchAPI (webpack-internal:///./lib/api.js:31:11)
```

The reason for this is `wp-graphql` released version v0.10.0 ten days ago which introduced a number of breaking changes (https://github.com/wp-graphql/wp-graphql/releases/tag/v0.10.0). Specifically, this is the change that breaks the current example:

> - One to One relationships are now nested. For example post.author and post.featuredImage now return an edge/node instead of the node directly.

More info about this change can be found here: https://github.com/wp-graphql/wp-graphql/issues/347#issuecomment-639071772

After my changes, `npm run dev` and `npm run build` succeed without errors.
2020-07-09 10:03:13 +00:00
Tomasz Tunik
015898ef6e
Fix cms-wordpress preview mode for post revisions (#14911)
Preview of existing posts should always return the latest revision so DESC sorting was required. Otherwise, it would always return the oldest revision.

Tested against latest Wordpress and GraphQL plugins on drafts, published, and edited but unpublished changes. The example works great!
2020-07-07 11:16:35 +00:00
Shu Uesugi
a841d10954
Add c=1 to deploy buttons on CMS Examples (#14293)
Fixes #14291
2020-06-17 23:25:11 +00:00
Jesse
d3704a66f8
added graphcms (#14026)
* added graphcms

* Updated readme and environment variables

* Removed gitignore

* Updated tailwind config

* Some fixes in pages

* Updated api endpoints

* lint fix

* Updated readme

* Updated og image

* Updated cms examples to include this one

* Added example to docs

* Added preview demo link

* Updated step

Co-authored-by: Luis Alvarez <luis@vercel.com>
2020-06-15 12:03:34 -05:00
Shu Uesugi
e781c44682
Use envLink for deploy buttons (#14110)
This is a quick fix for https://github.com/vercel/next.js/pull/14053 - the deploy buttons on CMS examples should be using `envLink` for the links.

## Before

<img width="565" alt="Screen Shot 2020-06-11 at 7 23 58 PM" src="https://user-images.githubusercontent.com/992008/84458119-21d52c80-ac19-11ea-9659-df6830fc7584.png">

## After

<img width="570" alt="Screen Shot 2020-06-11 at 7 23 33 PM" src="https://user-images.githubusercontent.com/992008/84458089-1255e380-ac19-11ea-81ff-bc2b58af3ea4.png">
2020-06-12 02:51:19 +00:00
Luis Alvarez D
2cd691050a
Add new import flow to CMS examples (#14053)
[ch2502]

- Added new import flow to every CMS example, using the deploy button, and removed `vercel.json`
- Replaced `dotenv` with the new env support in outdated examples
2020-06-11 23:44:23 +00:00
Shu Uesugi
30f30af320
Storyblok CMS Example (#13993)
[ch2842]

- Demo: https://next-blog-storyblok.now.sh/
- Preview Mode: https://next-blog-storyblok.now.sh/api/preview?secret=5nnybHTKlbzkOa6r&slug=draft-post-test
2020-06-10 22:23:28 +00:00
Shu Uesugi
dea4c2cbf4
ButterCMS Example (#13908)
[ch2580]

**Demo:** https://next-blog-buttercms.now.sh/
**Preview Mode:** https://next-blog-buttercms.now.sh/api/preview?secret=CdEAKMRT4tAwzqiD&slug=draft-post-test
2020-06-10 17:13:10 +00:00
Shu Uesugi
1935196e5e
Prefer docs site for documentation links in CMS examples (#13826)
[ch579]

Some README files in `examples/cms-*` were linking to a documentation markdown file inside the repo (e.g. `/docs/basic-features/pages.md`) instead of the documentation website. We should always link to the documentation website from an example README file because (1) the website has better UX and (2) as we’re creating the examples pages on `next-site` (https://github.com/vercel/next-site/pull/672), we’d like to avoid extra processing of markdown content.
2020-06-06 00:23:20 +00:00
Joe Haddad
4a12fb0a5f
Normalize example gitignores (#13768)
This removes a bunch of unnecessary `.gitignore`s and fixes some CMS examples that don't ignore `node_modules` etc.
2020-06-04 20:39:52 +00:00
Jazib Sawar
6ce7a0378e
CMS Cosmic Example (#13499)
* Add Cosmic CMS Example

* with native .env support, this file isn't needed anymore

* FIX use path alias

* Add cosmicjs package

* Fix alias import in pages/api/preview

* Added: react-imgix & lazysizes package

* Load lazysizes in layout

* Used imgix image with lazyloading

* Added avatar imgix optimizations

* EDITED: steps to install content, preview

* EDITED: demo link

* EDITED: Install step

* EDITED: preview link steps

* Edited: demo link

* FIXED: object_slug

* Screenshots

* Fixed object_slug link

* Update README.md

* Fix: formatting issue

* Updated readme and renamed .env to env.local

* Sanity checks

* Handle fallback data when expected

* Added link to the example in other examples

* Updated demo deployment

* Added example to docs

* minor lint fix

* Remove manual download step

* use vercel.json

Co-authored-by: Tony Spiro <tspiro@tonyspiro.com>
Co-authored-by: Luis Alvarez <luis@vercel.com>
2020-06-04 15:18:11 -05:00
Luis Alvarez D
ef22a8b7c5
[Examples] Add missing cms links (#13683)
This was a change that I forgot to push into the Agility CMS example PR, adding it now.
2020-06-02 17:36:12 +00:00
Luis Alvarez D
ad24a0c855
[Examples] Add WordPress Blog (#13194)
* Added most of the stuff

* Updated pages

* Removed unrequired deps

* API fixes

* Fixes fixes and updated readme

* Updated og image

* Added demo and links to example

* Updated packages

* update name. bump dependencies

* Renamed .env.example to .env.local.example

* Added node_modules to .gitignore

* use recommended config

* enable absolute import/alias support

* remove jsconfig.json

* allow HTML entities in post titles

* add underline to content links

* add basic ul & ol styles

* add code block styles

* add basic text alignment

* add basic image alignment styles

* adjust pre font-size and figcaption

* indent ul,ol lists to line up with grid

* add basic button styles

* add basic file styles

* add basic blockquote style

* add basic audio styles

* add h4 and enhance blockquote styles

* add basic cover block styles

* add basic verse styles

* add basic two-column block styles

* add tags

* add categories

* Only ignore .vercel

The rest is injected by create-next-app

* now → vercel

* npm init → npx

* Wordsmith

* Wordsmith

* Wordsmith

* Wordsmith

* Improve issue link

* Wordsmith

Co-authored-by: Greg Rickaby <greg@gregrickaby.com>
Co-authored-by: Joe Haddad <joe.haddad@zeit.co>
Co-authored-by: Shu Uesugi <shu@chibicode.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2020-06-01 17:17:20 -05:00