Skip to content

Commit

Permalink
📝 docs(docs): update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
angelespejo committed Dec 9, 2024
1 parent fa6225b commit 36de68c
Show file tree
Hide file tree
Showing 59 changed files with 579 additions and 6,592 deletions.
23 changes: 23 additions & 0 deletions .dovenv/core.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { defineConfig } from '@dovenv/core'
import {
asciiFont,
getCurrentDir,
getObjectFromJSONFile,
joinPath,
} from '@dovenv/core/utils'

const workspaceDir = joinPath( getCurrentDir( import.meta.url ), '..' )
const pkgPath = joinPath( workspaceDir, 'package.json' )
const pkg = await getObjectFromJSONFile( pkgPath )

export default defineConfig(
{
name : 'BACKAN',
desc : 'Workspace for backan 🔥',
const : {
workspaceDir,
pkg,
mark : `\n${asciiFont( `pigeonposse\n-------\n${pkg.extra.id}`, 'ANSI Shadow' )}\nAuthor: ${pkg.author.name}\n`,
},
},
)
30 changes: 11 additions & 19 deletions .dovenv/main.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,10 @@
import { defineConfig } from '@dovenv/core'
import {
asciiFont,
getCurrentDir,
getObjectFromJSONFile,
joinPath,
} from '@dovenv/core/utils'
import { defineConfig } from '@dovenv/core'
import { config as bandaTheme } from '@dovenv/theme-banda'

const workspaceDir = joinPath( getCurrentDir( import.meta.url ), '..' )
const pkgPath = joinPath( workspaceDir, 'package.json' )
const pkg = await getObjectFromJSONFile( pkgPath )
import corePlugin from './core.js'

