新增 server相关
This commit is contained in:
parent
9abf5b1e73
commit
ecf897688a
|
|
@ -28,7 +28,7 @@ module.exports = () => {
|
|||
const { navigationBarTitleText } = require(`${relPath}.json`);
|
||||
const pagePath = ele.slice(ele.indexOf('pages/') + 6, ele.length - 6);
|
||||
return t.objectExpression([
|
||||
t.objectProperty(t.identifier('title'), t.stringLiteral(navigationBarTitleText)),
|
||||
t.objectProperty(t.identifier('title'), t.stringLiteral(navigationBarTitleText || '')),
|
||||
t.objectProperty(t.identifier('path'), t.stringLiteral(pagePath)),
|
||||
t.objectProperty(t.identifier('element'), t.callExpression(
|
||||
t.identifier('LazyLoad'),
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ function packageJsonContent({ name, version, description, cliversion, cliname, i
|
|||
let oakPackageStr;
|
||||
if (isDev) {
|
||||
oakPackageStr = `"${cliname}": "file:../${cliname}",
|
||||
"oak-common-aspect": "file:../oak-common-aspect",
|
||||
"oak-domain": "file:../oak-domain",
|
||||
"oak-frontend-base": "file:../oak-frontend-base",
|
||||
"oak_external-sdk": "file:../oak-external-sdk",
|
||||
|
|
@ -13,6 +14,7 @@ function packageJsonContent({ name, version, description, cliversion, cliname, i
|
|||
}
|
||||
else {
|
||||
oakPackageStr = `"${cliname}": "^${cliversion}",
|
||||
"oak-common-aspect": "^1.0.0",
|
||||
"oak-domain": "^1.0.0",
|
||||
"oak-frontend-base": "^1.0.0",
|
||||
"oak-general-business": "^1.0.0",
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ const Locales = 'locales';
|
|||
|
||||
function copyLocaleFiles() {
|
||||
//build locales
|
||||
consola.start(`${chalk.blueBright('读取locales,生成json数据')}`);
|
||||
consola.success(`${chalk.blueBright('读取locales,生成json数据')}`);
|
||||
// locales到mp/dist下
|
||||
const buildPath = Path.resolve(paths.appBuild, Locales);
|
||||
const json = buildLocales({
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ export function packageJsonContent({
|
|||
let oakPackageStr;
|
||||
if (isDev) {
|
||||
oakPackageStr = `"${cliname}": "file:../${cliname}",
|
||||
"oak-common-aspect": "file:../oak-common-aspect",
|
||||
"oak-domain": "file:../oak-domain",
|
||||
"oak-frontend-base": "file:../oak-frontend-base",
|
||||
"oak_external-sdk": "file:../oak-external-sdk",
|
||||
|
|
@ -18,6 +19,7 @@ export function packageJsonContent({
|
|||
}
|
||||
else {
|
||||
oakPackageStr = `"${cliname}": "^${cliversion}",
|
||||
"oak-common-aspect": "^1.0.0",
|
||||
"oak-domain": "^1.0.0",
|
||||
"oak-frontend-base": "^1.0.0",
|
||||
"oak-general-business": "^1.0.0",
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"host": "localhost",
|
||||
"user": "root",
|
||||
"password": "",
|
||||
"database": "bangzuxia",
|
||||
"charset": "utf8mb4_general_ci",
|
||||
"connectionLimit": 5
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"port": 3001,
|
||||
"serverUrl": "http://localhost",
|
||||
"serverEndpoint": "/aspect"
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
import { removeSync, readdirSync, statSync } from 'fs-extra';
|
||||
import { join } from 'path';
|
||||
|
||||
function removeDts(path: string) {
|
||||
const files = readdirSync(path);
|
||||
|
||||
files.forEach(
|
||||
(file) => {
|
||||
const stat = statSync(join(path, file));
|
||||
if (stat.isDirectory() && !['types', 'typings', 'lin-ui'].includes(file)) {
|
||||
removeDts(join(path, file));
|
||||
}
|
||||
else if ((file.endsWith('.d.ts') || file.endsWith('.js')) && file !== 'react-app-env.d.ts') {
|
||||
removeSync(join(path, file));
|
||||
console.log(`remove ${join(path, file)}`);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
if (process.argv[2]) {
|
||||
console.log(`清理${process.argv[2]}路径下的d.ts和js文件`);
|
||||
removeDts(join(process.cwd(), process.argv[2]));
|
||||
}
|
||||
else {
|
||||
console.log('请输入路径名');
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
import { initialize } from 'oak-cli/lib/server/initialize';
|
||||
import { RuntimeContext } from '../src/RuntimeContext';
|
||||
|
||||
const pwd = process.cwd();
|
||||
|
||||
const dropIfExists = process.argv[2];
|
||||
console.log(dropIfExists);
|
||||
|
||||
initialize(pwd, RuntimeContext.FromCxtStr, !!dropIfExists)
|
||||
.then(
|
||||
() => process.exit(0)
|
||||
);
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
import { startup } from 'oak-cli/lib/server/start';
|
||||
import { RuntimeContext } from '../src/RuntimeContext';
|
||||
import { makeException } from '../src/types/Exception';
|
||||
import { SimpleConnector } from 'oak-domain/lib/utils/SimpleConnector';
|
||||
const pwd = process.cwd();
|
||||
|
||||
const connector = new SimpleConnector('', makeException, RuntimeContext.FromCxtStr);
|
||||
startup(pwd, RuntimeContext.FromCxtStr, connector);
|
||||
|
|
@ -3,14 +3,16 @@ import { EntityDict } from 'oak-app-domain';
|
|||
import { RowStore } from 'oak-domain/lib/types';
|
||||
|
||||
export class RuntimeContext extends GeneralRuntimeContext<EntityDict> {
|
||||
static FromCxtStr(cxtStr?: string) {
|
||||
const { token, applicationId, scene } = cxtStr
|
||||
? GeneralRuntimeContext.fromString(cxtStr)
|
||||
: {
|
||||
token: undefined,
|
||||
applicationId: undefined,
|
||||
scene: undefined,
|
||||
};
|
||||
static FromCxtStr(cxtStr?: string){
|
||||
const {
|
||||
token,
|
||||
applicationId,
|
||||
scene
|
||||
} = cxtStr ? GeneralRuntimeContext.fromString(cxtStr) : {
|
||||
token: undefined,
|
||||
applicationId: undefined,
|
||||
scene: undefined,
|
||||
};
|
||||
return (store: RowStore<EntityDict, RuntimeContext>) => {
|
||||
const context = new RuntimeContext(store, applicationId);
|
||||
context.setScene(scene);
|
||||
|
|
@ -18,4 +20,4 @@ export class RuntimeContext extends GeneralRuntimeContext<EntityDict> {
|
|||
return context;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue