Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolaslopezj committed Mar 24, 2023
0 parents commit 37cc97d
Show file tree
Hide file tree
Showing 10 changed files with 1,831 additions and 0 deletions.
Binary file added .DS_Store
Binary file not shown.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
*.tgz
yarn-error.log
node_modules
build.sh
cert.p12
dist/
55 changes: 55 additions & 0 deletions app/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
const { app, BrowserWindow } = require('electron');

const isLocal = process.env.JUSTO_ENV === 'local';

const url = isLocal
? 'http://crisp.internal:5140'
: 'https://crisp.getjusto.com';

const createWindow = () => {
// Create the browser window.
const mainWindow = new BrowserWindow({
width: 1100,
height: 750,
center: true,
titleBarStyle: 'hidden',
trafficLightPosition: { x: 10, y: 10 },
webPreferences: {
devTools: true,
autoplayPolicy: 'no-user-gesture-required',
allowRunningInsecureContent: true,
},
autoHideMenuBar: true,
});

// and load the index.html of the app.
mainWindow.loadURL(url);

// Open the DevTools.
// mainWindow.webContents.openDevTools();
};

// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
app.on('ready', createWindow);

// Quit when all windows are closed, except on macOS. There, it's common
// for applications and their menu bar to stay active until the user quits
// explicitly with Cmd + Q.
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit();
}
});

app.on('activate', () => {
// On OS X it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (BrowserWindow.getAllWindows().length === 0) {
createWindow();
}
});

// In this file you can include the rest of your app's specific main process
// code. You can also put them in separate files and import them here.
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.
56 changes: 56 additions & 0 deletions build/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
40 changes: 40 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"name": "justo-crisp",
"version": "0.0.1",
"license": "MIT",
"description": "Crisp POS",
"author": "nicolaslopezj",
"main": "./app/index.js",
"repository": "https://github.com/getjusto/tabs-electron",
"scripts": {
"postinstall": "electron-builder install-app-deps",
"start": "JUSTO_ENV=local yarn install && electron ./app",
"pack": "electron-builder --dir",
"release": "electron-builder --win --mac",
"afterSign": "scripts/notarize.js"
},
"build": {
"productName": "Crisp",
"appId": "com.getjusto.crisp",
"dmg": {
"icon": "build/icon.icns",
"internetEnabled": true
},
"win": {
"publish": [
"github"
],
"target": "nsis",
"icon": "build/icon.ico"
}
},
"dependencies": {
"electron-updater": "^5.3.0"
},
"devDependencies": {
"@electron/notarize": "^1.2.3",
"dotenv": "^16.0.3",
"electron": "latest",
"electron-builder": "latest"
}
}
20 changes: 20 additions & 0 deletions scripts/notarize.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const { notarize } = require('electron-notarize');
require('dotenv').config();

exports.default = async function notarizing(context) {
const { electronPlatformName, appOutDir } = context;
if (electronPlatformName !== 'darwin') {
return;
}

const appName = context.packager.appInfo.productFilename;

// Package your app here, and code sign with hardened runtime
await notarize({
tool: 'notarytool',
appPath: `${appOutDir}/${appName}.app`,
appleId: process.env.APPLE_ID,
appleIdPassword: process.env.APPLE_PASSWORD,
teamId: process.env.APPLE_TEAM_ID,
});
};
Loading

0 comments on commit 37cc97d

Please sign in to comment.