feat: add simple cli for nocobase api
This commit is contained in:
parent
c2f18763c9
commit
f58fad922f
13
packages/api/bin/nocobase.js
Normal file
13
packages/api/bin/nocobase.js
Normal file
@ -0,0 +1,13 @@
|
||||
const keys = process.argv;
|
||||
|
||||
const key = keys.pop();
|
||||
|
||||
const dotenv = require('dotenv');
|
||||
|
||||
dotenv.config();
|
||||
|
||||
if (key === 'start') {
|
||||
require('../lib/index');
|
||||
} else if (key === 'db-init') {
|
||||
require('../lib/migrations/init');
|
||||
}
|
@ -5,6 +5,9 @@
|
||||
"types": "./lib/index.d.ts",
|
||||
"license": "MIT",
|
||||
"scripts": {},
|
||||
"bin": {
|
||||
"nocobase": "bin/nocobase.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"@nocobase/actions": "^0.4.0-alpha.2",
|
||||
"@nocobase/client": "^0.4.0-alpha.2",
|
||||
|
@ -23,9 +23,7 @@ import { middlewares } from '@nocobase/server';
|
||||
useStaticServer: !(process.env.APP_USE_STATIC_SERVER === 'false' || !process.env.APP_USE_STATIC_SERVER),
|
||||
}));
|
||||
|
||||
if (require.main === module) {
|
||||
api.listen(process.env.API_PORT, () => {
|
||||
console.log(`http://localhost:${process.env.API_PORT}/`);
|
||||
});
|
||||
}
|
||||
api.listen(process.env.API_PORT, () => {
|
||||
console.log(`http://localhost:${process.env.API_PORT}/`);
|
||||
});
|
||||
})();
|
||||
|
Loading…
Reference in New Issue
Block a user