mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-18 00:56:02 +00:00
workflow refactor WIP
This commit is contained in:
42
common/processWorkflows.js
Normal file
42
common/processWorkflows.js
Normal file
@@ -0,0 +1,42 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const yaml = require('js-yaml');
|
||||
|
||||
const indir = path.resolve(path.join(__dirname, '..', 'workflow-templates'));
|
||||
const outdir = path.resolve(path.join(__dirname, '..', 'workflow-templates'));
|
||||
|
||||
const includes = {};
|
||||
|
||||
for (const file of fs.readdirSync(indir)) {
|
||||
const text = fs.readFileSync(path.join(indir, file), { encoding: 'utf-8' });
|
||||
const json = yaml.load(text);
|
||||
if (json._module) {
|
||||
for (const key in json) {
|
||||
if (key === '_module') {
|
||||
continue;
|
||||
}
|
||||
includes[key] = json[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (const file of fs.readdirSync(indir)) {
|
||||
const text = fs.readFileSync(path.join(indir, file), { encoding: 'utf-8' });
|
||||
const json = yaml.load(text);
|
||||
|
||||
if (json._module) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (json._templates) {
|
||||
for (const template of json._templates) {
|
||||
const outfile = template.file;
|
||||
const text = template.text;
|
||||
const json = template.json;
|
||||
const out = path.join(outdir, name);
|
||||
fs.writeFileSync(out, text);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user