Skip to content

Commit

Permalink
Merge pull request #79 from bgpworks/boxhero-electron-2
Browse files Browse the repository at this point in the history
BoxHero 2.0.0 - initial
  • Loading branch information
BitYoungjae authored Oct 24, 2023
2 parents 3a3eed1 + 63d726c commit c165fe7
Show file tree
Hide file tree
Showing 84 changed files with 3,841 additions and 156 deletions.
17 changes: 17 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
GITHUB_TOKEN="fill_here"

# aws
AWS_ACCESS_KEY_ID="fill_here"
AWS_SECRET_ACCESS_KEY="fill_here"

# for wi32
WIN_CERT_THUMBPRINT="fill_here"

# for darwin
APPLE_API_KEY="fill_here"
APPLE_API_KEY_ID="fill_here"
APPLE_API_ISSUER="fill_here"
APPLE_APP_BUNDLE_ID="fill_here"
APPLE_CERTIFICATE_IDENTITY="fill_here"
APPLE_CERTIFICATE="fill_here"
APPLE_CERTIFICATE_PASSWORD="fill_here"
5 changes: 4 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,8 @@
"plugin:import/electron",
"plugin:import/typescript"
],
"parser": "@typescript-eslint/parser"
"parser": "@typescript-eslint/parser",
"rules": {
"@typescript-eslint/ban-ts-comment": 0
}
}
58 changes: 58 additions & 0 deletions .github/workflows/publish-app.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: publish-app

on:
issue_comment:
types: [created]

jobs:
deploy-check:
runs-on: macos-latest
steps:
- name: acknowledge deployment request to commenter
id: check
uses: khan/pull-request-comment-trigger@master
with:
trigger: "/publish"
reaction: rocket
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
outputs:
triggered: ${{ steps.check.outputs.triggered }}

deploy:
runs-on: macos-latest
needs: deploy-check
if: needs.deploy-check.outputs.triggered == 'true'
steps:
- name: Github checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 18

- name: Add osx certs
run: chmod +x ./build/add-osx-cert.sh && ./build/add-osx-cert.sh
env:
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}

- name: Prepare for app notarization (macOS)
run: |
echo '${{ secrets.APPLE_API_KEY }}' > ./AuthKey_${{ secrets.APPLE_API_KEY_ID }}.p8
- name: Install Packages
run: yarn install

- name: Publish app
run: yarn publish-app
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY}}
APPLE_APP_BUNDLE_ID: ${{ secrets.APPLE_APP_BUNDLE_ID }}
APPLE_API_KEY_ID: ${{secrets.APPLE_API_KEY_ID}}
APPLE_API_ISSUER: ${{secrets.APPLE_API_ISSUER}}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,7 @@ typings/

# Electron-Forge
out/

# Top secrets
*.p8
*.p12
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx lint-staged
37 changes: 37 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# BoxHero Desktop App

