aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLibravatar Markus Hatvan <markus_hatvan@aon.at>2021-09-18 11:15:25 +0200
committerLibravatar GitHub <noreply@github.com>2021-09-18 11:15:25 +0200
commitd4101a48b3eee8b1fb177831aa02a4b4fbec2588 (patch)
treec92f2fbe91197fde8589207463d0d6526b4ff76b /src
parent5.6.3-nightly.6 [skip ci] (diff)
downloadferdium-app-d4101a48b3eee8b1fb177831aa02a4b4fbec2588.tar.gz
ferdium-app-d4101a48b3eee8b1fb177831aa02a4b4fbec2588.tar.zst
ferdium-app-d4101a48b3eee8b1fb177831aa02a4b4fbec2588.zip
chore: convert various files from JS to TS (#1959)
Diffstat (limited to 'src')
-rw-r--r--src/assets/themeInfo.json1
-rw-r--r--src/electron/ipc-api/localServer.ts4
-rw-r--r--src/electron/macOSPermissions.ts2
-rw-r--r--src/environment.ts (renamed from src/environment.js)59
-rw-r--r--src/features/appearance/index.ts (renamed from src/features/appearance/index.js)9
-rw-r--r--src/features/basicAuth/Form.ts (renamed from src/features/basicAuth/Form.js)0
-rw-r--r--src/features/basicAuth/mainIpcHandler.ts (renamed from src/features/basicAuth/mainIpcHandler.js)4
-rw-r--r--src/features/basicAuth/store.ts (renamed from src/features/basicAuth/store.js)0
-rw-r--r--src/features/basicAuth/styles.ts (renamed from src/features/basicAuth/styles.js)0
-rw-r--r--src/features/communityRecipes/index.ts (renamed from src/features/communityRecipes/index.js)0
-rw-r--r--src/features/utils/ActionBinding.ts (renamed from src/features/utils/ActionBinding.js)0
-rw-r--r--src/features/workspaces/actions.js27
-rw-r--r--src/features/workspaces/actions.ts30
-rw-r--r--src/features/workspaces/api.ts (renamed from src/features/workspaces/api.js)44
-rw-r--r--src/features/workspaces/constants.ts (renamed from src/features/workspaces/constants.js)0
-rw-r--r--src/features/workspaces/index.ts (renamed from src/features/workspaces/index.js)6
-rw-r--r--src/features/workspaces/models/Workspace.ts (renamed from src/features/workspaces/models/Workspace.js)4
-rw-r--r--src/i18n/apply-branding.ts (renamed from src/i18n/apply-branding.js)4
-rw-r--r--src/i18n/globalMessages.ts (renamed from src/i18n/globalMessages.js)0
-rw-r--r--src/i18n/languages.ts (renamed from src/i18n/languages.js)0
-rw-r--r--src/i18n/translations.ts (renamed from src/i18n/translations.js)0
-rw-r--r--src/internal-server/start.ts (renamed from src/internal-server/start.js)18
-rw-r--r--src/internal-server/test.ts (renamed from src/internal-server/test.js)6
23 files changed, 124 insertions, 94 deletions
diff --git a/src/assets/themeInfo.json b/src/assets/themeInfo.json
deleted file mode 100644
index 54e833789..000000000
--- a/src/assets/themeInfo.json
+++ /dev/null
@@ -1 +0,0 @@
1{"color":".theme__dark .app .sidebar .sidebar__button.is-muted, .theme__dark .app .sidebar .sidebar__button.is-active, .sidebar .sidebar__button.is-muted, .sidebar .sidebar__button.is-active, .tab-item.is-active, .settings .account .invoices .invoices__action button, .settings-navigation .settings-navigation__link.is-active .badge, a.link, button.link, .auth .welcome .button:hover, .auth .welcome .button__inverted, .franz-form .franz-form__radio.is-selected, .theme__dark .franz-form__button.franz-form__button--inverted, .franz-form__button.franz-form__button--inverted","border-color":".theme__dark .settings, .franz-form .franz-form__radio.is-selected","background":".settings .settings__header, .settings .settings__close, .settings-navigation .settings-navigation__link.is-active, a.button, button.button, .auth, .info-bar, .info-bar.info-bar--primary, .infobox.infobox--primary, .theme__dark .badge.badge--primary, .theme__dark, .badge.badge--primary, .content-tabs .content-tabs__tabs .content-tabs__item.is-active, #electron-app-title-bar .toolbar-dropdown:not(.open) > .toolbar-button > button:hover, #electron-app-title-bar .list-item.selected .menu-item, #electron-app-title-bar .list-item.selected:focus .menu-item, .theme__dark .quick-switch .active, .franz-form .franz-form__toggle-wrapper .franz-form__toggle.is-active .franz-form__toggle-button, .theme__dark .franz-form__button, .franz-form__button, .ferdi__fab, .franz-form .franz-form__slider-wrapper .slider::-webkit-slider-thumb","border-right-color":".settings .settings__header .separator"}
diff --git a/src/electron/ipc-api/localServer.ts b/src/electron/ipc-api/localServer.ts
index d318b93a5..61e56c777 100644
--- a/src/electron/ipc-api/localServer.ts
+++ b/src/electron/ipc-api/localServer.ts
@@ -2,7 +2,7 @@ import { ipcMain, BrowserWindow } from 'electron';
2import net from 'net'; 2import net from 'net';
3import { LOCAL_HOSTNAME, LOCAL_PORT } from '../../config'; 3import { LOCAL_HOSTNAME, LOCAL_PORT } from '../../config';
4import { userDataPath } from '../../environment'; 4import { userDataPath } from '../../environment';
5import startServer from '../../internal-server/start'; 5import { server } from '../../internal-server/start';
6 6
7const portInUse = (port: number): Promise<boolean> => 7const portInUse = (port: number): Promise<boolean> =>
8 new Promise(resolve => { 8 new Promise(resolve => {
@@ -35,7 +35,7 @@ export default (params: { mainWindow: BrowserWindow }) => {
35 } 35 }
36 console.log('Starting local server on port', port); 36 console.log('Starting local server on port', port);
37 37
38 startServer(userDataPath(), port); 38 server(userDataPath(), port);
39 39
40 params.mainWindow.webContents.send('localServerPort', { 40 params.mainWindow.webContents.send('localServerPort', {
41 port, 41 port,
diff --git a/src/electron/macOSPermissions.ts b/src/electron/macOSPermissions.ts
index f5a8c7cc4..aef3ac30b 100644
--- a/src/electron/macOSPermissions.ts
+++ b/src/electron/macOSPermissions.ts
@@ -15,7 +15,7 @@ debug(
15 15
16const filePath = userDataPath('.has-app-requested-screen-capture-permissions'); 16const filePath = userDataPath('.has-app-requested-screen-capture-permissions');
17 17
18function hasPromptedForScreenCapturePermission(): boolean { 18function hasPromptedForScreenCapturePermission(): string | boolean {
19 if (!isExplicitScreenCapturePermissionReqd) { 19 if (!isExplicitScreenCapturePermissionReqd) {
20 return false; 20 return false;
21 } 21 }
diff --git a/src/environment.js b/src/environment.ts
index b315466fc..ca1380199 100644
--- a/src/environment.js
+++ b/src/environment.ts
@@ -24,7 +24,9 @@ import {
24} from './config'; 24} from './config';
25 25
26import { asarPath } from './helpers/asar-helpers'; 26import { asarPath } from './helpers/asar-helpers';
27import * as buildInfo from './buildInfo.json'; // eslint-disable-line import/no-unresolved 27
28// @ts-expect-error Cannot find module './buildInfo.json' or its corresponding type declarations.
29import * as buildInfo from './buildInfo.json';
28 30
29export const { app } = electronApi; 31export const { app } = electronApi;
30export const ferdiVersion = app.getVersion(); 32export const ferdiVersion = app.getVersion();
@@ -38,7 +40,11 @@ if (process.env.FERDI_APPDATA_DIR != null) {
38 app.setPath('appData', process.env.FERDI_APPDATA_DIR); 40 app.setPath('appData', process.env.FERDI_APPDATA_DIR);
39 app.setPath('userData', join(app.getPath('appData'))); 41 app.setPath('userData', join(app.getPath('appData')));
40} else if (process.env.PORTABLE_EXECUTABLE_DIR != null) { 42} else if (process.env.PORTABLE_EXECUTABLE_DIR != null) {
41 app.setPath('appData', process.env.PORTABLE_EXECUTABLE_DIR, `${app.name}AppData`); 43 app.setPath(
44 'appData',
45 process.env.PORTABLE_EXECUTABLE_DIR,
46 `${app.name}AppData`,
47 );
42 app.setPath('userData', join(app.getPath('appData'), `${app.name}AppData`)); 48 app.setPath('userData', join(app.getPath('appData'), `${app.name}AppData`));
43} else if (is.windows) { 49} else if (is.windows) {
44 app.setPath('appData', process.env.APPDATA); 50 app.setPath('appData', process.env.APPDATA);
@@ -50,17 +56,17 @@ if (isDevMode) {
50 app.setPath('userData', join(app.getPath('appData'), `${app.name}Dev`)); 56 app.setPath('userData', join(app.getPath('appData'), `${app.name}Dev`));
51} 57}
52 58
53export function userDataPath(...segments) { 59export function userDataPath(...segments: string[]) {
54 return join(app.getPath('userData'), ...([segments].flat())); 60 return join(app.getPath('userData'), ...[segments].flat());
55} 61}
56 62
57export function userDataRecipesPath(...segments) { 63export function userDataRecipesPath(...segments: any[]) {
58 return userDataPath('recipes', ...([segments].flat())); 64 return userDataPath('recipes', ...[segments].flat());
59} 65}
60 66
61// Replacing app.asar is not beautiful but unfortunately necessary 67// Replacing app.asar is not beautiful but unfortunately necessary
62export function asarRecipesPath(...segments) { 68export function asarRecipesPath(...segments: any[]) {
63 return join(asarPath(join(__dirname, 'recipes')), ...([segments].flat())); 69 return join(asarPath(join(__dirname, 'recipes')), ...[segments].flat());
64} 70}
65 71
66export const useLiveAPI = process.env.USE_LIVE_API; 72export const useLiveAPI = process.env.USE_LIVE_API;
@@ -79,22 +85,31 @@ export const is64Bit = osArch.match(/64/);
79const ctrlKey = isMac ? '⌘' : 'Ctrl'; 85const ctrlKey = isMac ? '⌘' : 'Ctrl';
80const cmdKey = isMac ? 'Cmd' : 'Ctrl'; 86const cmdKey = isMac ? 'Cmd' : 'Ctrl';
81 87
82export const altKey = (isAccelerator = true) => (!isAccelerator && isMac ? '⌥' : 'Alt'); 88export const altKey = (isAccelerator = true) =>
83export const shiftKey = (isAccelerator = true) => (!isAccelerator && isMac ? '⇧' : 'Shift'); 89 !isAccelerator && isMac ? '⌥' : 'Alt';
90export const shiftKey = (isAccelerator = true) =>
91 !isAccelerator && isMac ? '⇧' : 'Shift';
84 92
85// Platform specific shortcut keys 93// Platform specific shortcut keys
86export const cmdOrCtrlShortcutKey = (isAccelerator = true) => (isAccelerator ? cmdKey : ctrlKey); 94export const cmdOrCtrlShortcutKey = (isAccelerator = true) =>
87export const lockFerdiShortcutKey = (isAccelerator = true) => `${cmdOrCtrlShortcutKey(isAccelerator)}+${shiftKey(isAccelerator)}+L`; 95 isAccelerator ? cmdKey : ctrlKey;
88export const todosToggleShortcutKey = (isAccelerator = true) => `${cmdOrCtrlShortcutKey(isAccelerator)}+T`; 96export const lockFerdiShortcutKey = (isAccelerator = true) =>
89export const workspaceToggleShortcutKey = (isAccelerator = true) => `${cmdOrCtrlShortcutKey(isAccelerator)}+D`; 97 `${cmdOrCtrlShortcutKey(isAccelerator)}+${shiftKey(isAccelerator)}+L`;
90export const muteFerdiShortcutKey = (isAccelerator = true) => `${cmdOrCtrlShortcutKey(isAccelerator)}+${shiftKey(isAccelerator)}+M`; 98export const todosToggleShortcutKey = (isAccelerator = true) =>
91export const addNewServiceShortcutKey = (isAccelerator = true) => `${cmdOrCtrlShortcutKey(isAccelerator)}+N`; 99 `${cmdOrCtrlShortcutKey(isAccelerator)}+T`;
92export const settingsShortcutKey = (isAccelerator = true) => `${cmdOrCtrlShortcutKey(isAccelerator)}+${isMac ? ',' : 'P'}`; 100export const workspaceToggleShortcutKey = (isAccelerator = true) =>
93 101 `${cmdOrCtrlShortcutKey(isAccelerator)}+D`;
94let api; 102export const muteFerdiShortcutKey = (isAccelerator = true) =>
95let wsApi; 103 `${cmdOrCtrlShortcutKey(isAccelerator)}+${shiftKey(isAccelerator)}+M`;
96let web; 104export const addNewServiceShortcutKey = (isAccelerator = true) =>
97let todos; 105 `${cmdOrCtrlShortcutKey(isAccelerator)}+N`;
106export const settingsShortcutKey = (isAccelerator = true) =>
107 `${cmdOrCtrlShortcutKey(isAccelerator)}+${isMac ? ',' : 'P'}`;
108
109let api: string;
110let wsApi: string;
111let web: string;
112let todos: string;
98if (!isDevMode || (isDevMode && useLiveAPI)) { 113if (!isDevMode || (isDevMode && useLiveAPI)) {
99 api = LIVE_FERDI_API; 114 api = LIVE_FERDI_API;
100 wsApi = LIVE_WS_API; 115 wsApi = LIVE_WS_API;
diff --git a/src/features/appearance/index.js b/src/features/appearance/index.ts
index 0c935be32..b00b9df3d 100644
--- a/src/features/appearance/index.js
+++ b/src/features/appearance/index.ts
@@ -1,6 +1,5 @@
1import color from 'color'; 1import color from 'color';
2import { reaction } from 'mobx'; 2import { reaction } from 'mobx';
3import themeInfo from '../../assets/themeInfo.json';
4import { iconSizeBias } from '../../config'; 3import { iconSizeBias } from '../../config';
5import { DEFAULT_APP_SETTINGS } from '../../environment'; 4import { DEFAULT_APP_SETTINGS } from '../../environment';
6 5
@@ -30,14 +29,6 @@ function darkenAbsolute(originalColor, absoluteChange) {
30function generateAccentStyle(accentColorStr) { 29function generateAccentStyle(accentColorStr) {
31 let style = ''; 30 let style = '';
32 31
33 for (const property of Object.keys(themeInfo)) {
34 style += `
35 ${themeInfo[property]} {
36 ${property}: ${accentColorStr};
37 }
38 `;
39 }
40
41 let accentColor = color(DEFAULT_APP_SETTINGS.accentColor); 32 let accentColor = color(DEFAULT_APP_SETTINGS.accentColor);
42 try { 33 try {
43 accentColor = color(accentColorStr); 34 accentColor = color(accentColorStr);
diff --git a/src/features/basicAuth/Form.js b/src/features/basicAuth/Form.ts
index 95721d0e9..95721d0e9 100644
--- a/src/features/basicAuth/Form.js
+++ b/src/features/basicAuth/Form.ts
diff --git a/src/features/basicAuth/mainIpcHandler.js b/src/features/basicAuth/mainIpcHandler.ts
index ae4e7cf93..4ec3848e8 100644
--- a/src/features/basicAuth/mainIpcHandler.js
+++ b/src/features/basicAuth/mainIpcHandler.ts
@@ -1,6 +1,8 @@
1import { BrowserWindow } from 'electron';
2
1const debug = require('debug')('Ferdi:feature:basicAuth:main'); 3const debug = require('debug')('Ferdi:feature:basicAuth:main');
2 4
3export default function mainIpcHandler(mainWindow, authInfo) { 5export default function mainIpcHandler(mainWindow: BrowserWindow, authInfo) {
4 debug('Sending basic auth call', authInfo); 6 debug('Sending basic auth call', authInfo);
5 7
6 mainWindow.webContents.send('feature:basic-auth', { 8 mainWindow.webContents.send('feature:basic-auth', {
diff --git a/src/features/basicAuth/store.js b/src/features/basicAuth/store.ts
index 0713ff572..0713ff572 100644
--- a/src/features/basicAuth/store.js
+++ b/src/features/basicAuth/store.ts
diff --git a/src/features/basicAuth/styles.js b/src/features/basicAuth/styles.ts
index 6bdaf9a6e..6bdaf9a6e 100644
--- a/src/features/basicAuth/styles.js
+++ b/src/features/basicAuth/styles.ts
diff --git a/src/features/communityRecipes/index.js b/src/features/communityRecipes/index.ts
index 828c6d867..828c6d867 100644
--- a/src/features/communityRecipes/index.js
+++ b/src/features/communityRecipes/index.ts
diff --git a/src/features/utils/ActionBinding.js b/src/features/utils/ActionBinding.ts
index 787166d44..787166d44 100644
--- a/src/features/utils/ActionBinding.js
+++ b/src/features/utils/ActionBinding.ts
diff --git a/src/features/workspaces/actions.js b/src/features/workspaces/actions.js
deleted file mode 100644
index 5b5db422e..000000000
--- a/src/features/workspaces/actions.js
+++ /dev/null
@@ -1,27 +0,0 @@
1import PropTypes from 'prop-types';
2import Workspace from './models/Workspace';
3import { createActionsFromDefinitions } from '../../actions/lib/actions';
4
5export const workspaceActions = createActionsFromDefinitions({
6 edit: {
7 workspace: PropTypes.instanceOf(Workspace).isRequired,
8 },
9 create: {
10 name: PropTypes.string.isRequired,
11 },
12 delete: {
13 workspace: PropTypes.instanceOf(Workspace).isRequired,
14 },
15 update: {
16 workspace: PropTypes.instanceOf(Workspace).isRequired,
17 },
18 activate: {
19 workspace: PropTypes.instanceOf(Workspace).isRequired,
20 },
21 deactivate: {},
22 toggleWorkspaceDrawer: {},
23 openWorkspaceSettings: {},
24 toggleKeepAllWorkspacesLoadedSetting: {},
25}, PropTypes.checkPropTypes);
26
27export default workspaceActions;
diff --git a/src/features/workspaces/actions.ts b/src/features/workspaces/actions.ts
new file mode 100644
index 000000000..5e7e6e721
--- /dev/null
+++ b/src/features/workspaces/actions.ts
@@ -0,0 +1,30 @@
1import PropTypes from 'prop-types';
2import Workspace from './models/Workspace';
3import { createActionsFromDefinitions } from '../../actions/lib/actions';
4
5export const workspaceActions = createActionsFromDefinitions(
6 {
7 edit: {
8 workspace: PropTypes.instanceOf(Workspace).isRequired,
9 },
10 create: {
11 name: PropTypes.string.isRequired,
12 },
13 delete: {
14 workspace: PropTypes.instanceOf(Workspace).isRequired,
15 },
16 update: {
17 workspace: PropTypes.instanceOf(Workspace).isRequired,
18 },
19 activate: {
20 workspace: PropTypes.instanceOf(Workspace).isRequired,
21 },
22 deactivate: {},
23 toggleWorkspaceDrawer: {},
24 openWorkspaceSettings: {},
25 toggleKeepAllWorkspacesLoadedSetting: {},
26 },
27 PropTypes.checkPropTypes,
28);
29
30export default workspaceActions;
diff --git a/src/features/workspaces/api.js b/src/features/workspaces/api.ts
index 322695ed2..8447fc247 100644
--- a/src/features/workspaces/api.js
+++ b/src/features/workspaces/api.ts
@@ -12,12 +12,14 @@ export const workspaceApi = {
12 debug('getUserWorkspaces GET', url); 12 debug('getUserWorkspaces GET', url);
13 const result = await sendAuthRequest(url, { method: 'GET' }); 13 const result = await sendAuthRequest(url, { method: 'GET' });
14 debug('getUserWorkspaces RESULT', result); 14 debug('getUserWorkspaces RESULT', result);
15 if (!result.ok) throw result; 15 if (!result.ok) {
16 throw new Error("Couldn't getUserWorkspaces");
17 }
16 const workspaces = await result.json(); 18 const workspaces = await result.json();
17 return workspaces.map((data) => new Workspace(data)); 19 return workspaces.map(data => new Workspace(data));
18 }, 20 },
19 21
20 createWorkspace: async (name) => { 22 createWorkspace: async name => {
21 const url = `${apiBase()}/workspace`; 23 const url = `${apiBase()}/workspace`;
22 const options = { 24 const options = {
23 method: 'POST', 25 method: 'POST',
@@ -26,20 +28,24 @@ export const workspaceApi = {
26 debug('createWorkspace POST', url, options); 28 debug('createWorkspace POST', url, options);
27 const result = await sendAuthRequest(url, options); 29 const result = await sendAuthRequest(url, options);
28 debug('createWorkspace RESULT', result); 30 debug('createWorkspace RESULT', result);
29 if (!result.ok) throw result; 31 if (!result.ok) {
32 throw new Error("Couldn't createWorkspace");
33 }
30 return new Workspace(await result.json()); 34 return new Workspace(await result.json());
31 }, 35 },
32 36
33 deleteWorkspace: async (workspace) => { 37 deleteWorkspace: async workspace => {
34 const url = `${apiBase()}/workspace/${workspace.id}`; 38 const url = `${apiBase()}/workspace/${workspace.id}`;
35 debug('deleteWorkspace DELETE', url); 39 debug('deleteWorkspace DELETE', url);
36 const result = await sendAuthRequest(url, { method: 'DELETE' }); 40 const result = await sendAuthRequest(url, { method: 'DELETE' });
37 debug('deleteWorkspace RESULT', result); 41 debug('deleteWorkspace RESULT', result);
38 if (!result.ok) throw result; 42 if (!result.ok) {
43 throw new Error("Couldn't deleteWorkspace");
44 }
39 return true; 45 return true;
40 }, 46 },
41 47
42 updateWorkspace: async (workspace) => { 48 updateWorkspace: async workspace => {
43 const url = `${apiBase()}/workspace/${workspace.id}`; 49 const url = `${apiBase()}/workspace/${workspace.id}`;
44 const options = { 50 const options = {
45 method: 'PUT', 51 method: 'PUT',
@@ -48,15 +54,29 @@ export const workspaceApi = {
48 debug('updateWorkspace UPDATE', url, options); 54 debug('updateWorkspace UPDATE', url, options);
49 const result = await sendAuthRequest(url, options); 55 const result = await sendAuthRequest(url, options);
50 debug('updateWorkspace RESULT', result); 56 debug('updateWorkspace RESULT', result);
51 if (!result.ok) throw result; 57 if (!result.ok) {
58 throw new Error("Couldn't updateWorkspace");
59 }
52 return new Workspace(await result.json()); 60 return new Workspace(await result.json());
53 }, 61 },
54}; 62};
55 63
56export const getUserWorkspacesRequest = new Request(workspaceApi, 'getUserWorkspaces'); 64export const getUserWorkspacesRequest = new Request(
57export const createWorkspaceRequest = new Request(workspaceApi, 'createWorkspace'); 65 workspaceApi,
58export const deleteWorkspaceRequest = new Request(workspaceApi, 'deleteWorkspace'); 66 'getUserWorkspaces',
59export const updateWorkspaceRequest = new Request(workspaceApi, 'updateWorkspace'); 67);
68export const createWorkspaceRequest = new Request(
69 workspaceApi,
70 'createWorkspace',
71);
72export const deleteWorkspaceRequest = new Request(
73 workspaceApi,
74 'deleteWorkspace',
75);
76export const updateWorkspaceRequest = new Request(
77 workspaceApi,
78 'updateWorkspace',
79);
60 80
61export const resetApiRequests = () => { 81export const resetApiRequests = () => {
62 getUserWorkspacesRequest.reset(); 82 getUserWorkspacesRequest.reset();
diff --git a/src/features/workspaces/constants.js b/src/features/workspaces/constants.ts
index 2d1416ee0..2d1416ee0 100644
--- a/src/features/workspaces/constants.js
+++ b/src/features/workspaces/constants.ts
diff --git a/src/features/workspaces/index.js b/src/features/workspaces/index.ts
index 83e4d9049..ecca64b41 100644
--- a/src/features/workspaces/index.js
+++ b/src/features/workspaces/index.ts
@@ -12,10 +12,8 @@ export default function initWorkspaces(stores, actions) {
12 12
13 // Toggle workspace feature 13 // Toggle workspace feature
14 reaction( 14 reaction(
15 () => ( 15 () => features.features.isWorkspaceEnabled,
16 features.features.isWorkspaceEnabled 16 isEnabled => {
17 ),
18 (isEnabled) => {
19 if (isEnabled && !workspaceStore.isFeatureActive) { 17 if (isEnabled && !workspaceStore.isFeatureActive) {
20 debug('Initializing `workspaces` feature'); 18 debug('Initializing `workspaces` feature');
21 workspaceStore.start(stores, actions); 19 workspaceStore.start(stores, actions);
diff --git a/src/features/workspaces/models/Workspace.js b/src/features/workspaces/models/Workspace.ts
index 14add9437..cd3918fba 100644
--- a/src/features/workspaces/models/Workspace.js
+++ b/src/features/workspaces/models/Workspace.ts
@@ -28,8 +28,10 @@ export default class Workspace {
28 services.push(KEEP_WS_LOADED_USID); 28 services.push(KEEP_WS_LOADED_USID);
29 } else if (data.saving && data.services.includes(KEEP_WS_LOADED_USID)) { 29 } else if (data.saving && data.services.includes(KEEP_WS_LOADED_USID)) {
30 // Don't keep loaded 30 // Don't keep loaded
31 services = services.filter((e) => e !== KEEP_WS_LOADED_USID); 31 services = services.filter(e => e !== KEEP_WS_LOADED_USID);
32 } 32 }
33
34 // @ts-expect-error Property 'replace' does not exist on type 'never[]'.
33 this.services.replace(services); 35 this.services.replace(services);
34 36
35 this.userId = data.userId; 37 this.userId = data.userId;
diff --git a/src/i18n/apply-branding.js b/src/i18n/apply-branding.ts
index 8ec573919..801a4a525 100644
--- a/src/i18n/apply-branding.js
+++ b/src/i18n/apply-branding.ts
@@ -1,8 +1,8 @@
1/** 1/**
2 * Apply Ferdi branding to i18n translations 2 * Apply Ferdi branding to i18n translations
3 */ 3 */
4const fs = require('fs-extra'); 4import fs from 'fs-extra';
5const path = require('path'); 5import path from 'path';
6 6
7console.log('Applying Ferdi branding to translations...'); 7console.log('Applying Ferdi branding to translations...');
8 8
diff --git a/src/i18n/globalMessages.js b/src/i18n/globalMessages.ts
index 8e1df10f7..8e1df10f7 100644
--- a/src/i18n/globalMessages.js
+++ b/src/i18n/globalMessages.ts
diff --git a/src/i18n/languages.js b/src/i18n/languages.ts
index e7713b42b..e7713b42b 100644
--- a/src/i18n/languages.js
+++ b/src/i18n/languages.ts
diff --git a/src/i18n/translations.js b/src/i18n/translations.ts
index 9a7dc7453..9a7dc7453 100644
--- a/src/i18n/translations.js
+++ b/src/i18n/translations.ts
diff --git a/src/internal-server/start.js b/src/internal-server/start.ts
index 5ccc1330e..392f7cf41 100644
--- a/src/internal-server/start.js
+++ b/src/internal-server/start.ts
@@ -15,16 +15,16 @@
15| Make sure to pass a relative path from the project root. 15| Make sure to pass a relative path from the project root.
16*/ 16*/
17 17
18const fold = require('@adonisjs/fold'); 18import fold from '@adonisjs/fold';
19const { Ignitor } = require('@adonisjs/ignitor'); 19import { Ignitor } from '@adonisjs/ignitor';
20const fs = require('fs-extra'); 20import fs from 'fs-extra';
21const path = require('path'); 21import path from 'path';
22const { LOCAL_HOSTNAME } = require('../config'); 22import { LOCAL_HOSTNAME } from '../config';
23const { isWindows } = require('../environment'); 23import { isWindows } from '../environment';
24 24
25process.env.ENV_PATH = path.join(__dirname, 'env.ini'); 25process.env.ENV_PATH = path.join(__dirname, 'env.ini');
26 26
27module.exports = async (userPath, port) => { 27export const server = async (userPath: string, port: number) => {
28 const dbPath = path.join(userPath, 'server.sqlite'); 28 const dbPath = path.join(userPath, 'server.sqlite');
29 const dbTemplatePath = path.join(__dirname, 'database', 'template.sqlite'); 29 const dbTemplatePath = path.join(__dirname, 'database', 'template.sqlite');
30 30
@@ -45,7 +45,7 @@ module.exports = async (userPath, port) => {
45 process.env.DB_PATH = dbPath; 45 process.env.DB_PATH = dbPath;
46 process.env.USER_PATH = userPath; 46 process.env.USER_PATH = userPath;
47 process.env.HOST = LOCAL_HOSTNAME; 47 process.env.HOST = LOCAL_HOSTNAME;
48 process.env.PORT = port; 48 process.env.PORT = port.toString();
49 49
50 new Ignitor(fold).appRoot(__dirname).fireHttpServer().catch(console.error); // eslint-disable-line no-console 50 new Ignitor(fold).appRoot(__dirname).fireHttpServer().catch(console.error);
51}; 51};
diff --git a/src/internal-server/test.js b/src/internal-server/test.ts
index ef85743f3..437a2813b 100644
--- a/src/internal-server/test.js
+++ b/src/internal-server/test.ts
@@ -1,6 +1,6 @@
1const path = require('path'); 1import path from 'path';
2const fs = require('fs-extra'); 2import fs from 'fs-extra';
3const server = require('./start'); 3import { server } from './start';
4 4
5const dummyUserFolder = path.join(__dirname, 'user_data'); 5const dummyUserFolder = path.join(__dirname, 'user_data');
6 6