sync
This commit is contained in:
23
concat-md.js
Normal file
23
concat-md.js
Normal file
@@ -0,0 +1,23 @@
|
||||
import concatMd, { concatMdSync } from "concat-md";
|
||||
import path from "path";
|
||||
import fs from "fs";
|
||||
|
||||
const resultMd = concatMdSync("./parts", {
|
||||
toc: false,
|
||||
sorter: (a, b) => {
|
||||
// Извлекаем номер из начала имени файла (например, "1" из "1-assistent.md")
|
||||
const getNumber = (filename) => {
|
||||
const match = filename.match(/^(\d+)/);
|
||||
return match ? parseInt(match[1], 10) : 0;
|
||||
};
|
||||
|
||||
// Сортировка по возрастанию (1, 2, 3...)
|
||||
return getNumber(a) - getNumber(b);
|
||||
}
|
||||
});
|
||||
|
||||
// Записываем результат в файл .cursorrules в корне проекта
|
||||
const outputPath = path.join("./", ".cursorrules");
|
||||
fs.writeFileSync(outputPath, resultMd, "utf8");
|
||||
|
||||
console.log(`Файл .cursorrules успешно создан: ${outputPath}`);
|
||||
Reference in New Issue
Block a user