Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

171 create script to sync examples #172

Merged
merged 7 commits into from
Jul 20, 2022
Merged

Conversation

skirianov
Copy link
Collaborator

Summary/ Motivation (TLDR;)

Created a script to copy files from GitHub examples and add/replace them in the Website Docs examples section.

Related issues

#171

Features

  • Add script to a build command

@netlify
Copy link

netlify bot commented Jun 29, 2022

Deploy Preview for jest-preview-library ready!

Name Link
🔨 Latest commit 98955bf
🔍 Latest deploy log https://app.netlify.com/sites/jest-preview-library/deploys/62d83b2ca370ca0009453757
😎 Deploy Preview https://deploy-preview-172--jest-preview-library.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

Copy link
Owner

@nvh95 nvh95 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • We need to review the content of /docs/examples/*.md before deleting it. They might need to combine with the current README.md in /examples. (Sorry for the inconsistent)
  • We might want to keep the front matter, to preserve the order of examples (need more discussion).

Comment on lines 1 to 3
---
sidebar_position: 2
---
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is for discussion. There are 2 options:

  1. Keep the front matter. In the future, we might want to add more data to the front matter. We might need to map the README in /examples with the existing .md file in /website
  2. Just remove all .md file in /website/docs/examples/ like you did. But we cannot control the order of example. And if we want to tweak something by adding more fields in front matter. It might be not possible. (or we can just add the front matter directly to README.md file??)

website/docs/examples/create-react-app.md Show resolved Hide resolved
Comment on lines -11 to -13
## Caveats

Next's `<Image />` component has yet to work with Jest Preview.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not mentioned in https://github.com/nvh95/jest-preview/tree/main/examples/nextjs-babel
Please help to move it there.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same 👇

Actually they are there

🚧 Next.js's component isn't working with Jest Preview yet.

Comment on lines -13 to -15
## Caveats

Next's `<Image />` component has yet to work with Jest Preview.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not mentioned in https://github.com/nvh95/jest-preview/tree/main/examples/nextjs
Please help to move it there.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually they are there

🚧 Next.js's <Image /> component isn't working with Jest Preview yet.

const path = require('path');

const rootExamples = '../../examples';
const webDocs = '../docs/examples';
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current build is failed.
https://app.netlify.com/sites/jest-preview-library/deploys/62bc8bb04f81ca0009cc8374

Remember the build settings

  • the base directory is website
  • the command to build is npm run build
    image

You might need to adjust the script.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is an issue with build, because all over the docs and examples relative paths are used. I have fixed some with last code fix, but what do you think, maybe we should go with absolute paths?

Comment on lines 1 to 11
# Use with Jest 24

This example demonstrates how to use `jest-preview` with `jest-24`. The main intention of this example is to make sure Jest Preview works with Jest 24

## Setup jest with vite

If you haven't set up jest with vite yet, you can see how to do it at [Setup Jest with Vite](https://hung.dev/jest-vite) ([repo](https://github.com/nvh95/jest-with-vite)).

## Installation and Usage

Please refer to [Installation](../getting-started/installation.md) and [Usage](../getting-started/usage.md).
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, we don't need to add every example to the docs site.
The idea of examples folder I learned from Next.js (https://github.com/vercel/next.js/tree/canary/examples)
They attracts contributors to contribute by examples. And it's very easy for anyone to find their corresponding technology in examples folder.

It will be a ridiculous huge folder in the future. So I think we don't want to put every example to www.jest-preview.com

Copy link
Owner

@nvh95 nvh95 Jun 29, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For example, jest-24 serve a little bit like an integration test, more than an example.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, before we move to other comments and fixes, we need some sort of mapping of which examples we want to include, so then I can filter them out and work from there

@nvh95 nvh95 self-assigned this Jul 10, 2022
@nvh95 nvh95 force-pushed the 171-create-script-to-sync-examples branch from b9aa0f8 to 98955bf Compare July 20, 2022 17:28
@nvh95 nvh95 merged commit d3b721d into main Jul 20, 2022
@nvh95 nvh95 deleted the 171-create-script-to-sync-examples branch July 20, 2022 17:36
@nvh95
Copy link
Owner

nvh95 commented Jul 21, 2022

@all-contributors please add @skirianov for code

@allcontributors
Copy link
Contributor

@nvh95

I've put up a pull request to add @skirianov! 🎉

@nvh95
Copy link
Owner

nvh95 commented Jul 21, 2022

@all-contributors please add @skirianov for code

@allcontributors
Copy link
Contributor

@nvh95

I've put up a pull request to add @skirianov! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create a script to keep GitHub examples README in sync with website docs pages.
2 participants