Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
ggazzo committed Sep 18, 2023
1 parent 7a26b8c commit 4ecac07
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 14 deletions.
10 changes: 7 additions & 3 deletions apps/meteor/app/api/server/lib/getServerInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ import {
getCachedSupportedVersionsToken,
wrapPromise,
} from '../../../cloud/server/functions/supportedVersionsToken/supportedVersionsToken';
import { Info } from '../../../utils/rocketchat.info';
import { Info, minimumClientVersions } from '../../../utils/rocketchat.info';

type ServerInfo =
| {
info: typeof Info;
supportedVersions?: string;
minimumClientVersions: typeof minimumClientVersions;
}
| {
version: string | undefined;
Expand All @@ -22,10 +24,12 @@ export async function getServerInfo(userId?: string): Promise<ServerInfo> {
return {
info: {
...Info,
...(supportedVersionsToken.success && {
},
minimumClientVersions,
...(supportedVersionsToken.success &&
supportedVersionsToken.result && {
supportedVersions: supportedVersionsToken.result,
}),
},
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,6 @@ const getSupportedVersionsFromCloud = async () => {
};

const getSupportedVersionsToken = async () => {
if (process.env.NODE_ENV === 'development') {
if (process.env.MOCK_CLOUD_SUPPORTED_VERSIONS_TOKEN) {
return JSON.parse(process.env.MOCK_CLOUD_SUPPORTED_VERSIONS_TOKEN);
}
}
/**
* Gets the supported versions from the license
* Gets the supported versions from the cloud
Expand Down
9 changes: 5 additions & 4 deletions apps/meteor/client/definitions/info.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ declare module '*.info' {
version: string;
tag?: string;
branch?: string;
minimumClientVersions: {
desktop: string;
mobile: string;
};
};

export const minimumClientVersions: {
desktop: string;
mobile: string;
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ class VersionCompiler {
};

output.marketplaceApiVersion = require('@rocket.chat/apps-engine/package.json').version.replace(/^[^0-9]/g, '');
output.minimumClientVersions = JSON.parse(fs.readFileSync(path.resolve(process.cwd(), './package.json'), { encoding: 'utf8' }))?.rocketchat?.minimumClientVersions || {};
const minimumClientVersions =
JSON.parse(fs.readFileSync(path.resolve(process.cwd(), './package.json'), { encoding: 'utf8' }))?.rocketchat
?.minimumClientVersions || {};
try {
const result = await execAsync("git log --pretty=format:'%H%n%ad%n%an%n%s' -n 1");
const data = result.stdout.split('\n');
Expand Down Expand Up @@ -58,7 +60,8 @@ class VersionCompiler {
// no branch
}

output = `exports.Info = ${JSON.stringify(output, null, 4)};`;
output = `exports.Info = ${JSON.stringify(output, null, 4)};
exports.minimumClientVersions = ${JSON.stringify(minimumClientVersions, null, 4)};`;

file.addJavaScript({
data: output,
Expand Down

0 comments on commit 4ecac07

Please sign in to comment.