Skip to content

Commit

Permalink
PR - build for windows on linux machine (#351)
Browse files Browse the repository at this point in the history
* test with graceful-fs

* test with graceful-fs

* test with graceful-fs with all

* Revert "test with graceful-fs"

This reverts commit 95f1558.

* 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 95f1558.

* 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 <[email protected]>
  • Loading branch information
DanielC-N and danielc-n authored Aug 1, 2024
1 parent 73db1b4 commit e70e328
Show file tree
Hide file tree
Showing 6 changed files with 94 additions and 77 deletions.
93 changes: 46 additions & 47 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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: |
Expand All @@ -58,98 +57,98 @@ 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
- 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 [email protected]
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/[email protected]/bin/pip3 install setuptools
/opt/homebrew/opt/[email protected]/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: |
Expand Down
9 changes: 7 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -15,10 +21,10 @@ export const AppHeader: React.FC = () => {
sentences,
// itemArrays,
curIndex,
setFileName,
setGlobalTotalSentences,
setItemArrays,
setOriginText,
// setFileName,
// setGlobalTotalSentences,
// setItemArrays,
// setOriginText,
setCurIndex,
setChapterNumber,
setVerseNumber,
Expand Down Expand Up @@ -61,15 +67,15 @@ 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);
}
}, [curIndex, setCurIndex]);

useEffect(() => {
if(closeNavigation) {
if (closeNavigation) {
setCurIndex(getSentenceFromCV());
}
}, [closeNavigation]);
Expand All @@ -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;
Expand Down Expand Up @@ -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<HTMLInputElement | HTMLTextAreaElement>
) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -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<HTMLInputElement | HTMLTextAreaElement>) => {
if(isEditing && e.key == "Enter") {
if (isEditing && e.key == "Enter") {
setIsEditing(false);
}
}
Expand All @@ -28,14 +32,14 @@ export const MarkdownInput = ({ setIsEditing, isEditing, fontSize, selectedFont,
return (
<Stack
flexDirection={"row"}
sx={{ background: "lightgrey", width: "100%", height: "36px", pl: "8px"}}
sx={{ background: "lightgrey", width: "100%", height: "36px", pl: "8px" }}
>
<Box flexGrow={1}>
<Input autoFocus onKeyDown={enterPressed} {...props} fullWidth onBlur={() => setIsEditing(false)} style={{
// fontFamily: selectedFont || 'sans-serif',
fontSize: `${fontSize}rem`,
lineHeight: (fontSize > 1.3) ? 1.5 : '',
}} ></Input>
// fontFamily: selectedFont || 'sans-serif',
fontSize: `${fontSize}rem`,
lineHeight: (fontSize > 1.3) ? 1.5 : '',
}} ></Input>
</Box>
<Box sx={{ padding: "6px" }}>
<Button
Expand All @@ -61,7 +65,7 @@ export const MarkdownInput = ({ setIsEditing, isEditing, fontSize, selectedFont,
<Stack
flexGrow={1}
justifyContent={"center"}
sx={{ width: "100%", height: "100%"}}
sx={{ width: "100%", height: "100%" }}
>
<Markdown
unwrapDisallowed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ import {
DropResult,
DraggableLocation,
} from '../components/Droppable';
import { Box, Button, Grid, Stack } from '@mui/material';
import Button from '@mui/material/Button';
import Grid from '@mui/material/Grid';
import Stack from '@mui/material/Stack';
import Box from '@mui/material/Box';
import { IoCaretUp, IoCaretDown } from 'react-icons/io5';
import { saveToFile } from '../../JuxtaTextEditor/hooks/saveToFile';

Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2951,10 +2951,10 @@
resolved "https://registry.yarnpkg.com/@mui/core-downloads-tracker/-/core-downloads-tracker-5.15.15.tgz#2bc2bda50db66c12f10aefec907c48c8f669ef59"
integrity sha512-aXnw29OWQ6I5A47iuWEI6qSSUfH6G/aCsW9KmW3LiFqr7uXZBK4Ks+z8G+qeIub8k0T5CMqlT2q0L+ZJTMrqpg==

"@mui/icons-material@^5.10.9":
version "5.15.15"
resolved "https://registry.yarnpkg.com/@mui/icons-material/-/icons-material-5.15.15.tgz#84ce08225a531d9f5dc5132009d91164b456a0ae"
integrity sha512-kkeU/pe+hABcYDH6Uqy8RmIsr2S/y5bP2rp+Gat4CcRjCcVne6KudS1NrZQhUCRysrTDCAhcbcf9gt+/+pGO2g==
"@mui/icons-material@^5.8.4":
version "5.15.20"
resolved "https://registry.yarnpkg.com/@mui/icons-material/-/icons-material-5.15.20.tgz#dbd45d635d82b034fb10dadb5c258c26e3311618"
integrity sha512-oGcKmCuHaYbAAoLN67WKSXtHmEgyWcJToT1uRtmPyxMj9N5uqwc/mRtEnst4Wj/eGr+zYH2FiZQ79v9k7kSk1Q==
dependencies:
"@babel/runtime" "^7.23.9"

Expand Down

0 comments on commit e70e328

Please sign in to comment.