Skip to content

Commit

Permalink
fix: Deserialization problem (opentiny#836)
Browse files Browse the repository at this point in the history
* fix: Deserialization problem

* fix: type error
  • Loading branch information
GaoNeng-wWw authored Nov 16, 2023
1 parent 7cd5270 commit 64183e2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions internals/cli/src/shared/module-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
})
}),

)
}

Expand Down
6 changes: 3 additions & 3 deletions internals/cli/src/shared/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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
}

/**
Expand Down

0 comments on commit 64183e2

Please sign in to comment.