Initial commit
**Motivations:** - Initialisation du versionning git pour le projet **Root causes:** - N/A (Nouveau projet) **Correctifs:** - N/A **Evolutions:** - Structure initiale du projet - Ajout du .gitignore **Pages affectées:** - Tous les fichiers
This commit is contained in:
97
scripts/remove-code-blocks.js
Normal file
97
scripts/remove-code-blocks.js
Normal file
@@ -0,0 +1,97 @@
|
||||
/**
|
||||
* Removes code blocks from cahier des charges:
|
||||
* - Lua blocks (-- path, local ..., return Module)
|
||||
* - weightedPick function block
|
||||
* - Console/stack trace blocks
|
||||
*/
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const filePath = path.join(__dirname, '..', 'docs', 'cahier des charges.md');
|
||||
let lines = fs.readFileSync(filePath, 'utf8').split('\n');
|
||||
const out = [];
|
||||
let i = 0;
|
||||
const n = lines.length;
|
||||
|
||||
function isLuaBlockStart(line) {
|
||||
return (
|
||||
line.startsWith('-- ReplicatedStorage/') ||
|
||||
line.startsWith('-- ServerScriptService/')
|
||||
);
|
||||
}
|
||||
|
||||
function isLuaBlockEnd(line, forServerMain) {
|
||||
if (forServerMain) {
|
||||
return line === 'end)';
|
||||
}
|
||||
return (
|
||||
line === 'return LootTables' ||
|
||||
line === 'return PlayerDataService' ||
|
||||
line === 'return ZooService' ||
|
||||
line === 'return IncomeService'
|
||||
);
|
||||
}
|
||||
|
||||
function isStackTraceLine(line) {
|
||||
if (!line || line.trim() === '') return false;
|
||||
return (
|
||||
/^\d{2}:\d{2}:\d{2}\.\d+ /.test(line) ||
|
||||
/\.(js|ts):\d+/.test(line) ||
|
||||
/^at \w+ \(/.test(line) ||
|
||||
/^(GET|POST) https:\/\//.test(line) ||
|
||||
/Fetch failed loading/.test(line) ||
|
||||
/^[a-zA-Z]+ @ (main|api-client|auth-client)\.js:\d+/.test(line) ||
|
||||
/^await in /.test(line) ||
|
||||
/\(anonymous\) @ /.test(line) ||
|
||||
/^Error: /.test(line) && /\.js:\d+/.test(line)
|
||||
);
|
||||
}
|
||||
|
||||
while (i < n) {
|
||||
const line = lines[i];
|
||||
|
||||
// Lua block: -- ReplicatedStorage/ or -- ServerScriptService/
|
||||
if (isLuaBlockStart(line)) {
|
||||
const forServerMain = line.includes('ServerMain');
|
||||
i++;
|
||||
while (i < n && !isLuaBlockEnd(lines[i], forServerMain)) {
|
||||
i++;
|
||||
}
|
||||
if (i < n) i++;
|
||||
continue;
|
||||
}
|
||||
|
||||
// weightedPick function block
|
||||
if (line.startsWith('local function weightedPick(rng, entries)')) {
|
||||
i++;
|
||||
while (i < n && lines[i] !== 'end') {
|
||||
i++;
|
||||
}
|
||||
if (i < n) i++;
|
||||
continue;
|
||||
}
|
||||
|
||||
// task.spawn(function() ... end) block (leftover Lua fragment)
|
||||
if (line === 'task.spawn(function()') {
|
||||
i++;
|
||||
while (i < n && lines[i] !== 'end)') {
|
||||
i++;
|
||||
}
|
||||
if (i < n) i++;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Consecutive stack trace lines
|
||||
if (isStackTraceLine(line)) {
|
||||
while (i < n && isStackTraceLine(lines[i])) {
|
||||
i++;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
out.push(line);
|
||||
i++;
|
||||
}
|
||||
|
||||
fs.writeFileSync(filePath, out.join('\n'));
|
||||
console.log('Removed code blocks. Lines: ' + lines.length + ' -> ' + out.length);
|
||||
46
scripts/strip-technical-cahier.js
Normal file
46
scripts/strip-technical-cahier.js
Normal file
@@ -0,0 +1,46 @@
|
||||
/**
|
||||
* Strip technical descriptions from cahier des charges:
|
||||
* Remove lines that are file paths, config references, or "Fichiers modifiés" lists.
|
||||
*/
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const baseDir = path.resolve(__dirname, '..');
|
||||
const filePath = path.join(baseDir, 'docs', 'cahier des charges.md');
|
||||
let content = fs.readFileSync(filePath, 'utf8');
|
||||
const lines = content.split('\n');
|
||||
const out = [];
|
||||
|
||||
function isTechnicalLine(line) {
|
||||
const t = line.trim();
|
||||
if (!t) return false;
|
||||
if (/^[-*]?\s*`?web\/js\//.test(t) || /^[-*]?\s*`?server\//.test(t)) return true;
|
||||
if (/^\*\*Fichiers (modifiés|impactés|concernés)/i.test(t)) return true;
|
||||
if (/^-\s*`[^`]+\.(js|css|ts)`\s*[;,.]/.test(t)) return true;
|
||||
if (/^\*\*Config\*\* `config\.js`/.test(t)) return true;
|
||||
if (/^-\s*`web\/js\/[^`]+`\s*$/.test(t)) return true;
|
||||
if (/^`web\/js\/[^`]+`,?\s*$/.test(t)) return true;
|
||||
if (/^-\s*\*\*[a-z0-9-]+\.(js|ts|css)\*\*/.test(t) && t.length < 130) return true;
|
||||
if (/^\d+\.\s+\*\*[a-z-]+\.(js|ts)\*\*/.test(t)) return true;
|
||||
if (/^-\s*`[a-z0-9/-]+\.(js|css|ts)`\s*[,(]/.test(t)) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
let i = 0;
|
||||
while (i < lines.length) {
|
||||
const line = lines[i];
|
||||
if (isTechnicalLine(line)) {
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
if (/^\*\*Fichiers (modifiés|impactés)/i.test(line.trim())) {
|
||||
i++;
|
||||
while (i < lines.length && (lines[i].trim().startsWith('-') || lines[i].trim() === '')) i++;
|
||||
continue;
|
||||
}
|
||||
out.push(line);
|
||||
i++;
|
||||
}
|
||||
|
||||
fs.writeFileSync(filePath, out.join('\n'));
|
||||
console.log('Lines: ' + lines.length + ' -> ' + out.length);
|
||||
Reference in New Issue
Block a user