This repository has been archived by the owner on Oct 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 223
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: use LibraryAnalysis to persist to disk (#799)
- Loading branch information
Showing
5 changed files
with
835 additions
and
847 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
Large diffs are not rendered by default.
Oops, something went wrong.
24 changes: 19 additions & 5 deletions
24
packages/model/src/pattern-library/builtin-pattern-library.ts
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 |
---|---|---|
@@ -1,7 +1,21 @@ | ||
import { analysis } from '@meetalva/essentials'; | ||
import { PatternLibrary } from './pattern-library'; | ||
import * as Essentials from '@meetalva/essentials'; | ||
import * as Types from '@meetalva/types'; | ||
import { PatternLibrary } from './pattern-library'; | ||
|
||
const data = Essentials.analysis as any; | ||
|
||
export const builtinPatternLibrary = (() => { | ||
// Legacy analysis persistence - Types.SerializedPatternLibrary | ||
if (data.model === Types.ModelName.PatternLibrary) { | ||
const serializedLibrary = data as Types.SerializedPatternLibrary; | ||
return PatternLibrary.from(serializedLibrary); | ||
} | ||
|
||
// Current analysis persistence - Types.LibraryAnalysis | ||
const analysis = data as Types.LibraryAnalysis; | ||
|
||
export const builtinPatternLibrary = PatternLibrary.from( | ||
(analysis as unknown) as Types.SerializedPatternLibrary | ||
); | ||
return PatternLibrary.fromAnalysis(analysis, { | ||
analyzeBuiltins: true, | ||
installType: Types.PatternLibraryInstallType.Local | ||
}); | ||
})(); |
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
25a1035
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deployed at: https://alva-commits-25a10.surge.sh