1
1
mirror of https://github.com/mdx-js/mdx.git synced 2024-10-03 19:07:42 +03:00

Remove examples from monorepo (#1681)

This commit is contained in:
Titus 2021-09-26 17:39:27 +02:00 committed by GitHub
parent 2b806ae902
commit 70742c9ff1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
38 changed files with 7011 additions and 39457 deletions

6
.gitignore vendored
View File

@ -3,12 +3,6 @@
.eslintcache
coverage/
node_modules/
/examples/next/build/
/examples/next/.next/
/examples/parcel/dist/
/examples/parcel/build/
/examples/react-web-components/build/
/examples/react-web-components/.next/
/packages/loader/lib/**/*.d.ts
/packages/loader/test/**/*.d.ts
/packages/mdx/**/*.d.ts

View File

@ -1,10 +1,3 @@
examples/gatsby/.cache/
examples/next/.next/
examples/next/build/
examples/parcel/build/
examples/parcel/dist/
examples/react-web-components/.next/
examples/react-web-components/build/
node_modules/
coverage/
public/

View File

@ -1,4 +1,4 @@
module.exports = {
babelrcRoots: ['.', './docs', './packages/*', './examples/*/*'],
babelrcRoots: ['.', './docs', './packages/*'],
presets: [['@babel/preset-react', {runtime: 'automatic'}]]
}

View File

@ -1,3 +0,0 @@
node_modules
.cache
public

View File

@ -1,12 +0,0 @@
module.exports = {
plugins: [
{
resolve: 'gatsby-plugin-mdx',
options: {
defaultLayouts: {
default: require.resolve('./src/components/Layout')
}
}
}
]
}

View File

@ -1,21 +0,0 @@
{
"name": "gatsby-example",
"private": true,
"repository": {
"type": "git",
"url": "https://github.com/mdx-js/mdx",
"directory": "examples/gatsby"
},
"scripts": {
"build": "gatsby build",
"start": "gatsby develop"
},
"dependencies": {
"@mdx-js/mdx": "^1.0.0",
"@mdx-js/react": "^1.0.0",
"gatsby": "^3.0.0",
"gatsby-plugin-mdx": "^2.0.0",
"react": "^17.0.0",
"react-dom": "^17.0.0"
}
}

View File

@ -1,27 +0,0 @@
# Gatsby + MDX
> [Try it on CodeSandbox](https://codesandbox.io/s/github/mdx-js/mdx/tree/main/examples/gatsby)
> [More information on our website](https://mdxjs.com/getting-started/gatsby/)
> [More information on `gatsby-plugin-mdx`](https://www.gatsbyjs.com/plugins/gatsby-plugin-mdx/)
> (their site)
Install:
```sh
npm install
```
Then, to start a development server:
```sh
npm start
```
Alternatively, to build for production and serve the resulting `public/`:
```sh
npm run build
npx serve public/
```

View File

@ -1,3 +0,0 @@
const Layout = ({children}) => children
export default Layout

View File

@ -1 +0,0 @@
# Hello, world!

View File

@ -1,14 +0,0 @@
const images = require('remark-images')
const emoji = require('remark-emoji')
// See <https://github.com/vercel/next.js/tree/canary/packages/next-mdx> for
// more info.
const withMDX = require('@next/mdx')({
options: {
remarkPlugins: [images, emoji]
}
})
module.exports = withMDX({
pageExtensions: ['js', 'jsx', 'mdx']
})

View File

@ -1,24 +0,0 @@
{
"name": "next-example",
"private": true,
"repository": {
"type": "git",
"url": "https://github.com/mdx-js/mdx",
"directory": "examples/next"
},
"scripts": {
"build": "next build && next export -o build/",
"start": "next"
},
"dependencies": {
"@mdx-js/loader": "^1.0.0",
"@mdx-js/mdx": "^1.0.0",
"@mdx-js/react": "^1.0.0",
"@next/mdx": "^11.0.0",
"next": "^11.0.0",
"react": "^17.0.0",
"react-dom": "^17.0.0",
"remark-emoji": "^2.0.0",
"remark-images": "^2.0.0"
}
}

View File

@ -1,9 +0,0 @@
import React from 'react'
const components = {
h1: props => <h1 style={{color: 'tomato'}} {...props} />
}
const Page = ({Component}) => <Component components={components} />
export default Page

View File

@ -1,3 +0,0 @@
# 👋 Hello, world!
This is MDX!

View File

@ -1,27 +0,0 @@
# Next.js + MDX
> [Try it on CodeSandbox](https://codesandbox.io/s/github/mdx-js/mdx/tree/main/examples/next)
> [More information on our website](https://mdxjs.com/getting-started/next/)
> [More information on `@next/mdx`](https://github.com/vercel/next.js/tree/canary/packages/next-mdx)
> (their repo)
Install:
```sh
npm install
```
Then, to start a development server:
```sh
npm start
```
Alternatively, to build for production and serve the resulting `build/`:
```sh
npm run build
npx serve build/
```

View File

@ -1,14 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>Parcel Plugin MDX Example</title>
</head>
<body>
<div id="demo"></div>
<script src="src/main.js" type="module"></script>
</body>
</html>

View File

@ -1,20 +0,0 @@
{
"name": "parcel-example",
"private": true,
"repository": {
"type": "git",
"url": "https://github.com/mdx-js/mdx",
"directory": "examples/parcel"
},
"scripts": {
"build": "parcel build --dist-dir build index.html",
"start": "parcel serve index.html"
},
"devDependencies": {
"@mdx-js/react": "^1.0.0",
"@parcel/transformer-mdx": "^2.0.0-rc.0",
"parcel": "^2.0.0-rc.0",
"react": "^17.0.0",
"react-dom": "^17.0.0"
}
}

View File

@ -1,24 +0,0 @@
# Parcel + MDX
> [Try it on CodeSandbox](https://codesandbox.io/s/github/mdx-js/mdx/tree/main/examples/parcel)
> [More information on our website](https://mdxjs.com/getting-started/parcel/)
Install:
```sh
npm install
```
Then, to start a development server:
```sh
npm start
```
Alternatively, to build for production and serve the resulting `build/`:
```sh
npm run build
npx serve build/
```

View File

@ -1,3 +0,0 @@
# Hello, world!
This is MDX!

View File

@ -1,16 +0,0 @@
import React from 'react'
import {render} from 'react-dom'
import {MDXProvider} from '@mdx-js/react'
import Content from './content.mdx'
const components = {
h1: props => <h1 style={{color: 'tomato'}} {...props} />
}
render(
<MDXProvider components={components}>
<Content />
</MDXProvider>,
document.querySelector('#demo')
)

View File

@ -1,5 +0,0 @@
const withMDX = require('@next/mdx')()
module.exports = withMDX({
pageExtensions: ['js', 'jsx', 'mdx']
})

View File

@ -1,22 +0,0 @@
{
"name": "react-web-components-example",
"private": true,
"repository": {
"type": "git",
"url": "https://github.com/mdx-js/mdx",
"directory": "examples/react-web-components"
},
"scripts": {
"build": "next build && next export -o build/",
"start": "next"
},
"dependencies": {
"@mdx-js/loader": "^1.0.0",
"@mdx-js/mdx": "^1.0.0",
"@mdx-js/react": "^1.0.0",
"@next/mdx": "^11.0.0",
"next": "^11.0.0",
"react": "^17.0.0",
"react-dom": "^17.0.0"
}
}

View File

@ -1,5 +0,0 @@
import React from 'react'
const Page = ({Component}) => <Component />
export default Page

View File

@ -1,40 +0,0 @@
import React, {useRef, useEffect} from 'react'
const ImperativeCounter =
typeof window === 'undefined'
? () => {}
: class extends HTMLElement {
constructor() {
super()
this.shadow = this.attachShadow({mode: 'open'})
this.currentCount = 0
this.update()
}
update() {
this.shadow.innerHTML = `<div><h2>Count: ${this.currentCount}</h2></div>`
}
increment() {
this.currentCount++
this.update()
}
}
const Counter = () => {
useEffect(() => {
window.customElements.define('i-counter', ImperativeCounter)
}, [])
const counterElement = useRef(null)
return (
<div>
<i-counter ref={counterElement}></i-counter>
<button onClick={() => counterElement.current.increment()}>
Increment
</button>
</div>
)
}
export default Counter

View File

@ -1,5 +0,0 @@
import Counter from './components/Counter.js'
# Hello, world!
<Counter/>

View File

@ -1,26 +0,0 @@
# React + MDX: Web components
> [Try it on CodeSandbox](https://codesandbox.io/s/github/mdx-js/mdx/tree/main/examples/react-web-components)
> More information about
> [Using Web Components in React](https://reactjs.org/docs/web-components.html)
> (their website).
Install:
```sh
npm install
```
Then, to start a development server:
```sh
npm start
```
Alternatively, to build for production and serve the resulting `build/`:
```sh
npm run build
npx serve build/
```

View File

@ -1,32 +0,0 @@
import React from 'react'
import {render, Box, Text} from 'ink'
import MDX from '@mdx-js/runtime'
const content = `
# Hello, world!
From <Text backgroundColor="black" color="white" bold>MDX!</Text>
<Box marginTop={1}>
<Text backgroundColor="cyan" color="white" bold>
I'm a cyan box!
</Text>
</Box>
`
render(
<MDX
components={{
Box,
Text,
h1: ({children}) => (
<Text underline bold>
{children}
</Text>
),
p: ({children}) => <Text>{children}</Text>
}}
>
{content}
</MDX>
)

View File

@ -1,21 +0,0 @@
{
"name": "terminal-example",
"private": true,
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/mdx-js/mdx",
"directory": "examples/terminal"
},
"scripts": {
"start": "node -r esbuild-register index.jsx"
},
"dependencies": {
"@mdx-js/mdx": "^1.0.0",
"@mdx-js/react": "^1.0.0",
"@mdx-js/runtime": "^1.0.0",
"esbuild-register": "^3.0.0",
"ink": "^3.0.0",
"react": "^17.0.0"
}
}

View File

@ -1,17 +0,0 @@
# Ink + MDX
> [Try it on CodeSandbox](https://codesandbox.io/s/github/mdx-js/mdx/tree/main/examples/shortcodes)
> More about [Ink on GitHub](https://github.com/vadimdemedes/ink).
Install:
```sh
npm install
```
Then to run the example:
```sh
npm start
```

View File

@ -1,12 +0,0 @@
{
"presets": [
[
"@babel/env",
{
"corejs": 3,
"useBuiltIns": "usage"
}
],
"@babel/react"
]
}

View File

@ -1,30 +0,0 @@
{
"name": "webpack-example",
"private": true,
"description": "",
"author": "Brent Jackson",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/mdx-js/mdx",
"directory": "examples/webpack"
},
"scripts": {
"build": "webpack",
"start": "webpack-dev-server"
},
"devDependencies": {
"@babel/core": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"@babel/preset-react": "^7.0.0",
"@mdx-js/loader": "^1.0.0",
"@mdx-js/mdx": "^1.0.0",
"@mdx-js/react": "^1.0.0",
"babel-loader": "^8.0.0",
"react": "^17.0.0",
"react-dom": "^17.0.0",
"webpack": "^5.0.0",
"webpack-cli": "^4.0.0",
"webpack-dev-server": "^4.0.0"
}
}

View File

@ -1,4 +0,0 @@
<!DOCTYPE html>
<meta charset="utf-8" />
<div id="root"></div>
<script src="main.js"></script>

View File

@ -1,15 +0,0 @@
# React + MDX: webpack
> [Try it on CodeSandbox](https://codesandbox.io/s/github/mdx-js/mdx/tree/main/examples/webpack)
Install:
```sh
npm install
```
Then, to start a development server:
```sh
npm start
```

View File

@ -1,3 +0,0 @@
# Hello, MDX!
This is an example using webpack

View File

@ -1,5 +0,0 @@
import React from 'react'
import {render} from 'react-dom'
import Hello from './hello.mdx'
render(<Hello />, document.getElementById('root'))

View File

@ -1,16 +0,0 @@
module.exports = {
mode: 'development',
module: {
rules: [
{
test: /\.js$/,
use: 'babel-loader',
exclude: /node_modules/
},
{
test: /\.mdx$/,
use: ['babel-loader', '@mdx-js/loader']
}
]
}
}

45963
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -16,13 +16,7 @@
"packages/vue",
"packages/mdx",
"packages/loader",
"packages/remark-mdx",
"examples/gatsby",
"examples/next",
"examples/parcel",
"examples/react-web-components",
"examples/terminal",
"examples/webpack"
"packages/remark-mdx"
],
"devDependencies": {
"@babel/core": "^7.0.0",

View File

@ -15,8 +15,7 @@ import React from 'react'
import {renderToStaticMarkup} from 'react-dom/server.js'
import {h} from 'preact'
import {render} from 'preact-render-to-string'
// eslint-disable-next-line import/default
import vue from 'vue'
import * as vue from 'vue'
// eslint-disable-next-line import/default
import serverRenderer from '@vue/server-renderer'