Skip to content

Commit

Permalink
propagate version
Browse files Browse the repository at this point in the history
  • Loading branch information
eltorio committed May 25, 2024
1 parent b109567 commit 4f0d409
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 22 deletions.
11 changes: 10 additions & 1 deletion build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
// along with SCTGDesk. If not, see <https://www.gnu.org/licenses/agpl-3.0.html>.
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
use std::env;
use std::path::PathBuf;
use std::process::Command;
use std::str;
use std::fs;
Expand Down Expand Up @@ -54,7 +56,14 @@ fn main() {
let data = fs::read_to_string("./webconsole/package.json").unwrap();
let mut package: PackageJson = serde_json::from_str(&data).unwrap();

package.set_version(std::env::var("MAIN_PKG_VERSION").unwrap_or(std::env::var("CARGO_PKG_VERSION").unwrap()).as_str());
// Construit le chemin du fichier dans le répertoire temporaire
let tmp_dir = env::var("TMP").or_else(|_| env::var("TEMP")).or_else(|_| env::var("TMPDIR")).unwrap_or_else(|_| "/tmp".to_string());
let mut path = PathBuf::from(tmp_dir);
path.push("version.txt");
// Lit la version à partir du fichier
let version = fs::read_to_string(&path).unwrap_or_else(|_| env::var("CARGO_PKG_VERSION").unwrap());

package.set_version(&version);

let serialized = serde_json::to_string_pretty(&package).unwrap();
fs::write("./webconsole/package.json", serialized).unwrap();
Expand Down
42 changes: 21 additions & 21 deletions webconsole/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,43 +4,43 @@
"version": "0.1.0",
"type": "module",
"scripts": {
"preview": "vite preview",
"create-cert": "openssl req -x509 -newkey rsa:4096 -keyout localhost.key -out localhost.pem -sha256 -nodes -days 365",
"dev": "vite",
"build": "vite build && gulp licenses",
"devserver": "npx nodemon -V -w ./src -e js,vue,ts,css,html --exec 'npm run build && node devserver.js'"
"dev": "vite",
"devserver": "npx nodemon -V -w ./src -e js,vue,ts,css,html --exec 'npm run build && node devserver.js'",
"preview": "vite preview",
"create-cert": "openssl req -x509 -newkey rsa:4096 -keyout localhost.key -out localhost.pem -sha256 -nodes -days 365"
},
"dependencies": {
"vue-router": "^4.3.2",
"vue": "^3.4.27",
"pinia": "^2.1.7",
"axios": "^1.7.2",
"@headlessui/vue": "^1.7.22",
"jdenticon": "^3.3.0",
"@heroicons/vue": "^2.1.3",
"axios": "^1.7.2",
"@pqina/flip": "^1.8.3",
"@headlessui/vue": "^1.7.22"
"@heroicons/vue": "^2.1.3",
"vue": "^3.4.27",
"vue-router": "^4.3.2"
},
"devDependencies": {
"@vitejs/plugin-vue": "^5.0.4",
"gulp-if": "^3.0.0",
"@tailwindcss/typography": "^0.5.13",
"@tailwindcss/forms": "^0.5.7",
"postcss": "^8.4.38",
"nodemon": "^3.1.0",
"gulp-append-prepend": "^1.0.9",
"tailwindcss": "^3.4.3",
"vite-plugin-static-copy": "^1.0.5",
"npm-check-updates": "^16.14.20",
"gulp-append-prepend": "^1.0.9",
"gulp-if": "^3.0.0",
"express": "^4.19.2",
"@types/glob": "^8.1.0",
"vite": "^5.2.11",
"sass": "^1.77.2",
"vite-plugin-static-copy": "^1.0.5",
"postcss": "^8.4.38",
"ts-node": "^10.9.2",
"postcss-purgefonts": "^1.0.2",
"gulp": "^5.0.0",
"glob": "10.4.1",
"postcss-purgefonts": "^1.0.2",
"@tailwindcss/forms": "^0.5.7",
"autoprefixer": "^10.4.19",
"typescript": "^5.4.5",
"glob": "10.4.1",
"@fullhuman/postcss-purgecss": "^6.0.0",
"vite": "^5.2.11",
"sass": "^1.77.2",
"express": "^4.19.2",
"@types/glob": "^8.1.0"
"typescript": "^5.4.5"
}
}

0 comments on commit 4f0d409

Please sign in to comment.