mirror of
https://github.com/Dokploy/templates
synced 2025-06-26 18:16:07 +00:00
- Deleted the blueprints path variable from script.js as it is no longer needed after recent changes to the template file format.
33 lines
854 B
JavaScript
33 lines
854 B
JavaScript
import yaml from "yaml";
|
|
import toml from "@iarna/toml";
|
|
import fs from "fs";
|
|
import path from "path";
|
|
import { fileURLToPath } from "url";
|
|
|
|
const __filename = fileURLToPath(import.meta.url);
|
|
const __dirname = path.dirname(__filename);
|
|
|
|
function convertYamlToToml(yamlContent) {
|
|
const parsedYaml = yaml.parse(yamlContent);
|
|
return toml.stringify(parsedYaml);
|
|
}
|
|
|
|
function processDirectory(dirPath) {
|
|
const files = fs.readdirSync(dirPath);
|
|
|
|
files.forEach((file) => {
|
|
const filePath = path.join(dirPath, file);
|
|
const stat = fs.statSync(filePath);
|
|
|
|
if (stat.isDirectory()) {
|
|
processDirectory(filePath);
|
|
} else if (file === "template.yml") {
|
|
console.log(`Deleting ${filePath}`);
|
|
fs.unlinkSync(filePath);
|
|
}
|
|
});
|
|
}
|
|
|
|
const blueprintsPath = path.join(__dirname, "..", "blueprints");
|
|
processDirectory(blueprintsPath);
|