-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: ci and compare vesion optimize cache (#26)
* ci: fix release add install * fix: change the compare version and optimize cache * fix: ci error * refactor: use store instead basic data * fix: compare cli version mistake
- Loading branch information
Showing
13 changed files
with
193 additions
and
55 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
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
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,42 @@ | ||
import type {ExtractStoreData, SAFE_ANY} from '@helpers/type'; | ||
|
||
import {type Components, getLatestVersion} from 'src/scripts/helpers'; | ||
|
||
import {NEXTUI_CLI, NEXT_UI} from './required'; | ||
|
||
export type NextUIComponentsMap = Record<string, Components[0]>; | ||
|
||
export type Store = { | ||
cliLatestVersion: string; | ||
latestVersion: string; | ||
nextUIComponents: Components; | ||
nextUIComponentsKeys: string[]; | ||
nextUIcomponentsPackages: string[]; | ||
nextUIComponentsKeysSet: Set<string>; | ||
nextUIComponentsMap: NextUIComponentsMap; | ||
nextUIComponentsPackageMap: NextUIComponentsMap; | ||
}; | ||
|
||
export const store = {} as Store; | ||
|
||
export type StoreKeys = keyof Store; | ||
|
||
export async function getStore<T extends StoreKeys = StoreKeys>( | ||
key: T | ||
): Promise<ExtractStoreData<T>> { | ||
let data = store[key]; | ||
|
||
if (!data) { | ||
if (key === 'latestVersion') { | ||
data = (await getLatestVersion(NEXT_UI)) as SAFE_ANY; | ||
|
||
store[key] = data; | ||
} else if (key === 'cliLatestVersion') { | ||
data = (await getLatestVersion(NEXTUI_CLI)) as SAFE_ANY; | ||
|
||
store[key] = data; | ||
} | ||
} | ||
|
||
return data as unknown as Promise<ExtractStoreData<T>>; | ||
} |
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
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
Oops, something went wrong.