Skip to content

Commit

Permalink
Merge pull request #47 from innogames/Fix-search-in-variant-files
Browse files Browse the repository at this point in the history
Also search in variant files content
  • Loading branch information
pbojan authored Feb 6, 2025
2 parents 7a56d0e + 671759f commit 730c68b
Show file tree
Hide file tree
Showing 7 changed files with 278 additions and 767 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/createWindowsBuild.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Create windows build

on:
workflow_dispatch:

jobs:
buildWin:
runs-on: windows-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '20.5.1'

- name: Install dependencies
run: yarn install

- name: Build the project
run: yarn run dist-win

- name: Upload path as artifact
uses: actions/upload-artifact@v4
with:
name: windows-build
path: dist/
if-no-files-found: error
retention-days: 1
overwrite: true
include-hidden-files: true
compression-level: 0

zipAndUploadAsArtifact:
needs: [buildWin]
runs-on: macos-14

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Download win dir artifact
uses: actions/download-artifact@v4
with:
name: windows-build
path: dist

- name: Zip windows build
run: ./build/scripts/zip-files.sh

- name: Upload zip file as artifact
uses: actions/upload-artifact@v4
with:
name: windows-build
path: dist/upload/Dr.Json-windows.zip
if-no-files-found: error
retention-days: 1
overwrite: true
include-hidden-files: true
compression-level: 0
15 changes: 12 additions & 3 deletions build/scripts/zip-files.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,15 @@ PRODUCT_NAME=$(getPackageJsonVal productName)

echo "Zip files..."
mkdir dist/upload
zip -j dist/upload/Dr.Json-${PACKAGE_VERSION}-mac.zip "dist/Dr. Json-${PACKAGE_VERSION}.dmg"
zip -j dist/upload/Dr.Json-${PACKAGE_VERSION}-arm64.zip "dist/Dr. Json-${PACKAGE_VERSION}-arm64.dmg"
zip -j dist/upload/Dr.Json-${PACKAGE_VERSION}-windows.zip "dist/Dr. Json ${PACKAGE_VERSION}.exe"

if [ -f "dist/Dr. Json-${PACKAGE_VERSION}.dmg" ]; then
zip -j dist/upload/Dr.Json-mac.zip "dist/Dr. Json-${PACKAGE_VERSION}.dmg"
fi

if [ -f "dist/Dr. Json-${PACKAGE_VERSION}-arm64.dmg" ]; then
zip -j dist/upload/Dr.Json-arm64.zip "dist/Dr. Json-${PACKAGE_VERSION}-arm64.dmg"
fi

if [ -f "dist/Dr. Json ${PACKAGE_VERSION}.exe" ]; then
zip -j dist/upload/Dr.Json-windows.zip "dist/Dr. Json ${PACKAGE_VERSION}.exe"
fi
10 changes: 5 additions & 5 deletions docs/developer-documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Requirements

- node.js (developed with node version 8.12.0)
- node.js (developed with node version v20.5.1)
- [yarn](https://yarnpkg.com/en/docs/install)


Expand Down Expand Up @@ -34,15 +34,15 @@ Also our TravisCI automated build pipeline is no longer functional and deactivat
yarn version --patch
```

> This will update the version in **package.json** as well as creating a new **git tag**.
> This will update the version in **package.json** as well as creating a new **git tag**.
2. Run `git push` to push to master and then `git push --tags` to also include the new tags.

3. Run `yarn run dist` from your mac/linux machine
3. Run `yarn run dist` from your mac

4. Run `yarn run dist-win` from your windows machine
4. Run the github action `createWindowsBuild` and download the file from the action

5. When all builds are done, create new release ([latest release here](https://github.com/innogames/dr-json/releases)) and append all build files to the release as well as a zip file containing the source code.
5. Create new release ([latest release here](https://github.com/innogames/dr-json/releases)) and append all build files to the release as well as a zip file containing the source code.


## Tech stack
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"author": {
"name": "Innogames GmbH"
},
"version": "0.22.0",
"version": "0.22.2",
"private": true,
"scripts": {
"postinstall": "electron-builder install-app-deps",
Expand All @@ -17,7 +17,7 @@
"dev-renderer": "webpack-dev-server --config-name renderer --mode=development --env env=dev --env devServerPort=3000",
"compile": "webpack --mode=production",
"create-icons": "electron-icon-maker --input=./build/icons/icon-src.png --output=./build/",
"dist-win": "rimraf dist && yarn run compile && electron-builder -w && ./build/scripts/zip-files.sh",
"dist-win": "rimraf dist && yarn run compile && electron-builder -w",
"dist": "rimraf dist && yarn run compile && electron-builder -m && ./build/scripts/zip-files.sh"
},
"main": "./dist/compiled/main.js",
Expand Down Expand Up @@ -68,6 +68,7 @@
"react-jsonschema-form": "1.8.1",
"react-select": "5.2.1",
"reflect-metadata": "0.1.13",
"sass": "^1.83.4",
"source-map-support": "0.5.21"
},
"devDependencies": {
Expand All @@ -89,7 +90,6 @@
"html-webpack-plugin": "5.5.0",
"jest": "27.4.3",
"mini-css-extract-plugin": "^2.4.5",
"node-sass": "9.0.0",
"rimraf": "3.0.2",
"sass-loader": "12.3.0",
"style-loader": "3.3.1",
Expand Down
17 changes: 15 additions & 2 deletions src/domain/context/fileTree/filter/byFileContentSearch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,22 @@ function checkFile(file: SchemaFile, search: string, filesystem: FilesystemImpl)
{
try{
const haystack: string = JSON.stringify(filesystem.readJsonSync(file.dataFile)).replace('\\', '').toLowerCase();
return haystack.includes(search);
if(haystack.includes(search))
{
return true;
}
} catch(error) {
console.warn(`Failed to read file "${file.dataFile}": ${error}`)
console.warn(error)
return false;
}

for(let i: number = 0; i < file.variants.length; i++)
{
const haystack: string = JSON.stringify(filesystem.readJsonSync(file.variants[i].variantFile)).replace('\\', '').toLowerCase();
if(haystack.includes(search))
{
return true;
}
}

return false;
Expand Down
5 changes: 3 additions & 2 deletions src/domain/useCases/project/ExportRewards.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,9 @@ export class ExportRewards {
try{
extractedData = [...extractedData, ...this.extractFileData(file.dataFile, file.label)]
} catch(error) {
console.warn(`Failed to read file "${file.dataFile}": ${error}`)
console.warn(error)
file.setIsReward(false);
return extractedData;
}

try{
Expand All @@ -96,7 +97,7 @@ export class ExportRewards {
}
})
} catch(error) {
console.warn(`Failed to read variant file "${file.dataFile}": ${error}`)
console.warn(error)
}

return extractedData;
Expand Down
Loading

0 comments on commit 730c68b

Please sign in to comment.