Skip to content

Commit

Permalink
feat: build, cli, devtools, sdk, docs...
Browse files Browse the repository at this point in the history
* feat: nocobase build

* chore: update build scripts

* chore: update build scripts

* chore(versions): 😊 publish v0.7.0-alpha.33

* chore: independent version

* chore: nocobase build

* chore(versions): 😊 publish v0.7.0-alpha.34

* feat: nocobase-cli

* feat: nocobase-cli

* chore: update dependencies

* feat: improve code

* refactor: create-nocobase-app

* chore(versions): 😊 publish v0.7.0-alpha.35

* feat: @nocobase/devtools

* chore(versions): 😊 publish v0.7.0-alpha.36

* chore: update dependencies

* chore(versions): 😊 publish v0.7.0-alpha.37

* feat: improve code

* chore(versions): 😊 publish v0.7.0-alpha.38

* feat: improve code

* chore(versions): 😊 publish v0.7.0-alpha.39

* feat: update deps

* chore(versions): 😊 publish v0.7.0-alpha.40

* chore: update devDependencies

* chore(versions): 😊 publish v0.7.0-alpha.41

* fix: postinstall

* chore(versions): 😊 publish v0.7.0-alpha.42

* chore: improve code

* chore(versions): 😊 publish v0.7.0-alpha.43

* chore: execa

* chore(versions): 😊 publish v0.7.0-alpha.44

* chore(cli): allow unknown option

* chore(versions): 😊 publish v0.7.0-alpha.45

* fix: default envs

* chore(versions): 😊 publish v0.7.0-alpha.45

* fix: package argument for build command

* chore(versions): 😊 publish v0.7.0-alpha.46

* fix: improve code

* chore(versions): 😊 publish v0.7.0-alpha.48

* feat: clean & doc

* chore(versions): 😊 publish v0.7.0-alpha.49

* feat: compilation tips

* feat: upgrade command

* chore(versions): 😊 publish v0.7.0-alpha.50

* fix: unexpected token ] in JSON

* chore(versions): 😊 publish v0.7.0-alpha.51

* fix: upgrade command

* chore(versions): 😊 publish v0.7.0-alpha.52

* fix: remove export action from available action

* fix: db sync after upgrade

* chore(versions): 😊 publish v0.7.0-alpha.53

* feat: upgrade log

* chore(versions): 😊 publish v0.7.0-alpha.54

* docs: updates

* feat: updates

* docs(cli): update usage description

* feat: updates

* docs: updates

* docs: updates

* docs: toc

* feat: sdk

* docs: updates

* docs: updates

* docs: updates

* Update index.md

* docs: updates

* Update release-notes.md

* Update roadmap.md

* Update index.md

* Update contributing.md

* Update contributing.md

* Update index.md

* Update index.md

* Update nocobase-cli.md

* Update nocobase-cli.md

* fix: user plugin initialization data

* Update env.md

* Update env.md

* Update directory-structure.md

* Update index.md

* Update action-api.md

* Update filter-operators.md

* docs: update thanks.md

* Update index.md

* Update javascript-sdk.md

* Update rest-api.md

* Update installation.md

* Update installation.md

* Update upgrading.md

* Update upgrading.md

* Update upgrading.md

* Update installation.md

* Update installation.md

* Create release-notes.md

* Update release-notes.md

* feat: updates

* feat: update docs

* feat: update release-notes.md

* feat: switch language

* feat: updates

* Add files via upload

* Add files via upload

* Update important-features.md

* Update thanks.md

* feat: nocobase postinstall

* Update index.md

* Create why-different.md

* Update why-different.md

* Create who-is-for.md

* Rename who-is-for.md to who.md

* feat: update docs

* Rename why-different.md to why.md

* Update why.md

* Update menus.ts

* Update why-nocobase.md

* Create who.md

* Create why.md

* feat: updates

* chore(versions): 😊 publish v0.7.0-alpha.55

* feat: tips

* Update who.md

* Update who.md

* feat: update docs

* feat: update doc menus

* fix: plugin client dist

* docs: update contributing.md

* docs: update readme.md

* docs: update readme.md

* docs: update readme.md

* Update functional-zoning.md

* fix: br

Co-authored-by: Zhou <[email protected]>
  • Loading branch information
chenos and zhouyanliang authored May 18, 2022
1 parent 439d7a4 commit 6410bc8
Show file tree
Hide file tree
Showing 889 changed files with 21,876 additions and 6,404 deletions.
12 changes: 12 additions & 0 deletions .buildrc.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export default {
target: 'node',
cjs: { type: 'babel', lazy: true },
excludePkgs: [
'core/build',
'core/cli',
'core/create-nocobase-app',
'core/devtools',
'core/dumi-theme-nocobase',
'app/client',
],
};
22 changes: 11 additions & 11 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,14 @@ VERDACCIO_PORT=10104

################# NOCOBASE APPLICATION #################

NOCOBASE_ENV=development
APP_ENV=development
APP_PORT=13000
APP_KEY=test-key

