diff --git a/docs/guide/builder/index.md b/docs/guide/builder/index.md
index 3a207f1..35d084a 100644
--- a/docs/guide/builder/index.md
+++ b/docs/guide/builder/index.md
@@ -39,20 +39,20 @@ Using *Backan* `Builder` is simple and will work in most cases, but that may no
import {build} from '@backan/builder'
await build( {
- input : 'src/server.ts', // JS or TS file
- name : 'my-app-name', // default is input filename
+ input : 'src/server.js', // JS or TS file
+ name : 'app-name', // default is input filename
} )
```
```bash
-backan-builder --input=src/server.ts --name=backan
+backan-builder --input=src/server.js --name=app-name
```
:::
### ⚙️ Configuration
-Todas estas opciones estan disponibles con el comando `backan-builder` añadiendole el sufijo `--` y seguidos de un `=` y su valor. Por ejemplo: `--input=src/server.ts --name=backan --onlyOs`
+All of these options are available with the `backan-builder` command by adding the suffix `--` and followed by an `=` and its value.
```ts
type BuilderParams = {
@@ -93,7 +93,7 @@ import {app} from './your-backan-app.js'
buildSchema( {
app : app,
- output : 'example-openapi.json',
+ output : 'openapi-schema.json',
} )
```
@@ -112,7 +112,7 @@ export type BuilderSchemaParams = {
}
```
-## Build `markdown` documentation
+## Build `Markdown` documentation
```js
import {buildMD} from '@backan/builder'
@@ -120,7 +120,7 @@ import {app} from './your-backan-app.js'
buildMD( {
app : app,
- output : 'example-openapi.md',
+ output : 'api-documentation.md',
} )
```
diff --git a/docs/guide/core/app.md b/docs/guide/core/app.md
index 8c8fe66..f400fb3 100644
--- a/docs/guide/core/app.md
+++ b/docs/guide/core/app.md
@@ -10,7 +10,6 @@ import { App } from 'backan';
const app = new App( {
version : '1.0.0',
title : 'BACKAN Example app',
- port : 1312,
})
export default app
diff --git a/docs/guide/create/index.md b/docs/guide/create/index.md
index 3d610a6..31f21f7 100644
--- a/docs/guide/create/index.md
+++ b/docs/guide/create/index.md
@@ -4,6 +4,8 @@ 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)
+
+
## CLI
diff --git a/docs/guide/index.md b/docs/guide/index.md
index 78c0489..3f70a73 100644
--- a/docs/guide/index.md
+++ b/docs/guide/index.md
@@ -53,8 +53,8 @@ Start building your restAPI app now 🌈.
## 📦 Build your project
-- Build your app documentation in a `markdown file`.
-- Export to `openapi schema` to a `json file`.
-- Build `binaries` of your project for all **systems** and **architectures**.
+- Create [`binaries`](./builder/index.md#build-binaries) of your project for all **systems** and **architectures** with zero config.
+- Export the `OpenAPI schema` to a [`JSON file`](./builder/index.md#build-json-schema).
+- Build your application documentation in a [`Markdown file`](./builder/index.md#build-markdown-documentation).
[Read more](./builder/index.md)
diff --git a/docs/guide/server/index.md b/docs/guide/server/index.md
index b3a2ee8..653468b 100644
--- a/docs/guide/server/index.md
+++ b/docs/guide/server/index.md
@@ -24,17 +24,14 @@ yarn add @backan/server
import {server} from '@backan/server'
import {App} from 'backan'
-// create base backan app
+// create backan app
const app = new App( {
version : '1.0.0',
- title : 'BACKAN Example app',
- port : 1312,
+ title : 'BACKAN sample application',
})
// create server for backan
-server({
- fetch: app.fetch
-})
+server({ app })
```
@@ -51,10 +48,10 @@ Here is a list of the available options.
*/
type ServerOpts = {
/**
- * The fetch handler for the server.
+ * The `backan` app instance.
*
*/
- fetch: App['fetch'],
+ app: App,
/**
* The port to start the server on.
*
@@ -145,11 +142,27 @@ type ServerInfo = {
## 💡 Examples
+### Zero config
+
+```js
+/**
+ * Start a server with zero config for BACKAN
+ *
+ * @see https://backan.pigeonposse.com/guide/server
+ */
+
+import { server } from '@backan/server'
+import app from './app.js' // your backan app
+
+await server({ app })
+
+```
+
### Fully customized
```js
/**
- * Starts a node server with BACKAN Fully customized
+ * Start a fully customized server for BACKAN
*
* @see https://backan.pigeonposse.com/guide/server
*/
@@ -158,10 +171,10 @@ import { server } from '@backan/server'
import app from './app.js' // your backan app
await server( {
- fetch : app.fetch,
+ app : app,
hostname : 'localhost',
protocol : 'http',
- port : app.port,
+ port : 1312,
autoPort : true,
allowFlags : true,
onError : async ( { id, error } ) => {
diff --git a/docs/public/backan-create.png b/docs/public/backan-create.png
new file mode 100644
index 0000000..6ce5a30
Binary files /dev/null and b/docs/public/backan-create.png differ
diff --git a/docs/todo/v1.md b/docs/todo/v1.md
index 9320f9f..a44a2b3 100644
--- a/docs/todo/v1.md
+++ b/docs/todo/v1.md
@@ -32,5 +32,5 @@
- [x] Finish beta.
- [x] Add js templates
-- [ ] Add tests to templates
+- [x] Add tests to templates
- [ ] create templates dynamically avoiding repeating code
diff --git a/packages/_config/CHANGELOG.md b/packages/_config/CHANGELOG.md
index 6875415..2bab054 100644
--- a/packages/_config/CHANGELOG.md
+++ b/packages/_config/CHANGELOG.md
@@ -1,5 +1,11 @@
# @backan/config
+## 0.0.6
+
+### Patch Changes
+
+- Update create repo and fix server repo
+
## 0.0.5
### Patch Changes
diff --git a/packages/_config/package.json b/packages/_config/package.json
index e5959f1..53cc989 100644
--- a/packages/_config/package.json
+++ b/packages/_config/package.json
@@ -1,11 +1,11 @@
{
"private": true,
"name": "@backan/config",
- "version": "0.0.5",
+ "version": "0.0.6",
"description": "Configuration files for monorepo",
"type": "module",
"scripts": {
- "test": "vitest run -r tests --passWithNoTests"
+ "test": "vitest run -r src --passWithNoTests"
},
"dependencies": {
"@types/archiver": "6.0.2",
diff --git a/packages/_config/src/tests/main.test.ts b/packages/_config/src/tests/main.test.ts
index 8f5392d..c70de41 100644
--- a/packages/_config/src/tests/main.test.ts
+++ b/packages/_config/src/tests/main.test.ts
@@ -15,6 +15,7 @@ test( async ( { section } ) => {
},
} )
+
addBooleanTest( {
title : 'boolean test',
expected : true,
diff --git a/packages/_config/src/tests/main.ts b/packages/_config/src/tests/main.ts
index c13a710..a38c701 100644
--- a/packages/_config/src/tests/main.ts
+++ b/packages/_config/src/tests/main.ts
@@ -48,8 +48,7 @@ export const test = ( fn: ( args: TestParams ) => Promise ) => {
const vifn = vi.fn( async () => {
- // eslint-disable-next-line no-async-promise-executor
- return new Promise( async ( resolve, reject ) => {
+ return new Promise( async ( resolve, reject ) => {
try {
@@ -68,6 +67,7 @@ export const test = ( fn: ( args: TestParams ) => Promise ) => {
} )
} )
+
const res = await vifn()
expect( res ).toBe( expected )
diff --git a/packages/backan/CHANGELOG.md b/packages/backan/CHANGELOG.md
index a810861..8c143e4 100644
--- a/packages/backan/CHANGELOG.md
+++ b/packages/backan/CHANGELOG.md
@@ -1,5 +1,12 @@
# backan
+## 0.0.14
+
+### Patch Changes
+
+- Updated dependencies []:
+ - @backan/core@0.0.14
+
## 0.0.13
### Patch Changes
diff --git a/packages/backan/package.json b/packages/backan/package.json
index 3911b34..34ab7bc 100644
--- a/packages/backan/package.json
+++ b/packages/backan/package.json
@@ -1,6 +1,6 @@
{
"name": "backan",
- "version": "0.0.13",
+ "version": "0.0.14",
"type": "module",
"license": "GPL-3.0",
"homepage": "https://backan.pigeonposse.com",
diff --git a/packages/builder/CHANGELOG.md b/packages/builder/CHANGELOG.md
index 866857f..c677608 100644
--- a/packages/builder/CHANGELOG.md
+++ b/packages/builder/CHANGELOG.md
@@ -1,5 +1,7 @@
# @backan/builder
+## 0.0.14
+
## 0.0.13
### Patch Changes
diff --git a/packages/builder/package.json b/packages/builder/package.json
index 84e70a9..1c29269 100644
--- a/packages/builder/package.json
+++ b/packages/builder/package.json
@@ -1,6 +1,6 @@
{
"name": "@backan/builder",
- "version": "0.0.13",
+ "version": "0.0.14",
"type": "module",
"license": "GPL-3.0",
"homepage": "https://backan.pigeonposse.com/",
diff --git a/packages/core/CHANGELOG.md b/packages/core/CHANGELOG.md
index 40a3e40..086dc66 100644
--- a/packages/core/CHANGELOG.md
+++ b/packages/core/CHANGELOG.md
@@ -1,5 +1,7 @@
# @backan/core
+## 0.0.14
+
## 0.0.13
## 0.0.12
diff --git a/packages/core/package.json b/packages/core/package.json
index c31fbd0..4cc1c70 100644
--- a/packages/core/package.json
+++ b/packages/core/package.json
@@ -1,6 +1,6 @@
{
"name": "@backan/core",
- "version": "0.0.13",
+ "version": "0.0.14",
"type": "module",
"license": "GPL-3.0",
"homepage": "https://backan.pigeonposse.com",
diff --git a/packages/create/CHANGELOG.md b/packages/create/CHANGELOG.md
index 82d6069..12233a3 100644
--- a/packages/create/CHANGELOG.md
+++ b/packages/create/CHANGELOG.md
@@ -1,5 +1,11 @@
# create-backan
+## 0.0.14
+
+### Patch Changes
+
+- Update create repo and fix server repo
+
## 0.0.13
## 0.0.12
diff --git a/packages/create/examples/all.ts b/packages/create/examples/all.ts
new file mode 100644
index 0000000..c5ec3a9
--- /dev/null
+++ b/packages/create/examples/all.ts
@@ -0,0 +1,39 @@
+
+import { create } from '../src/main'
+import { TEMPLATES } from '../src/const'
+import {
+ joinPath,
+ paths,
+ removePathIfExist,
+} from '@backan/config/core'
+
+process.argv.push( '--debug' )
+
+process.on( 'exit', code => {
+
+ console.log( {
+ title : 'On exit',
+ data : {
+ success : code === 0,
+ code,
+ },
+ } )
+
+} )
+
+for ( const TEMPLATE of Object.values( TEMPLATES ) ) {
+
+ const input = joinPath( paths.createDir, 'build' )
+ const name = 'examples-' + TEMPLATE
+ const inputPath = joinPath( input, name )
+
+ await removePathIfExist( inputPath )
+
+ await create( {
+ input,
+ name,
+ install : false,
+ template : TEMPLATE,
+ } )
+
+}
diff --git a/packages/create/examples/main.ts b/packages/create/examples/main.ts
index 9fea9f8..1e80624 100644
--- a/packages/create/examples/main.ts
+++ b/packages/create/examples/main.ts
@@ -5,7 +5,7 @@ import {
import { create } from '../src/main'
import { TEMPLATES } from '../src/const'
-const input = joinPath( paths.createDir, 'dist' )
+const input = joinPath( paths.createDir, 'build' )
const template = TEMPLATES.DEMO_TS
const name = 'examples-' + template
const inputPath = joinPath( input, name )
diff --git a/packages/create/package.json b/packages/create/package.json
index a5d159a..d6495ad 100644
--- a/packages/create/package.json
+++ b/packages/create/package.json
@@ -1,6 +1,6 @@
{
"name": "create-backan",
- "version": "0.0.13",
+ "version": "0.0.14",
"type": "module",
"license": "GPL-3.0",
"homepage": "https://backan.pigeonposse.com",
diff --git a/packages/create/src/bin.ts b/packages/create/src/bin.ts
index 0ee57bd..58c07b2 100644
--- a/packages/create/src/bin.ts
+++ b/packages/create/src/bin.ts
@@ -97,54 +97,7 @@ await group( {
},
} )
- // try{
- // while ( !validName ) {
-
- // if ( projectName !== undefined ) {
-
- // log.success( `Name of project: ${gray( projectName )}` )
- // break
-
- // }
-
- // projectName = await text( {
- // message : 'What is the name of the project?',
- // placeholder : name.toLowerCase() + '-project',
- // } ) as string
-
- // if ( typeof projectName === 'string' ) {
-
- // if ( !isValidProjectName( projectName ) ) {
-
- // log.error( 'The project name contains invalid characters. Only letters, numbers, hyphens, and underscores are allowed.' )
- // projectName = undefined // Reset to ask again
- // continue
-
- // }
-
- // const inputDir = resolvePath( projectName )
- // const existsInput = await existsPath( inputDir )
-
- // if ( existsInput ) {
-
- // log.error( `The project name "${projectName}" already exists. Please choose a different name.` )
- // projectName = undefined // Reset to ask again
-
- // } else validName = true
-
- // }
-
- // }
-
- // }catch( _e ){
-
- // cancelRes( )
-
- // }
-
- // return projectName
-
},
[OPTS.TEMPLATE] : async () => {
diff --git a/packages/create/src/main.test.ts b/packages/create/src/main.test.ts
index 5c60f89..126d6fc 100644
--- a/packages/create/src/main.test.ts
+++ b/packages/create/src/main.test.ts
@@ -2,49 +2,45 @@ import { test } from '@backan/config/tests'
import { create } from './main'
import { TEMPLATES } from './const'
-test( async ( { section, utils } ) => {
-
- section( {
- title : 'Create templates',
- fn : async ( { addBooleanTest } ) => {
+test( async ( { section, utils } ) => ( section( {
+ title : 'Create templates',
+ fn : async ( { addBooleanTest } ) => {
- addBooleanTest( {
- title : 'Create all templates in ./dist path',
- expected : true,
- fn : async ( ) => {
+ await addBooleanTest( {
+ title : 'Create all templates in ./dist path',
+ expected : true,
+ fn : async ( ) => {
- try{
+ try{
- for ( const TEMPLATE of Object.values( TEMPLATES ) ) {
+ for ( const TEMPLATE of Object.values( TEMPLATES ) ) {
- const input = utils.joinPath( utils.paths.createDir, 'dist' )
- const name = 'test-' + TEMPLATE
- const inputPath = utils.joinPath( input, name )
+ const input = utils.joinPath( utils.paths.createDir, 'dist' )
+ const name = 'test-' + TEMPLATE
+ const inputPath = utils.joinPath( input, name )
- await utils.removePathIfExist( inputPath )
-
- await create( {
- input,
- name,
- install : false,
- template : TEMPLATE,
- } )
+ await utils.removePathIfExist( inputPath )
+
+ await create( {
+ input,
+ name,
+ install : false,
+ template : TEMPLATE,
+ } )
- }
+ }
- return true
+ return true
- }catch( _e ){
+ }catch( _e ){
- console.log( _e )
- return false
+ console.error( _e )
+ return false
- }
+ }
- },
- } )
+ },
+ } )
- },
- } )
-
-} )
+ },
+} ) ) )
diff --git a/packages/create/src/main.ts b/packages/create/src/main.ts
index b310098..8dbb62a 100644
--- a/packages/create/src/main.ts
+++ b/packages/create/src/main.ts
@@ -202,7 +202,7 @@ export const create = async ( {
log.step( '' )
outro( `🔥 Let's work with ${green( 'backan' )} 🔥` )
- process.exit( 0 )
+ // process.exit( 0 )
},
onExit : async () => {
diff --git a/packages/docs/CHANGELOG.md b/packages/docs/CHANGELOG.md
index 9705efa..c535622 100644
--- a/packages/docs/CHANGELOG.md
+++ b/packages/docs/CHANGELOG.md
@@ -1,5 +1,7 @@
# @backan/docs
+## 0.0.14
+
## 0.0.13
## 0.0.12
diff --git a/packages/docs/package.json b/packages/docs/package.json
index 11767ba..0d88612 100644
--- a/packages/docs/package.json
+++ b/packages/docs/package.json
@@ -1,7 +1,7 @@
{
"private": true,
"name": "@backan/docs",
- "version": "0.0.13",
+ "version": "0.0.14",
"description": "Documentation for backan",
"type": "module",
"repository": {
diff --git a/packages/server/CHANGELOG.md b/packages/server/CHANGELOG.md
index 11e6afd..f7aecee 100644
--- a/packages/server/CHANGELOG.md
+++ b/packages/server/CHANGELOG.md
@@ -1,5 +1,11 @@
# @backan/server
+## 0.0.14
+
+### Patch Changes
+
+- Update create repo and fix server repo
+
## 0.0.13
## 0.0.12
diff --git a/packages/server/examples/app.ts b/packages/server/examples/app.ts
index 8e4ca68..1274211 100644
--- a/packages/server/examples/app.ts
+++ b/packages/server/examples/app.ts
@@ -6,13 +6,11 @@ import {
import { bugs } from '../../../package.json'
import { version } from '../package.json'
-import { port } from '../vite.config'
const app = new App( {
version,
title : 'BACKAN Example app',
description : 'API documentation for BACKAN Example',
- port : port,
cors : {
origin : '*',
allowMethods : [
diff --git a/packages/server/examples/node.ts b/packages/server/examples/node.ts
index 715be6d..5a1267b 100644
--- a/packages/server/examples/node.ts
+++ b/packages/server/examples/node.ts
@@ -1,12 +1,13 @@
import { server } from '../src/main'
import app from './app'
+import { port } from '../vite.config'
await server( {
- fetch : app.fetch,
+ app : app,
hostname : 'localhost',
protocol : 'http',
- port : app.port,
+ port : port,
autoPort : true,
allowFlags : true,
onError : async ( { id, error } ) => {
diff --git a/packages/server/package.json b/packages/server/package.json
index 323fb73..8367577 100644
--- a/packages/server/package.json
+++ b/packages/server/package.json
@@ -1,6 +1,6 @@
{
"name": "@backan/server",
- "version": "0.0.13",
+ "version": "0.0.14",
"type": "module",
"license": "GPL-3.0",
"homepage": "https://backan.pigeonposse.com",