-
-
Notifications
You must be signed in to change notification settings - Fork 358
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
241 additions
and
55 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
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 |
---|---|---|
@@ -1,64 +1,21 @@ | ||
import { Link, Warning } from '@brillout/docpress' | ||
import { UiFrameworkExtension, CustomIntegrationWarning } from '../../components' | ||
import { Link } from '@brillout/docpress' | ||
import { UiFrameworkExtension } from '../../components' | ||
import { BatiWidget } from './BatiWidget.tsx' | ||
import { BatiNote } from './BatiNote.tsx' | ||
|
||
<div style={{height: 30}}></div> | ||
|
||
## Bati | ||
<BatiWidget /> | ||
|
||
We recommend using [Bati](https://batijs.dev) for creating new Vike apps. | ||
<BatiNote /> | ||
|
||
> **Requirement**: you'll need [Node.js](https://nodejs.org) installed (or Deno/Bun). Note that Node.js includes the package manager `npm` (but you can also use any other package manager). | ||
<div style={{height: 10}}></div> | ||
|
||
> Apps scaffolded by Bati use <UiFrameworkExtension name />. | ||
## Without `vike-{react,vue,solid}` | ||
|
||
You can also create a new Vike app that doesn't use <UiFrameworkExtension name />. | ||
|
||
The following command scaffolds a Vike app with a fully custom React/Vue integration instead. | ||
|
||
<CustomIntegrationWarning /> | ||
|
||
With [npm](https://www.npmjs.com): | ||
|
||
```shell | ||
npm create vike-core@latest | ||
``` | ||
|
||
With [pnpm](https://pnpm.io): | ||
|
||
```shell | ||
pnpm create vike-core | ||
``` | ||
|
||
With [Bun](https://bun.sh): | ||
|
||
```shell | ||
bun create vike-core | ||
``` | ||
|
||
With [Yarn](https://yarnpkg.com): | ||
|
||
```shell | ||
yarn create vike-core | ||
``` | ||
|
||
Options: | ||
- `--skip-git`: don't initialize a new Git repository | ||
|
||
A prompt will let you choose between: | ||
- `react`: React + JavaScript | ||
- `react-ts`: React + TypeScript | ||
- `vue`: Vue + JavaScript | ||
- `vue-ts`: Vue + TypeScript | ||
|
||
See also: | ||
- [GitHub > `vikejs/vike` > `boilerplates/`](https://github.com/vikejs/vike/tree/main/boilerplates) | ||
- [GitHub > `vikejs/vike` > `examples/react-minimal`](https://github.com/vikejs/vike/tree/main/examples/react-minimal) | ||
- [GitHub > `vikejs/vike` > `examples/react-full`](https://github.com/vikejs/vike/tree/main/examples/react-full) | ||
- [GitHub > `vikejs/vike` > `examples/vue-minimal`](https://github.com/vikejs/vike/tree/main/examples/vue-minimal) | ||
- [GitHub > `vikejs/vike` > `examples/vue-full`](https://github.com/vikejs/vike/tree/main/examples/vue-full) | ||
> **Requirement:** you need [Node.js](https://nodejs.org) installed (or Deno/Bun). It includes the package manager `npm` (you can also use any other package manager). | ||
> Scaffolded apps use Vike extensions such as <UiFrameworkExtension name />. See <Link href="/new/core">vike.dev/new/core</Link> if you want to scaffold an app that directly uses Vike core (without any Vike extension). | ||
## See also | ||
|
||
- <Link href="/new/core" /> | ||
- <Link href="/add" /> |
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,31 @@ | ||
export { BatiNote } | ||
|
||
import React from 'react' | ||
import batiLogo from './bati-logo.svg' | ||
const batiLogoSize = 16 | ||
|
||
function BatiNote() { | ||
return ( | ||
<p | ||
style={{ | ||
color: '#888', | ||
fontSize: '14px', | ||
textAlign: 'center' | ||
}} | ||
> | ||
Powered by{' '} | ||
<a href="https://github.com/vikejs/bati"> | ||
Bati{' '} | ||
<img | ||
src={batiLogo} | ||
style={{ | ||
width: batiLogoSize, | ||
height: batiLogoSize, | ||
display: 'inline-block', | ||
verticalAlign: 'text-top' | ||
}} | ||
/> | ||
</a> | ||
</p> | ||
) | ||
} |
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,42 @@ | ||
export { BatiWidget } | ||
|
||
import React, { useEffect, useState } from 'react' | ||
import { assert } from '@brillout/docpress' | ||
|
||
const scriptSrc = 'https://unpkg.com/@batijs/elements/dist/elements/full.js' | ||
|
||
function BatiWidget() { | ||
const [isLoading, setIsLoading] = useState(true) | ||
useEffect(() => { | ||
if (wasAdded()) { | ||
setIsLoading(false) | ||
return | ||
} | ||
const script = document.createElement('script') | ||
script.type = 'module' | ||
script.src = scriptSrc | ||
script.onload = () => { | ||
setIsLoading(false) | ||
} | ||
document.head.appendChild(script) | ||
assert(wasAdded()) | ||
}, []) | ||
if (isLoading) { | ||
return ( | ||
<div style={{ textAlign: 'center', fontSize: '2em', margin: 100, paddingBottom: 50 }}>Loading scaffolder...</div> | ||
) | ||
} | ||
return ( | ||
<> | ||
<div className="container"> | ||
{/* @ts-expect-error */} | ||
<bati-widget theme="light"></bati-widget> | ||
</div> | ||
</> | ||
) | ||
} | ||
|
||
function wasAdded() { | ||
const el = document.querySelector(`script[src="${scriptSrc}"]`) | ||
return !!el | ||
} |
Oops, something went wrong.