SERVER_PORT=3000
API_BASE_PATH=/api/
API_BASE_URL=

# api base path endpoint for app(web)
SERVER_BASE_PATH=/api/

# api server access point for app(web when build)
SERVER_BASE_URL=

JWT_SECRET=09f26e402586e2faa8da4c98a35f1b20d6b033c60
PROXY_TARGET_URL=

################# DATABASE #################

Expand All @@ -28,15 +25,18 @@ DB_STORAGE=storage/db/nocobase.sqlite
# DB_DATABASE=postgres
# DB_USER=nocobase
# DB_PASSWORD=nocobase
# DB_LOG_SQL=on
# DB_LOGGING=on

################# STORAGE (Initialization only) #################

INIT_ROOT_EMAIL=[email protected]
INIT_ROOT_PASSWORD=admin123
INIT_ROOT_NICKNAME=Super Admin

# local or ali-oss
DEFAULT_STORAGE_TYPE=local

# LOCAL STORAGE
LOCAL_STORAGE_USE_STATIC_SERVER=true
LOCAL_STORAGE_BASE_URL=
LOCAL_STORAGE_DEST=storage/uploads

Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/node-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,9 @@ jobs:
node-version: ${{ matrix.node_version }}
cache: 'yarn'
- run: yarn install
- run: yarn bootstrap
- run: yarn build
- name: Test with postgres
run: yarn test -i
run: yarn test
env:
DB_DIALECT: postgres
DB_HOST: postgres
Expand All @@ -52,12 +51,12 @@ jobs:
DB_PASSWORD: password
DB_DATABASE: nocobase
- name: Test with Sqlite
run: yarn test -i
run: yarn test
env:
DB_DIALECT: sqlite
DB_STORAGE: /tmp/db.sqlite
- name: Test with MySQL
run: yarn test -i
run: yarn test
env:
DB_DIALECT: mysql
DB_HOST: mysql
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
node_modules/
lib/
!packages/core/create-nocobase-app/lib
esm/
es/
.env
.DS_Store
yarn-error.log
Expand Down
99 changes: 94 additions & 5 deletions .umirc.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,103 @@
import transformer from '@umijs/preset-dumi/lib/transformer';
import { defineConfig } from 'dumi';
import fs from 'fs';
import path from 'path';
import menus from './docs/menus';

const lang = process.env.DOC_LANG || 'en-US';

console.log('process.env.DOC_LANG', process.env.DOC_LANG);

const findFilePath = (filename, lang) => {
const filePath = path.resolve(__dirname, `docs/${lang}/${filename}`);
if (fs.existsSync(`${filePath}.md`)) {
return `${filePath}.md`;
}
return;
};

const markdown = (filename, lang) => {
const filePath = findFilePath(filename, lang);
if (!filePath) {
return;
}
return transformer.markdown(fs.readFileSync(filePath, 'utf8').toString(), filePath);
};

const getPath = (value: string) => {
if (!value) {
return '';
}
const keys = value.split('/');
if (keys.pop() === 'index') {
return keys.join('/') || '/';
}
return value;
};

const getTitle = (item, lang) => {
if (lang) {
return item[`title.${lang}`] || item.title;
}
return item.title;
};

const parseMenuItems = (items, lang = null) => {
const menuItems = [];
for (const item of items) {
if (typeof item === 'string') {
const result = markdown(item, lang);
if (result) {
menuItems.push({
title: result.meta.title,
disabled: result.meta.disabled,
path: getPath(item),
});
}
} else if (item.children) {
menuItems.push({
...item,
title: getTitle(item, lang),
children: parseMenuItems(item.children, lang),
});
} else if (item.path) {
menuItems.push({
...item,
title: getTitle(item, lang),
path: getPath(item.path),
});
} else {
menuItems.push({
title: getTitle(item, lang),
...item,
});
}
}
return menuItems;
};

export default defineConfig({
title: 'NocoBase',
favicon: 'https://user-images.githubusercontent.com/9554297/83762004-a0761b00-a6a9-11ea-83b4-9c8ff721d4b8.png',
logo: 'https://user-images.githubusercontent.com/9554297/83762004-a0761b00-a6a9-11ea-83b4-9c8ff721d4b8.png',
outputPath: 'docs-dist',
outputPath: `./docs/dist/${lang}`,
mode: 'site',
resolve: {
includes: ['docs', 'packages/client'],
includes: [`./docs/${lang}`],
},
locales: [[lang, lang]],
hash: true,
// more config: https://d.umijs.org/config
logo: 'https://www.nocobase.com/images/logo.png',
navs: [
{
title: 'Docs',
path: '/',
hidden: true,
},
{
title: 'GitHub',
path: 'https://github.com/nocobase/nocobase',
},
],
menus: {
'/': parseMenuItems(menus, lang),
},
});
170 changes: 7 additions & 163 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,172 +64,16 @@ NocoBase is designed for you if you have the following needs.

## Installation

NocoBase supports both Docker and CLI installation methods. Docker is recommended if you are new to NocoBase.
NocoBase supports three installation methods:

