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 = {
24
24
} ;
25
25
26
26
if ( mod ) {
27
+ config . testPathIgnorePatterns = [ '/node_modules/' , '/__tests__/apigw/custom-domains.test.ts' ] ;
27
28
if ( mod === 'custom-domains' ) {
28
29
config . testRegex = `/__tests__/apigw/custom-domains.test.(js|ts)` ;
29
30
} else {
30
31
if ( mod . indexOf ( '.' ) !== - 1 ) {
31
32
const [ moduleName , subModuleName ] = mod . split ( '.' ) ;
32
33
config . testRegex = `/__tests__/${ moduleName } /${ subModuleName } .test.(js|ts)` ;
33
- config . testPathIgnorePatterns = [ '/node_modules/' ] ;
34
34
} else {
35
35
config . testRegex = `/__tests__/${ process . env . MODULE } /.*.test.(js|ts)` ;
36
- config . testPathIgnorePatterns = [ '/node_modules/' ] ;
37
36
}
38
37
39
38
if ( mod === 'scf' ) {
Original file line number Diff line number Diff line change 1
1
import fs from 'fs' ;
2
2
import path from 'path' ;
3
3
import camelCase from 'camelcase' ;
4
+ import { PascalCase } from 'type-fest' ;
4
5
import { CamelCasedProps , PascalCasedProps } from '../modules/interface' ;
5
6
6
7
// TODO: 将一些库换成 lodash
@@ -173,13 +174,20 @@ export function camelCaseProps<T>(obj: T): CamelCasedProps<T> {
173
174
return res as CamelCasedProps < T > ;
174
175
}
175
176
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
+
176
184
export function pascalCaseProps < T > ( obj : T ) : PascalCasedProps < T > {
177
185
let res : Record < string , any > = { } ;
178
186
if ( isObject ( obj ) ) {
179
187
res = { } as any ;
180
188
Object . keys ( obj ) . forEach ( ( key : string ) => {
181
189
const val = ( obj as any ) [ key ] ;
182
- const k = camelCase ( key , { pascalCase : true } ) ;
190
+ const k = pascalCase ( key ) ;
183
191
res [ k ] = isObject ( val ) || isArray ( val ) ? pascalCaseProps ( val ) : val ;
184
192
} ) ;
185
193
}
You can’t perform that action at this time.
0 commit comments