1
0
mirror of https://github.com/garraflavatra/rolens.git synced 2025-01-18 13:07:58 +00:00

Attempt to fix build.js

This commit is contained in:
Romein van Buren 2023-06-30 20:09:36 +02:00
parent 1ecfa0ab20
commit 84f1b85356
Signed by: romein
GPG Key ID: 0EFF8478ADDF6C49
4 changed files with 43 additions and 19 deletions

View File

@ -73,7 +73,7 @@ jobs:
path: releases/*
- name: Test build script for users
run: ./build.js
run: node ./build.js
bundle:
name: Bundle artifacts

View File

@ -36,7 +36,7 @@ You can obtain a pre-compiled Rolens binary for macOS or installer for Windows f
### Compiling from source
If you have Node.js installed, just download the source from GitHub, and run `./build.js`. The install script will check that dependencies are present and build Rolens for you.
If you have Node.js installed, just download the source from GitHub, and run `node ./build.js`. The install script will check that dependencies are present and build Rolens for you.
If you want to build it yourself, please refer to the [advanced build process documentation](https://garraflavatra.github.io/rolens/development/advanced-build/) for detailed compilation instructions.

View File

@ -52,32 +52,43 @@ function isNullish(val) {
// Check that Go ^1.18 is installed.
const goMinorVersion = /go1\.([0-9][0-9])/.exec(
try {
const goMinorVersion = /go1\.([0-9][0-9])/.exec(
execSync('go version').toString()
)?.pop();
)?.pop();
if (isNullish(goMinorVersion) || (parseInt(goMinorVersion) < 18)) {
if (isNullish(goMinorVersion) || (parseInt(goMinorVersion) < 18)) {
throw new Error();
}
} catch {
missingDependencies.push({ name: 'Go ^1.18 ^16', url: 'https://go.dev/doc/install' });
}
// Check that Node.js ^16 is installed.
const nodeMajorVersion = /v([0-9]{1,2})\.[0-9]{1,3}\.[0-9]{1,3}/.exec(
try {
const nodeMajorVersion = /v([0-9]{1,2})\.[0-9]{1,3}\.[0-9]{1,3}/.exec(
execSync('node --version').toString()
)?.pop();
)?.pop();
if (isNullish(nodeMajorVersion) || (parseInt(nodeMajorVersion) < 16)) {
if (isNullish(nodeMajorVersion) || (parseInt(nodeMajorVersion) < 16)) {
throw new Error();
}
} catch {
missingDependencies.push({ name: 'Node.js ^16', url: 'https://go.dev/doc/install' });
}
// Check that Wails is installed.
const wailsMinorVersion = /v2\.([0-9])\.[0-9]/.exec(
try {
const wailsMinorVersion = /v2\.([0-9])\.[0-9]/.exec(
execSync('wails version').toString()
)?.pop();
)?.pop();
if (isNullish(wailsMinorVersion) || (parseInt(wailsMinorVersion) < 3)) {
if (isNullish(wailsMinorVersion) || (parseInt(wailsMinorVersion) < 3)) {
throw new Error();
}
} catch {
missingDependencies.push({
name: 'Wails ^2.3',
command: 'go install github.com/wailsapp/wails/v2/cmd/wails@latest',
@ -88,9 +99,18 @@ if (isNullish(wailsMinorVersion) || (parseInt(wailsMinorVersion) < 3)) {
// Check that NSIS is installed on Windows.
if (isWindows) {
try {
const nsisInstalled = /v3\.([0-9][0-9])/.test(execSync('makensis.exe /VERSION').toString());
if (!nsisInstalled) {
missingDependencies.push({ name: 'Nullsoft Install System ^3', url: 'https://nsis.sourceforge.io/Download' });
throw new Error();
}
} catch {
missingDependencies.push({
name: 'Nullsoft Install System ^3',
command: 'choco install nsis',
url: 'https://nsis.sourceforge.io/Download',
comment: 'Note: you should add makensis.exe to your path:\n setx /M PATH "%PATH%;C:\\Program Files (x86)\\NSIS\\Bin"'
});
}
}
@ -112,6 +132,10 @@ if (missingDependencies.length > 0) {
console.log(' Visit the following page for more information:');
console.log(` ${dependency.url}`);
}
if (dependency.comment) {
console.log(` ${dependency.comment}`);
}
}
process.exit(1);

View File

@ -23,7 +23,7 @@ If you use a Linux-based OS, please continue reading.
Rolens is free and open-source software, which means that you can compile it from source on your own machine by cloning [the repository](https://github.com/garraflavatra/rolens).
If you have Node.js installed, just download the source from GitHub, and run `./build.js`. The install script will check that dependencies are present and build Rolens for you. If you want to build it yourself, please continue reading.
If you have Node.js installed, just download the source from GitHub, and run `node ./build.js`. The install script will check that dependencies are present and build Rolens for you. If you want to build it yourself, please continue reading.
## Advanced build