Files
Agent-n8n/backups/exhibition-demo-backup-20250928-210916/node_modules/react-syntax-highlighter/scripts/build-stylesheets-highlightjs.js
Yep_Q 67f5dfbe50 feat: 实现多订单班支持系统
主要功能:
- 修改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>
2025-09-29 10:02:15 +08:00

132 lines
3.8 KiB
JavaScript

'use strict';
/*
* Quick and dirty script to build javascript stylesheets from highlight.js css
*/
const path = require('path');
const fs = require('fs');
const css = require('css');
const camel = require('to-camel-case');
const autogenMessage =
'//\n// This file has been auto-generated by the `npm run build-styles-hljs` task\n//\n\n';
fs.readdir(
path.join(__dirname, '../node_modules/highlight.js/styles'),
(err, files) => {
if (err) {
throw err;
}
files.forEach(file => {
if (file.includes('.css')) {
createJavascriptStyleSheet(file);
}
});
const onlyCSSFiles = files.filter(file => file.includes('.css'));
const availableStyleNames = onlyCSSFiles.map(file =>
file.split('.css')[0] === 'default'
? 'default-style'
: file.split('.css')[0]
);
const styles = availableStyleNames.map(name => `\n* ${camel(name)}`);
const defaultExports = availableStyleNames.map(
name => `export { default as ${camel(name)} } from './${name}';\n`
);
const styleMD = `## Available \`stylesheet\` props ${styles.join('')}`;
fs.writeFile(
path.join(__dirname, '../AVAILABLE_STYLES_HLJS.MD'),
styleMD,
err => {
if (err) {
throw err;
}
}
);
fs.writeFile(
path.join(__dirname, '../src/styles/hljs/index.js'),
defaultExports.join(''),
err => {
if (err) {
throw err;
}
}
);
const demoStylesArray = `${autogenMessage}export default [${availableStyleNames
.sort()
.map(style => `\n '${style}'`)}\n];`;
fs.writeFile(
path.join(__dirname, '../demo/styles/hljs.js'),
demoStylesArray,
err => {
if (err) {
throw err;
}
}
);
}
);
function createJavascriptStyleSheet(file) {
const ignoreStyleWithThis = '.hljs a';
const fileWithoutCSS =
file.split('.css')[0] === 'default'
? 'default-style'
: file.split('.css')[0];
fs.readFile(
path.join(__dirname, `../node_modules/highlight.js/styles/${file}`),
'utf-8',
(err, data) => {
if (err) {
throw err;
}
const javacriptStylesheet = css
.parse(data)
.stylesheet.rules.reduce((sheet, rule) => {
if (rule.type === 'rule') {
const style = rule.selectors.reduce((selectors, selector) => {
if (!selector.includes(ignoreStyleWithThis)) {
const selectorObject = rule.declarations.reduce(
(declarations, declaration) => {
if (
declaration.type === 'declaration' &&
declaration.property
) {
declarations[camel(declaration.property)] =
declaration.value;
}
return declarations;
},
{}
);
selectors[selector.substring(1)] = selectorObject;
}
return selectors;
}, {});
sheet = Object.keys(style).reduce((stylesheet, selector) => {
if (stylesheet[selector]) {
stylesheet[selector] = Object.assign(
{},
stylesheet[selector],
style[selector]
);
} else {
stylesheet[selector] = style[selector];
}
return stylesheet;
}, sheet);
}
return sheet;
}, {});
fs.writeFile(
path.join(__dirname, `../src/styles/hljs/${fileWithoutCSS}.js`),
`export default ${JSON.stringify(javacriptStylesheet, null, 4)}`,
err => {
if (err) {
throw err;
}
}
);
}
);
}