详细说明: - 基于文旅订单班框架复制创建food-order-demo项目 - 修改端口配置为4174避免冲突 - 更新LandingPage为青莳轻食主题(绿色健康风格) - 重新定义7个食品行业专业Agent: * 市场研究专家:轻食市场分析、客群画像 * 营养配方师:营养成分配比、低卡高蛋白设计 * 供应链管理专家:有机食材供应、溯源体系 * 品牌策划师:品牌定位、店铺空间布局 * 财务分析师:投资预算、ROI分析 * 运营管理专家:运营流程、品控标准 * 食品创业导师:中央协调、方案整合 - 创建专用启动脚本start.sh - 验证系统可正常运行在端口4174 - 实现代码复用率90%,符合预期目标 影响文件: web_frontend/food-order-demo/ 技术栈: React 18 + TypeScript + Tailwind CSS + Zustand
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
|
|
};
|