merge
This commit is contained in:
commit
cf72a2c302
|
|
@ -1,5 +1,6 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.default = build;
|
||||||
const tslib_1 = require("tslib");
|
const tslib_1 = require("tslib");
|
||||||
const tip_style_1 = require("./tip-style");
|
const tip_style_1 = require("./tip-style");
|
||||||
const cross_spawn_1 = tslib_1.__importDefault(require("cross-spawn"));
|
const cross_spawn_1 = tslib_1.__importDefault(require("cross-spawn"));
|
||||||
|
|
@ -153,4 +154,3 @@ async function build(cmd) {
|
||||||
(0, tip_style_1.Error)(`${(0, tip_style_1.error)(`target could only be web or mp(wechatMp) or rn(native)`)}`);
|
(0, tip_style_1.Error)(`${(0, tip_style_1.error)(`target could only be web or mp(wechatMp) or rn(native)`)}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.default = build;
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.default = run;
|
||||||
const tslib_1 = require("tslib");
|
const tslib_1 = require("tslib");
|
||||||
const tip_style_1 = require("./tip-style");
|
const tip_style_1 = require("./tip-style");
|
||||||
const cross_spawn_1 = tslib_1.__importDefault(require("cross-spawn"));
|
const cross_spawn_1 = tslib_1.__importDefault(require("cross-spawn"));
|
||||||
|
|
@ -48,4 +49,3 @@ async function run(options) {
|
||||||
process.exit(-1);
|
process.exit(-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.default = run;
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.update = exports.create = void 0;
|
exports.create = create;
|
||||||
|
exports.update = update;
|
||||||
const tslib_1 = require("tslib");
|
const tslib_1 = require("tslib");
|
||||||
const ts = tslib_1.__importStar(require("typescript"));
|
const ts = tslib_1.__importStar(require("typescript"));
|
||||||
const fs_1 = require("fs");
|
const fs_1 = require("fs");
|
||||||
|
|
@ -242,7 +243,7 @@ async function create(dirName, cmd) {
|
||||||
}
|
}
|
||||||
// 获取package.json内容
|
// 获取package.json内容
|
||||||
const packageJson = (0, template_1.packageJsonContent)({
|
const packageJson = (0, template_1.packageJsonContent)({
|
||||||
name: DEFAULT_PROJECT_NAME,
|
name: DEFAULT_PROJECT_NAME, // 后面再统一rename
|
||||||
version,
|
version,
|
||||||
description,
|
description,
|
||||||
cliName: config_1.CLI_NAME,
|
cliName: config_1.CLI_NAME,
|
||||||
|
|
@ -265,7 +266,6 @@ async function create(dirName, cmd) {
|
||||||
(0, tip_style_1.Error)((0, tip_style_1.error)(err));
|
(0, tip_style_1.Error)((0, tip_style_1.error)(err));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.create = create;
|
|
||||||
async function update(dirName, subDirName, cmd) {
|
async function update(dirName, subDirName, cmd) {
|
||||||
const isDev = cmd.dev ? true : false;
|
const isDev = cmd.dev ? true : false;
|
||||||
try {
|
try {
|
||||||
|
|
@ -292,4 +292,3 @@ async function update(dirName, subDirName, cmd) {
|
||||||
console.error((0, tip_style_1.error)(err.message));
|
console.error((0, tip_style_1.error)(err.message));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.update = update;
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.CreateCompilerConfig = void 0;
|
exports.CreateCompilerConfig = CreateCompilerConfig;
|
||||||
/**
|
/**
|
||||||
* 创建一个oak编译器配置
|
* 创建一个oak编译器配置
|
||||||
* @param raw 原始配置
|
* @param raw 原始配置
|
||||||
|
|
@ -11,7 +11,6 @@ function CreateCompilerConfig(raw) {
|
||||||
// 在这里可以做配置的预处理
|
// 在这里可以做配置的预处理
|
||||||
return raw;
|
return raw;
|
||||||
}
|
}
|
||||||
exports.CreateCompilerConfig = CreateCompilerConfig;
|
|
||||||
/**
|
/**
|
||||||
* 将compiler.js中的模块导出使用以下形式:
|
* 将compiler.js中的模块导出使用以下形式:
|
||||||
* module.exports = CreateComilerConfig({})
|
* module.exports = CreateComilerConfig({})
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
/// <reference types="node" />
|
|
||||||
/// <reference types="node" />
|
|
||||||
import { PathLike } from 'fs';
|
import { PathLike } from 'fs';
|
||||||
import { checkFileExistsAndCreateType } from './enum';
|
import { checkFileExistsAndCreateType } from './enum';
|
||||||
/**
|
/**
|
||||||
|
|
@ -39,7 +37,7 @@ export declare function writeFile(path: string | PathLike, data: any): void;
|
||||||
export declare function readFile(path: string | PathLike, options?: {
|
export declare function readFile(path: string | PathLike, options?: {
|
||||||
encoding?: null | undefined;
|
encoding?: null | undefined;
|
||||||
flag?: string | undefined;
|
flag?: string | undefined;
|
||||||
} | null): Buffer | undefined;
|
} | null): Buffer<ArrayBufferLike> | undefined;
|
||||||
/**
|
/**
|
||||||
* @name 拷贝文件夹
|
* @name 拷贝文件夹
|
||||||
* @export
|
* @export
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,15 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.checkFileExistsAndCreate = exports.checkFileExists = exports.copyFolder = exports.readFile = exports.writeFile = exports.deleteFolderRecursive = exports.parseJsonFile = exports.parseJsonFiles = exports.readDirGetFile = exports.readDirPath = void 0;
|
exports.readDirPath = readDirPath;
|
||||||
|
exports.readDirGetFile = readDirGetFile;
|
||||||
|
exports.parseJsonFiles = parseJsonFiles;
|
||||||
|
exports.parseJsonFile = parseJsonFile;
|
||||||
|
exports.deleteFolderRecursive = deleteFolderRecursive;
|
||||||
|
exports.writeFile = writeFile;
|
||||||
|
exports.readFile = readFile;
|
||||||
|
exports.copyFolder = copyFolder;
|
||||||
|
exports.checkFileExists = checkFileExists;
|
||||||
|
exports.checkFileExistsAndCreate = checkFileExistsAndCreate;
|
||||||
const fs_1 = require("fs");
|
const fs_1 = require("fs");
|
||||||
const path_1 = require("path");
|
const path_1 = require("path");
|
||||||
const enum_1 = require("./enum");
|
const enum_1 = require("./enum");
|
||||||
|
|
@ -25,7 +34,6 @@ function readDirPath(entry) {
|
||||||
}
|
}
|
||||||
return pathList;
|
return pathList;
|
||||||
}
|
}
|
||||||
exports.readDirPath = readDirPath;
|
|
||||||
/**
|
/**
|
||||||
* @name 读取指定目录的文件(不进行深度遍历,只获取根目录)
|
* @name 读取指定目录的文件(不进行深度遍历,只获取根目录)
|
||||||
* @export
|
* @export
|
||||||
|
|
@ -36,7 +44,6 @@ function readDirGetFile(entry) {
|
||||||
const dirInfo = (0, fs_1.readdirSync)(entry);
|
const dirInfo = (0, fs_1.readdirSync)(entry);
|
||||||
return dirInfo;
|
return dirInfo;
|
||||||
}
|
}
|
||||||
exports.readDirGetFile = readDirGetFile;
|
|
||||||
/**
|
/**
|
||||||
* @name 解析json文件(数组)
|
* @name 解析json文件(数组)
|
||||||
* @export
|
* @export
|
||||||
|
|
@ -51,7 +58,6 @@ function parseJsonFiles(arr) {
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
exports.parseJsonFiles = parseJsonFiles;
|
|
||||||
/**
|
/**
|
||||||
* @name 解析单个文件json
|
* @name 解析单个文件json
|
||||||
* @export
|
* @export
|
||||||
|
|
@ -67,7 +73,6 @@ function parseJsonFile(file) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.parseJsonFile = parseJsonFile;
|
|
||||||
/**
|
/**
|
||||||
* @name 删除文件夹
|
* @name 删除文件夹
|
||||||
* @export
|
* @export
|
||||||
|
|
@ -97,7 +102,6 @@ function deleteFolderRecursive(entry) {
|
||||||
// console.log("文件夹不存在");
|
// console.log("文件夹不存在");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.deleteFolderRecursive = deleteFolderRecursive;
|
|
||||||
;
|
;
|
||||||
function writeFile(path, data) {
|
function writeFile(path, data) {
|
||||||
try {
|
try {
|
||||||
|
|
@ -108,7 +112,6 @@ function writeFile(path, data) {
|
||||||
(0, tip_style_1.Error)((0, tip_style_1.error)('文件写入失败'));
|
(0, tip_style_1.Error)((0, tip_style_1.error)('文件写入失败'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.writeFile = writeFile;
|
|
||||||
function readFile(path, options) {
|
function readFile(path, options) {
|
||||||
try {
|
try {
|
||||||
const data = (0, fs_1.readFileSync)(path, options);
|
const data = (0, fs_1.readFileSync)(path, options);
|
||||||
|
|
@ -119,7 +122,6 @@ function readFile(path, options) {
|
||||||
(0, tip_style_1.Error)((0, tip_style_1.error)('文件读取失败'));
|
(0, tip_style_1.Error)((0, tip_style_1.error)('文件读取失败'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.readFile = readFile;
|
|
||||||
/**
|
/**
|
||||||
* @name 拷贝文件夹
|
* @name 拷贝文件夹
|
||||||
* @export
|
* @export
|
||||||
|
|
@ -181,7 +183,6 @@ function copyFolder(currentDir, targetDir, overwrite = false) {
|
||||||
throw new global.Error(`需要copy的文件夹不存在: ${currentDir}`);
|
throw new global.Error(`需要copy的文件夹不存在: ${currentDir}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.copyFolder = copyFolder;
|
|
||||||
/**
|
/**
|
||||||
* @name 检测文件/文件夹是否存在
|
* @name 检测文件/文件夹是否存在
|
||||||
* @export
|
* @export
|
||||||
|
|
@ -191,7 +192,6 @@ exports.copyFolder = copyFolder;
|
||||||
function checkFileExists(path) {
|
function checkFileExists(path) {
|
||||||
return (0, fs_1.existsSync)(path);
|
return (0, fs_1.existsSync)(path);
|
||||||
}
|
}
|
||||||
exports.checkFileExists = checkFileExists;
|
|
||||||
/**
|
/**
|
||||||
* @name 检测文件/文件夹是否存在,不存在则创建
|
* @name 检测文件/文件夹是否存在,不存在则创建
|
||||||
* @export
|
* @export
|
||||||
|
|
@ -217,4 +217,3 @@ function checkFileExistsAndCreate(path, data, type = enum_1.checkFileExistsAndCr
|
||||||
throw new global.Error(`${path} already exists!`);
|
throw new global.Error(`${path} already exists!`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.checkFileExistsAndCreate = checkFileExistsAndCreate;
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.default = make;
|
||||||
const tslib_1 = require("tslib");
|
const tslib_1 = require("tslib");
|
||||||
const tip_style_1 = require("./tip-style");
|
const tip_style_1 = require("./tip-style");
|
||||||
const cross_spawn_1 = tslib_1.__importDefault(require("cross-spawn"));
|
const cross_spawn_1 = tslib_1.__importDefault(require("cross-spawn"));
|
||||||
|
|
@ -20,4 +21,3 @@ async function make(cmd) {
|
||||||
process.exit(-1);
|
process.exit(-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.default = make;
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.default = make;
|
||||||
const tslib_1 = require("tslib");
|
const tslib_1 = require("tslib");
|
||||||
const tip_style_1 = require("./tip-style");
|
const tip_style_1 = require("./tip-style");
|
||||||
const cross_spawn_1 = tslib_1.__importDefault(require("cross-spawn"));
|
const cross_spawn_1 = tslib_1.__importDefault(require("cross-spawn"));
|
||||||
|
|
@ -20,4 +21,3 @@ async function make() {
|
||||||
process.exit(-1);
|
process.exit(-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.default = make;
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.default = make;
|
||||||
const tslib_1 = require("tslib");
|
const tslib_1 = require("tslib");
|
||||||
const tip_style_1 = require("./tip-style");
|
const tip_style_1 = require("./tip-style");
|
||||||
const localeBuilder_1 = tslib_1.__importDefault(require("oak-domain/lib/compiler/localeBuilder"));
|
const localeBuilder_1 = tslib_1.__importDefault(require("oak-domain/lib/compiler/localeBuilder"));
|
||||||
|
|
@ -18,4 +19,3 @@ async function make(cmd) {
|
||||||
process.exit(-1);
|
process.exit(-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.default = make;
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.default = make;
|
||||||
const tslib_1 = require("tslib");
|
const tslib_1 = require("tslib");
|
||||||
const tip_style_1 = require("./tip-style");
|
const tip_style_1 = require("./tip-style");
|
||||||
const cross_spawn_1 = tslib_1.__importDefault(require("cross-spawn"));
|
const cross_spawn_1 = tslib_1.__importDefault(require("cross-spawn"));
|
||||||
|
|
@ -30,4 +31,3 @@ async function make(cmd, watch) {
|
||||||
process.exit(-1);
|
process.exit(-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.default = make;
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.rename = exports.renameProject = void 0;
|
exports.renameProject = renameProject;
|
||||||
|
exports.rename = rename;
|
||||||
const path_1 = require("path");
|
const path_1 = require("path");
|
||||||
const fs_1 = require("fs");
|
const fs_1 = require("fs");
|
||||||
const editTemplate_1 = require("@react-native-community/cli/build/commands/init/editTemplate");
|
const editTemplate_1 = require("@react-native-community/cli/build/commands/init/editTemplate");
|
||||||
|
|
@ -19,11 +20,6 @@ async function renameProject(dir, name, title, placeholderName, placeholderTitle
|
||||||
const htmlContent = (0, fs_1.readFileSync)(htmlFilePath, 'utf-8');
|
const htmlContent = (0, fs_1.readFileSync)(htmlFilePath, 'utf-8');
|
||||||
const newHtmlContent = htmlContent.replace(new RegExp(placeholderTitle, 'g'), title).replace(new RegExp(placeholderTitle.toLowerCase(), 'g'), title.toLowerCase());
|
const newHtmlContent = htmlContent.replace(new RegExp(placeholderTitle, 'g'), title).replace(new RegExp(placeholderTitle.toLowerCase(), 'g'), title.toLowerCase());
|
||||||
(0, fs_1.writeFileSync)(htmlFilePath, newHtmlContent, 'utf-8');
|
(0, fs_1.writeFileSync)(htmlFilePath, newHtmlContent, 'utf-8');
|
||||||
// index.tsx下的title
|
|
||||||
const indexTsxPath = (0, path_1.join)(dir, 'web', 'src/index.tsx');
|
|
||||||
const tsxContent = (0, fs_1.readFileSync)(indexTsxPath, 'utf-8');
|
|
||||||
const newTsxlContent = tsxContent.replace(new RegExp(placeholderName, 'g'), name).replace(new RegExp(placeholderName.toLowerCase(), 'g'), name.toLowerCase());
|
|
||||||
(0, fs_1.writeFileSync)(indexTsxPath, newTsxlContent, 'utf-8');
|
|
||||||
// replace wechatMp下project.config.json中的projectname
|
// replace wechatMp下project.config.json中的projectname
|
||||||
// todo,现在这个是在wechatMp/src目录下的,可能是搞错了,待修正
|
// todo,现在这个是在wechatMp/src目录下的,可能是搞错了,待修正
|
||||||
const pcjFilePath = (0, path_1.join)(dir, 'wechatMp', 'src', 'project.config.json');
|
const pcjFilePath = (0, path_1.join)(dir, 'wechatMp', 'src', 'project.config.json');
|
||||||
|
|
@ -49,7 +45,6 @@ async function renameProject(dir, name, title, placeholderName, placeholderTitle
|
||||||
process.chdir(cwd);
|
process.chdir(cwd);
|
||||||
(0, tip_style_1.Success)(`${(0, tip_style_1.success)(`Change project name to ${(0, tip_style_1.primary)(name)}, project title to ${(0, tip_style_1.primary)(title)}`)}`);
|
(0, tip_style_1.Success)(`${(0, tip_style_1.success)(`Change project name to ${(0, tip_style_1.primary)(name)}, project title to ${(0, tip_style_1.primary)(title)}`)}`);
|
||||||
}
|
}
|
||||||
exports.renameProject = renameProject;
|
|
||||||
async function rename(cmd) {
|
async function rename(cmd) {
|
||||||
const { oldName, newName, oldTitle, newTitle } = cmd;
|
const { oldName, newName, oldTitle, newTitle } = cmd;
|
||||||
if (!oldName) {
|
if (!oldName) {
|
||||||
|
|
@ -70,4 +65,3 @@ async function rename(cmd) {
|
||||||
}
|
}
|
||||||
renameProject(process.cwd(), newName, newTitle, oldName, oldTitle);
|
renameProject(process.cwd(), newName, newTitle, oldName, oldTitle);
|
||||||
}
|
}
|
||||||
exports.rename = rename;
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.default = run;
|
||||||
const tslib_1 = require("tslib");
|
const tslib_1 = require("tslib");
|
||||||
const tip_style_1 = require("./tip-style");
|
const tip_style_1 = require("./tip-style");
|
||||||
const cross_spawn_1 = tslib_1.__importDefault(require("cross-spawn"));
|
const cross_spawn_1 = tslib_1.__importDefault(require("cross-spawn"));
|
||||||
|
|
@ -59,4 +60,3 @@ async function run(options) {
|
||||||
process.exit(-1);
|
process.exit(-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.default = run;
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
/// <reference path="../../src/typings/polyfill.d.ts" />
|
|
||||||
import { EntityDict } from 'oak-domain/lib/types';
|
import { EntityDict } from 'oak-domain/lib/types';
|
||||||
import { EntityDict as BaseEntityDict } from 'oak-domain/lib/base-app-domain';
|
import { EntityDict as BaseEntityDict } from 'oak-domain/lib/base-app-domain';
|
||||||
import { BackendRuntimeContext } from 'oak-frontend-base/lib/context/BackendRuntimeContext';
|
import { BackendRuntimeContext } from 'oak-frontend-base/lib/context/BackendRuntimeContext';
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.initialize = void 0;
|
exports.initialize = initialize;
|
||||||
/// <reference path="../typings/polyfill.d.ts" />
|
/// <reference path="../typings/polyfill.d.ts" />
|
||||||
const oak_backend_base_1 = require("oak-backend-base");
|
const oak_backend_base_1 = require("oak-backend-base");
|
||||||
async function initialize(path) {
|
async function initialize(path) {
|
||||||
|
|
@ -10,4 +10,3 @@ async function initialize(path) {
|
||||||
await appLoader.unmount();
|
await appLoader.unmount();
|
||||||
console.log('data initialized');
|
console.log('data initialized');
|
||||||
}
|
}
|
||||||
exports.initialize = initialize;
|
|
||||||
|
|
|
||||||
|
|
@ -261,11 +261,30 @@ async function startup(path, connector, omitWatchers, omitTimers, routine) {
|
||||||
const endpoints = appLoader.getEndpoints(connector.getEndpointRouter());
|
const endpoints = appLoader.getEndpoints(connector.getEndpointRouter());
|
||||||
endpoints.forEach(([type, name, method, url, fn]) => {
|
endpoints.forEach(([type, name, method, url, fn]) => {
|
||||||
router[method](url, async (ctx) => {
|
router[method](url, async (ctx) => {
|
||||||
|
<<<<<<< HEAD
|
||||||
try {
|
try {
|
||||||
await fn(ctx);
|
await fn(ctx);
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
console.log("exec:", name, "occure a error: ", err);
|
console.log("exec:", name, "occure a error: ", err);
|
||||||
|
=======
|
||||||
|
const { req, request, params, res } = ctx;
|
||||||
|
res.setHeader("Content-Type", "text/plain; charset=utf-8");
|
||||||
|
res.setHeader("Cache-Control","no-cache");
|
||||||
|
res.setHeader("Connection", "keep-alive");
|
||||||
|
const { body, headers, files } = request;
|
||||||
|
try {
|
||||||
|
const result = await fn(params, headers, req, files ? Object.assign({}, body, files) : body);
|
||||||
|
console.log(result)
|
||||||
|
ctx.response.body = result;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
console.log(err);
|
||||||
|
|
||||||
|
ctx.response.status = 500;
|
||||||
|
return;
|
||||||
|
>>>>>>> 0300b7070ba837a01493b2db444079b847d01d4d
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
/// <reference types="node" />
|
|
||||||
export type LogFormatterProp = {
|
export type LogFormatterProp = {
|
||||||
level: "info" | "warn" | "error";
|
level: "info" | "warn" | "error";
|
||||||
caller: NodeJS.CallSite | null;
|
caller: NodeJS.CallSite | null;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,16 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.updateCompilerJsContent = exports.oakConfigContentWithWeb = exports.oakConfigContentWithWeChatMp = exports.appJsonContentWithWeChatMp = exports.projectConfigContentWithWeChatMp = exports.tsConfigWebJsonContent = exports.tsConfigMpJsonContent = exports.tsConfigPathsJsonContent = exports.tsConfigBuildJsonContent = exports.tsConfigJsonContent = exports.packageJsonContent = void 0;
|
exports.packageJsonContent = packageJsonContent;
|
||||||
|
exports.tsConfigJsonContent = tsConfigJsonContent;
|
||||||
|
exports.tsConfigBuildJsonContent = tsConfigBuildJsonContent;
|
||||||
|
exports.tsConfigPathsJsonContent = tsConfigPathsJsonContent;
|
||||||
|
exports.tsConfigMpJsonContent = tsConfigMpJsonContent;
|
||||||
|
exports.tsConfigWebJsonContent = tsConfigWebJsonContent;
|
||||||
|
exports.projectConfigContentWithWeChatMp = projectConfigContentWithWeChatMp;
|
||||||
|
exports.appJsonContentWithWeChatMp = appJsonContentWithWeChatMp;
|
||||||
|
exports.oakConfigContentWithWeChatMp = oakConfigContentWithWeChatMp;
|
||||||
|
exports.oakConfigContentWithWeb = oakConfigContentWithWeb;
|
||||||
|
exports.updateCompilerJsContent = updateCompilerJsContent;
|
||||||
const tslib_1 = require("tslib");
|
const tslib_1 = require("tslib");
|
||||||
const child_process_1 = require("child_process");
|
const child_process_1 = require("child_process");
|
||||||
const fs_1 = require("fs");
|
const fs_1 = require("fs");
|
||||||
|
|
@ -299,7 +309,6 @@ function packageJsonContent({ name, version, description, cliName, cliBinName, i
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
exports.packageJsonContent = packageJsonContent;
|
|
||||||
function tsConfigJsonContent() {
|
function tsConfigJsonContent() {
|
||||||
return `{
|
return `{
|
||||||
"extends": "./tsconfig.paths.json",
|
"extends": "./tsconfig.paths.json",
|
||||||
|
|
@ -351,7 +360,6 @@ function tsConfigJsonContent() {
|
||||||
]
|
]
|
||||||
}`;
|
}`;
|
||||||
}
|
}
|
||||||
exports.tsConfigJsonContent = tsConfigJsonContent;
|
|
||||||
function tsConfigBuildJsonContent() {
|
function tsConfigBuildJsonContent() {
|
||||||
return `{
|
return `{
|
||||||
"extends": "./tsconfig.build.paths.json",
|
"extends": "./tsconfig.build.paths.json",
|
||||||
|
|
@ -391,7 +399,6 @@ function tsConfigBuildJsonContent() {
|
||||||
]
|
]
|
||||||
}`;
|
}`;
|
||||||
}
|
}
|
||||||
exports.tsConfigBuildJsonContent = tsConfigBuildJsonContent;
|
|
||||||
function tsConfigPathsJsonContent(deps) {
|
function tsConfigPathsJsonContent(deps) {
|
||||||
const paths = {
|
const paths = {
|
||||||
"@project/*": [
|
"@project/*": [
|
||||||
|
|
@ -420,7 +427,6 @@ function tsConfigPathsJsonContent(deps) {
|
||||||
}
|
}
|
||||||
}, null, '\t');
|
}, null, '\t');
|
||||||
}
|
}
|
||||||
exports.tsConfigPathsJsonContent = tsConfigPathsJsonContent;
|
|
||||||
function tsConfigMpJsonContent() {
|
function tsConfigMpJsonContent() {
|
||||||
return `{
|
return `{
|
||||||
"extends": "./tsconfig.paths.json",
|
"extends": "./tsconfig.paths.json",
|
||||||
|
|
@ -468,7 +474,6 @@ function tsConfigMpJsonContent() {
|
||||||
]
|
]
|
||||||
}`;
|
}`;
|
||||||
}
|
}
|
||||||
exports.tsConfigMpJsonContent = tsConfigMpJsonContent;
|
|
||||||
function tsConfigWebJsonContent() {
|
function tsConfigWebJsonContent() {
|
||||||
return `{
|
return `{
|
||||||
"extends": "./tsconfig.paths.json",
|
"extends": "./tsconfig.paths.json",
|
||||||
|
|
@ -518,7 +523,6 @@ function tsConfigWebJsonContent() {
|
||||||
]
|
]
|
||||||
}`;
|
}`;
|
||||||
}
|
}
|
||||||
exports.tsConfigWebJsonContent = tsConfigWebJsonContent;
|
|
||||||
function projectConfigContentWithWeChatMp(oakConfigName, projectname, miniVersion) {
|
function projectConfigContentWithWeChatMp(oakConfigName, projectname, miniVersion) {
|
||||||
return `{
|
return `{
|
||||||
"description": "项目配置文件",
|
"description": "项目配置文件",
|
||||||
|
|
@ -594,7 +598,6 @@ function projectConfigContentWithWeChatMp(oakConfigName, projectname, miniVersio
|
||||||
}
|
}
|
||||||
}`;
|
}`;
|
||||||
}
|
}
|
||||||
exports.projectConfigContentWithWeChatMp = projectConfigContentWithWeChatMp;
|
|
||||||
function appJsonContentWithWeChatMp(isDev) {
|
function appJsonContentWithWeChatMp(isDev) {
|
||||||
const pages = [
|
const pages = [
|
||||||
'@project/pages/store/list/index',
|
'@project/pages/store/list/index',
|
||||||
|
|
@ -618,21 +621,18 @@ function appJsonContentWithWeChatMp(isDev) {
|
||||||
"sitemapLocation": "sitemap.json"
|
"sitemapLocation": "sitemap.json"
|
||||||
}`;
|
}`;
|
||||||
}
|
}
|
||||||
exports.appJsonContentWithWeChatMp = appJsonContentWithWeChatMp;
|
|
||||||
function oakConfigContentWithWeChatMp() {
|
function oakConfigContentWithWeChatMp() {
|
||||||
return `{
|
return `{
|
||||||
"theme": {
|
"theme": {
|
||||||
}
|
}
|
||||||
}`;
|
}`;
|
||||||
}
|
}
|
||||||
exports.oakConfigContentWithWeChatMp = oakConfigContentWithWeChatMp;
|
|
||||||
function oakConfigContentWithWeb() {
|
function oakConfigContentWithWeb() {
|
||||||
return `{
|
return `{
|
||||||
"theme": {
|
"theme": {
|
||||||
}
|
}
|
||||||
}`;
|
}`;
|
||||||
}
|
}
|
||||||
exports.oakConfigContentWithWeb = oakConfigContentWithWeb;
|
|
||||||
function updateCompilerJsContent(directory, deps) {
|
function updateCompilerJsContent(directory, deps) {
|
||||||
const compilerJsPath = (0, path_1.join)(directory, 'configuration', 'compiler.js');
|
const compilerJsPath = (0, path_1.join)(directory, 'configuration', 'compiler.js');
|
||||||
(0, assert_1.default)((0, fs_1.existsSync)(compilerJsPath));
|
(0, assert_1.default)((0, fs_1.existsSync)(compilerJsPath));
|
||||||
|
|
@ -691,4 +691,3 @@ function updateCompilerJsContent(directory, deps) {
|
||||||
(0, fs_1.writeFileSync)(compilerJsPath, code);
|
(0, fs_1.writeFileSync)(compilerJsPath, code);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.updateCompilerJsContent = updateCompilerJsContent;
|
|
||||||
|
|
|
||||||
15
lib/utils.js
15
lib/utils.js
|
|
@ -1,6 +1,12 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.deWeight = exports.formatJsonByFile = exports.union = exports.intersect = exports.difference = exports.getStr = exports.findJson = void 0;
|
exports.findJson = findJson;
|
||||||
|
exports.getStr = getStr;
|
||||||
|
exports.difference = difference;
|
||||||
|
exports.intersect = intersect;
|
||||||
|
exports.union = union;
|
||||||
|
exports.formatJsonByFile = formatJsonByFile;
|
||||||
|
exports.deWeight = deWeight;
|
||||||
/**
|
/**
|
||||||
* @name 从一组路径里查找到所有json文件
|
* @name 从一组路径里查找到所有json文件
|
||||||
* @export
|
* @export
|
||||||
|
|
@ -18,7 +24,6 @@ function findJson(pathArr) {
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
exports.findJson = findJson;
|
|
||||||
/**
|
/**
|
||||||
* @name 已知前后文取中间文本
|
* @name 已知前后文取中间文本
|
||||||
* @export
|
* @export
|
||||||
|
|
@ -32,7 +37,6 @@ function getStr(str, start, end) {
|
||||||
let res = str.match(reg);
|
let res = str.match(reg);
|
||||||
return res ? res[1] : null;
|
return res ? res[1] : null;
|
||||||
}
|
}
|
||||||
exports.getStr = getStr;
|
|
||||||
/**
|
/**
|
||||||
* @name 差集
|
* @name 差集
|
||||||
* @export
|
* @export
|
||||||
|
|
@ -44,7 +48,6 @@ exports.getStr = getStr;
|
||||||
function difference(current, target) {
|
function difference(current, target) {
|
||||||
return new Set([...target].filter(x => !current.has(x)));
|
return new Set([...target].filter(x => !current.has(x)));
|
||||||
}
|
}
|
||||||
exports.difference = difference;
|
|
||||||
/**
|
/**
|
||||||
* @name 获取交集
|
* @name 获取交集
|
||||||
* @export
|
* @export
|
||||||
|
|
@ -56,7 +59,6 @@ exports.difference = difference;
|
||||||
function intersect(current, target) {
|
function intersect(current, target) {
|
||||||
return new Set([...target].filter(x => current.has(x)));
|
return new Set([...target].filter(x => current.has(x)));
|
||||||
}
|
}
|
||||||
exports.intersect = intersect;
|
|
||||||
/**
|
/**
|
||||||
* @name 获取并集
|
* @name 获取并集
|
||||||
* @export
|
* @export
|
||||||
|
|
@ -68,7 +70,6 @@ exports.intersect = intersect;
|
||||||
function union(current, target) {
|
function union(current, target) {
|
||||||
return new Set([...current, ...target]);
|
return new Set([...current, ...target]);
|
||||||
}
|
}
|
||||||
exports.union = union;
|
|
||||||
/**
|
/**
|
||||||
* @name 格式化json
|
* @name 格式化json
|
||||||
* @export
|
* @export
|
||||||
|
|
@ -79,7 +80,6 @@ exports.union = union;
|
||||||
function formatJsonByFile(data) {
|
function formatJsonByFile(data) {
|
||||||
return JSON.stringify(data, null, 2);
|
return JSON.stringify(data, null, 2);
|
||||||
}
|
}
|
||||||
exports.formatJsonByFile = formatJsonByFile;
|
|
||||||
/**
|
/**
|
||||||
* @name 数组对象去重
|
* @name 数组对象去重
|
||||||
* @export
|
* @export
|
||||||
|
|
@ -96,4 +96,3 @@ function deWeight(arr, type) {
|
||||||
}
|
}
|
||||||
return new Set([...map.values()]);
|
return new Set([...map.values()]);
|
||||||
}
|
}
|
||||||
exports.deWeight = deWeight;
|
|
||||||
|
|
|
||||||
|
|
@ -334,8 +334,10 @@ export async function startup<ED extends EntityDict & BaseEntityDict, FrontCxt e
|
||||||
try {
|
try {
|
||||||
await fn(ctx);
|
await fn(ctx);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log("exec:", name , "occure a error: ", err);
|
console.log(err);
|
||||||
|
|
||||||
|
ctx.response.status = 500;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue