-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
chore(plist): replace the plist functionality in app-builder-bin with plist #8890
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 17 commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
b2cc1b6
replace the encode plist functionality in app-builder-bin with simple…
beyondkmp bbd9f63
use SimplePlist
beyondkmp 59f3860
use plist instead of simple-plist
beyondkmp e301612
add test info
beyondkmp ea20d1a
fix sort
beyondkmp ef15d47
replace decode-list
beyondkmp 66ad619
fix typo
beyondkmp a7f78af
replace all decode-plist
beyondkmp ee1d828
fix import
beyondkmp 17bc7c0
Merge branch 'master' into plist
beyondkmp 5285342
catch the enode error
beyondkmp 7b573d2
add changeset
beyondkmp 15d679b
delete any
beyondkmp 72db00f
fix enoent error
beyondkmp 9e62bcf
check appPlist by saveParsePlistFile
beyondkmp 6ca34c7
delete all any
beyondkmp eaa34a4
update lock files
beyondkmp f1b519e
fix comments
beyondkmp 7f7dbbf
Merge branch 'master' into plist
beyondkmp 77d0f77
Merge branch 'master' into plist
mmaietta 8774d88
fix comments
beyondkmp 1b659ab
Merge branch 'master' into plist
beyondkmp 4cd45bc
fix asarIntegrity trans
beyondkmp 964718f
prettier
beyondkmp 99c5cff
Fix AsarIntegrity type compatibility with PlistValue
beyondkmp File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 @@ | ||
| --- | ||
| "app-builder-lib": patch | ||
| --- | ||
|
|
||
| chore: replace the plist functionality in app-builder-bin with plist |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,39 @@ | ||
| import { build, parse } from "plist" | ||
| import * as fs from "fs" | ||
|
|
||
| type PlistValue = string | number | boolean | Date | PlistObject | PlistValue[] | ||
|
|
||
| interface PlistObject { | ||
| [key: string]: PlistValue | ||
| } | ||
|
|
||
| function sortObjectKeys(obj: PlistValue): PlistValue { | ||
| if (obj === null || typeof obj !== "object") { | ||
| return obj | ||
| } | ||
|
|
||
| if (Array.isArray(obj)) { | ||
| return obj.map(sortObjectKeys) | ||
| } | ||
|
|
||
| const result: PlistObject = {} | ||
| Object.keys(obj) | ||
| .sort() | ||
| .forEach(key => { | ||
| result[key] = sortObjectKeys((obj as PlistObject)[key]) | ||
| }) | ||
| return result | ||
| } | ||
|
|
||
| export async function savePlistFile(path: string, data: PlistValue): Promise<void> { | ||
| const sortedData = sortObjectKeys(data) | ||
| const plist = build(sortedData) | ||
| await fs.promises.writeFile(path, plist) | ||
| } | ||
|
|
||
| export async function parsePlistFile(file: string): Promise<PlistValue> { | ||
| const data = await fs.promises.readFile(file, "utf8") | ||
| return parse(data) as PlistValue | ||
| } | ||
mmaietta marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| export type { PlistValue, PlistObject } | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.