From e70e3282b9b1dc619f5d6206a4fd12f9086ffc62 Mon Sep 17 00:00:00 2001 From: Dan Date: Thu, 1 Aug 2024 10:53:09 +0200 Subject: [PATCH] PR - build for windows on linux machine (#351) * test with graceful-fs * test with graceful-fs * test with graceful-fs with all * Revert "test with graceful-fs" This reverts commit 95f155873528f5c59c2b8962e21aaee26506acf8. * added nextjs optimization package for @mui/lab and translation-helps-rcl * added tc-ui-toolkit to 'optimizePackageImports' * added 'usfm-editor' to 'optimizePackageImports' * added some more packages to optimization * re-testing graceful-fs * updated next * updated nextjs config * Revert "test with graceful-fs" This reverts commit 95f155873528f5c59c2b8962e21aaee26506acf8. * trying with a node update to v20.15.0 * trying to update 'MaxOpenFiles' on windows * changed the way I call '@mui' * changed '@mui/icons-material' from deps to dev-deps * gracefuly-fs directly in yaml config file * let's try to build on linux machine to make an exe * now trying to fix install macos * fix yml file * fix yml file * final fix yml file * last fix yaml * testing a fix for macos * MODIFY : macos config => it looks like it lacked some deps install --------- Co-authored-by: danielc-n --- .github/workflows/node.js.yml | 93 +++++++++---------- package.json | 9 +- .../components/AppHeader/AppHeader.tsx | 34 ++++--- .../MarkdownInput/MarkdownInput.tsx | 22 +++-- .../JuxtalinearEditor/pages/Home.tsx | 5 +- yarn.lock | 8 +- 6 files changed, 94 insertions(+), 77 deletions(-) diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index c0df1a73..e1477e5c 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -9,20 +9,19 @@ on: jobs: build: - runs-on: ${{ matrix.os }} + runs-on: ubuntu-latest env: CI: false strategy: matrix: node-version: [18.20.3] - os: [ubuntu-latest] steps: - uses: actions/checkout@v2 - - name: Use Node.js ${{ matrix.node-version }} + - name: Use Node.js 18.20.3 uses: actions/setup-node@v1 with: - node-version: ${{ matrix.node-version }} + node-version: 18.20.3 - run: | node --version yarn --version @@ -33,7 +32,7 @@ jobs: run: yarn install - name: set max memory allocation - run: export NODE_OPTIONS=–max_old_space_size=4096 + run: export NODE_OPTIONS=-max_old_space_size=4096 # - name: Read version and commit sha # run: | @@ -58,19 +57,19 @@ jobs: path: dist build-windows: - runs-on: ${{ matrix.os }} + runs-on: ubuntu-latest env: CI: false strategy: matrix: node-version: [18.20.3] - os: [windows-latest] + steps: - uses: actions/checkout@v2 - - name: Use Node.js ${{ matrix.node-version }} + - name: Use Node.js 18.20.3 uses: actions/setup-node@v1 with: - node-version: ${{ matrix.node-version }} + node-version: 18.20.3 - run: | node --version yarn --version @@ -78,78 +77,78 @@ jobs: - name: set @bitregistry translation-help run: yarn config set '@bit:registry' https://node.bit.dev - - name: yarn install - run: yarn install - - name: set max memory allocation - run: set NODE_OPTIONS=–max_old_space_size=4096 - - # - name: Read version and commit sha - # run: - # echo "::set-env name=HASH::$(node -p -e "'${{ github.sha }}'.substring(0, 7)")" - # echo "::set-env name=APP_VERSION::$(node -p -e "require('./package.json').version")" + run: export NODE_OPTIONS=-max_old_space_size=4096 - # - name: Set x64 artifact name - # run: echo "::set-env name=ARTIFACT_X64::$(echo "Autographa-win-x64-${{ env.APP_VERSION }}.exe")" + - name: install dependencies + run: yarn install - - name: packaging - id: packaging + - name: install wine run: | - yarn dist + sudo dpkg --add-architecture i386 + sudo apt update + sudo apt install -y wine32 wine64 + + - name: build executable + run: yarn dist --win --x64 - name: Cleanup artifacts - if: matrix.os != 'windows-latest' - run: | - mkdir artifacts - mv "dist/(*.exe,*.deb,*.AppImage,*.dmg)" artifacts || true - - name: Cleanup artifacts Win - if: matrix.os == 'windows-latest' run: | - mkdir artifacts + mkdir -p artifacts mv dist/*.exe artifacts - - name: Upload artifacts ${{ env.ARTIFACT_X64 }} + - name: Upload artifacts uses: actions/upload-artifact@v1 with: - name: Scribe - path: artifacts + name: Scribe + path: artifacts build-mac: - runs-on: ${{ matrix.os }} + runs-on: macos-latest env: CI: false strategy: matrix: node-version: [18.20.3] - os: [macos-latest] steps: - uses: actions/checkout@v2 - - name: Use Node.js ${{ matrix.node-version }} + - name: Use Node.js 18.20.3 uses: actions/setup-node@v1 with: - node-version: ${{ matrix.node-version }} + node-version: 18.20.3 - run: | node --version yarn --version - name: set @bitregistry translation-help run: yarn config set '@bit:registry' https://node.bit.dev + - name: Install Homebrew + run: | + /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" + echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> $HOME/.zprofile + eval "$(/opt/homebrew/bin/brew shellenv)" + + - name: Install canvas dependencies + run: | + brew install pkg-config cairo pango libpng jpeg giflib librsvg python@3.12 + brew reinstall jpeg + echo 'export PATH="/opt/homebrew/opt/jpeg/bin:$PATH"' >> $HOME/.zprofile + echo 'export LDFLAGS="-L/opt/homebrew/opt/jpeg/lib"' >> $HOME/.zprofile + echo 'export CPPFLAGS="-I/opt/homebrew/opt/jpeg/include"' >> $HOME/.zprofile + echo 'export PKG_CONFIG_PATH="/opt/homebrew/opt/jpeg/lib/pkgconfig"' >> $HOME/.zprofile + eval "$(/opt/homebrew/bin/brew shellenv)" + /opt/homebrew/opt/python@3.12/bin/pip3 install setuptools + /opt/homebrew/opt/python@3.12/bin/pip3 install distutils + + - name: set max memory allocation + run: export NODE_OPTIONS=-max_old_space_size=4096 + - name: yarn install run: yarn install - name: install dmg-license run: yarn add dmg-license - - name: set max memory allocation - run: export NODE_OPTIONS=–max_old_space_size=4096 - - # - name: Read version and commit sha - # run: | - # echo "::set-env name=HASH::$(echo $GITHUB_SHA | cut -c1-7)" - # echo "::set-env name=APP_VERSION::$(node -p -e "require('./package.json').version")" - # - name: Set artifact name - # run: echo "::set-env name=ARTIFACT_NAME::$(echo "Autographa-mac-x64-$APP_VERSION.dmg")" - - name: package id: package run: | diff --git a/package.json b/package.json index 202323db..f1170586 100644 --- a/package.json +++ b/package.json @@ -119,7 +119,13 @@ "postcss": "^8.4.21", "prettier": "^2.8.3", "source-map-explorer": "^2.5.3", - "tailwindcss": "^3.2.4" + "tailwindcss": "^3.2.4", + "@mui/icons-material": "^5.8.4" + }, + "peerDependencies": { + "@material-ui/core": "^4.x", + "@material-ui/lab": "^4.x", + "@mui/icons-material": "^5.x" }, "dependencies": { "@babel/plugin-proposal-private-property-in-object": "^7.21.11", @@ -138,7 +144,6 @@ "@material-ui/core": "^4.12.4", "@material-ui/icons": "^4.11.3", "@material-ui/lab": "4.0.0-alpha.57", - "@mui/icons-material": "^5.10.9", "@mui/lab": "^5.0.0-alpha.104", "@mui/material": "^5.10.12", "@radix-ui/react-dialog": "^1.0.3", diff --git a/renderer/src/components/EditorPage/JuxtalinearEditor/components/AppHeader/AppHeader.tsx b/renderer/src/components/EditorPage/JuxtalinearEditor/components/AppHeader/AppHeader.tsx index 78fddbbb..6f7cc828 100644 --- a/renderer/src/components/EditorPage/JuxtalinearEditor/components/AppHeader/AppHeader.tsx +++ b/renderer/src/components/EditorPage/JuxtalinearEditor/components/AppHeader/AppHeader.tsx @@ -5,7 +5,13 @@ import { IoArrowBackCircleOutline, IoArrowForwardCircleOutline, } from "react-icons/io5"; -import { AppBar, Toolbar, Button, Box, Stack, Input } from "@mui/material"; +// AppBar, Toolbar, Button, Box, Stack, Input +import AppBar from "@mui/material/AppBar"; +import Toolbar from "@mui/material/Toolbar"; +import Button from "@mui/material/Button"; +import Box from "@mui/material/Box"; +import Stack from "@mui/material/Stack"; +import Input from "@mui/material/Input"; import { SentenceContext } from '@/components/context/SentenceContext'; @@ -15,10 +21,10 @@ export const AppHeader: React.FC = () => { sentences, // itemArrays, curIndex, - setFileName, - setGlobalTotalSentences, - setItemArrays, - setOriginText, + // setFileName, + // setGlobalTotalSentences, + // setItemArrays, + // setOriginText, setCurIndex, setChapterNumber, setVerseNumber, @@ -61,7 +67,7 @@ export const AppHeader: React.FC = () => { }; useEffect(() => { - if(sentences.length && sentences[curIndex]) { + if (sentences.length && sentences[curIndex]) { const [chap, vers] = sentences[curIndex].chunks[0].source[0].cv.split(":").map((digit: string) => parseInt(digit, 10)); setChapterNumber(chap); setVerseNumber(vers); @@ -69,7 +75,7 @@ export const AppHeader: React.FC = () => { }, [curIndex, setCurIndex]); useEffect(() => { - if(closeNavigation) { + if (closeNavigation) { setCurIndex(getSentenceFromCV()); } }, [closeNavigation]); @@ -85,18 +91,18 @@ export const AppHeader: React.FC = () => { let chap: number, vers: number; let doBreak: boolean; - for(let i = 0; i < sentences.length; i++) { + for (let i = 0; i < sentences.length; i++) { doBreak = false; - for(let chunk of sentences[i].chunks) { - for(let src of chunk.source) { + for (let chunk of sentences[i].chunks) { + for (let src of chunk.source) { [chap, vers] = src.cv.split(":").map((digit) => parseInt(digit)); - if(chap < chapter && vers < verse) { + if (chap < chapter && vers < verse) { doBreak = true; break; } - if(chap == chapter && vers == verse) return i; + if (chap == chapter && vers == verse) return i; } - if(doBreak) break; + if (doBreak) break; } } return 0; @@ -131,7 +137,7 @@ export const AppHeader: React.FC = () => { const startVerse = () => firstSource()?.cv.split(":")[1] ?? 0; const endVerse = () => lastSource()?.cv.split(":")[1] ?? 0; - + const indexChangeHandler = ( e: React.ChangeEvent ) => { diff --git a/renderer/src/components/EditorPage/JuxtalinearEditor/components/MarkdownInput/MarkdownInput.tsx b/renderer/src/components/EditorPage/JuxtalinearEditor/components/MarkdownInput/MarkdownInput.tsx index f7a0afe2..2fe54310 100644 --- a/renderer/src/components/EditorPage/JuxtalinearEditor/components/MarkdownInput/MarkdownInput.tsx +++ b/renderer/src/components/EditorPage/JuxtalinearEditor/components/MarkdownInput/MarkdownInput.tsx @@ -1,14 +1,18 @@ import React, { useState, useRef } from "react"; -import { Button, Input, Stack, InputProps, Box } from "@mui/material"; +// Input, Stack, InputProps, Box +import Button from "@mui/material/Button"; +import Input, { InputProps } from "@mui/material/Input"; +import Stack from "@mui/material/Stack"; +import Box from "@mui/material/Box"; import Markdown from "react-markdown"; import { IoCheckmark, IoCreate } from "react-icons/io5"; -export const MarkdownInput = ({ setIsEditing, isEditing, fontSize, selectedFont, ...props }: InputProps & { setIsEditing: (value: boolean) => boolean, isEditing: boolean, fontSize:number, selectedFont:string }) => { +export const MarkdownInput = ({ setIsEditing, isEditing, fontSize, selectedFont, ...props }: InputProps & { setIsEditing: (value: boolean) => boolean, isEditing: boolean, fontSize: number, selectedFont: string }) => { const [isHovered, setIsHovered] = useState(false); const clickRef = useRef(0); const enterPressed = (e: React.KeyboardEvent) => { - if(isEditing && e.key == "Enter") { + if (isEditing && e.key == "Enter") { setIsEditing(false); } } @@ -28,14 +32,14 @@ export const MarkdownInput = ({ setIsEditing, isEditing, fontSize, selectedFont, return ( setIsEditing(false)} style={{ - // fontFamily: selectedFont || 'sans-serif', - fontSize: `${fontSize}rem`, - lineHeight: (fontSize > 1.3) ? 1.5 : '', - }} > + // fontFamily: selectedFont || 'sans-serif', + fontSize: `${fontSize}rem`, + lineHeight: (fontSize > 1.3) ? 1.5 : '', + }} >