-
-
Notifications
You must be signed in to change notification settings - Fork 476
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(console): show version number for oss
- Loading branch information
Showing
15 changed files
with
210 additions
and
155 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@logto/console": minor | ||
--- | ||
|
||
show version number in the topbar |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
38 changes: 0 additions & 38 deletions
38
packages/console/src/components/Topbar/Contact/index.module.scss
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
43 changes: 0 additions & 43 deletions
43
packages/console/src/components/Topbar/DocumentNavButton/index.module.scss
This file was deleted.
Oops, something went wrong.
26 changes: 0 additions & 26 deletions
26
packages/console/src/components/Topbar/DocumentNavButton/index.tsx
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { version as currentVersion } from '../../../../core/package.json'; | ||
|
||
import { isGreaterThanCurrentVersion } from './utils'; | ||
|
||
describe('isGreaterThanCurrentVersion', () => { | ||
it('should return true if the target version is greater than the current Logto version', () => { | ||
expect(isGreaterThanCurrentVersion('v2.0')).toBe(true); | ||
expect(isGreaterThanCurrentVersion('2.0')).toBe(true); | ||
expect(isGreaterThanCurrentVersion('v1.999.0')).toBe(true); | ||
expect(isGreaterThanCurrentVersion('1.999.0')).toBe(true); | ||
}); | ||
|
||
it('should return false if the target version is less than the current Logto version', () => { | ||
expect(isGreaterThanCurrentVersion('v0.1.1')).toBe(false); | ||
expect(isGreaterThanCurrentVersion('0.1.1')).toBe(false); | ||
expect(isGreaterThanCurrentVersion('v1.15')).toBe(false); | ||
expect(isGreaterThanCurrentVersion('1.15')).toBe(false); | ||
}); | ||
|
||
it('should return false if the target version is malformed', () => { | ||
expect(isGreaterThanCurrentVersion('vv1.1')).toBe(false); | ||
expect(isGreaterThanCurrentVersion('foo')).toBe(false); | ||
}); | ||
|
||
it('should return false if the target version is equal to the current Logto version', () => { | ||
expect(isGreaterThanCurrentVersion(currentVersion)).toBe(false); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { version } from '../../../../core/package.json'; | ||
|
||
export { version as currentVersion } from '../../../../core/package.json'; | ||
|
||
/** Check if the target version is greater than the current Logto version. */ | ||
export const isGreaterThanCurrentVersion = (target: string) => { | ||
const latestComponents = (target.startsWith('v') ? target.slice(1) : target).split('.'); | ||
const currentComponents = version.split('.'); | ||
|
||
for (const [index, component] of latestComponents.entries()) { | ||
const current = currentComponents[index]; | ||
if (!current || Number(current) < Number(component)) { | ||
return true; | ||
} | ||
|
||
if (Number(current) > Number(component)) { | ||
return false; | ||
} | ||
} | ||
return false; | ||
}; |
Oops, something went wrong.