build和测试

This commit is contained in:
pqcqaq 2024-10-27 13:39:48 +08:00
parent 9ed416470f
commit bfa5d14e00
19 changed files with 171 additions and 139 deletions

15
lib/CdnConfig.d.ts vendored Normal file
View File

@ -0,0 +1,15 @@
export type CdnConfig = {
from: string | string[];
module: {
[name: string]: ModuleConfig;
};
timeout: number;
retry: number;
};
export type ModuleConfig = {
scope: string;
version: string;
js: string;
css?: string;
direct?: boolean;
};

2
lib/CdnConfig.js Normal file
View File

@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

View File

@ -1,5 +1,6 @@
"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"));
@ -150,4 +151,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)`)}`);
}
}
exports.default = build;

View File

@ -1,5 +1,6 @@
"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"));
@ -48,4 +49,3 @@ async function run(options) {
process.exit(-1);
}
}
exports.default = run;

View File

@ -1,6 +1,7 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.update = exports.create = void 0;
exports.create = create;
exports.update = update;
const tslib_1 = require("tslib");
const ts = tslib_1.__importStar(require("typescript"));
const fs_1 = require("fs");
@ -188,7 +189,8 @@ async function create(dirName, cmd) {
// 小程序项目根路径
const weChatMpRootPath = `${rootPath}/wechatMp`;
// 被复制的文件夹路径
const currentPath = (0, path_1.join)(__dirname, '..', 'template');
const emptyTemplatePath = (0, path_1.join)(__dirname, '..', 'template');
const examplePath = (0, path_1.join)(__dirname, '..', 'templateExample');
//检查项目名是否存在
checkProjectName(dirName);
try {
@ -209,11 +211,11 @@ async function create(dirName, cmd) {
// 复制项目文件
if (isModule) {
// 模块化的项目只拷贝src和typings目录
(0, file_handle_1.copyFolder)((0, path_1.join)(currentPath, 'src'), (0, path_1.join)(rootPath, 'src'));
(0, file_handle_1.copyFolder)((0, path_1.join)(currentPath, 'typings'), (0, path_1.join)(rootPath, 'typings'));
(0, file_handle_1.copyFolder)((0, path_1.join)(emptyTemplatePath, 'src'), (0, path_1.join)(rootPath, 'src'));
(0, file_handle_1.copyFolder)((0, path_1.join)(emptyTemplatePath, 'typings'), (0, path_1.join)(rootPath, 'typings'));
}
else {
(0, file_handle_1.copyFolder)(currentPath, rootPath);
(0, file_handle_1.copyFolder)(emptyTemplatePath, rootPath);
await createWechatMpBoilplate(weChatMpRootPath, isDev);
await createWebBoilplate(webRootPath, isDev);
/* if (!shell.which('npm')) {
@ -239,7 +241,7 @@ async function create(dirName, cmd) {
}
// 获取package.json内容
const packageJson = (0, template_1.packageJsonContent)({
name: DEFAULT_PROJECT_NAME,
name: DEFAULT_PROJECT_NAME, // 后面再统一rename
version,
description,
cliName: config_1.CLI_NAME,
@ -253,6 +255,7 @@ async function create(dirName, cmd) {
(0, rename_1.renameProject)(rootPath, name, title, DEFAULT_PROJECT_NAME, DEFAULT_PROJECT_TITLE);
if (example) {
// todo: copy template example files
(0, file_handle_1.copyFolder)(examplePath, rootPath, true);
}
(0, tip_style_1.Success)(`${(0, tip_style_1.success)(`Ok, type 'npm install' to install libs, then start!`)}`);
}
@ -261,7 +264,6 @@ 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 {
@ -288,4 +290,3 @@ async function update(dirName, subDirName, cmd) {
console.error((0, tip_style_1.error)(err.message));
}
}
exports.update = update;

View File

@ -1,5 +1,3 @@
/// <reference types="node" />
/// <reference types="node" />
import { PathLike } from 'fs';
import { checkFileExistsAndCreateType } from './enum';
/**
@ -45,6 +43,7 @@ export declare function readFile(path: string | PathLike, options?: {
* @export
* @param {PathLike} currentDir
* @param {PathLike} targetDir
* @param {boolean} [overwrite=false]
*/
export declare function copyFolder(currentDir: PathLike, targetDir: PathLike, overwrite?: boolean): void;
/**

View File

@ -1,6 +1,15 @@
"use strict";
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 path_1 = require("path");
const enum_1 = require("./enum");
@ -25,7 +34,6 @@ function readDirPath(entry) {
}
return pathList;
}
exports.readDirPath = readDirPath;
/**
* @name 读取指定目录的文件不进行深度遍历只获取根目录
* @export
@ -36,7 +44,6 @@ function readDirGetFile(entry) {
const dirInfo = (0, fs_1.readdirSync)(entry);
return dirInfo;
}
exports.readDirGetFile = readDirGetFile;
/**
* @name 解析json文件(数组)
* @export
@ -51,7 +58,6 @@ function parseJsonFiles(arr) {
}
return result;
}
exports.parseJsonFiles = parseJsonFiles;
/**
* @name 解析单个文件json
* @export
@ -67,7 +73,6 @@ function parseJsonFile(file) {
return;
}
}
exports.parseJsonFile = parseJsonFile;
/**
* @name 删除文件夹
* @export
@ -97,7 +102,6 @@ function deleteFolderRecursive(entry) {
// console.log("文件夹不存在");
}
}
exports.deleteFolderRecursive = deleteFolderRecursive;
;
function writeFile(path, data) {
try {
@ -108,7 +112,6 @@ 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);
@ -119,45 +122,49 @@ function readFile(path, options) {
(0, tip_style_1.Error)((0, tip_style_1.error)('文件读取失败'));
}
}
exports.readFile = readFile;
/**
* @name 拷贝文件夹
* @export
* @param {PathLike} currentDir
* @param {PathLike} targetDir
* @param {boolean} [overwrite=false] 是否覆盖已存在的文件
*/
function copyFolder(currentDir, targetDir, overwrite) {
function copyFolder(currentDir, targetDir, overwrite = false) {
function handleFolder(currentDir, targetDir) {
const files = (0, fs_1.readdirSync)(currentDir, {
withFileTypes: true
});
for (let file of files) {
// 拼接文件绝对路径
const copyCurrentFileInfo = currentDir + '/' + file.name;
const copyTargetFileInfo = targetDir + '/' + file.name;
// 判断文件是否存在
const copyCurrentFileInfo = (0, path_1.join)(currentDir.toString(), file.name);
const copyTargetFileInfo = (0, path_1.join)(targetDir.toString(), file.name);
const readCurrentFile = (0, fs_1.existsSync)(copyCurrentFileInfo);
const readTargetFile = (0, fs_1.existsSync)(copyTargetFileInfo);
if (!readCurrentFile) {
console.error(`操作失败,待拷贝的源路径${copyCurrentFileInfo}不存在`);
throw new global.Error(`操作失败,待拷贝的源路径${copyCurrentFileInfo}不存在`);
}
else if (file.isFile() && readTargetFile && !overwrite) {
throw new global.Error(`操作失败,待拷贝的目标文件${copyTargetFileInfo}已经存在`);
// console.warn(`目标文件${copyTargetFileInfo}已存在,跳过复制`);
continue;
}
else {
// 判断是否为文件,如果为文件则复制,文件夹则递归
if (file.isFile()) {
const readStream = (0, fs_1.createReadStream)(copyCurrentFileInfo);
const writeStream = (0, fs_1.createWriteStream)(copyTargetFileInfo);
readStream.pipe(writeStream);
// console.log(`复制文件: ${copyCurrentFileInfo} -> ${copyTargetFileInfo}`);
}
else {
try {
(0, fs_1.accessSync)((0, path_1.join)(copyTargetFileInfo, '..'), fs_1.constants.W_OK);
if (!(0, fs_1.existsSync)(copyTargetFileInfo)) {
(0, fs_1.mkdirSync)(copyTargetFileInfo);
}
// console.log(`创建文件夹: ${copyTargetFileInfo}`);
copyFolder(copyCurrentFileInfo, copyTargetFileInfo, overwrite);
}
catch (error) {
(0, tip_style_1.Warn)('权限不足' + error);
console.error('权限不足', error);
throw error;
}
}
@ -167,14 +174,15 @@ function copyFolder(currentDir, targetDir, overwrite) {
if ((0, fs_1.existsSync)(currentDir)) {
if (!(0, fs_1.existsSync)(targetDir)) {
(0, fs_1.mkdirSync)(targetDir);
// console.log(`创建目标文件夹: ${targetDir}`);
}
handleFolder(currentDir, targetDir);
}
else {
throw new global.Error('需要copy的文件夹不存在:' + currentDir);
console.error(`需要copy的文件夹不存在: ${currentDir}`);
throw new global.Error(`需要copy的文件夹不存在: ${currentDir}`);
}
}
exports.copyFolder = copyFolder;
/**
* @name 检测文件/文件夹是否存在
* @export
@ -184,7 +192,6 @@ exports.copyFolder = copyFolder;
function checkFileExists(path) {
return (0, fs_1.existsSync)(path);
}
exports.checkFileExists = checkFileExists;
/**
* @name 检测文件/文件夹是否存在不存在则创建
* @export
@ -210,4 +217,3 @@ function checkFileExistsAndCreate(path, data, type = enum_1.checkFileExistsAndCr
throw new global.Error(`${path} already exists!`);
}
}
exports.checkFileExistsAndCreate = checkFileExistsAndCreate;

View File

@ -1,5 +1,6 @@
"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"));
@ -24,4 +25,3 @@ async function make(cmd, rebuild) {
process.exit(-1);
}
}
exports.default = make;

View File

@ -1,5 +1,6 @@
"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"));
@ -20,4 +21,3 @@ async function make() {
process.exit(-1);
}
}
exports.default = make;

View File

@ -1,5 +1,6 @@
"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"));
@ -18,4 +19,3 @@ async function make(cmd) {
process.exit(-1);
}
}
exports.default = make;

View File

@ -1,5 +1,6 @@
"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"));
@ -30,4 +31,3 @@ async function make(cmd, watch) {
process.exit(-1);
}
}
exports.default = make;

View File

@ -1,6 +1,7 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.rename = exports.renameProject = void 0;
exports.renameProject = renameProject;
exports.rename = rename;
const path_1 = require("path");
const fs_1 = require("fs");
const editTemplate_1 = require("@react-native-community/cli/build/commands/init/editTemplate");
@ -42,12 +43,10 @@ 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: '太藏',

View File

@ -1,5 +1,6 @@
"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"));
@ -59,4 +60,3 @@ async function run(options) {
process.exit(-1);
}
}
exports.default = run;

View File

@ -1,4 +1,3 @@
/// <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';

View File

@ -1,6 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.initialize = void 0;
exports.initialize = initialize;
/// <reference path="../typings/polyfill.d.ts" />
const oak_backend_base_1 = require("oak-backend-base");
async function initialize(path) {
@ -10,4 +10,3 @@ async function initialize(path) {
await appLoader.unmount();
console.log('data initialized');
}
exports.initialize = initialize;

View File

@ -1,4 +1,3 @@
/// <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';

View File

@ -1,6 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.startup = void 0;
exports.startup = startup;
const tslib_1 = require("tslib");
/// <reference path="../typings/polyfill.d.ts" />
require("./polyfill");
@ -222,4 +222,3 @@ async function startup(path, connector, omitWatchers, omitTimers, routine) {
process.exit(0);
});
}
exports.startup = startup;

View File

@ -1,6 +1,16 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.oakConfigContentWithWeb = exports.oakConfigContentWithWeChatMp = exports.appJsonContentWithWeChatMp = exports.projectConfigContentWithWeChatMp = exports.tsConfigWebJsonContent = exports.tsConfigMpJsonContent = exports.tsConfigPathsJsonContent = exports.tsConfigBuildPathsJsonContent = exports.tsConfigBuildJsonContent = exports.tsConfigJsonContent = exports.packageJsonContent = void 0;
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;
const child_process_1 = require("child_process");
const fs_1 = require("fs");
const path_1 = require("path");
@ -93,80 +103,91 @@ function packageJsonContent({ name, version, description, cliName, cliBinName, i
"license": "",
"typings": "typings/index.d.ts",
"dependencies": {
"@ant-design/cssinjs": "^1.16.2",
"@ant-design/icons": "^5.2.6",
"@react-native-async-storage/async-storage": "^1.19.8",
"@react-native-masked-view/masked-view": "^0.3.0",
"@react-navigation/bottom-tabs": "^6.5.11",
"@react-navigation/native": "^6.1.9",
"@react-navigation/stack": "^6.3.20",
"@wangeditor/basic-modules": "^1.1.3",
"@wangeditor/editor": "^5.1.14",
"@wangeditor/editor-for-react": "^1.0.4",
"antd": "^5.8.3",
"antd-mobile": "^5.32.0",
"antd-mobile-icons": "^0.3.0",
"classnames": "^2.3.1",
"crypto-browserify": "^3.12.0",
"crypto-js": "^4.1.1",
"dayjs": "^1.11.5",
"echarts": "^5.3.0",
"echarts-for-react": "^3.0.2",
"history": "^5.3.0",
"hmacsha1": "^1.0.0",
"js-base64": "^3.7.2",
"lodash": "^4.17.21",
"nprogress": "^0.2.0",
${oakDependencyStr}
"react": "^18.3.0",
"react-dom": "^18.3.0",
"react-native": "^0.75.0",
"react-native-exception-handler": "^2.10.10",
"react-native-gesture-handler": "^2.14.0",
"react-native-localize": "^3.0.4",
"react-native-quick-base64": "^2.0.7",
"react-native-quick-crypto": "^0.6.1",
"react-native-reanimated": "^3.5.4",
"react-native-safe-area-context": "^4.7.4",
"react-native-screens": "^3.27.0",
"react-native-url-polyfill": "^2.0.0",
"react-responsive": "^9.0.0-beta.10",
"react-router-dom": "^6.4.0",
"react-slick": "^0.29.0",
"rmc-pull-to-refresh": "^1.0.13",
"uuid": "^8.3.2"
"@ant-design/cssinjs": "^1.16.2",
"@ant-design/icons": "^5.2.6",
"@bytemd/plugin-breaks": "^1.21.0",
"@bytemd/plugin-frontmatter": "^1.21.0",
"@bytemd/plugin-gemoji": "^1.21.0",
"@bytemd/plugin-gfm": "^1.21.0",
"@bytemd/plugin-highlight": "^1.21.0",
"@bytemd/plugin-math": "^1.21.0",
"@bytemd/plugin-medium-zoom": "^1.21.0",
"@bytemd/plugin-mermaid": "^1.21.0",
"@bytemd/react": "^1.21.0",
"react-beautiful-dnd": "^13.1.1",
"@react-native-async-storage/async-storage": "^1.19.8",
"@react-native-masked-view/masked-view": "^0.3.0",
"@react-navigation/bottom-tabs": "^6.5.11",
"@react-navigation/native": "^6.1.9",
"@react-navigation/stack": "^6.3.20",
"@wangeditor/basic-modules": "^1.1.3",
"@wangeditor/editor": "^5.1.14",
"@wangeditor/editor-for-react": "^1.0.4",
"antd": "^5.8.3",
"antd-mobile": "^5.32.0",
"antd-mobile-icons": "^0.3.0",
"classnames": "^2.3.1",
"crypto-browserify": "^3.12.0",
"crypto-js": "^4.1.1",
"dayjs": "^1.11.5",
"echarts": "^5.3.0",
"echarts-for-react": "^3.0.2",
"history": "^5.3.0",
"hmacsha1": "^1.0.0",
"js-base64": "^3.7.2",
"lodash": "^4.17.21",
"nprogress": "^0.2.0",
${oakDependencyStr}
"react": "^18.3.0",
"react-dom": "^18.3.0",
"react-native": "^0.75.0",
"react-native-exception-handler": "^2.10.10",
"react-native-gesture-handler": "^2.14.0",
"react-native-localize": "^3.0.4",
"react-native-quick-base64": "^2.0.7",
"react-native-quick-crypto": "^0.6.1",
"react-native-reanimated": "^3.5.4",
"react-native-safe-area-context": "^4.7.4",
"react-native-screens": "^3.27.0",
"react-native-url-polyfill": "^2.0.0",
"react-responsive": "^9.0.0-beta.10",
"react-router-dom": "^6.4.0",
"react-slick": "^0.29.0",
"rmc-pull-to-refresh": "^1.0.13",
"uuid": "^8.3.2"
},
"devDependencies": {
"@babel/cli": "^7.12.13",
"@babel/core": "^7.12.13",
"@babel/plugin-proposal-class-properties": "^7.12.13",
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
"@babel/preset-env": "^7.12.13",
"@babel/preset-typescript": "^7.12.13",
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.3",
"@react-native/metro-config": "^0.72.11",
"@svgr/webpack": "^5.5.0",
"@testing-library/jest-dom": "^5.16.4",
"@testing-library/react": "^13.3.0",
"@testing-library/user-event": "^13.5.0",
"@tsconfig/react-native": "^3.0.0",
"@types/assert": "^1.5.6",
"@types/crypto-js": "^4.1.1",
"@types/fs-extra": "^9.0.13",
"@types/isomorphic-fetch": "^0.0.36",
"@types/jest": "^27.5.2",
"@types/lodash": "^4.14.179",
"@types/luxon": "^2.3.2",
"@types/mocha": "^8.2.0",
"@types/node": "^20.10.2",
"@types/nprogress": "^0.2.0",
"@types/react": "^18.0.12",
"@types/react-dom": "^18.0.5",
"@types/react-image-gallery": "^1.2.0",
"@types/shelljs": "^0.8.11",
"@types/urlsafe-base64": "^1.0.28",
"@types/uuid": "^8.3.0",
"@types/wechat-miniprogram": "^3.4.0",
"@babel/cli": "^7.12.13",
"@babel/core": "^7.12.13",
"@babel/plugin-proposal-class-properties": "^7.12.13",
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
"@babel/preset-env": "^7.12.13",
"@babel/preset-typescript": "^7.12.13",
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.3",
"@react-native/metro-config": "^0.72.11",
"@svgr/webpack": "^5.5.0",
"@testing-library/jest-dom": "^5.16.4",
"@testing-library/react": "^13.3.0",
"@testing-library/user-event": "^13.5.0",
"@tsconfig/react-native": "^3.0.0",
"@types/assert": "^1.5.6",
"@types/crypto-js": "^4.1.1",
"@types/fs-extra": "^9.0.13",
"@types/isomorphic-fetch": "^0.0.36",
"@types/jest": "^27.5.2",
"@types/lodash": "^4.14.179",
"@types/luxon": "^2.3.2",
"@types/mocha": "^8.2.0",
"@types/node": "^20.10.2",
"@types/nprogress": "^0.2.0",
"@types/react": "^18.0.12",
"@types/react-dom": "^18.0.5",
"@types/react-image-gallery": "^1.2.0",
"@types/react-beautiful-dnd": "^13.1.8",
"@types/shelljs": "^0.8.11",
"@types/urlsafe-base64": "^1.0.28",
"@types/uuid": "^8.3.0",
"@types/wechat-miniprogram": "^3.4.0",
${oakDevDependencyStr}
"assert": "^2.0.0",
"babel-jest": "^27.4.2",
@ -261,11 +282,15 @@ function packageJsonContent({ name, version, description, cliName, cliBinName, i
"not op_mini all"
]
},
"copyWebpack": []
"copyWebpack": [],
"overrides": {
"crypto-browserify": {
"readable-stream": "3.6.2"
}
}
}
`;
}
exports.packageJsonContent = packageJsonContent;
function tsConfigJsonContent() {
return `{
"extends": "./tsconfig.paths.json",
@ -312,7 +337,6 @@ function tsConfigJsonContent() {
]
}`;
}
exports.tsConfigJsonContent = tsConfigJsonContent;
function tsConfigBuildJsonContent() {
return `{
"extends": "./tsconfig.build.paths.json",
@ -352,7 +376,6 @@ function tsConfigBuildJsonContent() {
]
}`;
}
exports.tsConfigBuildJsonContent = tsConfigBuildJsonContent;
function tsConfigBuildPathsJsonContent() {
return `{
"compilerOptions": {
@ -372,7 +395,6 @@ function tsConfigBuildPathsJsonContent() {
}
}`;
}
exports.tsConfigBuildPathsJsonContent = tsConfigBuildPathsJsonContent;
function tsConfigPathsJsonContent() {
return `{
"compilerOptions": {
@ -392,7 +414,6 @@ function tsConfigPathsJsonContent() {
}
}`;
}
exports.tsConfigPathsJsonContent = tsConfigPathsJsonContent;
function tsConfigMpJsonContent() {
return `{
"extends": "./tsconfig.paths.json",
@ -440,7 +461,6 @@ function tsConfigMpJsonContent() {
]
}`;
}
exports.tsConfigMpJsonContent = tsConfigMpJsonContent;
function tsConfigWebJsonContent() {
return `{
"extends": "./tsconfig.paths.json",
@ -490,7 +510,6 @@ function tsConfigWebJsonContent() {
]
}`;
}
exports.tsConfigWebJsonContent = tsConfigWebJsonContent;
function projectConfigContentWithWeChatMp(oakConfigName, projectname, miniVersion) {
return `{
"description": "项目配置文件",
@ -566,7 +585,6 @@ function projectConfigContentWithWeChatMp(oakConfigName, projectname, miniVersio
}
}`;
}
exports.projectConfigContentWithWeChatMp = projectConfigContentWithWeChatMp;
function appJsonContentWithWeChatMp(isDev) {
const pages = [
'@project/pages/store/list/index',
@ -590,18 +608,15 @@ function appJsonContentWithWeChatMp(isDev) {
"sitemapLocation": "sitemap.json"
}`;
}
exports.appJsonContentWithWeChatMp = appJsonContentWithWeChatMp;
function oakConfigContentWithWeChatMp() {
return `{
"theme": {
}
}`;
}
exports.oakConfigContentWithWeChatMp = oakConfigContentWithWeChatMp;
function oakConfigContentWithWeb() {
return `{
"theme": {
}
}`;
}
exports.oakConfigContentWithWeb = oakConfigContentWithWeb;

View File

@ -1,6 +1,12 @@
"use strict";
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文件
* @export
@ -18,7 +24,6 @@ function findJson(pathArr) {
}
return result;
}
exports.findJson = findJson;
/**
* @name 已知前后文取中间文本
* @export
@ -32,7 +37,6 @@ function getStr(str, start, end) {
let res = str.match(reg);
return res ? res[1] : null;
}
exports.getStr = getStr;
/**
* @name 差集
* @export
@ -44,7 +48,6 @@ exports.getStr = getStr;
function difference(current, target) {
return new Set([...target].filter(x => !current.has(x)));
}
exports.difference = difference;
/**
* @name 获取交集
* @export
@ -56,7 +59,6 @@ exports.difference = difference;
function intersect(current, target) {
return new Set([...target].filter(x => current.has(x)));
}
exports.intersect = intersect;
/**
* @name 获取并集
* @export
@ -68,7 +70,6 @@ exports.intersect = intersect;
function union(current, target) {
return new Set([...current, ...target]);
}
exports.union = union;
/**
* @name 格式化json
* @export
@ -79,7 +80,6 @@ exports.union = union;
function formatJsonByFile(data) {
return JSON.stringify(data, null, 2);
}
exports.formatJsonByFile = formatJsonByFile;
/**
* @name 数组对象去重
* @export
@ -96,4 +96,3 @@ function deWeight(arr, type) {
}
return new Set([...map.values()]);
}
exports.deWeight = deWeight;