Files
n3wt-school/scripts/update-version.js
Luc SORIGNET af0cd1c840 chore: Initial Commit
feat: Gestion des inscriptions [#1]
feat(frontend): Création des vues pour le paramétrage de l'école [#2]
feat: Gestion du login [#6]
fix: Correction lors de la migration des modèle [#8]
feat: Révision du menu principal [#9]
feat: Ajout d'un footer [#10]
feat: Création des dockers compose pour les environnements de
développement et de production [#12]
doc(ci): Mise en place de Husky et d'un suivi de version automatique [#14]
2024-11-18 16:06:21 +01:00

26 lines
1.2 KiB
JavaScript

const fs = require('fs');
const path = require('path');
// Chemins vers les fichiers
const rootPackageJsonPath = path.resolve(__dirname, '../package.json');
const rootPackageJson = JSON.parse(fs.readFileSync(rootPackageJsonPath, 'utf8'));
// Lire la version actuelle du package.json principal
const newVersion = rootPackageJson.version;
const frontendPackageJsonPath = path.resolve(__dirname, '../Front-End/package.json');
// Lire et mettre à jour le package.json du sous-module
const frontendPackageJson = JSON.parse(fs.readFileSync(frontendPackageJsonPath, 'utf8'));
frontendPackageJson.version = newVersion;
// Écrire les changements dans le fichier frontend/package.json
fs.writeFileSync(frontendPackageJsonPath, JSON.stringify(frontendPackageJson, null, 2), 'utf8');
console.log(`Version mise à jour dans frontend/package.json : ${newVersion}`);
// Chemin vers le fichier Python de version
const versionFilePath = path.resolve(__dirname, '../Back-End/__version__.py');
// Mettre à jour le fichier Python
const versionContent = `__version__ = "${newVersion}"\n`;
fs.writeFileSync(versionFilePath, versionContent, 'utf8');
console.log(`Version du backend mise à jour dans ${versionFilePath} : ${newVersion}`);