Compare commits
6 Commits
11bdecc6d3
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| f34d8e836a | |||
|
|
c891fdad45 | ||
|
|
128d4da9d9 | ||
|
|
417179a5e2 | ||
|
|
37e6e6d003 | ||
| afa0518f5f |
@@ -1,48 +0,0 @@
|
||||
import { app, shell } from 'electron';
|
||||
import { Window } from './window';
|
||||
export class App {
|
||||
static launch() {
|
||||
app.on('window-all-closed', App.quit);
|
||||
app.on('activate', App.start);
|
||||
app.on('ready', App.start);
|
||||
// Limit navigation and open external links in default browser
|
||||
app.on('web-contents-created', App.openExternalLinksInDefaultBrowser);
|
||||
}
|
||||
static get electronWindow() {
|
||||
return this._wrapper ? this._wrapper.electronWindow : undefined;
|
||||
}
|
||||
static start() {
|
||||
// On MacOS it is common to re-create a window from app even after all windows have been closed
|
||||
if (!App.electronWindow) {
|
||||
App._wrapper = new Window();
|
||||
}
|
||||
}
|
||||
static quit() {
|
||||
// On MacOS it is common for applications to stay open until the user explicitly quits
|
||||
// But WebDriverIO Test Runner does handle that behaviour yet
|
||||
if (
|
||||
process.platform !== 'darwin' ||
|
||||
global.appConfig.configId === 'e2e-test'
|
||||
) {
|
||||
app.quit();
|
||||
}
|
||||
}
|
||||
}
|
||||
App.openExternalLinksInDefaultBrowser = (event, contents) => {
|
||||
// Disabling creation of new windows
|
||||
contents.setWindowOpenHandler((handler) => {
|
||||
// Telling the user platform to open this event's url in the default browser
|
||||
shell.openExternal(handler.url);
|
||||
// Blocking this event from loading in current app
|
||||
return { action: 'deny' };
|
||||
});
|
||||
// Limiting navigation
|
||||
contents.on('will-navigate', (event, navigationUrl) => {
|
||||
const parsedUrl = new URL(navigationUrl);
|
||||
// Allowing local navigation only
|
||||
if (parsedUrl.origin !== 'http://localhost:4200') {
|
||||
event.preventDefault();
|
||||
}
|
||||
});
|
||||
};
|
||||
//# sourceMappingURL=app.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../../../worksp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AAC;QAEhC,kDAAkD;QAClD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;IAC3B,CAAC,CAAC,CAAC;IAEH,sBAAsB;IACtB,QAAQ,CAAC,EAAE,CACV,eAAe,EACf,CAAC,KAAqB,EAAE,aAAqB,EAAE,EAAE;QAChD,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,aAAa,CAAC,CAAC;QACzC,iCAAiC;QACjC,IAAI,SAAS,CAAC,MAAM,KAAK,uBAAuB,EAAE;YACjD,KAAK,CAAC,cAAc,EAAE,CAAC;SACvB;IACF,CAAC,CACD,CAAC;AACH,CAAC,CAAC"}
|
||||
@@ -1,141 +0,0 @@
|
||||
var __awaiter =
|
||||
(this && this.__awaiter) ||
|
||||
function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) {
|
||||
return value instanceof P
|
||||
? value
|
||||
: new P(function (resolve) {
|
||||
resolve(value);
|
||||
});
|
||||
}
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) {
|
||||
try {
|
||||
step(generator.next(value));
|
||||
} catch (e) {
|
||||
reject(e);
|
||||
}
|
||||
}
|
||||
function rejected(value) {
|
||||
try {
|
||||
step(generator['throw'](value));
|
||||
} catch (e) {
|
||||
reject(e);
|
||||
}
|
||||
}
|
||||
function step(result) {
|
||||
result.done
|
||||
? resolve(result.value)
|
||||
: adopt(result.value).then(fulfilled, rejected);
|
||||
}
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
import * as remoteMain from '@electron/remote/main';
|
||||
import { app, BrowserWindow, ipcMain, nativeImage } from 'electron';
|
||||
import * as path from 'node:path';
|
||||
import { FileListService } from '../services/file-list-service';
|
||||
import { Logger } from '../utils/logger';
|
||||
export class Window {
|
||||
constructor() {
|
||||
this.createWindow();
|
||||
this.loadRenderer();
|
||||
this.registerService(new FileListService());
|
||||
}
|
||||
createWindow() {
|
||||
this._electronWindow = new BrowserWindow({
|
||||
width: 1280,
|
||||
height: 720,
|
||||
backgroundColor: '#FFFFFF',
|
||||
icon: this.loadIcon(),
|
||||
webPreferences: {
|
||||
// Default behavior in Electron since 5, that
|
||||
// limits the powers granted to remote content
|
||||
// except in e2e test when those powers are required
|
||||
nodeIntegration: global.appConfig.isNodeIntegration,
|
||||
// Isolate window context to protect against prototype pollution
|
||||
// except in e2e test when that access is required
|
||||
contextIsolation: global.appConfig.isContextIsolation,
|
||||
// Introduced in Electron 20 and enabled by default
|
||||
// Among others security constraints, it prevents from required
|
||||
// CommonJS modules imports into preload script
|
||||
// which is not bundled yet in dev mode
|
||||
sandbox: global.appConfig.isSandbox,
|
||||
// Use a preload script to enhance security
|
||||
preload: MAIN_WINDOW_PRELOAD_WEBPACK_ENTRY,
|
||||
},
|
||||
});
|
||||
// Disable the remote module to enhance security
|
||||
// except in e2e test when that access is required
|
||||
if (global.appConfig.isEnableRemoteModule) {
|
||||
remoteMain.enable(this._electronWindow.webContents);
|
||||
}
|
||||
}
|
||||
loadIcon() {
|
||||
let iconObject;
|
||||
if (global.appConfig.isIconAvailable) {
|
||||
const iconPath = path.join(__dirname, 'icons/icon.png');
|
||||
Logger.debug('Icon Path', iconPath);
|
||||
iconObject = nativeImage.createFromPath(iconPath);
|
||||
// Change dock icon on MacOS
|
||||
if (iconObject && process.platform === 'darwin') {
|
||||
app.dock.setIcon(iconObject);
|
||||
}
|
||||
}
|
||||
return iconObject;
|
||||
}
|
||||
loadRenderer() {
|
||||
if (global.appConfig.configId === 'development') {
|
||||
// Dev mode, take advantage of the live reload by loading local URL
|
||||
this.electronWindow.loadURL(`http://localhost:4200`);
|
||||
} else {
|
||||
// Else mode, we simply load angular bundle
|
||||
const indexPath = path.join(
|
||||
__dirname,
|
||||
'../renderer/angular_window/index.html'
|
||||
);
|
||||
this.electronWindow.loadURL(`file://${indexPath}`);
|
||||
}
|
||||
if (global.appConfig.isOpenDevTools) {
|
||||
this.openDevTools();
|
||||
}
|
||||
// When the window is closed`
|
||||
this._electronWindow.on('closed', () => {
|
||||
// Remove IPC Main listeners
|
||||
ipcMain.removeAllListeners();
|
||||
// Delete current reference
|
||||
delete this._electronWindow;
|
||||
});
|
||||
}
|
||||
openDevTools() {
|
||||
this._electronWindow.webContents.openDevTools();
|
||||
this._electronWindow.webContents.on('devtools-opened', () => {
|
||||
this._electronWindow.focus();
|
||||
setImmediate(() => {
|
||||
this._electronWindow.focus();
|
||||
});
|
||||
});
|
||||
}
|
||||
registerService(service) {
|
||||
ipcMain.on(service.receptionChannel(), (event, ...parameters) =>
|
||||
__awaiter(this, void 0, void 0, function* () {
|
||||
// Handling input
|
||||
const input = parameters[0];
|
||||
Logger.debug(`[${service.receptionChannel()}] =====> `, input);
|
||||
const output = service.process(input);
|
||||
// Handling output
|
||||
if (service.sendingChannel()) {
|
||||
Logger.debug(`[${service.sendingChannel()}] =====> `, output);
|
||||
this._electronWindow.webContents.send(
|
||||
service.sendingChannel(),
|
||||
output
|
||||
);
|
||||
}
|
||||
})
|
||||
);
|
||||
}
|
||||
get electronWindow() {
|
||||
return this._electronWindow;
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=window.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"window.js","sourceRoot":"","sources":["../../../../workspaces/electron-app/main/components/window.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,KAAK,UAAU,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,GAAG,EAAE,aAAa,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACpE,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAKzC,MAAM,OAAO,MAAM;IAGlB;QACC,IAAI,CAAC,YAAY,EAAE,CAAC;QACpB,IAAI,CAAC,YAAY,EAAE,CAAC;QACpB,IAAI,CAAC,eAAe,CAAgC,IAAI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CAAC,IAAI,OAAO,CAAC,gBAAgB,EAAE,YAAY,EAAE,KAAK,CAAC,CAAC;YAChE,MAAM,MAAM,GAAQ,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;YAE3C,kBAAkB;YAClB,IAAI,OAAO,CAAC,cAAc,EAAE,EAAE;gBAC7B,MAAM,CAAC,KAAK,CAAC,IAAI,OAAO,CAAC,cAAc,EAAE,WAAW,EAAE,MAAM,CAAC,CAAC;gBAC9D,IAAI,CAAC,eAAe,CAAC,WAAW,CAAC,IAAI,CACpC,OAAO,CAAC,cAAc,EAAE,EACxB,MAAM,CACN,CAAC;aACF;QACF,CAAC,CAAA,CACD,CAAC;IACH,CAAC;IAED,IAAW,cAAc;QACxB,OAAO,IAAI,CAAC,eAAe,CAAC;IAC7B,CAAC;CACD"}
|
||||
@@ -1,16 +0,0 @@
|
||||
import * as fs from 'fs-extra';
|
||||
import _ from 'lodash';
|
||||
import * as path from 'node:path';
|
||||
import { App } from './components/app';
|
||||
// Load config
|
||||
const currentEnvironment = process.env.X_NODE_ENV || process.env.NODE_ENV;
|
||||
const appConfigs = fs.readJsonSync(path.join(__dirname, 'config.json'));
|
||||
const defaultConfig = appConfigs.development;
|
||||
const currentConfig = appConfigs[currentEnvironment];
|
||||
global.appConfig =
|
||||
currentEnvironment === 'development'
|
||||
? defaultConfig
|
||||
: _.merge(defaultConfig, currentConfig);
|
||||
// Launch app
|
||||
App.launch();
|
||||
//# sourceMappingURL=index.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../workspaces/electron-app/main/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,CAAC,MAAM,QAAQ,CAAC;AACvB,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAWvC,cAAc;AACd,MAAM,kBAAkB,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC;AAC1E,MAAM,UAAU,GAAG,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC,CAAC;AACxE,MAAM,aAAa,GAAG,UAAU,CAAC,WAAW,CAAC;AAC7C,MAAM,aAAa,GAAG,UAAU,CAAC,kBAAkB,CAAC,CAAC;AACrD,MAAM,CAAC,SAAS;IACf,kBAAkB,KAAK,aAAa;QACnC,CAAC,CAAC,aAAa;QACf,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,aAAa,EAAE,aAAa,CAAC,CAAC;AAE1C,aAAa;AACb,GAAG,CAAC,MAAM,EAAE,CAAC"}
|
||||
@@ -1,13 +0,0 @@
|
||||
const NOT_IMPEMENTED_YET = 'Method not implemented yet.';
|
||||
export class AbstractService {
|
||||
receptionChannel() {
|
||||
throw new Error(NOT_IMPEMENTED_YET);
|
||||
}
|
||||
sendingChannel() {
|
||||
throw new Error(NOT_IMPEMENTED_YET);
|
||||
}
|
||||
process(_input) {
|
||||
throw new Error(NOT_IMPEMENTED_YET);
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=abstract-service.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"abstract-service.js","sourceRoot":"","sources":["../../../../workspaces/electron-app/main/services/abstract-service.ts"],"names":[],"mappings":"AAAA,MAAM,kBAAkB,GAAG,6BAA6B,CAAC;AACzD,MAAM,OAAO,eAAe;IAC3B,gBAAgB;QACf,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;IACrC,CAAC;IAED,cAAc;QACb,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;IACrC,CAAC;IAED,OAAO,CAAC,MAAU;QACjB,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;IACrC,CAAC;CACD"}
|
||||
@@ -1,24 +0,0 @@
|
||||
import { readdir } from 'node:fs';
|
||||
import { WindowApiConst } from 'shared-lib';
|
||||
import { AbstractService } from './abstract-service';
|
||||
export class FileListService extends AbstractService {
|
||||
receptionChannel() {
|
||||
return WindowApiConst.FILELIST_INPUT;
|
||||
}
|
||||
sendingChannel() {
|
||||
return WindowApiConst.FILELIST_OUTPUT;
|
||||
}
|
||||
process() {
|
||||
readdir('./', (error, fileList) => {
|
||||
if (!error) {
|
||||
const newList = {};
|
||||
for (const file in fileList) {
|
||||
newList[file] = [];
|
||||
}
|
||||
return newList;
|
||||
}
|
||||
return {};
|
||||
});
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=file-list-service.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"file-list-service.js","sourceRoot":"","sources":["../../../../workspaces/electron-app/main/services/file-list-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,cAAc,EAAQ,MAAM,YAAY,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,MAAM,OAAO,eAAgB,SAAQ,eAA8C;IAClF,gBAAgB;QACf,OAAO,cAAc,CAAC,cAAc,CAAC;IACtC,CAAC;IAED,cAAc;QACb,OAAO,cAAc,CAAC,eAAe,CAAC;IACvC,CAAC;IAED,OAAO;QACA,QAAQ,CAAC;QACT,OAAO,CAAC,IAAI,EAAE,CAAC,KAAK,EAAE,QAAkB,EAAE,EAAE;YACxC,IAAI,CAAC,KAAK,EAAE;gBACR,MAAO,OAAO,GAA4B,EAAE,CAAC;gBAC7C,KAAI,MAAM,IAAI,IAAI,QAAQ,EAAE;oBACxB,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;iBACtB;gBACD,OAAO,OAAO,CAAC;aAClB;YAED,OAAO,EAAE,CAAC;QACd,CAAC,CAAC,CAAC;QAEH,OAAO,EAAE,CAAC;IACjB,CAAC;CACD"}
|
||||
@@ -1,20 +0,0 @@
|
||||
// import { WindowApiConst } from 'shared-lib';
|
||||
// import { AbstractService } from './abstract-service';
|
||||
// export class MultiplesService extends AbstractService<number, number[]> {
|
||||
// receptionChannel(): string {
|
||||
// return WindowApiConst.MULTIPLES_INPUT;
|
||||
// }
|
||||
// sendingChannel(): string {
|
||||
// return WindowApiConst.MULTIPLES_OUTPUT;
|
||||
// }
|
||||
// process(input: number): number[] {
|
||||
// // From 1 to 10, return input multiples
|
||||
// const multiples = [];
|
||||
// for (let n = 1; n <= 10; n++) {
|
||||
// multiples.push(n * input);
|
||||
// }
|
||||
// return multiples;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//# sourceMappingURL=multiples-service.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"multiples-service.js","sourceRoot":"","sources":["../../../../workspaces/electron-app/main/services/multiples-service.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,wDAAwD;AAExD,4EAA4E;AAC5E,gCAAgC;AAChC,2CAA2C;AAC3C,KAAK;AAEL,8BAA8B;AAC9B,4CAA4C;AAC5C,KAAK;AAEL,sCAAsC;AACtC,4CAA4C;AAC5C,0BAA0B;AAC1B,oCAAoC;AACpC,gCAAgC;AAChC,MAAM;AACN,sBAAsB;AACtB,KAAK;AACL,IAAI;AACJ,EAAE"}
|
||||
@@ -1,121 +0,0 @@
|
||||
import { app } from 'electron';
|
||||
import * as os from 'node:os';
|
||||
import * as path from 'node:path';
|
||||
import * as winston from 'winston';
|
||||
export class Logger {
|
||||
constructor() {
|
||||
/**
|
||||
* Custom winston file format
|
||||
* Write JSON logs with given format :
|
||||
* `${timestamp} ${level} : ${info.message} : ${meta})`
|
||||
*/
|
||||
this.fileFormat = winston.format.printf((data) => {
|
||||
return JSON.stringify(this.prepareLogData(data));
|
||||
});
|
||||
/**
|
||||
* Custom winston console format
|
||||
* Write logs with given format :
|
||||
* `${timestamp} ${level} : ${info.message} : JSON.stringify({ ...meta }) `
|
||||
*/
|
||||
this.consoleFormat = winston.format.printf((data) => {
|
||||
const preparedData = this.prepareLogData(data);
|
||||
return (
|
||||
`${preparedData.timestamp} ${preparedData.level} : ` +
|
||||
`${preparedData.message} : ${JSON.stringify(preparedData.meta)}`
|
||||
);
|
||||
});
|
||||
this.prepareLogData = (data) => {
|
||||
const additionalData = Object.assign({}, data);
|
||||
delete additionalData.timestamp;
|
||||
delete additionalData.level;
|
||||
delete additionalData.message;
|
||||
delete additionalData.service;
|
||||
return {
|
||||
timestamp: data.timestamp,
|
||||
level: data.level,
|
||||
message: data.message,
|
||||
meta: additionalData,
|
||||
};
|
||||
};
|
||||
this._logger = winston.createLogger({
|
||||
level: 'debug',
|
||||
format: winston.format.json(),
|
||||
defaultMeta: { service: 'user-service' },
|
||||
transports: [
|
||||
new winston.transports.File({
|
||||
filename: this.getLogFilename(),
|
||||
level: global.appConfig.mainLogLevel,
|
||||
format: winston.format.combine(
|
||||
winston.format.timestamp(),
|
||||
this.fileFormat
|
||||
),
|
||||
}),
|
||||
],
|
||||
});
|
||||
// If we're not in production then log also to the `console` with the format:
|
||||
// `${info.timestamp} ${info.level}: ${info.message} JSON.stringify({ ...rest }) `
|
||||
if (global.appConfig.configId === 'development') {
|
||||
this._logger.add(
|
||||
new winston.transports.Console({
|
||||
stderrLevels: ['error', 'warn'],
|
||||
format: winston.format.combine(
|
||||
winston.format.timestamp(),
|
||||
this.consoleFormat
|
||||
),
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
static error(message, ...meta) {
|
||||
Logger.initSingleton();
|
||||
Logger.singleton._logger.error(message, meta);
|
||||
}
|
||||
static warn(message, ...meta) {
|
||||
Logger.initSingleton();
|
||||
Logger.singleton._logger.warn(message, meta);
|
||||
}
|
||||
static info(message, ...meta) {
|
||||
Logger.initSingleton();
|
||||
Logger.singleton._logger.info(message, meta);
|
||||
}
|
||||
static http(message, ...meta) {
|
||||
Logger.initSingleton();
|
||||
Logger.singleton._logger.http(message, meta);
|
||||
}
|
||||
static verbose(message, ...meta) {
|
||||
Logger.initSingleton();
|
||||
Logger.singleton._logger.verbose(message, meta);
|
||||
}
|
||||
static debug(message, ...meta) {
|
||||
Logger.initSingleton();
|
||||
Logger.singleton._logger.debug(message, meta);
|
||||
}
|
||||
static silly(message, ...meta) {
|
||||
Logger.initSingleton();
|
||||
Logger.singleton._logger.silly(message, meta);
|
||||
}
|
||||
static initSingleton() {
|
||||
if (!Logger.singleton) {
|
||||
Logger.singleton = new Logger();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Returns log filename with standard path
|
||||
* In production, returns absolute standard path depending on platform
|
||||
*/
|
||||
getLogFilename() {
|
||||
let filename = global.appConfig.mainLogFile;
|
||||
if (global.appConfig.configId === 'production') {
|
||||
const appName = app.getName();
|
||||
if (process.platform == 'linux') {
|
||||
filename = `.config/${appName}/${filename}`;
|
||||
} else if (process.platform == 'darwin') {
|
||||
filename = `Library/Logs/${appName}/${filename}`;
|
||||
} else if (process.platform == 'win32') {
|
||||
filename = `AppData\\Roaming\\${appName}\\${filename}`;
|
||||
}
|
||||
}
|
||||
return path.join(os.homedir(), filename);
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=logger.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../../../workspaces/electron-app/main/utils/logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAInC,MAAM,OAAO,MAAM;IA6ClB;QAmDA;;;;WAIG;QACK,eAAU,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,CACzC,CAAC,IAAuC,EAAE,EAAE;YAC3C,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC;QAClD,CAAC,C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IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,QAAQ,CAAC,CAAC;IAC1C,CAAC;CAyCD"}
|
||||
@@ -1,32 +0,0 @@
|
||||
/**
|
||||
* This file will automatically be loaded by webpack and run in the "renderer" context.
|
||||
* To learn more about the differences between the "main" and the "renderer" context in
|
||||
* Electron, visit:
|
||||
*
|
||||
* https://electronjs.org/docs/tutorial/application-architecture#main-and-renderer-processes
|
||||
*
|
||||
* By default, Node.js integration in this file is disabled. When enabling Node.js integration
|
||||
* in a renderer process, please be aware of potential security implications. You can read
|
||||
* more about security risks here:
|
||||
*
|
||||
* https://electronjs.org/docs/tutorial/security
|
||||
*
|
||||
* To enable Node.js integration in this file, open up `main.js` and enable the `nodeIntegration`
|
||||
* flag:
|
||||
*
|
||||
* ```
|
||||
* // Create the browser window.
|
||||
* mainWindow = new BrowserWindow({
|
||||
* width: 800,
|
||||
* height: 600,
|
||||
* webPreferences: {
|
||||
* nodeIntegration: true
|
||||
* }
|
||||
* });
|
||||
* ```
|
||||
*/
|
||||
import './index.css';
|
||||
console.log(
|
||||
'👋 This message is being logged by "renderer.js", included via webpack'
|
||||
);
|
||||
//# sourceMappingURL=index.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../workspaces/electron-app/renderer/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,aAAa,CAAC;AAErB,OAAO,CAAC,GAAG,CAAC,wEAAwE,CAAC,CAAC"}
|
||||
@@ -1,53 +0,0 @@
|
||||
/*/ To secure user platform when running renderer process stuff,
|
||||
// Node.JS and Electron APIs are only available in this script
|
||||
import { contextBridge, ipcRenderer, IpcRendererEvent } from 'electron';
|
||||
import { WindowApi, WindowApiConst } from 'shared-lib';
|
||||
|
||||
// So we expose protected methods that allow the renderer process
|
||||
// to use the ipcRenderer without exposing the entire object
|
||||
const windowApi: WindowApi = {
|
||||
send: <In>(channel: string, input: In) => {
|
||||
if (WindowApiConst.SENDING_SAFE_CHANNELS.includes(channel)) {
|
||||
ipcRenderer.send(channel, input);
|
||||
}
|
||||
},
|
||||
receive: <Out>(channel: string, callback: (output: Out) => void) => {
|
||||
if (WindowApiConst.RECEIVING_SAFE_CHANNELS.includes(channel)) {
|
||||
// Deliberately strip event as it includes `sender`
|
||||
ipcRenderer.on(
|
||||
channel,
|
||||
(_event: IpcRendererEvent, ...parameters: any[]) =>
|
||||
callback(parameters[0])
|
||||
);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
declare const window: Window;
|
||||
if (process.env.X_NODE_ENV === 'e2e-test') {
|
||||
// Injecting windowApi directly
|
||||
window.api = windowApi;
|
||||
} else {
|
||||
// ContextBridge API can only be used when contextIsolation is enabled
|
||||
// which is normally the case except in e2e test mode
|
||||
contextBridge.exposeInMainWorld('api', windowApi);
|
||||
}*/
|
||||
import { contextBridge, ipcRenderer } from 'electron';
|
||||
import { WindowApiConst } from 'shared-lib';
|
||||
contextBridge.exposeInMainWorld('api', {
|
||||
node: () => process.versions.node,
|
||||
chrome: () => process.versions.chrome,
|
||||
electron: () => process.versions.electron,
|
||||
send: (channel, input) => {
|
||||
if (WindowApiConst.SENDING_SAFE_CHANNELS.includes(channel)) {
|
||||
ipcRenderer.send(channel, input);
|
||||
}
|
||||
},
|
||||
receive: (channel, callback) => {
|
||||
// Deliberately strip event as it includes `sender`
|
||||
ipcRenderer.on(channel, (_event, ...parameters) => callback(parameters[0]));
|
||||
},
|
||||
// we can also expose variables, not just functions
|
||||
});
|
||||
console.log('The preload script has been injected successfully.');
|
||||
//# sourceMappingURL=preload.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"preload.js","sourceRoot":"","sources":["../../../workspaces/electron-app/renderer/preload.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,OAAO,EAAE,aAAa,EAAE,WAAW,EAAoB,MAAM,UAAU,CAAC;AACxE,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C,aAAa,CAAC,iBAAiB,CAAC,KAAK,EAAE;IACtC,IAAI,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI;IACjC,MAAM,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,MAAM;IACrC,QAAQ,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzC,IAAI,EAAE,CAAK,OAAe,EAAE,KAAS,EAAE,EAAE;QACxC,IAAI,cAAc,CAAC,qBAAqB,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE;YAC3D,WAAW,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;SACjC;IACF,CAAC;IACD,OAAO,EAAE,CAAM,OAAe,EAAE,QAA+B,EAAE,EAAE;QAClE,mDAAmD;QACnD,WAAW,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,MAAwB,EAAE,GAAG,UAAiB,EAAE,EAAE,CAC1E,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CACvB,CAAC;IACH,CAAC;IACD,mDAAmD;CACnD,CAAC,CAAC;AAEH,OAAO,CAAC,GAAG,CAAC,oDAAoD,CAAC,CAAC"}
|
||||
@@ -1,80 +0,0 @@
|
||||
/*import MainPage from './pageobjects/main.page';
|
||||
|
||||
describe('My Login application', () => {
|
||||
it('should login with valid credentials', async () => {
|
||||
await MainPage.open();
|
||||
/*await LoginPage.open();
|
||||
|
||||
await LoginPage.login('tomsmith', 'SuperSecretPassword!');
|
||||
await expect(SecurePage.flashAlert).toBeExisting();
|
||||
await expect(SecurePage.flashAlert).toHaveTextContaining(
|
||||
'You logged into a secure area!');* /
|
||||
});
|
||||
});* /
|
||||
|
||||
describe('application loading', () => {
|
||||
describe('App', () => {
|
||||
it('should launch the application', async () => {
|
||||
|
||||
console.log('==>', await browser.getTitle());
|
||||
// expect(title).toEqual('Test');
|
||||
});
|
||||
|
||||
// it('should pass args through to the launched application', async () => {
|
||||
// // custom args are set in the wdio.conf.js file as they need to be set before WDIO starts
|
||||
// const argv = await app.mainProcess.argv();
|
||||
// expect(argv).toContain('--foo');
|
||||
// expect(argv).toContain('--bar=baz');
|
||||
// });
|
||||
});
|
||||
}); */
|
||||
var __awaiter =
|
||||
(this && this.__awaiter) ||
|
||||
function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) {
|
||||
return value instanceof P
|
||||
? value
|
||||
: new P(function (resolve) {
|
||||
resolve(value);
|
||||
});
|
||||
}
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) {
|
||||
try {
|
||||
step(generator.next(value));
|
||||
} catch (e) {
|
||||
reject(e);
|
||||
}
|
||||
}
|
||||
function rejected(value) {
|
||||
try {
|
||||
step(generator['throw'](value));
|
||||
} catch (e) {
|
||||
reject(e);
|
||||
}
|
||||
}
|
||||
function step(result) {
|
||||
result.done
|
||||
? resolve(result.value)
|
||||
: adopt(result.value).then(fulfilled, rejected);
|
||||
}
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
describe('A simple test to check if app window is opened, visible and with expected title', () => {
|
||||
describe('App should', () => {
|
||||
it('show an initial window', () =>
|
||||
__awaiter(this, void 0, void 0, function* () {
|
||||
// Checking there is one visible window
|
||||
// expect(await browser.).toEqual(true);
|
||||
// Please note that getWindowHandles() will return 2 if `dev tools` is opened.
|
||||
const { length } = yield browser.getWindowHandles();
|
||||
expect(length).toEqual(1);
|
||||
}));
|
||||
it('have expected title', () =>
|
||||
__awaiter(this, void 0, void 0, function* () {
|
||||
expect(yield browser.getTitle()).toEqual('ElectronAngularQuickStart');
|
||||
}));
|
||||
});
|
||||
});
|
||||
//# sourceMappingURL=app.spec.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"app.spec.js","sourceRoot":"","sources":["../../workspaces/electron-e2e/app.spec.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MA6BM;;;;;;;;;;AAEN,QAAQ,CAAC,iFAAiF,EAAE,GAAG,EAAE;IAChG,QAAQ,CAAC,YAAY,EAAE,GAAG,EAAE;QAC3B,EAAE,CAAC,wBAAwB,EAAE,GAAS,EAAE;YACvC,uCAAuC;YACvC,wCAAwC;YACxC,8EAA8E;YAC9E,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,OAAO,CAAC,gBAAgB,EAAE,CAAC;YACpD,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QAC3B,CAAC,CAAA,CAAC,CAAC;QAEH,EAAE,CAAC,qBAAqB,EAAE,GAAS,EAAE;YACpC,MAAM,CAAC,MAAM,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,OAAO,CAAC,2BAA2B,CAAC,CAAC;QACvE,CAAC,CAAA,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
||||
@@ -1,54 +0,0 @@
|
||||
var __awaiter =
|
||||
(this && this.__awaiter) ||
|
||||
function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) {
|
||||
return value instanceof P
|
||||
? value
|
||||
: new P(function (resolve) {
|
||||
resolve(value);
|
||||
});
|
||||
}
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) {
|
||||
try {
|
||||
step(generator.next(value));
|
||||
} catch (e) {
|
||||
reject(e);
|
||||
}
|
||||
}
|
||||
function rejected(value) {
|
||||
try {
|
||||
step(generator['throw'](value));
|
||||
} catch (e) {
|
||||
reject(e);
|
||||
}
|
||||
}
|
||||
function step(result) {
|
||||
result.done
|
||||
? resolve(result.value)
|
||||
: adopt(result.value).then(fulfilled, rejected);
|
||||
}
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
import MultiplesPage from './pageobjects/multiples.page';
|
||||
describe('A simple test to check if a given input matches with computed multiples', () => {
|
||||
describe('Multiples component should', () => {
|
||||
it('show up on startup', () =>
|
||||
__awaiter(void 0, void 0, void 0, function* () {
|
||||
yield expect(MultiplesPage.root).toBeDisplayed();
|
||||
}));
|
||||
const number = Math.floor(Math.random() * 100) % 10;
|
||||
it(`display expected results on input (${number})`, () =>
|
||||
__awaiter(void 0, void 0, void 0, function* () {
|
||||
yield MultiplesPage.enterInput(number);
|
||||
const results = yield MultiplesPage.results;
|
||||
for (const index of results.keys()) {
|
||||
const ntimes = 1 + index;
|
||||
const expected = `${number} * ${ntimes} = ${number * ntimes}`;
|
||||
expect(yield results[index].getText()).toEqual(expected);
|
||||
}
|
||||
}));
|
||||
});
|
||||
});
|
||||
//# sourceMappingURL=multiples.spec.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"multiples.spec.js","sourceRoot":"","sources":["../../workspaces/electron-e2e/multiples.spec.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,aAAa,MAAM,8BAA8B,CAAC;AAEzD,QAAQ,CAAC,yEAAyE,EAAE,GAAG,EAAE;IACxF,QAAQ,CAAC,4BAA4B,EAAE,GAAG,EAAE;QAC3C,EAAE,CAAC,oBAAoB,EAAE,GAAS,EAAE;YACnC,MAAM,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,aAAa,EAAE,CAAC;QAClD,CAAC,CAAA,CAAC,CAAC;QAEH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,CAAC,GAAG,EAAE,CAAC;QACpD,EAAE,CAAC,sCAAsC,MAAM,GAAG,EAAE,GAAS,EAAE;YAC9D,MAAM,aAAa,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;YACvC,MAAM,OAAO,GAAG,MAAM,aAAa,CAAC,OAAO,CAAC;YAC5C,KAAK,MAAM,KAAK,IAAI,OAAO,CAAC,IAAI,EAAE,EAAE;gBACnC,MAAM,MAAM,GAAG,CAAC,GAAG,KAAK,CAAC;gBACzB,MAAM,QAAQ,GAAG,GAAG,MAAM,MAAM,MAAM,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC;gBAC9D,MAAM,CAAC,MAAM,OAAO,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;aACzD;QACF,CAAC,CAAA,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
||||
@@ -1,62 +0,0 @@
|
||||
var __awaiter =
|
||||
(this && this.__awaiter) ||
|
||||
function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) {
|
||||
return value instanceof P
|
||||
? value
|
||||
: new P(function (resolve) {
|
||||
resolve(value);
|
||||
});
|
||||
}
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) {
|
||||
try {
|
||||
step(generator.next(value));
|
||||
} catch (e) {
|
||||
reject(e);
|
||||
}
|
||||
}
|
||||
function rejected(value) {
|
||||
try {
|
||||
step(generator['throw'](value));
|
||||
} catch (e) {
|
||||
reject(e);
|
||||
}
|
||||
}
|
||||
function step(result) {
|
||||
result.done
|
||||
? resolve(result.value)
|
||||
: adopt(result.value).then(fulfilled, rejected);
|
||||
}
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
import AbstractPage from './page';
|
||||
class MultiplesPage extends AbstractPage {
|
||||
/**
|
||||
* Selectors using getter methods
|
||||
*/
|
||||
get root() {
|
||||
return $('#multiples');
|
||||
}
|
||||
get input() {
|
||||
return $('#input');
|
||||
}
|
||||
get results() {
|
||||
return $$('.results');
|
||||
}
|
||||
get buttonSubmit() {
|
||||
return $('button[type="submit"]');
|
||||
}
|
||||
/**
|
||||
* Wrapper method to interact with the page
|
||||
*/
|
||||
enterInput(number) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
yield this.input.setValue(number);
|
||||
yield this.buttonSubmit.click();
|
||||
});
|
||||
}
|
||||
}
|
||||
export default new MultiplesPage();
|
||||
//# sourceMappingURL=multiples.page.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"multiples.page.js","sourceRoot":"","sources":["../../../workspaces/electron-e2e/pageobjects/multiples.page.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,YAAY,MAAM,QAAQ,CAAC;AAElC,MAAM,aAAc,SAAQ,YAAY;IACvC;;OAEG;IACH,IAAW,IAAI;QACd,OAAO,CAAC,CAAC,YAAY,CAAC,CAAC;IACxB,CAAC;IAED,IAAW,KAAK;QACf,OAAO,CAAC,CAAC,QAAQ,CAAC,CAAC;IACpB,CAAC;IAED,IAAW,OAAO;QACjB,OAAO,EAAE,CAAC,UAAU,CAAC,CAAC;IACvB,CAAC;IAED,IAAW,YAAY;QACtB,OAAO,CAAC,CAAC,uBAAuB,CAAC,CAAC;IACnC,CAAC;IAED;;OAEG;IACU,UAAU,CAAC,MAAc;;YACrC,MAAM,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;YAClC,MAAM,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,CAAC;QACjC,CAAC;KAAA;CACD;AAED,eAAe,IAAI,aAAa,EAAE,CAAC"}
|
||||
@@ -1,6 +0,0 @@
|
||||
/**
|
||||
* Abstract page object containing all methods, selectors and functionality
|
||||
* that is shared across all page objects
|
||||
*/
|
||||
export default class AbstractPage {}
|
||||
//# sourceMappingURL=page.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"page.js","sourceRoot":"","sources":["../../../workspaces/electron-e2e/pageobjects/page.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAgB,YAAY;CAEzC"}
|
||||
@@ -1,396 +0,0 @@
|
||||
var __awaiter =
|
||||
(this && this.__awaiter) ||
|
||||
function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) {
|
||||
return value instanceof P
|
||||
? value
|
||||
: new P(function (resolve) {
|
||||
resolve(value);
|
||||
});
|
||||
}
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) {
|
||||
try {
|
||||
step(generator.next(value));
|
||||
} catch (e) {
|
||||
reject(e);
|
||||
}
|
||||
}
|
||||
function rejected(value) {
|
||||
try {
|
||||
step(generator['throw'](value));
|
||||
} catch (e) {
|
||||
reject(e);
|
||||
}
|
||||
}
|
||||
function step(result) {
|
||||
result.done
|
||||
? resolve(result.value)
|
||||
: adopt(result.value).then(fulfilled, rejected);
|
||||
}
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
import path from 'node:path';
|
||||
// Path to local electron binary
|
||||
let electronPath = path.join(__dirname, '../../node_modules/.bin/electron');
|
||||
if (process.platform === 'win32') {
|
||||
electronPath += '.cmd';
|
||||
}
|
||||
// Starting hook
|
||||
const waitUntilWindowLoaded = () =>
|
||||
__awaiter(void 0, void 0, void 0, function* () {
|
||||
const timeout = 10000;
|
||||
yield browser.waitUntil(
|
||||
() =>
|
||||
__awaiter(void 0, void 0, void 0, function* () {
|
||||
return (yield browser.isLoading()) === false;
|
||||
}),
|
||||
{
|
||||
timeout: timeout,
|
||||
timeoutMsg: `Expected app to be loaded in less than ${timeout}ms`,
|
||||
}
|
||||
);
|
||||
});
|
||||
// Closing hook
|
||||
const closeApplication = () =>
|
||||
__awaiter(void 0, void 0, void 0, function* () {
|
||||
if (browser) {
|
||||
// Wait 1 second and close window
|
||||
yield new Promise((resolve) => setTimeout(resolve, 1000));
|
||||
yield browser.closeWindow();
|
||||
}
|
||||
});
|
||||
export const config = {
|
||||
//
|
||||
// ====================
|
||||
// Runner Configuration
|
||||
// ====================
|
||||
//
|
||||
//
|
||||
// =====================
|
||||
// ts-node Configurations
|
||||
// =====================
|
||||
//
|
||||
// You can write tests using TypeScript to get autocompletion and type safety.
|
||||
// You will need typescript and ts-node installed as devDependencies.
|
||||
// WebdriverIO will automatically detect if these dependencies are installed
|
||||
// and will compile your config and tests for you.
|
||||
// If you need to configure how ts-node runs please use the
|
||||
// environment variables for ts-node or use wdio config's autoCompileOpts section.
|
||||
//
|
||||
autoCompileOpts: {
|
||||
autoCompile: true,
|
||||
// see https://github.com/TypeStrong/ts-node#cli-and-programmatic-options
|
||||
// for all available options
|
||||
tsNodeOpts: {
|
||||
transpileOnly: true,
|
||||
project: 'workspaces/electron-e2e/tsconfig.json',
|
||||
},
|
||||
// tsconfig-paths is only used if "tsConfigPathsOpts" are provided, if you
|
||||
// do please make sure "tsconfig-paths" is installed as dependency
|
||||
// tsConfigPathsOpts: {
|
||||
// baseUrl: './'
|
||||
// }
|
||||
},
|
||||
//
|
||||
// ==================
|
||||
// Specify Test Files
|
||||
// ==================
|
||||
// Define which test specs should run. The pattern is relative to the directory
|
||||
// from which `wdio` was called.
|
||||
//
|
||||
// The specs are defined as an array of spec files (optionally using wildcards
|
||||
// that will be expanded). The test for each spec file will be run in a separate
|
||||
// worker process. In order to have a group of spec files run in the same worker
|
||||
// process simply enclose them in an array within the specs array.
|
||||
//
|
||||
// If you are calling `wdio` from an NPM script (see https://docs.npmjs.com/cli/run-script),
|
||||
// then the current working directory is where your `package.json` resides, so `wdio`
|
||||
// will be called from there.
|
||||
//
|
||||
specs: ['./workspaces/electron-e2e/**/*.spec.ts'],
|
||||
// Patterns to exclude.
|
||||
exclude: [
|
||||
// 'path/to/excluded/files'
|
||||
],
|
||||
//
|
||||
// ============
|
||||
// Capabilities
|
||||
// ============
|
||||
// Define your capabilities here. WebdriverIO can run multiple capabilities at the same
|
||||
// time. Depending on the number of capabilities, WebdriverIO launches several test
|
||||
// sessions. Within your capabilities you can overwrite the spec and exclude options in
|
||||
// order to group specific specs to a specific capability.
|
||||
//
|
||||
// First, you can define how many instances should be started at the same time. Let's
|
||||
// say you have 3 different capabilities (Chrome, Firefox, and Safari) and you have
|
||||
// set maxInstances to 1; wdio will spawn 3 processes. Therefore, if you have 10 spec
|
||||
// files and you set maxInstances to 10, all spec files will get tested at the same time
|
||||
// and 30 processes will get spawned. The property handles how many capabilities
|
||||
// from the same test should run tests.
|
||||
//
|
||||
maxInstances: 10,
|
||||
//
|
||||
// If you have trouble getting all important capabilities together, check out the
|
||||
// Sauce Labs platform configurator - a great tool to configure your capabilities:
|
||||
// https://saucelabs.com/platform/platform-configurator
|
||||
//
|
||||
capabilities: [
|
||||
{
|
||||
// maxInstances can get overwritten per capability. So if you have an in-house Selenium
|
||||
// grid with only 5 firefox instances available you can make sure that not more than
|
||||
// 5 instances get started at a time.
|
||||
maxInstances: 5,
|
||||
//
|
||||
browserName: 'chrome',
|
||||
acceptInsecureCerts: true,
|
||||
'goog:chromeOptions': {
|
||||
binary: electronPath,
|
||||
args: ['app=' + '.webpack/main/index.js'],
|
||||
},
|
||||
// If outputDir is provided WebdriverIO can capture driver session logs
|
||||
// it is possible to configure which logTypes to include/exclude.
|
||||
// excludeDriverLogs: ['*'], // pass '*' to exclude all driver session logs
|
||||
// excludeDriverLogs: ['bugreport', 'server'],
|
||||
},
|
||||
],
|
||||
//
|
||||
// ===================
|
||||
// Test Configurations
|
||||
// ===================
|
||||
// Define all options that are relevant for the WebdriverIO instance here
|
||||
//
|
||||
// Level of logging verbosity: trace | debug | info | warn | error | silent
|
||||
logLevel: 'info',
|
||||
//
|
||||
// Set specific log levels per logger
|
||||
// loggers:
|
||||
// - webdriver, webdriverio
|
||||
// - @wdio/browserstack-service, @wdio/devtools-service, @wdio/sauce-service
|
||||
// - @wdio/mocha-framework, @wdio/jasmine-framework
|
||||
// - @wdio/local-runner
|
||||
// - @wdio/sumologic-reporter
|
||||
// - @wdio/cli, @wdio/config, @wdio/utils
|
||||
// Level of logging verbosity: trace | debug | info | warn | error | silent
|
||||
// logLevels: {
|
||||
// webdriver: 'info',
|
||||
// '@wdio/appium-service': 'info'
|
||||
// },
|
||||
//
|
||||
// If you only want to run your tests until a specific amount of tests have failed use
|
||||
// bail (default is 0 - don't bail, run all tests).
|
||||
bail: 0,
|
||||
//
|
||||
// Set a base URL in order to shorten url command calls. If your `url` parameter starts
|
||||
// with `/`, the base url gets prepended, not including the path portion of your baseUrl.
|
||||
// If your `url` parameter starts without a scheme or `/` (like `some/path`), the base url
|
||||
// gets prepended directly.
|
||||
baseUrl: 'http://localhost',
|
||||
//
|
||||
// Default timeout for all waitFor* commands.
|
||||
waitforTimeout: 10000,
|
||||
//
|
||||
// Default timeout in milliseconds for request
|
||||
// if browser driver or grid doesn't send response
|
||||
connectionRetryTimeout: 120000,
|
||||
//
|
||||
// Default request retries count
|
||||
connectionRetryCount: 3,
|
||||
//
|
||||
// Test runner services
|
||||
// Services take over a specific job you don't want to take care of. They enhance
|
||||
// your test setup with almost no effort. Unlike plugins, they don't add new
|
||||
// commands. Instead, they hook themselves up into the test process.
|
||||
services: ['chromedriver'],
|
||||
// Framework you want to run your specs with.
|
||||
// The following are supported: Mocha, Jasmine, and Cucumber
|
||||
// see also: https://webdriver.io/docs/frameworks
|
||||
//
|
||||
// Make sure you have the wdio adapter package for the specific framework installed
|
||||
// before running any tests.
|
||||
framework: 'jasmine',
|
||||
//
|
||||
// The number of times to retry the entire specfile when it fails as a whole
|
||||
// specFileRetries: 1,
|
||||
//
|
||||
// Delay in seconds between the spec file retry attempts
|
||||
// specFileRetriesDelay: 0,
|
||||
//
|
||||
// Whether or not retried specfiles should be retried immediately or deferred to the end of the queue
|
||||
// specFileRetriesDeferred: false,
|
||||
//
|
||||
// Test reporter for stdout.
|
||||
// The only one supported by default is 'dot'
|
||||
// see also: https://webdriver.io/docs/dot-reporter
|
||||
reporters: ['spec', ['allure', { outputDir: 'allure-results' }]],
|
||||
//
|
||||
// Options to be passed to Jasmine.
|
||||
jasmineOpts: {
|
||||
// Jasmine default timeout
|
||||
defaultTimeoutInterval: 60000,
|
||||
//
|
||||
// The Jasmine framework allows interception of each assertion in order to log the state of the application
|
||||
// or website depending on the result. For example, it is pretty handy to take a screenshot every time
|
||||
// an assertion fails.
|
||||
expectationResultHandler: function (_passed, _assertion) {
|
||||
// do something
|
||||
},
|
||||
},
|
||||
//
|
||||
// =====
|
||||
// Hooks
|
||||
// =====
|
||||
// WebdriverIO provides several hooks you can use to interfere with the test process in order to enhance
|
||||
// it and to build services around it. You can either apply a single function or an array of
|
||||
// methods to it. If one of them returns with a promise, WebdriverIO will wait until that promise got
|
||||
// resolved to continue.
|
||||
/**
|
||||
* Gets executed once before all workers get launched.
|
||||
* @param {Object} config wdio configuration object
|
||||
* @param {Array.<Object>} capabilities list of capabilities details
|
||||
*/
|
||||
// onPrepare: function (config, capabilities) {
|
||||
// },
|
||||
/**
|
||||
* Gets executed before a worker process is spawned and can be used to initialise specific service
|
||||
* for that worker as well as modify runtime environments in an async fashion.
|
||||
* @param {String} cid capability id (e.g 0-0)
|
||||
* @param {[type]} caps object containing capabilities for session that will be spawn in the worker
|
||||
* @param {[type]} specs specs to be run in the worker process
|
||||
* @param {[type]} args object that will be merged with the main configuration once worker is initialized
|
||||
* @param {[type]} execArgv list of string arguments passed to the worker process
|
||||
*/
|
||||
// onWorkerStart: function (cid, caps, specs, args, execArgv) {
|
||||
// },
|
||||
/**
|
||||
* Gets executed just after a worker process has exited.
|
||||
* @param {String} cid capability id (e.g 0-0)
|
||||
* @param {Number} exitCode 0 - success, 1 - fail
|
||||
* @param {[type]} specs specs to be run in the worker process
|
||||
* @param {Number} retries number of retries used
|
||||
*/
|
||||
// onWorkerEnd: function (cid, exitCode, specs, retries) {
|
||||
// },
|
||||
/**
|
||||
* Gets executed just before initialising the webdriver session and test framework. It allows you
|
||||
* to manipulate configurations depending on the capability or spec.
|
||||
* @param {Object} config wdio configuration object
|
||||
* @param {Array.<Object>} capabilities list of capabilities details
|
||||
* @param {Array.<String>} specs List of spec file paths that are to be run
|
||||
* @param {String} cid worker id (e.g. 0-0)
|
||||
*/
|
||||
// beforeSession: function (config, capabilities, specs, cid) {
|
||||
// },
|
||||
/**
|
||||
* Gets executed before test execution begins. At this point you can access to all global
|
||||
* variables like `browser`. It is the perfect place to define custom commands.
|
||||
* @param {Array.<Object>} capabilities list of capabilities details
|
||||
* @param {Array.<String>} specs List of spec file paths that are to be run
|
||||
* @param {Object} browser instance of created browser/device session
|
||||
*/
|
||||
// before: function (capabilities, specs) {
|
||||
// },
|
||||
/**
|
||||
* Runs before a WebdriverIO command gets executed.
|
||||
* @param {String} commandName hook command name
|
||||
* @param {Array} args arguments that command would receive
|
||||
*/
|
||||
// beforeCommand: function (commandName, args) {
|
||||
// },
|
||||
/**
|
||||
* Hook that gets executed before the suite starts
|
||||
* @param {Object} suite suite details
|
||||
*/
|
||||
beforeSuite: (_suite) =>
|
||||
__awaiter(void 0, void 0, void 0, function* () {
|
||||
yield waitUntilWindowLoaded();
|
||||
}),
|
||||
/**
|
||||
* Function to be executed before a test (in Mocha/Jasmine) starts.
|
||||
*/
|
||||
// beforeTest: function (test, context) {
|
||||
// },
|
||||
/**
|
||||
* Hook that gets executed _before_ a hook within the suite starts (e.g. runs before calling
|
||||
* beforeEach in Mocha)
|
||||
*/
|
||||
// beforeHook: function (test, context) {
|
||||
// },
|
||||
/**
|
||||
* Hook that gets executed _after_ a hook within the suite starts (e.g. runs after calling
|
||||
* afterEach in Mocha)
|
||||
*/
|
||||
// afterHook: function (test, context, { error, result, duration, passed, retries }) {
|
||||
// },
|
||||
/**
|
||||
* Function to be executed after a test (in Mocha/Jasmine only)
|
||||
* @param {Object} test test object
|
||||
* @param {Object} context scope object the test was executed with
|
||||
* @param {Error} result.error error object in case the test fails, otherwise `undefined`
|
||||
* @param {Any} result.result return object of test function
|
||||
* @param {Number} result.duration duration of test
|
||||
* @param {Boolean} result.passed true if test has passed, otherwise false
|
||||
* @param {Object} result.retries informations to spec related retries, e.g. `{ attempts: 0, limit: 0 }`
|
||||
*/
|
||||
afterTest: function (_test, _context, result) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
// result = { _error, _result, _duration, passed, _retries }
|
||||
if (!result.passed) {
|
||||
yield browser.takeScreenshot();
|
||||
}
|
||||
});
|
||||
},
|
||||
/**
|
||||
* Hook that gets executed after the suite has ended
|
||||
* @param {Object} suite suite details
|
||||
*/
|
||||
// afterSuite: async function (_suite) {
|
||||
// },
|
||||
/**
|
||||
* Runs after a WebdriverIO command gets executed
|
||||
* @param {String} commandName hook command name
|
||||
* @param {Array} args arguments that command would receive
|
||||
* @param {Number} result 0 - command success, 1 - command error
|
||||
* @param {Object} error error object if any
|
||||
*/
|
||||
// afterCommand: function (commandName, args, result, error) {
|
||||
// },
|
||||
/**
|
||||
* Gets executed after all tests are done. You still have access to all global variables from
|
||||
* the test.
|
||||
* @param {Number} result 0 - test pass, 1 - test fail
|
||||
* @param {Array.<Object>} capabilities list of capabilities details
|
||||
* @param {Array.<String>} specs List of spec file paths that ran
|
||||
*/
|
||||
after: (_result, _capabilities, _specs) =>
|
||||
__awaiter(void 0, void 0, void 0, function* () {
|
||||
yield closeApplication();
|
||||
}),
|
||||
/**
|
||||
* Gets executed right after terminating the webdriver session.
|
||||
* @param {Object} config wdio configuration object
|
||||
* @param {Array.<Object>} capabilities list of capabilities details
|
||||
* @param {Array.<String>} specs List of spec file paths that ran
|
||||
*/
|
||||
// afterSession: function (config, capabilities, specs) {
|
||||
// },
|
||||
/**
|
||||
* Gets executed after all workers got shut down and the process is about to exit. An error
|
||||
* thrown in the onComplete hook will result in the test run failing.
|
||||
* @param {Object} exitCode 0 - success, 1 - fail
|
||||
* @param {Object} config wdio configuration object
|
||||
* @param {Array.<Object>} capabilities list of capabilities details
|
||||
* @param {<Object>} results object containing test results
|
||||
*/
|
||||
// onComplete: function(_exitCode, _config, _capabilities, _results) {
|
||||
// },
|
||||
/**
|
||||
* Gets executed when a refresh happens.
|
||||
* @param {String} oldSessionId session ID of the old session
|
||||
* @param {String} newSessionId session ID of the new session
|
||||
*/
|
||||
// onReload: function(oldSessionId, newSessionId) {
|
||||
// }
|
||||
};
|
||||
//# sourceMappingURL=webdriverio.config.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"webdriverio.config.js","sourceRoot":"","sources":["../../workspaces/electron-e2e/webdriverio.config.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,gCAAgC;AAChC,IAAI,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,kCAAkC,CAAC,CAAC;AAC5E,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE;IACjC,YAAY,IAAI,MAAM,CAAC;CACvB;AAED,gBAAgB;AAChB,MAAM,qBAAqB,GAAG,GAAS,EAAE;IACxC,MAAM,OAAO,GAAG,KAAM,CAAC;IACvB,MAAM,OAAO,CAAC,SAAS,CAAC,GAAS,EAAE,kDAAC,OAAA,CAAC,MAAM,OAAO,CAAC,SAAS,EAAE,CAAC,KAAK,KAAK,CAAA,GAAA,EAAE;QAC1E,OAAO,EAAE,OAAO;QAChB,UAAU,EAAE,0CAA0C,OAAO,IAAI;KACjE,CAAC,CAAC;AACJ,CAAC,CAAA,CAAC;AAEF,eAAe;AACf,MAAM,gBAAgB,GAAG,GAAS,EAAE;IACnC,IAAI,OAAO,EAAE;QACZ,iCAAiC;QACjC,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC;QAC1D,MAAM,OAAO,CAAC,WAAW,EAAE,CAAC;KAC5B;AACF,CAAC,CAAA,CAAC;AAEF,MAAM,CAAC,MAAM,MAAM,GAAuB;IACzC,EAAE;IACF,uBAAuB;IACvB,uBAAuB;IACvB,uBAAuB;IACvB,EAAE;IACF,EAAE;IACF,wBAAwB;IACxB,yBAAyB;IACzB,wBAAwB;IACxB,EAAE;IACF,8EAA8E;IAC9E,qEAAqE;IACrE,4EAA4E;IAC5E,kDAAkD;IAClD,2DAA2D;IAC3D,kFAAkF;IAClF,EAAE;IAEF,eAAe,EAA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||||
# ---> Node
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
@@ -5,6 +6,7 @@ npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
lerna-debug.log*
|
||||
.pnpm-debug.log*
|
||||
|
||||
# Diagnostic reports (https://nodejs.org/api/report.html)
|
||||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
||||
@@ -26,6 +28,12 @@ coverage
|
||||
# nyc test coverage
|
||||
.nyc_output
|
||||
|
||||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
||||
.grunt
|
||||
|
||||
# Bower dependency directory (https://bower.io/)
|
||||
bower_components
|
||||
|
||||
# node-waf configuration
|
||||
.lock-wscript
|
||||
|
||||
@@ -36,6 +44,8 @@ build/Release
|
||||
node_modules/
|
||||
jspm_packages/
|
||||
|
||||
# Snowpack dependency directory (https://snowpack.dev/)
|
||||
web_modules/
|
||||
# TypeScript v1 declaration files
|
||||
typings/
|
||||
|
||||
@@ -48,6 +58,15 @@ typings/
|
||||
# Optional eslint cache
|
||||
.eslintcache
|
||||
|
||||
# Optional stylelint cache
|
||||
.stylelintcache
|
||||
|
||||
# Microbundle cache
|
||||
.rpt2_cache/
|
||||
.rts2_cache_cjs/
|
||||
.rts2_cache_es/
|
||||
.rts2_cache_umd/
|
||||
|
||||
# Optional REPL history
|
||||
.node_repl_history
|
||||
|
||||
@@ -57,6 +76,31 @@ typings/
|
||||
# Yarn Integrity file
|
||||
.yarn-integrity
|
||||
|
||||
# dotenv environment variable files
|
||||
.env
|
||||
.env.development.local
|
||||
.env.test.local
|
||||
.env.production.local
|
||||
.env.local
|
||||
|
||||
# parcel-bundler cache (https://parceljs.org/)
|
||||
.cache
|
||||
.parcel-cache
|
||||
|
||||
# Next.js build output
|
||||
.next
|
||||
out
|
||||
|
||||
# Nuxt.js build / generate output
|
||||
.nuxt
|
||||
dist
|
||||
.dist
|
||||
|
||||
# Gatsby files
|
||||
.cache/
|
||||
# Comment in the public line in if your project uses Gatsby and not Next.js
|
||||
# https://nextjs.org/blog/next-9-1#public-directory-support
|
||||
# public
|
||||
# dotenv environment variables file
|
||||
.env
|
||||
.env.test
|
||||
@@ -73,6 +117,13 @@ typings/
|
||||
# vuepress build output
|
||||
.vuepress/dist
|
||||
|
||||
# vuepress v2.x temp and cache directory
|
||||
.temp
|
||||
.cache
|
||||
|
||||
# Docusaurus cache and generated files
|
||||
.docusaurus
|
||||
|
||||
# Serverless directories
|
||||
.serverless/
|
||||
|
||||
@@ -82,6 +133,19 @@ typings/
|
||||
# DynamoDB Local files
|
||||
.dynamodb/
|
||||
|
||||
# TernJS port file
|
||||
.tern-port
|
||||
|
||||
# Stores VSCode versions used for testing VSCode extensions
|
||||
.vscode-test
|
||||
|
||||
# yarn v2
|
||||
.yarn/cache
|
||||
.yarn/unplugged
|
||||
.yarn/build-state.yml
|
||||
.yarn/install-state.gz
|
||||
.pnp.*
|
||||
|
||||
# Webpack
|
||||
.webpack/
|
||||
|
||||
@@ -93,4 +157,4 @@ allure-results
|
||||
|
||||
# System Files
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
Thumbs.db
|
||||
|
||||
23
LICENSE
23
LICENSE
@@ -1,21 +1,10 @@
|
||||
MIT License
|
||||
This is free and unencumbered software released into the public domain.
|
||||
|
||||
Copyright (c) 2020 Sourcygen
|
||||
Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit of the public at large and to the detriment of our heirs and
|
||||
successors. We intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law.
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
For more information, please refer to <http://unlicense.org/>
|
||||
|
||||
162
README.md
162
README.md
@@ -1,162 +1,2 @@
|
||||
<a href="https://github.com/sourcygen/electron-angular-quick-start/actions"><img src="https://github.com/sourcygen/electron-angular-quick-start/workflows/CI/badge.svg?branch=master" alt="CI Status"/></a>
|
||||
<a href="https://gitHub.com/sourcygen/electron-angular-quick-start/graphs/commit-activity"><img src="https://img.shields.io/badge/maintained-yes-brightgreen.svg" alt="Maintenance Status"/></a>
|
||||
<a href="https://github.com/sourcygen/electron-angular-quick-start/blob/master/LICENSE"><img src="https://img.shields.io/badge/license-MIT-brightgreen.svg" alt="License MIT"></a>
|
||||
<a href="http://makeapullrequest.com"><img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg" alt="PRs Welcome"></a>
|
||||
<a href="https://twitter.com/share?text=Build%20cross%20platform%20desktop%20app%20with%20Electron%20and%20Angular%20%F0%9F%9A%80&url=https://github.com/sourcygen/electron-angular-quick-start"><img src="https://img.shields.io/twitter/url/https/github.com/sourcygen/electron-angular-quick-start.svg?style=social" alt="Tweet" align="right"></a>
|
||||
<a href="https://github.com/sourcygen/electron-angular-quick-start/watchers"><img src="https://img.shields.io/github/watchers/sourcygen/electron-angular-quick-start.svg?style=social" alt="Watch on GitHub" align="right"></a>
|
||||
<a href="https://github.com/sourcygen/electron-angular-quick-start/stargazers"><img src="https://img.shields.io/github/stars/sourcygen/electron-angular-quick-start.svg?style=social" alt="Star on GitHub" align="right"></a>
|
||||
# Pevabo-doors
|
||||
|
||||