[박스히어로](https://www.boxhero-app.com) 데스크톱 앱

![제품목록](screenshots/item_list.png)

## NPM Scripts

### 설치

```sh
yarn install
```

### 개발

```sh
yarn start
```

### 패키징 & 배포

```sh
yarn package
yarn make
yarn publish
```

## 스크린샷

![제품 정보](screenshots/item_detail.png)
![대시보드](screenshots/dashboard.png)
![입출고](screenshots/stock_in.png)
![바코드 스캔](screenshots/barcode_scan.png)
![바코드 라벨 디자인](screenshots/label_design.png)
![바코드 라벨 인쇄](screenshots/label_print.png)
![입출고 내역](screenshots/transaction_history.png)
23 changes: 23 additions & 0 deletions build/add-osx-cert.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env sh

KEY_CHAIN=build.keychain
CERTIFICATE_P12=certificate.p12

# Recreate the certificate from the secure environment variable
echo $APPLE_CERTIFICATE | base64 --decode > $CERTIFICATE_P12

#create a keychain
security create-keychain -p actions $KEY_CHAIN

# Make the keychain the default so identities are found
security default-keychain -s $KEY_CHAIN

# Unlock the keychain
security unlock-keychain -p actions $KEY_CHAIN

security import $CERTIFICATE_P12 -k $KEY_CHAIN -P $APPLE_CERTIFICATE_PASSWORD -T /usr/bin/codesign;

security set-key-partition-list -S apple-tool:,apple: -s -k actions $KEY_CHAIN

# remove certs
rm -fr *.p12
Binary file added build/icon.icns
Binary file not shown.
Binary file added build/icon.ico
Binary file not shown.
Binary file added build/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
82 changes: 68 additions & 14 deletions forge.config.ts
Original file line number Diff line number Diff line change
@@ -1,33 +1,87 @@
import type { ForgeConfig } from '@electron-forge/shared-types';
import { MakerSquirrel } from '@electron-forge/maker-squirrel';
import { MakerZIP } from '@electron-forge/maker-zip';
import { MakerDeb } from '@electron-forge/maker-deb';
import { MakerRpm } from '@electron-forge/maker-rpm';
import { VitePlugin } from '@electron-forge/plugin-vite';
import dotenv from "dotenv";
import path from "path";

import { MakerDMG } from "@electron-forge/maker-dmg";
import { MakerSquirrel } from "@electron-forge/maker-squirrel";
import { VitePlugin } from "@electron-forge/plugin-vite";
import { PublisherGithub } from "@electron-forge/publisher-github";
import { PublisherS3 } from "@electron-forge/publisher-s3";

import type { ForgeConfig } from "@electron-forge/shared-types";

dotenv.config();

const WIN_CERT_THUMBPRINT = process.env["WIN_CERT_THUMBPRINT"] ?? "";
const APPLE_APP_BUNDLE_ID = process.env["APPLE_APP_BUNDLE_ID"] ?? "";
const APPLE_CERTIFICATE_IDENTITY =
process.env["APPLE_CERTIFICATE_IDENTITY"] ?? "";
const APPLE_API_KEY_ID = process.env["APPLE_API_KEY_ID"] ?? "";
const APPLE_API_ISSUER = process.env["APPLE_API_ISSUER"] ?? "";

const config: ForgeConfig = {
packagerConfig: {},
packagerConfig: {
name: "BoxHero",
icon: "./build/icon",
appBundleId: APPLE_APP_BUNDLE_ID,
osxSign: {
identity: APPLE_CERTIFICATE_IDENTITY,
type: "distribution",
identityValidation: true,
},
osxNotarize: {
tool: "notarytool",
appleApiKey: `./AuthKey_${APPLE_API_KEY_ID}.p8`,
appleApiKeyId: APPLE_API_KEY_ID,
appleApiIssuer: APPLE_API_ISSUER,
},
appCategoryType: "public.app-category.business",
},
rebuildConfig: {},
makers: [new MakerSquirrel({}), new MakerZIP({}, ['darwin']), new MakerRpm({}), new MakerDeb({})],
makers: [
new MakerSquirrel({
name: "BoxHero",
signWithParams: `/fd sha256 /sha1 ${WIN_CERT_THUMBPRINT} /tr http://timestamp.digicert.com /td sha256`,
setupIcon: path.resolve(__dirname, "./build/icon.ico"),
}),
new MakerDMG({
name: "BoxHero",
icon: "./build/icon.icns",
additionalDMGOptions: { "background-color": "#4f67ff" },
}),
],
publishers: [
new PublisherGithub({
repository: { owner: "bgpworks", name: "boxhero-electron" },
prerelease: true,
draft: true,
}),
new PublisherS3({
bucket: "boxhero-autoupdate",
public: true,
keyResolver(fileName, platform, arch) {
return `${platform}-${arch}/${fileName}`;
},
}),
],
plugins: [
new VitePlugin({
// `build` can specify multiple entry builds, which can be Main process, Preload scripts, Worker process, etc.
// If you are familiar with Vite configuration, it will look really familiar.
build: [
{
// `entry` is just an alias for `build.lib.entry` in the corresponding file of `config`.
entry: 'src/main.ts',
config: 'vite.main.config.ts',
entry: "src/main.ts",
config: "vite.main.config.ts",
},
{
entry: 'src/preload.ts',
config: 'vite.preload.config.ts',
entry: "src/preload.ts",
config: "vite.preload.config.ts",
},
],
renderer: [
{
name: 'main_window',
config: 'vite.renderer.config.ts',
name: "main_window",
config: "vite.renderer-main.config.ts",
},
],
}),
Expand Down
13 changes: 0 additions & 13 deletions index.html

This file was deleted.

10 changes: 10 additions & 0 deletions lint-staged.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/** @type {import('lint-staged').Config} */
module.exports = {
"**/*.(ts|tsx)": () => "npx tsc --noEmit",
"**/*.(ts|tsx|js)": (filenames) => [
`npx eslint --fix ${filenames.join(" ")}`,
`npx prettier --write ${filenames.join(" ")}`,
],
"**/*.(md|json)": (filenames) =>
`npx prettier --write ${filenames.join(" ")}`,
};
41 changes: 32 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,39 +1,62 @@
{
"name": "boxhero-electron",
"productName": "boxhero-electron",
"productName": "BoxHero",
"version": "2.0.0",
"description": "Simple Inventory Management Solution",
"main": ".vite/build/main.js",
"scripts": {
"start": "electron-forge start",
"package": "electron-forge package",
"make": "electron-forge make",
"publish": "electron-forge publish",
"lint": "eslint --ext .ts,.tsx ."
"publish-app": "electron-forge publish",
"lint": "eslint --ext .ts,.tsx .",
"prepare": "husky install"
},
"keywords": [],
"author": {
"name": "BitYoungjae",
"email": "bityoungjae@gmail.com"
"repository": {
"type": "git",
"url": "git+https://github.com/bgpworks/boxhero-electron.git"
},
"license": "MIT",
"author": "BoxHero, Inc.",
"license": "ISC",
"devDependencies": {
"@electron-forge/cli": "^6.4.2",
"@electron-forge/maker-deb": "^6.4.2",
"@electron-forge/maker-dmg": "^6.4.2",
"@electron-forge/maker-rpm": "^6.4.2",
"@electron-forge/maker-squirrel": "^6.4.2",
"@electron-forge/maker-zip": "^6.4.2",
"@electron-forge/plugin-auto-unpack-natives": "^6.4.2",
"@electron-forge/plugin-vite": "^6.4.2",
"@electron-forge/publisher-github": "^6.4.2",
"@electron-forge/publisher-s3": "^6.4.2",
"@types/electron-squirrel-startup": "^1.0.1",
"@types/lodash": "^4.14.200",
"@types/react": "^18.2.29",
"@types/react-dom": "^18.2.14",
"@types/styled-components": "^5.1.29",
"@typescript-eslint/eslint-plugin": "^5.0.0",
"@typescript-eslint/parser": "^5.0.0",
"dotenv": "^16.3.1",
"electron": "27.0.1",
"eslint": "^8.0.1",
"eslint-plugin-import": "^2.25.0",
"ts-node": "^10.0.0",
"husky": "^8.0.0",
"lint-staged": "^15.0.1",
"prettier": "^3.0.3",
"ts-node": "^10.9.1",
"typescript": "~4.5.4"
},
"dependencies": {
"electron-squirrel-startup": "^1.0.0"
"electron-log": "^5.0.0-rc.1",
"electron-squirrel-startup": "^1.0.0",
"i18next": "^23.6.0",
"i18next-fs-backend": "^2.2.0",
"lodash": "^4.17.21",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-i18next": "^13.3.0",
"styled-components": "^6.1.0",
"update-electron-app": "^3.0.0"
}
}
11 changes: 11 additions & 0 deletions prettier.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/** @type {import('prettier').Config} */
const config = {
trailingComma: "es5",
tabWidth: 2,
semi: true,
singleQuote: false,
bracketSameLine: true,
singleAttributePerLine: true,
};

module.exports = config;
Binary file added screenshots/barcode_scan.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/dashboard.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/data_center.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/item_detail.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/item_list.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/label_design.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/label_print.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/stock_analysis.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/stock_in.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/transaction_history.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/envs.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const isWindow = process.platform === "win32";
export const isMac = process.platform === "darwin";
export const isDev = process.env.NODE_ENV === "development";
Loading

0 comments on commit c165fe7

Please sign in to comment.