docs: update doc

This commit is contained in:
chenos 2021-10-08 00:32:40 +08:00
parent 2fa8280803
commit 04cdaae31c
4 changed files with 142 additions and 7 deletions

View File

@ -64,7 +64,7 @@ Database:
Installation
----------
Create a project with `create-nocobase-app`
### Create a project with `create-nocobase-app`
~~~shell
mkdir my-nocobase-app && cd my-nocobase-app
@ -76,15 +76,71 @@ yarn nocobase init
yarn start
~~~
Participate in the development
Open http://localhost:8000 in a web browser.
### Use docker compose
Create a `docker-compose.yml` file
```yaml
version: "3"
networks:
nocobase:
driver: bridge
services:
adminer:
image: adminer
restart: always
networks:
- nocobase
ports:
- 28080:8080
postgres:
image: postgres:10
restart: always
networks:
- nocobase
command: postgres -c wal_level=logical
environment:
POSTGRES_USER: nocobase
POSTGRES_DB: nocobase
POSTGRES_PASSWORD: nocobase
nocobase:
image: nocobase/nocobase:0.5.0-alpha.14
networks:
- nocobase
command: [ "yarn", "serve", "start", "--port", "8000" ]
environment:
DB_DIALECT: postgres
DB_DATABASE: nocobase
DB_USER: nocobase
DB_PASSWORD: nocobase
DB_PORT: 5432
DB_HOST: postgres
ports:
- "28000:8000"
```
Run the command on your terminal
```
docker-compose run nocobase bash -c 'yarn serve init'
docker-compose up -d
```
Open http://localhost:28000 in a web browser.
### Participate in the development
~~~shell
git clone https://github.com/nocobase/nocobase.git
cd nocobase
docker-compose up -d postgres # 用 docker 启动数据库
cp .env.example .env # 配置数据库信息、APP 端口等
cp .env.example .env
docker-compose up -d postgres
yarn install
yarn run bootstrap
yarn run build
yarn start
~~~
Open http://localhost:8000 in a web browser.

View File

@ -66,7 +66,7 @@ Database:
安装 & 运行
----------
通过 `create-nocobase-app` 创建项目
### 通过 `create-nocobase-app` 创建项目
~~~shell
mkdir my-nocobase-app && cd my-nocobase-app
@ -78,7 +78,61 @@ yarn nocobase init
yarn start
~~~
参与开发
浏览器内打开 http://localhost:8000
### 使用 docker compose
创建 `docker-compose.yml` 文件
```yaml
version: "3"
networks:
nocobase:
driver: bridge
services:
adminer:
image: adminer
restart: always
networks:
- nocobase
ports:
- 28080:8080
postgres:
image: postgres:10
restart: always
networks:
- nocobase
command: postgres -c wal_level=logical
environment:
POSTGRES_USER: nocobase
POSTGRES_DB: nocobase
POSTGRES_PASSWORD: nocobase
nocobase:
image: nocobase/nocobase:0.5.0-alpha.14
networks:
- nocobase
command: [ "yarn", "serve", "start", "--port", "8000" ]
environment:
DB_DIALECT: postgres
DB_DATABASE: nocobase
DB_USER: nocobase
DB_PASSWORD: nocobase
DB_PORT: 5432
DB_HOST: postgres
ports:
- "28000:8000"
```
终端运行
```
docker-compose run nocobase bash -c 'yarn serve init'
docker-compose up -d
```
浏览器内打开 http://localhost:28000
### 参与开发
~~~shell
git clone https://github.com/nocobase/nocobase.git
@ -90,3 +144,5 @@ yarn run bootstrap
yarn run build
yarn start
~~~
浏览器内打开 http://localhost:8000

View File

@ -6,10 +6,11 @@
"start-client": "umi dev",
"start-server": "ts-node-dev -r dotenv/config --project tsconfig.apis.json ./src/apis/index.ts",
"nocobase": "ts-node-dev -r dotenv/config --project tsconfig.apis.json ./src/apis/index.ts",
"serve": "node -r dotenv/config ./lib/apis/index.js",
"build": "npm run build-server && npm run build-client",
"build-client": "umi build",
"build-server": "rimraf -rf lib && tsc --project tsconfig.apis.json",
"postinstall": "umi generate tmp",
"postinstall": "node ./umi.js generate tmp",
"prettier": "prettier --write '**/*.{js,jsx,tsx,ts,less,md,json}'",
"test": "umi-test",
"test:coverage": "umi-test --coverage"

View File

@ -0,0 +1,22 @@
#!/usr/bin/env node
try {
require.resolve('umi');
require('v8-compile-cache');
const resolveCwd = require('@umijs/deps/compiled/resolve-cwd');
const { name, bin } = require('umi/package.json');
const localCLI = resolveCwd.silent(`${name}/${bin['umi']}`);
if (!process.env.USE_GLOBAL_UMI && localCLI && localCLI !== __filename) {
const debug = require('@umijs/utils').createDebug('umi:cli');
debug('Using local install of umi');
require(localCLI);
} else {
require('umi/lib/cli');
}
} catch (error) {
console.log('done')
}