测试:judger封装为模块

This commit is contained in:
undefined committed 2020-05-08 12:28:04 +08:00
1 parent 5d7f57334f
commit 6134a16f8c
8 files changed
+305 -30

No files matched your search

+12 -2
View File
@@ -30,7 +30,9 @@ const build = async (type) => {
module: {},
plugins: [
new webpack.ProgressPlugin(),
new FriendlyErrorsPlugin(),
new FriendlyErrorsPlugin({
clearConsole: false,
}),
],
};
for (const i of modules) {
@@ -90,11 +92,19 @@ const build = async (type) => {
if (exist(`module/${i}/template`)) {
current.template = template(`module/${i}/template`);
}
if (exist(`module/${i}/file`)) {
const files = fs.readdirSync(root(`module/${i}/file`));
current.file = {};
for (const file of files) {
current.file[file] = fs.readFileSync(root(`module/${i}/file/${file}`)).toString('base64');
}
}
const m = require(root(`module/${i}/hydro.json`));
current.description = m.description || '';
current.requirements = m.requirements || [];
current.version = m.version || 'unknown';
const data = zlib.gzipSync(Buffer.from(yaml.safeDump(current)), { level: 3 });
if (m.os) current.os = m.os;
const data = zlib.gzipSync(Buffer.from(yaml.safeDump(current)), { level: -1 });
fs.writeFileSync(root(`.build/module/${i}.hydro`), data);
}
}
+3 -1
View File
@@ -34,7 +34,9 @@ const build = async (type) => {
module: {},
plugins: [
new webpack.ProgressPlugin(),
new FriendlyErrorsPlugin(),
new FriendlyErrorsPlugin({
clearConsole: false,
}),
],
};
const compiler = webpack(config);