mirror of
https://github.com/tobspr/shapez.io.git
synced 2025-12-11 09:11:50 +00:00
* Switch to npm in electron/ May change resolved package versions. * Remove redundant electron-notarize dependency The number of dependencies stays the same. Only direct mention in package.json is removed. * Assume Node.js 22.x and clean up dependencies Targeting Node.js 22.x allows using the new fs.glob* functions, which can replace the glob module. It is still downloaded as there are other packages using it, but is no longer included in devDependencies. Also remove @types/filesystem, as this API is not used anywhere in the code, it is non-standard and some of it was removed from Chromium. Was likely used with Cordova for YORG.io 3 mobile support. * Update linting stack Install the latest versions of the following packages: - @eslint/js (^9.24.0) - eslint (^9.24.0) - typescript-eslint (^8.29.1) and remove packages that are no longer used: - @types/eslint__js - yarn Config files were not modified. * Switch root package to npm npm is able to resolve packages using yarn.lock as a resolution hint. Note that files other than those included in this commit are intentionally kept outdated, as they may need a bigger change.
26 lines
835 B
JavaScript
26 lines
835 B
JavaScript
import { execSync } from "child_process";
|
|
import fs from "fs";
|
|
|
|
export function getRevision(useLast = false) {
|
|
const commitHash = execSync("git rev-parse --short " + (useLast ? "HEAD^1" : "HEAD")).toString("ascii");
|
|
return commitHash.replace(/^\s+|\s+$/g, "");
|
|
}
|
|
|
|
export function getAllResourceImages() {
|
|
return fs
|
|
.globSync("res/**/*.@(png|svg|jpg)", { cwd: ".." })
|
|
.map(f => f.replace(/^res\//gi, ""))
|
|
.filter(f => {
|
|
if (f.indexOf("ui") >= 0) {
|
|
// We drop all ui images except for the noinline ones
|
|
return f.indexOf("noinline") >= 0;
|
|
}
|
|
return true;
|
|
});
|
|
}
|
|
|
|
export function getVersion() {
|
|
// Use the version number specified in package.json
|
|
return JSON.parse(fs.readFileSync("../package.json", "utf-8")).version;
|
|
}
|