mirror of
https://github.com/garraflavatra/rolens.git
synced 2025-01-18 04:57:59 +00:00
Attempt to fix build.js
This commit is contained in:
parent
1ecfa0ab20
commit
84f1b85356
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@ -73,7 +73,7 @@ jobs:
|
|||||||
path: releases/*
|
path: releases/*
|
||||||
|
|
||||||
- name: Test build script for users
|
- name: Test build script for users
|
||||||
run: ./build.js
|
run: node ./build.js
|
||||||
|
|
||||||
bundle:
|
bundle:
|
||||||
name: Bundle artifacts
|
name: Bundle artifacts
|
||||||
|
@ -36,7 +36,7 @@ You can obtain a pre-compiled Rolens binary for macOS or installer for Windows f
|
|||||||
|
|
||||||
### Compiling from source
|
### 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.
|
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.
|
||||||
|
|
||||||
|
56
build.js
56
build.js
@ -52,32 +52,43 @@ function isNullish(val) {
|
|||||||
|
|
||||||
// Check that Go ^1.18 is installed.
|
// Check that Go ^1.18 is installed.
|
||||||
|
|
||||||
const goMinorVersion = /go1\.([0-9][0-9])/.exec(
|
try {
|
||||||
execSync('go version').toString()
|
const goMinorVersion = /go1\.([0-9][0-9])/.exec(
|
||||||
)?.pop();
|
execSync('go version').toString()
|
||||||
|
)?.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' });
|
missingDependencies.push({ name: 'Go ^1.18 ^16', url: 'https://go.dev/doc/install' });
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check that Node.js ^16 is installed.
|
// Check that Node.js ^16 is installed.
|
||||||
|
|
||||||
const nodeMajorVersion = /v([0-9]{1,2})\.[0-9]{1,3}\.[0-9]{1,3}/.exec(
|
try {
|
||||||
execSync('node --version').toString()
|
const nodeMajorVersion = /v([0-9]{1,2})\.[0-9]{1,3}\.[0-9]{1,3}/.exec(
|
||||||
)?.pop();
|
execSync('node --version').toString()
|
||||||
|
)?.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' });
|
missingDependencies.push({ name: 'Node.js ^16', url: 'https://go.dev/doc/install' });
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check that Wails is installed.
|
// Check that Wails is installed.
|
||||||
|
|
||||||
const wailsMinorVersion = /v2\.([0-9])\.[0-9]/.exec(
|
try {
|
||||||
execSync('wails version').toString()
|
const wailsMinorVersion = /v2\.([0-9])\.[0-9]/.exec(
|
||||||
)?.pop();
|
execSync('wails version').toString()
|
||||||
|
)?.pop();
|
||||||
|
|
||||||
if (isNullish(wailsMinorVersion) || (parseInt(wailsMinorVersion) < 3)) {
|
if (isNullish(wailsMinorVersion) || (parseInt(wailsMinorVersion) < 3)) {
|
||||||
|
throw new Error();
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
missingDependencies.push({
|
missingDependencies.push({
|
||||||
name: 'Wails ^2.3',
|
name: 'Wails ^2.3',
|
||||||
command: 'go install github.com/wailsapp/wails/v2/cmd/wails@latest',
|
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.
|
// Check that NSIS is installed on Windows.
|
||||||
|
|
||||||
if (isWindows) {
|
if (isWindows) {
|
||||||
const nsisInstalled = /v3\.([0-9][0-9])/.test(execSync('makensis.exe /VERSION').toString());
|
try {
|
||||||
if (!nsisInstalled) {
|
const nsisInstalled = /v3\.([0-9][0-9])/.test(execSync('makensis.exe /VERSION').toString());
|
||||||
missingDependencies.push({ name: 'Nullsoft Install System ^3', url: 'https://nsis.sourceforge.io/Download' });
|
if (!nsisInstalled) {
|
||||||
|
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(' Visit the following page for more information:');
|
||||||
console.log(` ${dependency.url}`);
|
console.log(` ${dependency.url}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (dependency.comment) {
|
||||||
|
console.log(` ${dependency.comment}`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
|
@ -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).
|
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
|
## Advanced build
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user