Skip to content

Commit

Permalink
rewrite install / update scripts
Browse files Browse the repository at this point in the history
rvion committed Dec 5, 2023
1 parent da0dabd commit ea4ec66
Showing 8 changed files with 65 additions and 99 deletions.
1 change: 0 additions & 1 deletion 2_run.bat

This file was deleted.

1 change: 0 additions & 1 deletion 2_run.sh

This file was deleted.

File renamed without changes.
63 changes: 63 additions & 0 deletions START_windows.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
@echo off
SETLOCAL EnableExtensions
setlocal enabledelayedexpansion

:: Exit with nonzero exit code if anything fails
set errorlevel=

:: Define variables
SET PNPM_VERSION=8.11.0
SET PNPM_HOME=%CD%\.cushy
SET PNPM_BIN_PATH=%CD%\.cushy\pnpm

:: Function to install using PowerShell
CALL :install_with_powershell

:: Check if pnpm is already installed
IF EXIST "%PNPM_HOME%\pnpm" (
FOR /F "tokens=*" %%i IN ('%PNPM_BIN_PATH% --version') DO SET INSTALLED_PNPM_VERSION=%%i
IF NOT "%INSTALLED_PNPM_VERSION%"=="%PNPM_VERSION%" (
ECHO Updating pnpm from version %INSTALLED_PNPM_VERSION% to %PNPM_VERSION%...
CALL :install_with_powershell
) ELSE (
ECHO pnpm is already installed and up to date.
)
) ELSE (
ECHO pnpm is not installed, proceeding with installation...
CALL :install_with_powershell
)

:: Verify pnpm installation
IF NOT EXIST "%PNPM_BIN_PATH%" (
ECHO Failed to install or update pnpm.
EXIT /B 1
)

:: Install dependencies using pnpm
ECHO Installing dependencies...
CALL %PNPM_BIN_PATH% install

:: ensuring binary dependencies are correctly linked across installed
CALL .\node_modules\.bin\electron-builder install-app-deps

:: Define the path to tsconfig.custom.json
SET tsconfigPath=.\tsconfig.custom.json

:: JSON content to write if the file does not exist
SET defaultTsconfigJSON={ "include": ["src", "schema/global.d.ts"], "exclude": [] }

:: Check if the file exists
IF NOT EXIST "%tsconfigPath%" (
ECHO %defaultTsconfigJSON% > "%tsconfigPath%"
)

:: Start Vite using Electron's Node
ECHO Starting Vite with Electron's Node...
CALL .\node_modules\.bin\electron -i src\shell

EXIT /B 0

:install_with_powershell
ECHO Installing pnpm with PowerShell...
PowerShell -Command "iwr https://get.pnpm.io/install.ps1 -useb | iex"
EXIT /B 0
2 changes: 1 addition & 1 deletion 1_update.sh → UPDATE_macos_linux.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -2,4 +2,4 @@ set -eux
rm -rf node_modules/.vite
git checkout master || true
git pull origin master || true
npm install
# npm install
3 changes: 1 addition & 2 deletions 1_update.bat → UPDATE_windows.bat
100644 → 100755
Original file line number Diff line number Diff line change
@@ -2,5 +2,4 @@ rmdir /s /q node_modules\.vite
git checkout master -- package-lock.json
git checkout master
git pull origin master
npm install
pause
@REM pause
93 changes: 0 additions & 93 deletions _CushyStudio_MAC.sh

This file was deleted.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -22,7 +22,6 @@
"main": "./lib/index.js",
"typings": "./lib/index.d.ts",
"scripts": {
"start": "node ./start.cjs",
"📌 CODEGEN": "",
"gen-bins-node": "npm rebuild",
"gen-bins": "electron-builder install-app-deps",

0 comments on commit ea4ec66

Please sign in to comment.