|
||||
|
||||
## Overview
|
||||
|
||||
Depending on your need, putting up [Electron](https://www.electronjs.org/) and [Angular](https://angular.io/) may require a lot of setup. Fortunately, this simple project will help you **go fast** and directly start building desktop apps in [Typescript](https://www.typescriptlang.org/) with live reload.
|
||||
|
||||
> Because building a desktop app with Electron and Angular shouldn't be difficult.
|
||||
|
||||
### Main features :
|
||||
|
||||
- This project is based on last [Angular 14](https://angular.io/) version with required dependencies for [Electron 18](https://www.electronjs.org/).
|
||||
- This project is also written in [Typescript 4](https://www.typescriptlang.org/) and includes test samples ([WebdriverIO](https://webdriver.io/) and [Jasmine](https://jasmine.github.io/)).
|
||||
- The app is runnable `on desktop` (with **live-reload** in `development mode`).
|
||||
- The app is also runnable `on browser` but **without Electron features**.
|
||||
- You can generate your platform distributables thanks to [`electron-forge`](https://www.electronforge.io/).
|
||||
- You are also granted a minimal size for your app thanks to the packaging based on its[`webpack-template`](https://www.electronforge.io/templates/typescript-+-webpack-template).
|
||||
|
||||
### Project structure :
|
||||
|
||||
```
|
||||
├── ./CHANGELOG.md
|
||||
├── ./LICENSE
|
||||
├── ./README.md
|
||||
├── ./_config.yml
|
||||
├── ./commitlint.config.js
|
||||
├── ./package-lock.json
|
||||
├── ./package.json
|
||||
├── ./tsconfig.json
|
||||
├── ./webpack.main.config.js
|
||||
├── ./webpack.plugins.js
|
||||
├── ./webpack.renderer.config.js
|
||||
├── ./webpack.rules.js
|
||||
└── ./workspaces
|
||||
├── ./workspaces/angular-app # Angular source directory (web renderer part)
|
||||
├── ./workspaces/electron-app # Electron source directory (main & preload part)
|
||||
├── ./workspaces/electron-e2e # Electron end-to-end test directory
|
||||
└── ./workspaces/shared-lib # Shared source directory (common part)
|
||||
```
|
||||
|
||||
## Getting started
|
||||
|
||||
To clone and run this repository, you'll need installed on your computer at least :
|
||||
|
||||
- [Git](https://git-scm.com)
|
||||
- [Node 14.15.0 or later](https://nodejs.org/en/download/)
|
||||
- [Npm 7 or later](https://docs.npmjs.com/about-npm)
|
||||
- [Angular-CLI 14 or later](https://angular.io/cli)
|
||||
|
||||
Then from your command line:
|
||||
|
||||
```bash
|
||||
# Upgrade to the latest version of npm (if necessary)
|
||||
npm install -g npm@latest
|
||||
|
||||
# Upgrade to the latest version of Angular CLI (if necessary)
|
||||
npm install -g @angular/cli@latest
|
||||
|
||||
# Clone this repository
|
||||
git clone https://github.com/sourcygen/electron-angular-quick-start.git
|
||||
|
||||
# Then go into the repository
|
||||
cd electron-angular-quick-start
|
||||
|
||||
# After that, install dependencies
|
||||
npm install
|
||||
|
||||
# And finally run the app (dev mode)
|
||||
npm start
|
||||
```
|
||||
|
||||
## How to use
|
||||
|
||||
| Command | Description |
|
||||
| --------------------------- | ---------------------------------------- |
|
||||
| `npm run install` | Install dependencies |
|
||||
| `npm run start` | Run the app on desktop (dev mode) |
|
||||
| `npm run start:angular-app` | Run the app on browser (dev mode) |
|
||||
| `npm run test:angular-e2e` | Run **angular** end-to-end tests |
|
||||
| `npm run test:electron-e2e` | Run **electron** end-to-end tests |
|
||||
| `npm run package` | Build and prepare application content |
|
||||
| `npm run make` | Generate platform distributables (./out) |
|
||||
| `npm run clean` | Delete generated outputs |
|
||||
|
||||
## Behind a proxy
|
||||
|
||||
After settings **HTTP_PROXY** and **HTTPS_PROXY** environment variables :
|
||||
|
||||
```bash
|
||||
# Install dependencies
|
||||
npx cross-env ELECTRON_GET_USE_PROXY=true GLOBAL_AGENT_HTTPS_PROXY=%HTTPS_PROXY% npm install
|
||||
```
|
||||
|
||||
### Adding dependencies
|
||||
|
||||
This project architecture is based on [npm workspaces](https://docs.npmjs.com/cli/v7/using-npm/workspaces). This allows having different version of the same dependency depending on your workspace :
|
||||
|
||||
- electron-app
|
||||
`npm install --save <dependency>`
|
||||
- angular-app
|
||||
`npm install --save <dependency> -w angular-app`
|
||||
- shared-lib
|
||||
`npm install --save <dependency> -w shared-lib`
|
||||
|
||||
### Listing outdated dependencies
|
||||
|
||||
- electron-app
|
||||
`npm run outdated-deps:electron-app`
|
||||
- angular-app
|
||||
`npm run outdated-deps:angular-app`
|
||||
- shared-lib
|
||||
`npm run outdated-deps:shared-lib`
|
||||
- all of them
|
||||
`npm run outdated-deps`
|
||||
|
||||
### Updating dependencies
|
||||
|
||||
- electron-app
|
||||
`npm run update-deps:electron-app`
|
||||
- angular-app
|
||||
`npm run update-deps:angular-app`
|
||||
- shared-lib
|
||||
`npm run update-deps:shared-lib`
|
||||
- all of them
|
||||
`npm run update-deps`
|
||||
|
||||
### Customizing app icons
|
||||
|
||||
```bash
|
||||
# Install the icon generator globally
|
||||
npm i -g electron-icon-maker
|
||||
|
||||
# Run following command from anywhere you have your input file (1024px at least) to generate platforms icons
|
||||
electron-icon-maker --input=icon.png --output=./out
|
||||
```
|
||||
|
||||
Rename and move files to match with next config
|
||||
|
||||
- ./workspaces/electron-app/main/assets/icons/icon.png for Linux
|
||||
- ./workspaces/electron-app/main/assets/icons/icon.icns for MacOs
|
||||
- ./workspaces/electron-app/main/assets/icons/icon.ico for Windows
|
||||
|
||||
## Resources
|
||||
|
||||
### Electron
|
||||
|
||||
- [electronjs.org/docs](https://electronjs.org/docs) - Electron's documentation
|
||||
- [electron/simple-samples](https://github.com/electron/simple-samples) - Small applications with ideas to take further
|
||||
- [electron/electron-api-demos](https://github.com/electron/electron-api-demos) - Sample app that teaches you how to use Electron
|
||||
|
||||
### Angular
|
||||
|
||||
- [angular.io/start](https://angular.io/start) - Getting started with Angular
|
||||
- [angular.io/docs](https://angular.io/docs) - Angular's documentation
|
||||
- [cli.angular.io](https://cli.angular.io/) - Angular CLI documentation
|
||||
|
||||
10
config.json
10
config.json
@@ -1,5 +1,13 @@
|
||||
{
|
||||
"filePaths": [
|
||||
"./assets"
|
||||
]
|
||||
],
|
||||
"mapping": {
|
||||
"lr": ["L/R"],
|
||||
"krukSlot": ["Kruk/\r\nSLOT"],
|
||||
"pivot": ["SCHARNIER"],
|
||||
"type": ["SOORT"],
|
||||
"modelKruk": ["MODEL\r\nKRUK"],
|
||||
"remark": ["OPMERKING"]
|
||||
}
|
||||
}
|
||||
@@ -24,3 +24,28 @@
|
||||
.print-button {
|
||||
margin-left: 2rem;
|
||||
}
|
||||
|
||||
@media print {
|
||||
mat-form-field {
|
||||
display: none;
|
||||
}
|
||||
|
||||
button {
|
||||
display: none;
|
||||
}
|
||||
|
||||
|
||||
.door {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.specs {
|
||||
flex-direction: row;
|
||||
|
||||
p {
|
||||
display: inline-block;
|
||||
width: 220px;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,2 +1,11 @@
|
||||
/* You can add global styles to this file, and also import other style files */
|
||||
@import '~@angular/material/prebuilt-themes/indigo-pink.css';
|
||||
|
||||
@media print {
|
||||
html {
|
||||
height: 530px;
|
||||
width: 460px;
|
||||
overflow: hidden;
|
||||
zoom: 0.25;
|
||||
}
|
||||
}
|
||||
@@ -22,7 +22,8 @@ export class Window {
|
||||
|
||||
const fileListService = new FileListService();
|
||||
this.registerService<void, any[]>(fileListService);
|
||||
this.registerService<any, Door[]>(new DoorService());
|
||||
const doorService = new DoorService();
|
||||
this.registerService<any, Door[]>(doorService);
|
||||
|
||||
readFile('./config.json', 'utf8', (error, data) => {
|
||||
if(error){
|
||||
@@ -31,7 +32,7 @@ export class Window {
|
||||
}
|
||||
const config = JSON.parse(data);
|
||||
fileListService.setPaths(config.filePaths);
|
||||
|
||||
doorService.setMapping(config.mapping);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,11 @@ export class DoorService extends AbstractService<any, Door[]> {
|
||||
sendingChannel(): string {
|
||||
return WindowApiConst.PROJECT_OUTPUT;
|
||||
}
|
||||
private _mapping: any = {};
|
||||
|
||||
public setMapping(mapping: any): void {
|
||||
this._mapping = mapping;
|
||||
}
|
||||
|
||||
process(input: {name: string, path: string}): Promise<Door[]> {
|
||||
return new Promise((resolve) => {
|
||||
@@ -19,19 +24,34 @@ export class DoorService extends AbstractService<any, Door[]> {
|
||||
const workingSheet = workbook.Sheets['DEURLIJST'];
|
||||
const doorList: Door[] = [];
|
||||
|
||||
// remove 2 top rows
|
||||
|
||||
const headers: any = {};
|
||||
// get header values
|
||||
for (let index = 65; index <= 90; index++) {
|
||||
const currentValue = workingSheet[`${String.fromCodePoint(index)}3`]?.v;
|
||||
|
||||
for (const [key, value] of Object.entries(this._mapping)) {
|
||||
if ((value as string[]).find((x: string) => x.includes(currentValue)) != undefined) {
|
||||
this.setObjectWithChar(headers, key, index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// get max records
|
||||
const maxRecords = Number.parseInt(workingSheet['!ref'].split(':')[1].replace(/[A-Z]*/g, ''));
|
||||
|
||||
// stop at 19
|
||||
|
||||
for (let index = 4; index < 19; index++) {
|
||||
for (let index = 4; index < maxRecords; index++) {
|
||||
const door: Door = {};
|
||||
door.nr = workingSheet[`A${index}`]?.v;
|
||||
if (door.nr) {
|
||||
door.lr = workingSheet[`H${index}`]?.v;
|
||||
door.krukSlot = workingSheet[`K${index}`]?.v;
|
||||
door.pivot = workingSheet[`Q${index}`]?.v;
|
||||
door.type = workingSheet[`S${index}`]?.v;
|
||||
door.modelKruk = workingSheet[`T${index}`]?.v;
|
||||
door.remark = workingSheet[`U${index}`]?.v;
|
||||
door.lr = workingSheet[`${headers['lr']}${index}`]?.v;
|
||||
door.krukSlot = workingSheet[`${headers['krukSlot']}${index}`]?.v;
|
||||
door.pivot = workingSheet[`${headers['pivot']}${index}`]?.v;
|
||||
door.type = workingSheet[`${headers['type']}${index}`]?.v;
|
||||
door.modelKruk = workingSheet[`${headers['modelKruk']}${index}`]?.v;
|
||||
door.remark = workingSheet[`${headers['remark']}${index}`]?.v;
|
||||
|
||||
doorList.push(door);
|
||||
}
|
||||
@@ -40,4 +60,8 @@ export class DoorService extends AbstractService<any, Door[]> {
|
||||
resolve(doorList);
|
||||
});
|
||||
}
|
||||
|
||||
private setObjectWithChar(object: any, key: string, value: number) {
|
||||
object[key] = String.fromCodePoint(value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ export class PrintService extends AbstractService<string, void> {
|
||||
process(): Promise<void> {
|
||||
return new Promise((resolve) => {
|
||||
if (this._browserWindow) {
|
||||
this._browserWindow.webContents.print({ silent: true });
|
||||
this._browserWindow.webContents.print({ silent: false });
|
||||
}
|
||||
resolve();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user