From 07eafd85f6c6e3a71f15db58003db5d391d78d4a Mon Sep 17 00:00:00 2001 From: hiento09 <136591877+hiento09@users.noreply.github.com> Date: Wed, 29 Nov 2023 17:27:15 +0700 Subject: [PATCH] Switch from .zip to .tar.gz for nitro url inference plugin (#781) * Switch from .zip to .tar.gz for nitro url * make clean add clean data folder --------- Co-authored-by: Hien To --- .github/workflows/jan-electron-build.yml | 18 +++--------------- Makefile | 20 +++++++++++++++----- plugins/inference-plugin/download.bat | 4 ++++ plugins/inference-plugin/package.json | 6 +++--- 4 files changed, 25 insertions(+), 23 deletions(-) create mode 100644 plugins/inference-plugin/download.bat diff --git a/.github/workflows/jan-electron-build.yml b/.github/workflows/jan-electron-build.yml index 4d5835f1e..7d3f7adcb 100644 --- a/.github/workflows/jan-electron-build.yml +++ b/.github/workflows/jan-electron-build.yml @@ -121,22 +121,10 @@ jobs: env: VERSION_TAG: ${{ steps.tag.outputs.tag }} - - name: Build uikit + - name: Build app + shell: cmd run: | - cd uikit - yarn config set network-timeout 300000 - yarn install - yarn build - - - name: Install yarn dependencies - shell: powershell - run: | - yarn config set network-timeout 300000 - yarn build:core - yarn install - $env:NITRO_VERSION = Get-Content .\plugins\inference-plugin\nitro\version.txt; echo $env:NITRO_VERSION - yarn build:plugins - yarn build + make build - name: Windows Code Sign with AzureSignTool run: | diff --git a/Makefile b/Makefile index af416304c..3a3d58b83 100644 --- a/Makefile +++ b/Makefile @@ -15,14 +15,11 @@ endif # Installs yarn dependencies and builds core and plugins install-and-build: build-uikit ifeq ($(OS),Windows_NT) - powershell -Command "yarn config set network-timeout 300000; \ - $$env:NITRO_VERSION = Get-Content .\\plugins\\inference-plugin\\nitro\\version.txt; \ - Write-Output \"Nitro version: $$env:NITRO_VERSION\"; yarn build:core; yarn install; yarn build:plugins" -else + yarn config set network-timeout 300000 +endif yarn build:core yarn install yarn build:plugins -endif dev: install-and-build yarn dev @@ -47,8 +44,21 @@ build: install-and-build clean: ifeq ($(OS),Windows_NT) powershell -Command "Get-ChildItem -Path . -Include node_modules, .next, dist -Recurse -Directory | Remove-Item -Recurse -Force" + rmdir /s /q "%USERPROFILE%\AppData\Roaming\jan" + rmdir /s /q "%USERPROFILE%\AppData\Roaming\jan-electron" + rmdir /s /q "%USERPROFILE%\AppData\Local\jan*" +else ifeq ($(shell uname -s),Linux) + find . -name "node_modules" -type d -prune -exec rm -rf '{}' + + find . -name ".next" -type d -exec rm -rf '{}' + + find . -name "dist" -type d -exec rm -rf '{}' + + rm -rf "~/.config/jan" + rm -rf "~/.config/jan-electron" + rm -rf "~/.cache/jan*" else find . -name "node_modules" -type d -prune -exec rm -rf '{}' + find . -name ".next" -type d -exec rm -rf '{}' + find . -name "dist" -type d -exec rm -rf '{}' + + rm -rf ~/Library/Application\ Support/jan + rm -rf ~/Library/Application\ Support/jan-electron + rm -rf ~/Library/Caches/jan* endif diff --git a/plugins/inference-plugin/download.bat b/plugins/inference-plugin/download.bat new file mode 100644 index 000000000..3dfe34218 --- /dev/null +++ b/plugins/inference-plugin/download.bat @@ -0,0 +1,4 @@ +@echo off +set /p NITRO_VERSION=<./nitro/version.txt +.\node_modules\.bin\download https://github.com/janhq/nitro/releases/download/v%NITRO_VERSION%/nitro-%NITRO_VERSION%-win-amd64-cuda.zip -e --strip 1 -o ./nitro/win-cuda +.\node_modules\.bin\download https://github.com/janhq/nitro/releases/download/v%NITRO_VERSION%/nitro-%NITRO_VERSION%-win-amd64.zip -e --strip 1 -o ./nitro/win-cpu diff --git a/plugins/inference-plugin/package.json b/plugins/inference-plugin/package.json index f19c864cd..97d9fc7c0 100644 --- a/plugins/inference-plugin/package.json +++ b/plugins/inference-plugin/package.json @@ -13,9 +13,9 @@ ], "scripts": { "build": "tsc -b . && webpack --config webpack.config.js", - "downloadnitro:linux": "NITRO_VERSION=$(cat ./nitro/version.txt) && download https://github.com/janhq/nitro/releases/download/v${NITRO_VERSION}/nitro-${NITRO_VERSION}-linux-amd64.zip -e --strip 1 -o ./nitro/linux-cpu && chmod +x ./nitro/linux-cpu/nitro && chmod +x ./nitro/linux-start.sh && download https://github.com/janhq/nitro/releases/download/v${NITRO_VERSION}/nitro-${NITRO_VERSION}-linux-amd64-cuda.zip -e --strip 1 -o ./nitro/linux-cuda && chmod +x ./nitro/linux-cuda/nitro && chmod +x ./nitro/linux-start.sh", - "downloadnitro:darwin": "NITRO_VERSION=$(cat ./nitro/version.txt) && download https://github.com/janhq/nitro/releases/download/v${NITRO_VERSION}/nitro-${NITRO_VERSION}-mac-arm64.zip -e --strip 1 -o ./nitro/mac-arm64 && chmod +x ./nitro/mac-arm64/nitro && download https://github.com/janhq/nitro/releases/download/v${NITRO_VERSION}/nitro-${NITRO_VERSION}-mac-amd64.zip -e --strip 1 -o ./nitro/mac-x64 && chmod +x ./nitro/mac-x64/nitro", - "downloadnitro:win32": "download https://github.com/janhq/nitro/releases/download/v%NITRO_VERSION%/nitro-%NITRO_VERSION%-win-amd64.zip -e --strip 1 -o ./nitro/win-cpu && download https://github.com/janhq/nitro/releases/download/v%NITRO_VERSION%/nitro-%NITRO_VERSION%-win-amd64-cuda.zip -e --strip 1 -o ./nitro/win-cuda", + "downloadnitro:linux": "NITRO_VERSION=$(cat ./nitro/version.txt) && download https://github.com/janhq/nitro/releases/download/v${NITRO_VERSION}/nitro-${NITRO_VERSION}-linux-amd64.tar.gz -e --strip 1 -o ./nitro/linux-cpu && chmod +x ./nitro/linux-cpu/nitro && chmod +x ./nitro/linux-start.sh && download https://github.com/janhq/nitro/releases/download/v${NITRO_VERSION}/nitro-${NITRO_VERSION}-linux-amd64-cuda.tar.gz -e --strip 1 -o ./nitro/linux-cuda && chmod +x ./nitro/linux-cuda/nitro && chmod +x ./nitro/linux-start.sh", + "downloadnitro:darwin": "NITRO_VERSION=$(cat ./nitro/version.txt) && download https://github.com/janhq/nitro/releases/download/v${NITRO_VERSION}/nitro-${NITRO_VERSION}-mac-arm64.tar.gz -e --strip 1 -o ./nitro/mac-arm64 && chmod +x ./nitro/mac-arm64/nitro && download https://github.com/janhq/nitro/releases/download/v${NITRO_VERSION}/nitro-${NITRO_VERSION}-mac-amd64.tar.gz -e --strip 1 -o ./nitro/mac-x64 && chmod +x ./nitro/mac-x64/nitro", + "downloadnitro:win32": "download.bat", "downloadnitro": "run-script-os", "build:publish:darwin": "rimraf *.tgz --glob && npm run build && npm run downloadnitro && ../../.github/scripts/auto-sign.sh && cpx \"nitro/**\" \"dist/nitro\" && npm pack && cpx *.tgz ../../electron/core/pre-install", "build:publish:win32": "rimraf *.tgz --glob && npm run build && npm run downloadnitro && cpx \"nitro/**\" \"dist/nitro\" && npm pack && cpx *.tgz ../../electron/core/pre-install",