Skip to content

Commit

Permalink
Merge branch 'develop' into chore/upgrade-ng-to-19
Browse files Browse the repository at this point in the history
  • Loading branch information
rahul-rocket committed Jan 1, 2025
2 parents 0fa5565 + a764d17 commit b925368
Show file tree
Hide file tree
Showing 175 changed files with 2,030 additions and 658 deletions.
3 changes: 2 additions & 1 deletion .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,8 @@
"theora",
"Theora",
"Unregisters",
"allwindows"
"allwindows",
"Johndoe"
],
"useGitignore": true,
"ignorePaths": [
Expand Down
3 changes: 3 additions & 0 deletions .deploy/api/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ WORKDIR /srv/gauzy
COPY --chown=node:node apps/api/package.json ./apps/api/

COPY --chown=node:node packages/common/package.json ./packages/common/
COPY --chown=node:node packages/utils/package.json ./packages/utils/
COPY --chown=node:node packages/config/package.json ./packages/config/
COPY --chown=node:node packages/contracts/package.json ./packages/contracts/
COPY --chown=node:node packages/auth/package.json ./packages/auth/
Expand Down Expand Up @@ -203,6 +204,7 @@ WORKDIR /srv/gauzy
COPY --chown=node:node apps/api/package.json ./apps/api/

COPY --chown=node:node packages/common/package.json ./packages/common/
COPY --chown=node:node packages/utils/package.json ./packages/utils/
COPY --chown=node:node packages/config/package.json ./packages/config/
COPY --chown=node:node packages/contracts/package.json ./packages/contracts/
COPY --chown=node:node packages/auth/package.json ./packages/auth/
Expand Down Expand Up @@ -325,6 +327,7 @@ RUN yarn cache clean
# we need node_modules inside each @gauzy package
RUN cp -r ./packages/auth/node_modules ./node_modules/@gauzy/auth/
RUN cp -r ./packages/common/node_modules ./node_modules/@gauzy/common/
RUN cp -r ./packages/utils/node_modules ./node_modules/@gauzy/utils/
RUN cp -r ./packages/config/node_modules ./node_modules/@gauzy/config/
RUN cp -r ./packages/contracts/node_modules ./node_modules/@gauzy/contracts/
RUN cp -r ./packages/core/node_modules ./node_modules/@gauzy/core/
Expand Down
1 change: 1 addition & 0 deletions .deploy/webapp/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ WORKDIR /srv/gauzy
COPY --chown=node:node apps/gauzy/package.json ./apps/gauzy/

COPY --chown=node:node packages/common/package.json ./packages/common/
COPY --chown=node:node packages/utils/package.json ./packages/utils/
COPY --chown=node:node packages/config/package.json ./packages/config/
COPY --chown=node:node packages/contracts/package.json ./packages/contracts/
COPY --chown=node:node packages/auth/package.json ./packages/auth/
Expand Down
2 changes: 1 addition & 1 deletion apps/desktop-timer/src/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,10 @@
"@datorama/akita-ngdevtools": "^7.0.0",
"@electron/remote": "^2.0.8",
"@gauzy/contracts": "file:../../../dist/packages/contracts",
"@gauzy/desktop-core": "file:../../../dist/packages/desktop-core",
"@gauzy/desktop-lib": "file:../../../dist/packages/desktop-lib",
"@gauzy/desktop-window": "file:../../../dist/packages/desktop-window",
"@gauzy/ui-config": "file:../../../dist/packages/ui-config",
"@gauzy/desktop-core": "^0.1.0",
"@sentry/electron": "^4.18.0",
"@sentry/profiling-node": "^7.101.1",
"@sentry/replay": "^7.101.1",
Expand Down
75 changes: 67 additions & 8 deletions apps/desktop/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,34 @@ import { fork } from 'child_process';
import { autoUpdater } from 'electron-updater';
import { initSentry } from './sentry';

/**
* Describes the configuration for building the Gauzy API base URL.
*/
export interface ApiConfig {
/**
* A custom server URL, if provided (e.g. 'https://mydomain.com/api').
*/
serverUrl?: string;

/**
* The protocol to use (e.g. 'http', 'https').
* Defaults to 'http' if not provided.
*/
protocol?: string;

/**
* The hostname or IP address.
* Defaults to '127.0.0.1' if not provided.
*/
host?: string;

/**
* The port number for the local environment.
* Defaults to environment.API_DEFAULT_PORT if not provided.
*/
port?: number;
}

// the folder where all app data will be stored (e.g. sqlite DB, settings, cache, etc)
// C:\Users\USERNAME\AppData\Roaming\gauzy-desktop
process.env.GAUZY_USER_PATH = app.getPath('userData');
Expand Down Expand Up @@ -271,7 +299,7 @@ async function startServer(value, restart = false) {
process.env.DB_NAME = value['postgres']?.dbName;
process.env.DB_USER = value['postgres']?.dbUsername;
process.env.DB_PASS = value['postgres']?.dbPassword;
}
}

