build(deps): bump the kopia-ui-npm-dependencies group across 1 directory with 9 updates + upgraded 'app' to ESM modules (#3978)

* build(deps): bump the kopia-ui-npm-dependencies group across 1 directory with 9 updates

Bumps the kopia-ui-npm-dependencies group with 7 updates in the /app directory:

| Package | From | To |
| --- | --- | --- |
| [electron-log](https://github.com/megahertz/electron-log) | `5.1.2` | `5.1.5` |
| [electron-store](https://github.com/sindresorhus/electron-store) | `8.2.0` | `10.0.0` |
| [electron-updater](https://github.com/electron-userland/electron-builder/tree/HEAD/packages/electron-updater) | `6.3.0-alpha.6` | `6.3.0-alpha.7` |
| [uuid](https://github.com/uuidjs/uuid) | `9.0.1` | `10.0.0` |
| [@electron/notarize](https://github.com/electron/notarize) | `2.3.0` | `2.3.2` |
| [@playwright/test](https://github.com/microsoft/playwright) | `1.42.1` | `1.45.1` |
| [electron](https://github.com/electron/electron) | `29.1.6` | `31.2.0` |



Updates `electron-log` from 5.1.2 to 5.1.5
- [Changelog](https://github.com/megahertz/electron-log/blob/master/CHANGELOG.md)
- [Commits](https://github.com/megahertz/electron-log/compare/v5.1.2...v5.1.5)

Updates `electron-store` from 8.2.0 to 10.0.0
- [Release notes](https://github.com/sindresorhus/electron-store/releases)
- [Commits](https://github.com/sindresorhus/electron-store/compare/v8.2.0...v10.0.0)

Updates `electron-updater` from 6.3.0-alpha.6 to 6.3.0-alpha.7
- [Release notes](https://github.com/electron-userland/electron-builder/releases)
- [Changelog](https://github.com/electron-userland/electron-builder/blob/master/packages/electron-updater/CHANGELOG.md)
- [Commits](https://github.com/electron-userland/electron-builder/commits/electron-updater@6.3.0-alpha.7/packages/electron-updater)

Updates `uuid` from 9.0.1 to 10.0.0
- [Changelog](https://github.com/uuidjs/uuid/blob/main/CHANGELOG.md)
- [Commits](https://github.com/uuidjs/uuid/compare/v9.0.1...v10.0.0)

Updates `@electron/notarize` from 2.3.0 to 2.3.2
- [Release notes](https://github.com/electron/notarize/releases)
- [Changelog](https://github.com/electron/notarize/blob/main/.releaserc.json)
- [Commits](https://github.com/electron/notarize/compare/v2.3.0...v2.3.2)

Updates `@playwright/test` from 1.42.1 to 1.45.1
- [Release notes](https://github.com/microsoft/playwright/releases)
- [Commits](https://github.com/microsoft/playwright/compare/v1.42.1...v1.45.1)

Updates `electron` from 29.1.6 to 31.2.0
- [Release notes](https://github.com/electron/electron/releases)
- [Changelog](https://github.com/electron/electron/blob/main/docs/breaking-changes.md)
- [Commits](https://github.com/electron/electron/compare/v29.1.6...v31.2.0)

Updates `playwright` from 1.42.1 to 1.45.1
- [Release notes](https://github.com/microsoft/playwright/releases)
- [Commits](https://github.com/microsoft/playwright/compare/v1.42.1...v1.45.1)

Updates `playwright-core` from 1.42.1 to 1.45.1
- [Release notes](https://github.com/microsoft/playwright/releases)
- [Commits](https://github.com/microsoft/playwright/compare/v1.42.1...v1.45.1)

---
updated-dependencies:
- dependency-name: electron-log
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: kopia-ui-npm-dependencies
- dependency-name: electron-store
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: kopia-ui-npm-dependencies
- dependency-name: electron-updater
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: kopia-ui-npm-dependencies
- dependency-name: uuid
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: kopia-ui-npm-dependencies
- dependency-name: "@electron/notarize"
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: kopia-ui-npm-dependencies
- dependency-name: "@playwright/test"
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: kopia-ui-npm-dependencies
- dependency-name: electron
  dependency-type: direct:development
  update-type: version-update:semver-major
  dependency-group: kopia-ui-npm-dependencies
- dependency-name: playwright
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: kopia-ui-npm-dependencies
- dependency-name: playwright-core
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: kopia-ui-npm-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>

* upgraded app to ES modules

* renamed notarize.js and sign.js to CommonJS

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jarek Kowalski <jaak@jkowalski.net>
This commit is contained in:
dependabot[bot]
2024-07-13 02:31:41 +00:00
committed by GitHub
parent 9c5fc842a1
commit 6235ba5c6b
10 changed files with 406 additions and 510 deletions

2
app/.gitignore vendored
View File

@@ -21,3 +21,5 @@
npm-debug.log*
yarn-debug.log*
yarn-error.log*
test-results/

View File

653
app/package-lock.json generated
View File

File diff suppressed because it is too large Load Diff

View File

@@ -4,13 +4,14 @@
"repository": "github:kopia/kopia",
"dependencies": {
"auto-launch": "^5.0.6",
"electron-log": "^5.1.2",
"electron-store": "^8.2.0",
"electron-updater": "^6.3.0-alpha.6",
"electron-log": "^5.1.5",
"electron-store": "^10.0.0",
"electron-updater": "^6.3.0-alpha.7",
"minimist": "^1.2.8",
"semver": "^7.6.0",
"uuid": "^9.0.1"
"uuid": "^10.0.0"
},
"type": "module",
"author": {
"email": "kopia-pmc@googlegroups.com",
"name": "Kopia Authors"
@@ -70,7 +71,7 @@
]
}
],
"sign": "./sign.js",
"sign": "./sign.cjs",
"signingHashAlgorithms": [
"sha256"
]
@@ -107,17 +108,17 @@
}
]
},
"afterSign": "notarize.js"
"afterSign": "notarize.cjs"
},
"devDependencies": {
"@electron/notarize": "^2.3.0",
"@playwright/test": "^1.42.1",
"@electron/notarize": "^2.3.2",
"@playwright/test": "^1.45.1",
"asar": "^3.2.0",
"concurrently": "^8.2.2",
"dotenv": "^16.4.5",
"electron": "^29.1.6",
"electron": "^31.2.0",
"electron-builder": "^24.13.3",
"electron-store": "^8.2.0",
"electron-store": "^10.0.0",
"playwright": "^1.37.1",
"playwright-core": "^1.35.1"
},

View File

@@ -1,7 +1,7 @@
const { ipcMain } = require('electron');
const log = require("electron-log");
import { ipcMain } from 'electron';
import log from "electron-log";
const AutoLaunch = require('auto-launch');
import AutoLaunch from 'auto-launch';
const autoLauncher = new AutoLaunch({
name: 'Kopia',
@@ -12,11 +12,11 @@ const autoLauncher = new AutoLaunch({
let enabled = false;
module.exports = {
willLaunchAtStartup() {
export function willLaunchAtStartup() {
return enabled;
},
toggleLaunchAtStartup() {
}
export function toggleLaunchAtStartup() {
if (enabled) {
log.info('disabling autorun');
autoLauncher.disable()
@@ -28,8 +28,8 @@ module.exports = {
.then(() => { enabled = true; ipcMain.emit('launch-at-startup-updated'); })
.catch((err) => log.info(err));
}
},
refreshWillLaunchAtStartup() {
}
export function refreshWillLaunchAtStartup() {
autoLauncher.isEnabled()
.then((isEnabled) => {
enabled = isEnabled;
@@ -38,5 +38,4 @@ module.exports = {
.catch(function (err) {
log.info('unable to get autoLauncher state', err);
});
},
}
}

View File

@@ -1,12 +1,12 @@
const fs = require('fs');
const path = require('path');
const Electron = require('electron');
const log = require("electron-log");
const fs = await import('fs');
const path = await import('path');
const Electron = await import('electron');
const log = await import("electron-log");
let configs = {};
const configFileSuffix = ".config";
let configDir = "";
let myConfigDir = "";
let isPortable = false;
let firstRun = false;
@@ -32,34 +32,34 @@ function portableConfigDirs() {
}
function globalConfigDir() {
if (!configDir) {
if (!myConfigDir) {
// try portable config dirs in order.
portableConfigDirs().forEach(d => {
if (configDir) {
if (myConfigDir) {
return;
}
d = path.normalize(d)
if (!fs.existsSync(d)) {
return;
}
configDir = d;
myConfigDir = d;
isPortable = true;
});
// still not set, fall back to per-user config dir.
// we use the same directory that is used by Kopia CLI.
if (!configDir) {
configDir = path.join(Electron.app.getPath("appData"), "kopia");
if (!myConfigDir) {
myConfigDir = path.join(Electron.app.getPath("appData"), "kopia");
}
}
return configDir;
return myConfigDir;
}
function allConfigs() {
export function allConfigs() {
let result = [];
for (let k in configs) {
@@ -69,7 +69,7 @@ function allConfigs() {
return result;
}
function addNewConfig() {
export function addNewConfig() {
let id;
if (!configs) {
@@ -91,7 +91,7 @@ function emitConfigListUpdated() {
Electron.ipcMain.emit('config-list-updated-event', allConfigs());
};
function deleteConfigIfDisconnected(repoID) {
export function deleteConfigIfDisconnected(repoID) {
if (repoID === "repository") {
// never delete default repository config
return false;
@@ -106,51 +106,44 @@ function deleteConfigIfDisconnected(repoID) {
return false;
}
module.exports = {
loadConfigs() {
fs.mkdirSync(globalConfigDir(), { recursive: true, mode: 0700 });
let entries = fs.readdirSync(globalConfigDir());
let count = 0;
entries.filter(e => path.extname(e) == configFileSuffix).forEach(v => {
const repoID = v.replace(configFileSuffix, "");
configs[repoID] = true;
count++;
});
if (!configs["repository"]) {
configs["repository"] = true;
firstRun = true;
}
},
isPortableConfig() {
globalConfigDir();
return isPortable;
},
isFirstRun() {
return firstRun;
},
configDir() {
return globalConfigDir();
},
deleteConfigIfDisconnected,
addNewConfig,
allConfigs,
configForRepo(repoID) {
let c = configs[repoID];
if (c) {
return c;
}
export function loadConfigs() {
fs.mkdirSync(globalConfigDir(), { recursive: true, mode: 0o700 });
let entries = fs.readdirSync(globalConfigDir());
let count = 0;
entries.filter(e => path.extname(e) == configFileSuffix).forEach(v => {
const repoID = v.replace(configFileSuffix, "");
configs[repoID] = true;
emitConfigListUpdated();
count++;
});
if (!configs["repository"]) {
configs["repository"] = true;
firstRun = true;
}
};
export function isPortableConfig() {
globalConfigDir();
return isPortable;
};
export function isFirstRun() {
return firstRun;
}
export function configDir() {
return globalConfigDir();
}
export function configForRepo(repoID) {
let c = configs[repoID];
if (c) {
return c;
}
}
configs[repoID] = true;
emitConfigListUpdated();
return c;
}

View File

@@ -1,13 +1,15 @@
const { app, BrowserWindow, Notification, screen, Menu, Tray, ipcMain, dialog, shell } = require('electron')
const { autoUpdater } = require("electron-updater");
const { resourcesPath, selectByOS } = require('./utils');
const { toggleLaunchAtStartup, willLaunchAtStartup, refreshWillLaunchAtStartup } = require('./auto-launch');
const { serverForRepo } = require('./server');
const { loadConfigs, allConfigs, deleteConfigIfDisconnected, addNewConfig, configDir, isFirstRun, isPortableConfig } = require('./config');
const Store = require('electron-store')
const log = require("electron-log");
const path = require('path');
const crypto = require('crypto')
import { app, BrowserWindow, Notification, screen, Menu, Tray, ipcMain, dialog, shell } from 'electron';
import pkg from "electron-updater";
const autoUpdater = pkg.autoUpdater;
import { iconsPath, publicPath, selectByOS } from './utils.js';
import { toggleLaunchAtStartup, willLaunchAtStartup, refreshWillLaunchAtStartup } from './auto-launch.js';
import { serverForRepo } from './server.js';
import { loadConfigs, allConfigs, deleteConfigIfDisconnected, addNewConfig, configDir, isFirstRun, isPortableConfig } from './config.js';
import Store from 'electron-store';
import log from "electron-log";
import path from 'path';
import crypto from 'crypto';
// Store to save parameters
const store = new Store();
@@ -78,7 +80,7 @@ function showRepoWindow(repositoryID) {
resizable: true,
show: false,
webPreferences: {
preload: path.join(resourcesPath(), 'preload.js'),
preload: path.join(publicPath(), 'preload.js'),
},
};
@@ -421,7 +423,7 @@ app.on('ready', () => {
tray = new Tray(
path.join(
resourcesPath(), 'icons',
iconsPath(),
selectByOS({ mac: 'kopiaTrayTemplate.png', win: 'kopia-tray.ico', linux: 'kopia-tray.png' })));
tray.setToolTip('Kopia');
@@ -528,7 +530,7 @@ function updateTrayContextMenu() {
autoUpdateMenuItems.push({ label: "KopiaUI is up-to-date: " + app.getVersion(), enabled: false });
}
template = defaultReposTemplates.concat(additionalReposTemplates).concat([
let template = defaultReposTemplates.concat(additionalReposTemplates).concat([
{ type: 'separator' },
{ label: 'Connect To Another Repository...', click: addAnotherRepository },
{ type: 'separator' },

View File

@@ -1,11 +1,11 @@
const { ipcMain } = require('electron');
const path = require('path');
const https = require('https');
import { ipcMain } from 'electron';
const path = await import('path');
const https = await import('https');
const { defaultServerBinary } = require('./utils');
const { spawn } = require('child_process');
const log = require("electron-log")
const { configDir, isPortableConfig } = require('./config');
import { defaultServerBinary } from './utils.js';
import { spawn } from 'child_process';
import log from "electron-log";
import { configDir, isPortableConfig } from './config.js';
let servers = {};
@@ -242,8 +242,7 @@ ipcMain.on('status-fetch', (event, args) => {
}
})
module.exports = {
serverForRepo(repoID) {
export function serverForRepo(repoID) {
let s = servers[repoID];
if (s) {
return s;
@@ -253,4 +252,4 @@ module.exports = {
servers[repoID] = s;
return s;
}
}

View File

@@ -1,7 +1,8 @@
const { app } = require('electron');
const path = require('path');
import { app } from 'electron';
import path from 'path';
const __dirname = import.meta.dirname;
const osShortName = function() {
const osShortName = function () {
switch (process.platform) {
case "win32":
return "win"
@@ -14,29 +15,37 @@ const osShortName = function() {
}
}();
module.exports = {
resourcesPath: function () {
if (!app.isPackaged) {
return path.join(__dirname, "..", "resources", osShortName);
}
return process.resourcesPath;
},
defaultServerBinary: function () {
if (!app.isPackaged) {
return {
"mac": path.join(__dirname, "..", "..", "dist", "kopia_darwin_amd64", "kopia"),
"win": path.join(__dirname, "..", "..", "dist", "kopia_windows_amd64", "kopia.exe"),
"linux": path.join(__dirname, "..", "..", "dist", "kopia_linux_amd64", "kopia"),
}[osShortName]
}
export function iconsPath() {
if (!app.isPackaged) {
return path.join(__dirname, "..", "resources", osShortName, "icons");
}
return path.join(process.resourcesPath, "icons");
}
export function publicPath() {
if (!app.isPackaged) {
return path.join(__dirname, "..", "public");
}
return process.resourcesPath;
}
export function defaultServerBinary() {
if (!app.isPackaged) {
return {
"mac": path.join(process.resourcesPath, "server", "kopia"),
"win": path.join(process.resourcesPath, "server", "kopia.exe"),
"linux": path.join(process.resourcesPath, "server", "kopia"),
"mac": path.join(__dirname, "..", "..", "dist", "kopia_darwin_amd64", "kopia"),
"win": path.join(__dirname, "..", "..", "dist", "kopia_windows_amd64", "kopia.exe"),
"linux": path.join(__dirname, "..", "..", "dist", "kopia_linux_amd64", "kopia"),
}[osShortName]
},
selectByOS: function (x) {
return x[osShortName]
},
}
}
return {
"mac": path.join(process.resourcesPath, "server", "kopia"),
"win": path.join(process.resourcesPath, "server", "kopia.exe"),
"linux": path.join(process.resourcesPath, "server", "kopia"),
}[osShortName]
}
export function selectByOS(x) {
return x[osShortName]
}

View File