主要功能: - 修改RequirementModal支持12个订单班选择 - 添加OrderClassIconMap图标映射组件 - Store中添加selectedOrderClass状态管理 - WorkflowPage支持传递orderClass参数 - web_result添加URL参数切换功能 - 创建order-class-handler.js动态处理页面主题 技术改进: - 创建软链接关联订单班数据目录 - 生成wenlu.json和food.json数据结构 - 删除重复的web_result目录 - 添加测试页面test-order-class.html 影响范围: - 展会策划系统现支持12个订单班 - 结果展示页面自动适配不同订单班主题 - 用户可选择不同行业生成对应方案 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
76 lines
2.3 KiB
JavaScript
76 lines
2.3 KiB
JavaScript
'use strict';
|
|
const path = require('path');
|
|
const pathType = require('path-type');
|
|
|
|
const getExtensions = extensions => extensions.length > 1 ? `{${extensions.join(',')}}` : extensions[0];
|
|
|
|
const getPath = (filepath, cwd) => {
|
|
const pth = filepath[0] === '!' ? filepath.slice(1) : filepath;
|
|
return path.isAbsolute(pth) ? pth : path.join(cwd, pth);
|
|
};
|
|
|
|
const addExtensions = (file, extensions) => {
|
|
if (path.extname(file)) {
|
|
return `**/${file}`;
|
|
}
|
|
|
|
return `**/${file}.${getExtensions(extensions)}`;
|
|
};
|
|
|
|
const getGlob = (directory, options) => {
|
|
if (options.files && !Array.isArray(options.files)) {
|
|
throw new TypeError(`Expected \`files\` to be of type \`Array\` but received type \`${typeof options.files}\``);
|
|
}
|
|
|
|
if (options.extensions && !Array.isArray(options.extensions)) {
|
|
throw new TypeError(`Expected \`extensions\` to be of type \`Array\` but received type \`${typeof options.extensions}\``);
|
|
}
|
|
|
|
if (options.files && options.extensions) {
|
|
return options.files.map(x => path.posix.join(directory, addExtensions(x, options.extensions)));
|
|
}
|
|
|
|
if (options.files) {
|
|
return options.files.map(x => path.posix.join(directory, `**/${x}`));
|
|
}
|
|
|
|
if (options.extensions) {
|
|
return [path.posix.join(directory, `**/*.${getExtensions(options.extensions)}`)];
|
|
}
|
|
|
|
return [path.posix.join(directory, '**')];
|
|
};
|
|
|
|
module.exports = async (input, options) => {
|
|
options = {
|
|
cwd: process.cwd(),
|
|
...options
|
|
};
|
|
|
|
if (typeof options.cwd !== 'string') {
|
|
throw new TypeError(`Expected \`cwd\` to be of type \`string\` but received type \`${typeof options.cwd}\``);
|
|
}
|
|
|
|
const globs = await Promise.all([].concat(input).map(async x => {
|
|
const isDirectory = await pathType.isDirectory(getPath(x, options.cwd));
|
|
return isDirectory ? getGlob(x, options) : x;
|
|
}));
|
|
|
|
return [].concat.apply([], globs); // eslint-disable-line prefer-spread
|
|
};
|
|
|
|
module.exports.sync = (input, options) => {
|
|
options = {
|
|
cwd: process.cwd(),
|
|
...options
|
|
};
|
|
|
|
if (typeof options.cwd !== 'string') {
|
|
throw new TypeError(`Expected \`cwd\` to be of type \`string\` but received type \`${typeof options.cwd}\``);
|
|
}
|
|
|
|
const globs = [].concat(input).map(x => pathType.isDirectorySync(getPath(x, options.cwd)) ? getGlob(x, options) : x);
|
|
|
|
return [].concat.apply([], globs); // eslint-disable-line prefer-spread
|
|
};
|