### Docker (👍Recommended)
- <a target="_blank" href="https://docs.nocobase.com/getting-started/installation/docker-compose">Installing With Docker (👍Recommended)</a>

#### 0. Before start
Suitable for no-code scenarios, no code to write. When upgrading, just download the latest image and reboot.

⚡⚡ Please make sure you have installed [Docker](https://docs.docker.com/get-docker/)
- <a target="_blank" href="https://docs.nocobase.com/getting-started/installation/create-nocobase-app">Installing from create-nocobase-app CLI</a>

#### 1. Download NocoBase
The business code of the project is completely independent and supports low-code development.

Download with Git (or Download Zip,and extract it to the nocobase directory)
- <a target="_blank" href="https://docs.nocobase.com/getting-started/installation/git-clone">Installing from Git source code</a>

```bash
git clone https://github.com/nocobase/nocobase.git nocobase
```

#### 2. Select database (choose one)

Supports SQLite, MySQL, PostgreSQL

```bash
# SQLite
cd nocobase/docker/app-sqlite
# MySQL
cd nocobase/docker/app-mysql
# PostgreSQL
cd nocobase/docker/app-postgres
```

#### 3. Install and start NocoBase

It may take dozens of seconds

```bash
# run in the background
$ docker-compose up -d
# view app logs
$ docker-compose logs app

app-sqlite-app-1 | nginx started
app-sqlite-app-1 | yarn run v1.22.15
app-sqlite-app-1 | $ cross-env DOTENV_CONFIG_PATH=.env node -r dotenv/config packages/app/server/lib/index.js install -s
app-sqlite-app-1 | Done in 2.72s.
app-sqlite-app-1 | yarn run v1.22.15
app-sqlite-app-1 | $ pm2-runtime start --node-args="-r dotenv/config" packages/app/server/lib/index.js -- start
app-sqlite-app-1 | 2022-04-28T15:45:38: PM2 log: Launching in no daemon mode
app-sqlite-app-1 | 2022-04-28T15:45:38: PM2 log: App [index:0] starting in -fork mode-
app-sqlite-app-1 | 2022-04-28T15:45:38: PM2 log: App [index:0] online
app-sqlite-app-1 | 🚀 NocoBase server running at: http://localhost:13000/
```

#### 4. Log in to NocoBase

Open [http://localhost:13000](http://localhost:13000) in a web browser. The initial account and password are `[email protected]` and `admin123`.


### CLI

#### 0. Before start

Please make sure you have Node.js 12.x or above installed. You can download and install the latest LTS version from the official website. It is recommended to use nvm (or nvm-windows for Win systems) to manage Node.js versions if you plan to work with Node.js for a long time.

```bash
$ node -v

v16.13.2
```

yarn package manager is recommend.

```bash
$ npm install --global yarn
$ yarn -v

1.22.10
```

Also, make sure you have configured and started the required database, which supports SQLite, MySQL, PostgreSQL.

#### 1. Create a NocoBase project

```bash
# SQLite
yarn create nocobase-app my-nocobase-app -d sqlite
# MySQL
yarn create nocobase-app my-nocobase-app -d mysql \
-e DB_HOST=localhost \
-e DB_PORT=3356 \
-e DB_DATABASE=nocobase \
-e DB_USER=nocobase \
-e DB_PASSWORD=nocobase
# PostgreSQL
yarn create nocobase-app my-nocobase-app -d postgres \
-e DB_HOST=localhost \
-e DB_PORT=5432 \
-e DB_DATABASE=nocobase \
-e DB_USER=nocobase \
-e DB_PASSWORD=nocobase
```

#### 2. Switch to the project directory

```bash
cd my-nocobase-app
```

#### 3. Install dependencies

```bash
yarn install
```

#### 4. Install & Start NocoBase

```bash
yarn nocobase install --lang=en-US
yarn start
```

#### 5. Log in to NocoBase

Open [http://localhost:8000](http://localhost:8000) in a web browser. The initial account and password are `[email protected]` and `admin123`.

## Contributing

- Fork the source code to your own repository
- Modify source code
- Submit pull request

### Download

```bash
# Replace the following git address with your own repo
git clone https://github.com/nocobase/nocobase.git
cd nocobase
cp .env.example .env
yarn install
```

### Development and Testing

```bash
# Install NocoBase
yarn nocobase install --lang=en-US
# Start NocoBase
yarn start
# Run all tests
yarn test
# Run all test files in the folder
yarn test <dir>
# Run a single test file
yarn test <file>
```

### Documentation preview

```bash
# Start documentation
yarn doc --lang=zh-CN
yarn doc --lang=en-US
```

The documentation is in the docs directory and follows Markdown syntax

```bash
|- /docs/
|- en-US
|- zh-CN
```
If you want to experience the latest unreleased version, or want to participate in the contribution, you need to make changes and debug on the source code, it is recommended to choose this installation method, which requires a high level of development skills, and if the code has been updated, you can git pull the latest code.
Loading

0 comments on commit 6410bc8

Please sign in to comment.