Merge branch 'release'
This commit is contained in:
commit
8f642d581d
|
|
@ -1,6 +1,5 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = build;
|
||||
const tslib_1 = require("tslib");
|
||||
const tip_style_1 = require("./tip-style");
|
||||
const cross_spawn_1 = tslib_1.__importDefault(require("cross-spawn"));
|
||||
|
|
@ -151,3 +150,4 @@ 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)`)}`);
|
||||
}
|
||||
}
|
||||
exports.default = build;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = run;
|
||||
const tslib_1 = require("tslib");
|
||||
const tip_style_1 = require("./tip-style");
|
||||
const cross_spawn_1 = tslib_1.__importDefault(require("cross-spawn"));
|
||||
|
|
@ -49,3 +48,4 @@ async function run(options) {
|
|||
process.exit(-1);
|
||||
}
|
||||
}
|
||||
exports.default = run;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.create = create;
|
||||
exports.update = update;
|
||||
exports.update = exports.create = void 0;
|
||||
const tslib_1 = require("tslib");
|
||||
const ts = tslib_1.__importStar(require("typescript"));
|
||||
const fs_1 = require("fs");
|
||||
|
|
@ -241,7 +240,7 @@ async function create(dirName, cmd) {
|
|||
}
|
||||
// 获取package.json内容
|
||||
const packageJson = (0, template_1.packageJsonContent)({
|
||||
name: DEFAULT_PROJECT_NAME, // 后面再统一rename
|
||||
name: DEFAULT_PROJECT_NAME,
|
||||
version,
|
||||
description,
|
||||
cliName: config_1.CLI_NAME,
|
||||
|
|
@ -264,6 +263,7 @@ async function create(dirName, cmd) {
|
|||
(0, tip_style_1.Error)((0, tip_style_1.error)(err));
|
||||
}
|
||||
}
|
||||
exports.create = create;
|
||||
async function update(dirName, subDirName, cmd) {
|
||||
const isDev = cmd.dev ? true : false;
|
||||
try {
|
||||
|
|
@ -290,3 +290,4 @@ async function update(dirName, subDirName, cmd) {
|
|||
console.error((0, tip_style_1.error)(err.message));
|
||||
}
|
||||
}
|
||||
exports.update = update;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
/// <reference types="node" />
|
||||
/// <reference types="node" />
|
||||
import { PathLike } from 'fs';
|
||||
import { checkFileExistsAndCreateType } from './enum';
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,15 +1,6 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
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;
|
||||
exports.checkFileExistsAndCreate = exports.checkFileExists = exports.copyFolder = exports.readFile = exports.writeFile = exports.deleteFolderRecursive = exports.parseJsonFile = exports.parseJsonFiles = exports.readDirGetFile = exports.readDirPath = void 0;
|
||||
const fs_1 = require("fs");
|
||||
const path_1 = require("path");
|
||||
const enum_1 = require("./enum");
|
||||
|
|
@ -34,6 +25,7 @@ function readDirPath(entry) {
|
|||
}
|
||||
return pathList;
|
||||
}
|
||||
exports.readDirPath = readDirPath;
|
||||
/**
|
||||
* @name 读取指定目录的文件(不进行深度遍历,只获取根目录)
|
||||
* @export
|
||||
|
|
@ -44,6 +36,7 @@ function readDirGetFile(entry) {
|
|||
const dirInfo = (0, fs_1.readdirSync)(entry);
|
||||
return dirInfo;
|
||||
}
|
||||
exports.readDirGetFile = readDirGetFile;
|
||||
/**
|
||||
* @name 解析json文件(数组)
|
||||
* @export
|
||||
|
|
@ -58,6 +51,7 @@ function parseJsonFiles(arr) {
|
|||
}
|
||||
return result;
|
||||
}
|
||||
exports.parseJsonFiles = parseJsonFiles;
|
||||
/**
|
||||
* @name 解析单个文件json
|
||||
* @export
|
||||
|
|
@ -73,6 +67,7 @@ function parseJsonFile(file) {
|
|||
return;
|
||||
}
|
||||
}
|
||||
exports.parseJsonFile = parseJsonFile;
|
||||
/**
|
||||
* @name 删除文件夹
|
||||
* @export
|
||||
|
|
@ -102,6 +97,7 @@ function deleteFolderRecursive(entry) {
|
|||
// console.log("文件夹不存在");
|
||||
}
|
||||
}
|
||||
exports.deleteFolderRecursive = deleteFolderRecursive;
|
||||
;
|
||||
function writeFile(path, data) {
|
||||
try {
|
||||
|
|
@ -112,6 +108,7 @@ function writeFile(path, data) {
|
|||
(0, tip_style_1.Error)((0, tip_style_1.error)('文件写入失败'));
|
||||
}
|
||||
}
|
||||
exports.writeFile = writeFile;
|
||||
function readFile(path, options) {
|
||||
try {
|
||||
const data = (0, fs_1.readFileSync)(path, options);
|
||||
|
|
@ -122,6 +119,7 @@ function readFile(path, options) {
|
|||
(0, tip_style_1.Error)((0, tip_style_1.error)('文件读取失败'));
|
||||
}
|
||||
}
|
||||
exports.readFile = readFile;
|
||||
/**
|
||||
* @name 拷贝文件夹
|
||||
* @export
|
||||
|
|
@ -183,6 +181,7 @@ function copyFolder(currentDir, targetDir, overwrite = false) {
|
|||
throw new global.Error(`需要copy的文件夹不存在: ${currentDir}`);
|
||||
}
|
||||
}
|
||||
exports.copyFolder = copyFolder;
|
||||
/**
|
||||
* @name 检测文件/文件夹是否存在
|
||||
* @export
|
||||
|
|
@ -192,6 +191,7 @@ function copyFolder(currentDir, targetDir, overwrite = false) {
|
|||
function checkFileExists(path) {
|
||||
return (0, fs_1.existsSync)(path);
|
||||
}
|
||||
exports.checkFileExists = checkFileExists;
|
||||
/**
|
||||
* @name 检测文件/文件夹是否存在,不存在则创建
|
||||
* @export
|
||||
|
|
@ -217,3 +217,4 @@ function checkFileExistsAndCreate(path, data, type = enum_1.checkFileExistsAndCr
|
|||
throw new global.Error(`${path} already exists!`);
|
||||
}
|
||||
}
|
||||
exports.checkFileExistsAndCreate = checkFileExistsAndCreate;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = make;
|
||||
const tslib_1 = require("tslib");
|
||||
const tip_style_1 = require("./tip-style");
|
||||
const cross_spawn_1 = tslib_1.__importDefault(require("cross-spawn"));
|
||||
|
|
@ -25,3 +24,4 @@ async function make(cmd, rebuild) {
|
|||
process.exit(-1);
|
||||
}
|
||||
}
|
||||
exports.default = make;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = make;
|
||||
const tslib_1 = require("tslib");
|
||||
const tip_style_1 = require("./tip-style");
|
||||
const cross_spawn_1 = tslib_1.__importDefault(require("cross-spawn"));
|
||||
|
|
@ -21,3 +20,4 @@ async function make() {
|
|||
process.exit(-1);
|
||||
}
|
||||
}
|
||||
exports.default = make;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = make;
|
||||
const tslib_1 = require("tslib");
|
||||
const tip_style_1 = require("./tip-style");
|
||||
const localeBuilder_1 = tslib_1.__importDefault(require("oak-domain/lib/compiler/localeBuilder"));
|
||||
|
|
@ -19,3 +18,4 @@ async function make(cmd) {
|
|||
process.exit(-1);
|
||||
}
|
||||
}
|
||||
exports.default = make;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = make;
|
||||
const tslib_1 = require("tslib");
|
||||
const tip_style_1 = require("./tip-style");
|
||||
const cross_spawn_1 = tslib_1.__importDefault(require("cross-spawn"));
|
||||
|
|
@ -31,3 +30,4 @@ async function make(cmd, watch) {
|
|||
process.exit(-1);
|
||||
}
|
||||
}
|
||||
exports.default = make;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.renameProject = renameProject;
|
||||
exports.rename = rename;
|
||||
exports.rename = exports.renameProject = void 0;
|
||||
const path_1 = require("path");
|
||||
const fs_1 = require("fs");
|
||||
const editTemplate_1 = require("@react-native-community/cli/build/commands/init/editTemplate");
|
||||
|
|
@ -43,10 +42,12 @@ async function renameProject(dir, name, title, placeholderName, placeholderTitle
|
|||
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)}`)}`);
|
||||
}
|
||||
exports.renameProject = renameProject;
|
||||
async function rename(cmd) {
|
||||
const { projectName, displayName } = cmd;
|
||||
// todo 取native/android下的name和title作为placeholder,再调用renameProject
|
||||
}
|
||||
exports.rename = rename;
|
||||
/* changePlaceholderInTemplate({
|
||||
projectName: 'taicang',
|
||||
projectTitle: '太藏',
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = run;
|
||||
const tslib_1 = require("tslib");
|
||||
const tip_style_1 = require("./tip-style");
|
||||
const cross_spawn_1 = tslib_1.__importDefault(require("cross-spawn"));
|
||||
|
|
@ -60,3 +59,4 @@ async function run(options) {
|
|||
process.exit(-1);
|
||||
}
|
||||
}
|
||||
exports.default = run;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
/// <reference path="../../src/typings/polyfill.d.ts" />
|
||||
import { EntityDict } from 'oak-domain/lib/types';
|
||||
import { EntityDict as BaseEntityDict } from 'oak-domain/lib/base-app-domain';
|
||||
import { BackendRuntimeContext } from 'oak-frontend-base/lib/context/BackendRuntimeContext';
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.initialize = initialize;
|
||||
exports.initialize = void 0;
|
||||
/// <reference path="../typings/polyfill.d.ts" />
|
||||
const oak_backend_base_1 = require("oak-backend-base");
|
||||
async function initialize(path) {
|
||||
|
|
@ -10,3 +10,4 @@ async function initialize(path) {
|
|||
await appLoader.unmount();
|
||||
console.log('data initialized');
|
||||
}
|
||||
exports.initialize = initialize;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
/// <reference path="../../src/typings/polyfill.d.ts" />
|
||||
import './polyfill';
|
||||
import { BackendRuntimeContext } from 'oak-frontend-base/lib/context/BackendRuntimeContext';
|
||||
import { Connector, EntityDict } from 'oak-domain/lib/types';
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.startup = startup;
|
||||
exports.startup = void 0;
|
||||
const tslib_1 = require("tslib");
|
||||
/// <reference path="../typings/polyfill.d.ts" />
|
||||
require("./polyfill");
|
||||
|
|
@ -33,8 +33,6 @@ async function startup(path, connector, omitWatchers, omitTimers, routine) {
|
|||
'Authorization',
|
||||
'Accept',
|
||||
'X-Requested-With',
|
||||
'oak-cxt',
|
||||
'oak-aspect',
|
||||
];
|
||||
const corsMethods = ['PUT', 'POST', 'GET', 'DELETE', 'OPTIONS'];
|
||||
const koa = new koa_1.default();
|
||||
|
|
@ -45,7 +43,7 @@ async function startup(path, connector, omitWatchers, omitTimers, routine) {
|
|||
cors: process.env.NODE_ENV === 'development'
|
||||
? {
|
||||
origin: '*',
|
||||
allowedHeaders: corsHeaders,
|
||||
allowedHeaders: corsHeaders.concat(connector.getCorsHeader()),
|
||||
}
|
||||
: serverConfiguration.cors
|
||||
? {
|
||||
|
|
@ -102,7 +100,7 @@ async function startup(path, connector, omitWatchers, omitTimers, routine) {
|
|||
if (['development', 'staging'].includes(process.env.NODE_ENV)) {
|
||||
koa.use(async (ctx, next) => {
|
||||
ctx.set('Access-Control-Allow-Origin', '*');
|
||||
ctx.set('Access-Control-Allow-Headers', corsHeaders);
|
||||
ctx.set('Access-Control-Allow-Headers', corsHeaders.concat(connector.getCorsHeader()));
|
||||
ctx.set('Access-Control-Allow-Methods', corsMethods);
|
||||
if (ctx.method == 'OPTIONS') {
|
||||
ctx.body = 200;
|
||||
|
|
@ -116,7 +114,7 @@ async function startup(path, connector, omitWatchers, omitTimers, routine) {
|
|||
koa.use(async (ctx, next) => {
|
||||
ctx.set('Access-Control-Allow-Origin', serverConfiguration.cors.origin);
|
||||
ctx.set('Access-Control-Allow-Headers', [
|
||||
...corsHeaders,
|
||||
...corsHeaders.concat(connector.getCorsHeader()),
|
||||
...(serverConfiguration.cors.headers || []),
|
||||
]);
|
||||
ctx.set('Access-Control-Allow-Methods', serverConfiguration.cors.methods || corsMethods);
|
||||
|
|
@ -222,3 +220,4 @@ async function startup(path, connector, omitWatchers, omitTimers, routine) {
|
|||
process.exit(0);
|
||||
});
|
||||
}
|
||||
exports.startup = startup;
|
||||
|
|
|
|||
|
|
@ -1,16 +1,6 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.packageJsonContent = packageJsonContent;
|
||||
exports.tsConfigJsonContent = tsConfigJsonContent;
|
||||
exports.tsConfigBuildJsonContent = tsConfigBuildJsonContent;
|
||||
exports.tsConfigBuildPathsJsonContent = tsConfigBuildPathsJsonContent;
|
||||
exports.tsConfigPathsJsonContent = tsConfigPathsJsonContent;
|
||||
exports.tsConfigMpJsonContent = tsConfigMpJsonContent;
|
||||
exports.tsConfigWebJsonContent = tsConfigWebJsonContent;
|
||||
exports.projectConfigContentWithWeChatMp = projectConfigContentWithWeChatMp;
|
||||
exports.appJsonContentWithWeChatMp = appJsonContentWithWeChatMp;
|
||||
exports.oakConfigContentWithWeChatMp = oakConfigContentWithWeChatMp;
|
||||
exports.oakConfigContentWithWeb = oakConfigContentWithWeb;
|
||||
exports.oakConfigContentWithWeb = exports.oakConfigContentWithWeChatMp = exports.appJsonContentWithWeChatMp = exports.projectConfigContentWithWeChatMp = exports.tsConfigWebJsonContent = exports.tsConfigMpJsonContent = exports.tsConfigPathsJsonContent = exports.tsConfigBuildPathsJsonContent = exports.tsConfigBuildJsonContent = exports.tsConfigJsonContent = exports.packageJsonContent = void 0;
|
||||
const child_process_1 = require("child_process");
|
||||
const fs_1 = require("fs");
|
||||
const path_1 = require("path");
|
||||
|
|
@ -258,6 +248,7 @@ function packageJsonContent({ name, version, description, cliName, cliBinName, i
|
|||
"tsc-alias": "^1.8.2",
|
||||
"tslib": "^2.4.0",
|
||||
"typescript": "^5.2.2",
|
||||
"typescript-plugin-css-modules": "^5.1.0",
|
||||
"ui-extract-webpack-plugin": "^1.0.0",
|
||||
"web-vitals": "^2.1.4",
|
||||
"webpack": "^5.86.0",
|
||||
|
|
@ -291,6 +282,7 @@ function packageJsonContent({ name, version, description, cliName, cliBinName, i
|
|||
}
|
||||
`;
|
||||
}
|
||||
exports.packageJsonContent = packageJsonContent;
|
||||
function tsConfigJsonContent() {
|
||||
return `{
|
||||
"extends": "./tsconfig.paths.json",
|
||||
|
|
@ -310,6 +302,11 @@ function tsConfigJsonContent() {
|
|||
"dom.iterable",
|
||||
"esnext"
|
||||
],
|
||||
"plugins": [
|
||||
{
|
||||
"name": "typescript-plugin-css-modules",
|
||||
}
|
||||
],
|
||||
//"outDir": "lib", /* Redirect output structure to the directory. */
|
||||
//"rootDir": "src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
|
||||
"types": [
|
||||
|
|
@ -337,6 +334,7 @@ function tsConfigJsonContent() {
|
|||
]
|
||||
}`;
|
||||
}
|
||||
exports.tsConfigJsonContent = tsConfigJsonContent;
|
||||
function tsConfigBuildJsonContent() {
|
||||
return `{
|
||||
"extends": "./tsconfig.build.paths.json",
|
||||
|
|
@ -376,6 +374,7 @@ function tsConfigBuildJsonContent() {
|
|||
]
|
||||
}`;
|
||||
}
|
||||
exports.tsConfigBuildJsonContent = tsConfigBuildJsonContent;
|
||||
function tsConfigBuildPathsJsonContent() {
|
||||
return `{
|
||||
"compilerOptions": {
|
||||
|
|
@ -395,6 +394,7 @@ function tsConfigBuildPathsJsonContent() {
|
|||
}
|
||||
}`;
|
||||
}
|
||||
exports.tsConfigBuildPathsJsonContent = tsConfigBuildPathsJsonContent;
|
||||
function tsConfigPathsJsonContent() {
|
||||
return `{
|
||||
"compilerOptions": {
|
||||
|
|
@ -414,6 +414,7 @@ function tsConfigPathsJsonContent() {
|
|||
}
|
||||
}`;
|
||||
}
|
||||
exports.tsConfigPathsJsonContent = tsConfigPathsJsonContent;
|
||||
function tsConfigMpJsonContent() {
|
||||
return `{
|
||||
"extends": "./tsconfig.paths.json",
|
||||
|
|
@ -461,6 +462,7 @@ function tsConfigMpJsonContent() {
|
|||
]
|
||||
}`;
|
||||
}
|
||||
exports.tsConfigMpJsonContent = tsConfigMpJsonContent;
|
||||
function tsConfigWebJsonContent() {
|
||||
return `{
|
||||
"extends": "./tsconfig.paths.json",
|
||||
|
|
@ -510,6 +512,7 @@ function tsConfigWebJsonContent() {
|
|||
]
|
||||
}`;
|
||||
}
|
||||
exports.tsConfigWebJsonContent = tsConfigWebJsonContent;
|
||||
function projectConfigContentWithWeChatMp(oakConfigName, projectname, miniVersion) {
|
||||
return `{
|
||||
"description": "项目配置文件",
|
||||
|
|
@ -585,6 +588,7 @@ function projectConfigContentWithWeChatMp(oakConfigName, projectname, miniVersio
|
|||
}
|
||||
}`;
|
||||
}
|
||||
exports.projectConfigContentWithWeChatMp = projectConfigContentWithWeChatMp;
|
||||
function appJsonContentWithWeChatMp(isDev) {
|
||||
const pages = [
|
||||
'@project/pages/store/list/index',
|
||||
|
|
@ -608,15 +612,18 @@ function appJsonContentWithWeChatMp(isDev) {
|
|||
"sitemapLocation": "sitemap.json"
|
||||
}`;
|
||||
}
|
||||
exports.appJsonContentWithWeChatMp = appJsonContentWithWeChatMp;
|
||||
function oakConfigContentWithWeChatMp() {
|
||||
return `{
|
||||
"theme": {
|
||||
}
|
||||
}`;
|
||||
}
|
||||
exports.oakConfigContentWithWeChatMp = oakConfigContentWithWeChatMp;
|
||||
function oakConfigContentWithWeb() {
|
||||
return `{
|
||||
"theme": {
|
||||
}
|
||||
}`;
|
||||
}
|
||||
exports.oakConfigContentWithWeb = oakConfigContentWithWeb;
|
||||
|
|
|
|||
15
lib/utils.js
15
lib/utils.js
|
|
@ -1,12 +1,6 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.findJson = findJson;
|
||||
exports.getStr = getStr;
|
||||
exports.difference = difference;
|
||||
exports.intersect = intersect;
|
||||
exports.union = union;
|
||||
exports.formatJsonByFile = formatJsonByFile;
|
||||
exports.deWeight = deWeight;
|
||||
exports.deWeight = exports.formatJsonByFile = exports.union = exports.intersect = exports.difference = exports.getStr = exports.findJson = void 0;
|
||||
/**
|
||||
* @name 从一组路径里查找到所有json文件
|
||||
* @export
|
||||
|
|
@ -24,6 +18,7 @@ function findJson(pathArr) {
|
|||
}
|
||||
return result;
|
||||
}
|
||||
exports.findJson = findJson;
|
||||
/**
|
||||
* @name 已知前后文取中间文本
|
||||
* @export
|
||||
|
|
@ -37,6 +32,7 @@ function getStr(str, start, end) {
|
|||
let res = str.match(reg);
|
||||
return res ? res[1] : null;
|
||||
}
|
||||
exports.getStr = getStr;
|
||||
/**
|
||||
* @name 差集
|
||||
* @export
|
||||
|
|
@ -48,6 +44,7 @@ function getStr(str, start, end) {
|
|||
function difference(current, target) {
|
||||
return new Set([...target].filter(x => !current.has(x)));
|
||||
}
|
||||
exports.difference = difference;
|
||||
/**
|
||||
* @name 获取交集
|
||||
* @export
|
||||
|
|
@ -59,6 +56,7 @@ function difference(current, target) {
|
|||
function intersect(current, target) {
|
||||
return new Set([...target].filter(x => current.has(x)));
|
||||
}
|
||||
exports.intersect = intersect;
|
||||
/**
|
||||
* @name 获取并集
|
||||
* @export
|
||||
|
|
@ -70,6 +68,7 @@ function intersect(current, target) {
|
|||
function union(current, target) {
|
||||
return new Set([...current, ...target]);
|
||||
}
|
||||
exports.union = union;
|
||||
/**
|
||||
* @name 格式化json
|
||||
* @export
|
||||
|
|
@ -80,6 +79,7 @@ function union(current, target) {
|
|||
function formatJsonByFile(data) {
|
||||
return JSON.stringify(data, null, 2);
|
||||
}
|
||||
exports.formatJsonByFile = formatJsonByFile;
|
||||
/**
|
||||
* @name 数组对象去重
|
||||
* @export
|
||||
|
|
@ -96,3 +96,4 @@ function deWeight(arr, type) {
|
|||
}
|
||||
return new Set([...map.values()]);
|
||||
}
|
||||
exports.deWeight = deWeight;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@xuchangzju/oak-cli",
|
||||
"version": "4.0.12",
|
||||
"version": "4.0.13",
|
||||
"description": "client for oak framework",
|
||||
"main": "lib/index.js",
|
||||
"scripts": {
|
||||
|
|
@ -100,8 +100,8 @@
|
|||
"mini-css-extract-plugin": "^2.5.3",
|
||||
"node-watch": "^0.7.4",
|
||||
"oak-backend-base": "^4.1.7",
|
||||
"oak-domain": "^5.1.7",
|
||||
"oak-frontend-base": "^5.3.15",
|
||||
"oak-domain": "^5.1.8",
|
||||
"oak-frontend-base": "^5.3.16",
|
||||
"parse-asn1": "5.1.6",
|
||||
"postcss": "^8.4.4",
|
||||
"postcss-flexbugs-fixes": "^5.0.2",
|
||||
|
|
|
|||
|
|
@ -50,8 +50,6 @@ export async function startup<ED extends EntityDict & BaseEntityDict, FrontCxt e
|
|||
'Authorization',
|
||||
'Accept',
|
||||
'X-Requested-With',
|
||||
'oak-cxt',
|
||||
'oak-aspect',
|
||||
];
|
||||
const corsMethods = ['PUT', 'POST', 'GET', 'DELETE', 'OPTIONS'];
|
||||
|
||||
|
|
@ -64,7 +62,7 @@ export async function startup<ED extends EntityDict & BaseEntityDict, FrontCxt e
|
|||
process.env.NODE_ENV === 'development'
|
||||
? {
|
||||
origin: '*',
|
||||
allowedHeaders: corsHeaders,
|
||||
allowedHeaders: corsHeaders.concat(connector.getCorsHeader()),
|
||||
}
|
||||
: serverConfiguration.cors
|
||||
? {
|
||||
|
|
@ -138,7 +136,7 @@ export async function startup<ED extends EntityDict & BaseEntityDict, FrontCxt e
|
|||
if (['development', 'staging'].includes(process.env.NODE_ENV!)) {
|
||||
koa.use(async (ctx, next) => {
|
||||
ctx.set('Access-Control-Allow-Origin', '*');
|
||||
ctx.set('Access-Control-Allow-Headers', corsHeaders);
|
||||
ctx.set('Access-Control-Allow-Headers', corsHeaders.concat(connector.getCorsHeader()));
|
||||
ctx.set('Access-Control-Allow-Methods', corsMethods);
|
||||
if (ctx.method == 'OPTIONS') {
|
||||
ctx.body = 200;
|
||||
|
|
@ -153,7 +151,7 @@ export async function startup<ED extends EntityDict & BaseEntityDict, FrontCxt e
|
|||
serverConfiguration.cors!.origin!
|
||||
);
|
||||
ctx.set('Access-Control-Allow-Headers', [
|
||||
...corsHeaders,
|
||||
...corsHeaders.concat(connector.getCorsHeader()),
|
||||
...(serverConfiguration.cors!.headers || []),
|
||||
]);
|
||||
ctx.set(
|
||||
|
|
|
|||
|
|
@ -266,6 +266,7 @@ export function packageJsonContent({
|
|||
"tsc-alias": "^1.8.2",
|
||||
"tslib": "^2.4.0",
|
||||
"typescript": "^5.2.2",
|
||||
"typescript-plugin-css-modules": "^5.1.0",
|
||||
"ui-extract-webpack-plugin": "^1.0.0",
|
||||
"web-vitals": "^2.1.4",
|
||||
"webpack": "^5.86.0",
|
||||
|
|
@ -319,6 +320,11 @@ export function tsConfigJsonContent() {
|
|||
"dom.iterable",
|
||||
"esnext"
|
||||
],
|
||||
"plugins": [
|
||||
{
|
||||
"name": "typescript-plugin-css-modules",
|
||||
}
|
||||
],
|
||||
//"outDir": "lib", /* Redirect output structure to the directory. */
|
||||
//"rootDir": "src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
|
||||
"types": [
|
||||
|
|
|
|||
Loading…
Reference in New Issue