try {
const config: any = {
Expand Down Expand Up @@ -395,13 +423,44 @@ function setEnvAdditional() {
};
}

const getApiBaseUrl = (configs) => {
if (configs.serverUrl) return configs.serverUrl;
else {
return configs.port ? `http://127.0.0.1:${configs.port}` : `http://127.0.0.1:${environment.API_DEFAULT_PORT}`;
/**
* Retrieves the base URL for the Gauzy API based on a configuration object.
*
* If `configs.serverUrl` is defined, this function returns that URL directly.
* Otherwise, it constructs a local address using `configs.host`, `configs.protocol`,
* and `configs.port` or falls back to sensible defaults.
*
* @param {ApiConfig} configs - The configuration object.
* @returns {string} - The resulting base URL for the API.
*/
export const getApiBaseUrl = (configs: ApiConfig): string => {
console.log('get configs', configs);

// If a full server URL is provided, return it directly
if (configs.serverUrl) {
console.log('get configs.serverUrl', configs.serverUrl);
return configs.serverUrl;
}

// Otherwise, build the URL dynamically using the host, protocol, and port
const protocol = configs.protocol ?? 'http'; // default protocol
const host = configs.host ?? '127.0.0.1'; // default host
const port = configs.port ?? environment.API_DEFAULT_PORT;

console.log('get configs.protocol', configs.protocol);
console.log('get configs.host', configs.host);
console.log('get configs.port', configs.port);

return `${protocol}://${host}:${port}`;
};

const closeSplashScreen = () => {
if (splashScreen) {
splashScreen.close();
splashScreen = null;
}
}

// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
Expand Down Expand Up @@ -486,7 +545,7 @@ app.on('ready', async () => {
if (!configs.serverConfigConnected && !configs?.isLocalServer) {
setupWindow = await createSetupWindow(setupWindow, false, pathWindow.timeTrackerUi);
setupWindow.show();
splashScreen.close();
closeSplashScreen()
setupWindow.webContents.send('setup-data', {
...configs
});
Expand All @@ -501,7 +560,7 @@ app.on('ready', async () => {
} else {
setupWindow = await createSetupWindow(setupWindow, false, pathWindow.timeTrackerUi);
setupWindow.show();
splashScreen.close();
closeSplashScreen();
}
} catch (error) {
console.error('ERROR: Occurred while create window:' + error);
Expand Down Expand Up @@ -717,7 +776,7 @@ app.on('activate', async () => {
} else {
if (setupWindow) {
setupWindow.show();
splashScreen.close();
closeSplashScreen();
}
}
});
Expand Down
44 changes: 42 additions & 2 deletions apps/desktop/src/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,30 @@
"main": "index.js",
"workspaces": {
"packages": [
"../../../dist/packages/auth",
"../../../dist/packages/common",
"../../../dist/packages/utils",
"../../../dist/packages/config",
"../../../dist/packages/contracts",
"../../../dist/packages/core",
"../../../dist/packages/desktop-core",
"../../../dist/packages/desktop-lib",
"../../../dist/packages/desktop-window",
"../../../dist/packages/plugin",
"../../../dist/packages/plugins/changelog",
"../../../dist/packages/plugins/integration-ai",
"../../../dist/packages/plugins/integration-github",
"../../../dist/packages/plugins/integration-hubstaff",
"../../../dist/packages/plugins/integration-jira",
"../../../dist/packages/plugins/integration-upwork",
"../../../dist/packages/plugins/integration-wakatime",
"../../../dist/packages/plugins/jitsu-analytics",
"../../../dist/packages/plugins/job-proposal",
"../../../dist/packages/plugins/job-search",
"../../../dist/packages/plugins/knowledge-base",
"../../../dist/packages/plugins/product-reviews",
"../../../dist/packages/plugins/sentry-tracing",
"../../../dist/packages/plugins/videos",
"../../../dist/packages/ui-config"
]
},
Expand Down Expand Up @@ -124,11 +144,31 @@
"@datorama/akita-ngdevtools": "^7.0.0",
"@datorama/akita": "^7.1.1",
"@electron/remote": "^2.0.8",
"@gauzy/auth": "file:../../../dist/packages/auth",
"@gauzy/common": "file:../../../dist/packages/common",
"@gauzy/utils": "file:../../../dist/packages/utils",
"@gauzy/config": "file:../../../dist/packages/config",
"@gauzy/contracts": "file:../../../dist/packages/contracts",
"@gauzy/core": "file:../../../dist/packages/core",
"@gauzy/desktop-core": "file:../../../dist/packages/desktop-core",
"@gauzy/desktop-lib": "file:../../../dist/packages/desktop-lib",
"@gauzy/desktop-window": "file:../../../dist/packages/desktop-window",
"@gauzy/plugin": "file:../../../dist/packages/plugin",
"@gauzy/plugin-changelog": "file:../../../dist/packages/plugins/changelog",
"@gauzy/plugin-integration-ai": "file:../../../dist/packages/plugins/integration-ai",
"@gauzy/plugin-integration-github": "file:../../../dist/packages/plugins/integration-github",
"@gauzy/plugin-integration-hubstaff": "file:../../../dist/packages/plugins/integration-hubstaff",
"@gauzy/plugin-integration-jira": "file:../../../dist/packages/plugins/integration-jira",
"@gauzy/plugin-integration-upwork": "file:../../../dist/packages/plugins/integration-upwork",
"@gauzy/plugin-integration-wakatime": "file:../../../dist/packages/plugins/integration-wakatime",
"@gauzy/plugin-jitsu-analytics": "file:../../../dist/packages/plugins/jitsu-analytics",
"@gauzy/plugin-job-proposal": "file:../../../dist/packages/plugins/job-proposal",
"@gauzy/plugin-job-search": "file:../../../dist/packages/plugins/job-search",
"@gauzy/plugin-knowledge-base": "file:../../../dist/packages/plugins/knowledge-base",
"@gauzy/plugin-product-reviews": "file:../../../dist/packages/plugins/product-reviews",
"@gauzy/plugin-sentry": "file:../../../dist/packages/plugins/sentry-tracing",
"@gauzy/plugin-videos": "file:../../../dist/packages/plugins/videos",
"@gauzy/ui-config": "file:../../../dist/packages/ui-config",
"@gauzy/desktop-core": "^0.1.0",
"@nestjs/platform-express": "^10.3.7",
"@sentry/electron": "^4.18.0",
"@sentry/node": "^7.101.1",
Expand All @@ -147,7 +187,7 @@
"htmlparser2": "^8.0.2",
"knex": "^3.1.0",
"libsql": "^0.3.16",
"locutus": "^2.0.30",
"locutus": "^2.0.30",
"moment": "^2.30.1",
"node-fetch": "^2.6.7",
"node-notifier": "^8.0.0",
Expand Down
1 change: 1 addition & 0 deletions apps/gauzy-e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"build:package:contracts": "cross-env NODE_ENV=development NODE_OPTIONS=--max-old-space-size=14000 yarn --cwd ./packages/contracts build",
"build:package:config": "cross-env NODE_ENV=development NODE_OPTIONS=--max-old-space-size=14000 yarn --cwd ./packages/config build",
"build:package:common": "cross-env NODE_ENV=development NODE_OPTIONS=--max-old-space-size=14000 yarn --cwd ./packages/common build",
"build:package:utils": "cross-env NODE_ENV=development NODE_OPTIONS=--max-old-space-size=14000 yarn --cwd ./packages/utils build",
"build:package:plugin": "cross-env NODE_ENV=development NODE_OPTIONS=--max-old-space-size=14000 yarn --cwd ./packages/plugin build",
"build:package:plugin:integration-wakatime": "cross-env NODE_ENV=development NODE_OPTIONS=--max-old-space-size=14000 yarn --cwd ./packages/plugins/integration-wakatime build",
"build:package:desktop-lib": "yarn run build:package:desktop-window && cross-env NODE_ENV=development NODE_OPTIONS=--max-old-space-size=14000 yarn nx build desktop-lib --configuration=development",
Expand Down
13 changes: 10 additions & 3 deletions apps/server-api/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,14 +238,21 @@ eventErrorManager.onShowError(async (message) => {
}
});

const closeSplashScreen = () => {
if (splashScreen) {
splashScreen.close();
splashScreen = null;
}
}

const runSetup = async () => {
// Set default configuration
LocalStore.setDefaultServerConfig();
if (!setupWindow) {
setupWindow = await createSetupWindow(setupWindow, false, pathWindow.ui);
}
setupWindow.show();
splashScreen.close();
closeSplashScreen();
};

const appState = async () => {
Expand All @@ -264,7 +271,7 @@ const runMainWindow = async () => {

serverWindow.show();

splashScreen.close();
closeSplashScreen();

if (!tray) {
createTray();
Expand Down Expand Up @@ -334,7 +341,7 @@ const getEnvApi = () => {
DB_NAME: config[provider]?.dbName,
DB_USER: config[provider]?.dbUsername,
DB_PASS: config[provider]?.dbPassword
}),
}),
DEBUG: 'true',
API_PORT: String(config.port),
...addsConfig
Expand Down
31 changes: 17 additions & 14 deletions apps/server-api/src/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,19 @@
"bin": "api/main.js",
"workspaces": {
"packages": [
"../../../dist/packages/plugins/integration-ai",
"../../../dist/packages/plugins/job-proposal",
"../../../dist/packages/auth",
"../../../dist/packages/common",
"../../../dist/packages/utils",
"../../../dist/packages/config",
"../../../dist/packages/contracts",
"../../../dist/packages/core",
"../../../dist/packages/desktop-core",
"../../../dist/packages/desktop-lib",
"../../../dist/packages/desktop-window",
"../../../dist/packages/ui-config",
"../../../dist/packages/auth",
"../../../dist/packages/plugin",
"../../../dist/packages/core",
"../../../dist/packages/common"
"../../../dist/packages/plugins/integration-ai",
"../../../dist/packages/plugins/job-proposal",
"../../../dist/packages/ui-config"
]
},
"build": {
Expand Down Expand Up @@ -132,27 +133,29 @@
"@datorama/akita-ngdevtools": "^7.0.0",
"@datorama/akita": "^7.1.1",
"@electron/remote": "^2.0.8",
"@gauzy/config": "file:../../../dist/packages/config",
"@gauzy/auth": "file:../../../dist/packages/auth",
"@gauzy/plugin": "file:../../../dist/packages/plugin",
"@gauzy/utils": "file:../../../dist/packages/utils",
"@gauzy/config": "file:../../../dist/packages/config",
"@gauzy/contracts": "file:../../../dist/packages/contracts",
"@gauzy/core": "file:../../../dist/packages/core",
"@gauzy/desktop-core": "file:../../../dist/packages/desktop-core",
"@gauzy/desktop-lib": "file:../../../dist/packages/desktop-lib",
"@gauzy/desktop-window": "file:../../../dist/packages/desktop-window",
"@gauzy/plugin": "file:../../../dist/packages/plugin",
"@gauzy/plugin-changelog": "file:../../../dist/packages/plugins/changelog",
"@gauzy/plugin-integration-ai": "file:../../../dist/packages/plugins/integration-ai",
"@gauzy/plugin-integration-github": "file:../../../dist/packages/plugins/integration-github",
"@gauzy/plugin-integration-hubstaff": "file:../../../dist/packages/plugins/integration-hubstaff",
"@gauzy/plugin-job-proposal": "file:../../../dist/packages/plugins/job-proposal",
"@gauzy/plugin-integration-jira": "file:../../../dist/packages/plugins/integration-jira",
"@gauzy/plugin-integration-upwork": "file:../../../dist/packages/plugins/integration-upwork",
"@gauzy/plugin-integration-wakatime": "file:../../../dist/packages/plugins/integration-wakatime",
"@gauzy/plugin-jitsu-analytics": "file:../../../dist/packages/plugins/jitsu-analytics",
"@gauzy/plugin-job-proposal": "file:../../../dist/packages/plugins/job-proposal",
"@gauzy/plugin-job-search": "file:../../../dist/packages/plugins/job-search",
"@gauzy/plugin-knowledge-base": "file:../../../dist/packages/plugins/knowledge-base",
"@gauzy/plugin-product-reviews": "file:../../../dist/packages/plugins/product-reviews",
"@gauzy/plugin-sentry": "file:../../../dist/packages/plugins/sentry-tracing",
"@gauzy/plugin-videos": "file:../../../dist/packages/plugins/videos",
"@gauzy/desktop-core": "^0.1.0",
"@gauzy/contracts": "^0.1.0",
"@gauzy/desktop-lib": "^0.1.0",
"@gauzy/desktop-window": "^0.1.0",
"@gauzy/ui-config": "file:../../../dist/packages/ui-config",
"@nestjs/platform-express": "^10.3.7",
"@sentry/electron": "^4.18.0",
Expand Down Expand Up @@ -306,7 +309,7 @@
"passport-jwt": "^4.0.0",
"prettier": "^2.8.4",
"redis": "^4.6.12",
"slugify": "^1.6.5",
"slugify": "^1.6.6",
"reflect-metadata": "^0.1.13",
"request": "^2.88.2",
"rxjs": "^7.8.0",
Expand Down
Loading

0 comments on commit b925368

Please sign in to comment.