File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -24,16 +24,15 @@ const config = {
2424} ;
2525
2626if ( mod ) {
27+ config . testPathIgnorePatterns = [ '/node_modules/' , '/__tests__/apigw/custom-domains.test.ts' ] ;
2728 if ( mod === 'custom-domains' ) {
2829 config . testRegex = `/__tests__/apigw/custom-domains.test.(js|ts)` ;
2930 } else {
3031 if ( mod . indexOf ( '.' ) !== - 1 ) {
3132 const [ moduleName , subModuleName ] = mod . split ( '.' ) ;
3233 config . testRegex = `/__tests__/${ moduleName } /${ subModuleName } .test.(js|ts)` ;
33- config . testPathIgnorePatterns = [ '/node_modules/' ] ;
3434 } else {
3535 config . testRegex = `/__tests__/${ process . env . MODULE } /.*.test.(js|ts)` ;
36- config . testPathIgnorePatterns = [ '/node_modules/' ] ;
3736 }
3837
3938 if ( mod === 'scf' ) {
Original file line number Diff line number Diff line change 11import fs from 'fs' ;
22import path from 'path' ;
33import camelCase from 'camelcase' ;
4+ import { PascalCase } from 'type-fest' ;
45import { CamelCasedProps , PascalCasedProps } from '../modules/interface' ;
56
67// TODO: 将一些库换成 lodash
@@ -173,13 +174,20 @@ export function camelCaseProps<T>(obj: T): CamelCasedProps<T> {
173174 return res as CamelCasedProps < T > ;
174175}
175176
177+ export function pascalCase < T extends string > ( str : T ) : PascalCase < T > {
178+ if ( str . length <= 1 ) {
179+ return str . toUpperCase ( ) as any ;
180+ }
181+ return `${ str [ 0 ] . toUpperCase ( ) } ${ str . slice ( 1 ) } ` as any ;
182+ }
183+
176184export function pascalCaseProps < T > ( obj : T ) : PascalCasedProps < T > {
177185 let res : Record < string , any > = { } ;
178186 if ( isObject ( obj ) ) {
179187 res = { } as any ;
180188 Object . keys ( obj ) . forEach ( ( key : string ) => {
181189 const val = ( obj as any ) [ key ] ;
182- const k = camelCase ( key , { pascalCase : true } ) ;
190+ const k = pascalCase ( key ) ;
183191 res [ k ] = isObject ( val ) || isArray ( val ) ? pascalCaseProps ( val ) : val ;
184192 } ) ;
185193 }
You can’t perform that action at this time.
0 commit comments