fix: Deserialization problem (#836)

* fix: Deserialization problem

* fix: type error
This commit is contained in:
GaoNeng 2023-11-16 14:10:24 +08:00 committed by GitHub
parent 7cd5270d46
commit 64183e2c25
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 7 deletions

View File

@ -444,16 +444,16 @@ const createModuleMapping = (componentName, isMobile = false) => {
})
const moduleJson = quickSort({ sortData: moduleMap, returnType: 'object' })
fs.writeJsonSync(
fs.writeFileSync(
pathJoinFromCLI('../../packages/modules.json'),
prettierFormat({
str: JSON.stringify(moduleJson),
str: typeof moduleJson === 'string' ? moduleJson : JSON.stringify(moduleJson),
options: {
parser: 'json',
printWidth: 10
}
})
}),
)
}

View File

@ -129,7 +129,7 @@ const kebabCase = ({ str, splitChar = '-' }: { str: string; splitChar?: string }
* @param {String} str
* @param {Object} options
*/
const prettierFormat = ({ str, options = {} }: { str: string; options?: object }) => {
const prettierFormat = ({ str, options = {} }: { str: string; options?: object }):string => {
return prettier.format(
str,
Object.assign(
@ -143,10 +143,10 @@ const prettierFormat = ({ str, options = {} }: { str: string; options?: object }
bracketSpacing: true,
quoteProps: 'preserve',
parser: 'typescript'
},
} as any,
options
)
)
) as unknown as string
}
/**