export default defineConfig(
{
name : 'BACKAN',
desc : 'Workspace for backan 🔥',
const : {
workspaceDir,
pkg,
mark : `\n${asciiFont( `pigeonposse\n-------\n${pkg.extra.id}`, 'ANSI Shadow' )}\nAuthor: ${pkg.author.name}\n`,
},
},
corePlugin,
bandaTheme( {
repo : { commit : { scopes : [
{
Expand All @@ -45,6 +29,14 @@ export default defineConfig(
staged : { '*.{js,cjs,mjs,jsx,ts,cts,mts,tsx,json,yml,yaml}': 'pnpm --silent . lint eslint --silent' },
eslint : { flags: [ '--fix' ] },
},
todo : { ws : {
input : [ '**/*.{js,ts}', '**/*.md' ],
inputOpts : {
gitignore : true,
onlyFiles : true,
dot : true,
},
} },
workspace : { check : { pkg : { schema : async ( {
v, path, data,
} ) => {
Expand Down
4 changes: 4 additions & 0 deletions docs/contributors.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
layout: contributors
---

2 changes: 1 addition & 1 deletion docs/dev-dist/sw.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ define(['./workbox-8027588d'], (function (workbox) { 'use strict';
"revision": "3ca0b8505b4bec776b69afdba2768812"
}, {
"url": "index.html",
"revision": "0.q9pvp9fpvn8"
"revision": "0.464eql50f38"
}], {});
workbox.cleanupOutdatedCaches();
workbox.registerRoute(new workbox.NavigationRoute(workbox.createHandlerBoundToURL("index.html"), {
Expand Down
4 changes: 4 additions & 0 deletions docs/guide/builder/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ yarn add @backan/builder
bun add @backan/builder
```

```bash [deno]
deno add npm:@backan/builder
```

:::

[![NPM Version](https://img.shields.io/npm/v/@backan/builder?style=for-the-badge&color=yellow)](https://www.npmjs.com/package/@backan/builder)
Expand Down
46 changes: 7 additions & 39 deletions docs/guide/core/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,7 @@ Start building your restAPI app now 🌈.

## 🔑 Installation

::: code-group

```bash [npm]
npm install backan
```

```bash [pnpm]
pnpm add backan
```

```bash [yarn]
yarn add backan
```

```bash [bun]
bun add backan
```

:::
<!--@include: ../../partials/install.md-->

[![NPM Version](https://img.shields.io/npm/v/backan?style=for-the-badge&color=yellow)](https://www.npmjs.com/package/backan)

Expand All @@ -43,7 +25,11 @@ yarn add @backan/core
```

```bash [bun]
bun add backan
bun add backancore
```

```bash [deno]
deno add npm:backancore
```

:::
Expand All @@ -54,25 +40,7 @@ bun add backan

You can automatically create a `backan` template with:

::: code-group

```bash [npm]
npm create backan
```

```bash [pnpm]
pnpm create backan
```

```bash [yarn]
yarn create backan
```

```bash [bun]
bun create backan
```

:::
<!--@include: ../../partials/create.md-->

<video src="/backan-create.webm" controls/>

Expand Down
79 changes: 27 additions & 52 deletions docs/guide/create/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,30 @@ A `CLI` for creating new [Backan](https://backan.pigeonposse.com) project.

[![NPM Version](https://img.shields.io/npm/v/create-backan?style=for-the-badge&color=yellow)](https://www.npmjs.com/package/create-backan)

<!-- ![backan-image](/backan-create.png) -->
![backan-image](/create-banner.png)

<video src="/backan-create.webm" controls autoplay />

## CLI

<!--@include: ../../partials/create.md-->

```bash
# using NPM
npm create backan@latest
# using PNPM
pnpm create backan@latest
# using YARN
yarn create backan@latest
# using BUN
bun create backan@latest
Usage: create-backan [options]

Options:
--output Set the path where you want to create your project [string]
--name Set the name of the project [string]
--input Select project template [string]
[choices: "demo", "demo-ts", "skeleton", "skeleton-ts"]
--install Select the package manager to install the dependencies [string]
[choices: "npm", "pnpm", "yarn", "deno", "none"]
--openEditor Select the text editor to open the project [string]
[choices: "subl", "code", "webstorm", "none"]
--debug Set Debug mode [boolean]
-h, --help Show help [boolean]
-v, --version Show version number [boolean]

```

## API
Expand All @@ -29,62 +38,28 @@ You can also use `create-backan` programmatically
import { create } from 'create-backan';

await create( {
input : '.',
name : 'my-app-name',
template : 'demo',
install : false,
open : 'code',
output : './my-project',
name : 'my-app-name',
input : 'demo',
install : false,
openEditor : 'code',
});
```

## Parameters

```ts
export type CreateParams = {
/**
* Directory to build.
*
* @default .
*/
input?: string
/**
* The name of the project & dirmane.
*/
name?: string
/**
* The template to use for the project.
*
* @default demo
*/
template?: typeof TEMPLATES[keyof typeof TEMPLATES]
/**
* Whether to automatically install dependencies after creating the project.
*
* @default false
*/
install?: typeof INSTALL_OPTS[keyof typeof INSTALL_OPTS]
/**
* Specifies whether to open the project in an IDE or text editor after creation.
* Can be `false` for no IDE, or specify an IDE/editor to open.
* Supported options include:
* - `'code'`: Visual Studio Code
* - `'subl'`: Sublime Text
* - `'webstorm'`: WebStorm.
*
* @default false
*/
open?: typeof OPEN_OPTS[keyof typeof OPEN_OPTS]
}
```ts twoslash
import type { CreateParams } from 'create-backan';
```

## Examples

```bash
npm create backan@latest --name=my-app-name --template='skeleton' --open='code' --install='npm'
npm create backan@latest --name my-app-name --input 'skeleton' --install 'npm'
```

```bash
pnpm create backan@latest --name=my-app-name --template='skeleton' --open='code' --install='pnpm'
pnpm create backan@latest --name my-app-name --input 'skeleton' --install 'pnpm'
```

## library
Expand Down
8 changes: 8 additions & 0 deletions docs/guide/server/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ pnpm i @backan/server
yarn add @backan/server
```

```bash [bun]
bun add @backan/server
```

```bash [deno]
deno add npm:@backan/server
```

:::

[![NPM Version](https://img.shields.io/npm/v/@backan/server?style=for-the-badge&color=yellow)](https://www.npmjs.com/package/@backan/server)
Expand Down
16 changes: 4 additions & 12 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,10 @@ features:

---

::: code-group
## Install

```bash [npm]
npm install backan
```
<!--@include: ./partials/install.md-->

```bash [pnpm]
pnpm install backan
```
## Starter app

```bash [yarn]
yarn add backan
```

:::
<!--@include: ./partials/create.md-->
22 changes: 22 additions & 0 deletions docs/partials/create.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
::: code-group

```bash [npm]
npm create backan
```

```bash [pnpm]
pnpm create backan
```

```bash [yarn]
yarn create backan
```

```bash [bun]
bun create backan
```

```bash [deno]
deno init --npm backan
```
:::
23 changes: 23 additions & 0 deletions docs/partials/install.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
::: code-group

```bash [npm]
npm install backan
```

```bash [pnpm]
pnpm install backan
```

```bash [yarn]
yarn add backan
```

```bash [bun]
bun add backan
```

```bash [deno]
deno add npm:backan
```

:::
Binary file added docs/public/create-banner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/todo/v1.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
- [x] Finish beta.
- [x] Add js templates
- [x] Add tests to templates
- [ ] create templates dynamically avoiding repeating code
- [x] create templates dynamically avoiding repeating code

## 🧑‍💻 Development environment

Expand Down
Loading

0 comments on commit 36de68c

Please sign in to comment.