File tree Expand file tree Collapse file tree 3 files changed +60
-2
lines changed Expand file tree Collapse file tree 3 files changed +60
-2
lines changed Original file line number Diff line number Diff line change
1
+ # v12.0.4 (Fri Jul 24 2020)
2
+
3
+ #### 🐛 Bug Fix
4
+
5
+ - Make syncFixtures flexible to get fixtures from other paths [ #197 ] ( https://github.com/relay-tools/relay-compiler-language-typescript/pull/197 ) ([ @thicodes ] ( https://github.com/thicodes ) )
6
+
7
+ #### Authors: 1
8
+
9
+ - [ @thicodes ] ( https://github.com/thicodes )
10
+
11
+ ---
12
+
1
13
# v12.0.3 (Wed May 20 2020)
2
14
3
15
#### 🐛 Bug Fix
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " relay-compiler-language-typescript" ,
3
- "version" : " 12.0.3 " ,
3
+ "version" : " 12.0.4 " ,
4
4
"description" : " A language plugin for Relay that adds TypeScript support, including emitting type definitions." ,
5
5
"keywords" : [
6
6
" graphql" ,
38
38
"prettier" : " prettier --write '{src,types,test}/**/*.ts'" ,
39
39
"prepublish" : " npm run build" ,
40
40
"relay" : " node bin/relay-compiler.js --schema test/schema.graphql --src test/ --outputDir __generated__" ,
41
- "sync-fixtures" : " rsync -avh --delete --stats --progress ../relay/packages/relay-compiler/language/javascript/__tests__/fixtures/flow-generator/**/*.graphql test/fixtures/type-generator " ,
41
+ "sync-fixtures" : " ts-node ./syncFixtures.ts " ,
42
42
"test" : " npm run type-check && jest" ,
43
43
"watch" : " concurrently 'tsc --watch' 'chokidar \" lib/**/*.js\" -c \" yalc publish --force --push\" '" ,
44
44
"type-check" : " tsc --noEmit --pretty"
85
85
"babel-plugin-relay" : " ^10.0.0" ,
86
86
"chokidar-cli" : " ^2.0.0" ,
87
87
"concurrently" : " ^5.0.0" ,
88
+ "glob" : " ^7.1.6" ,
88
89
"graphql" : " ^15.3.0" ,
89
90
"husky" : " ^3.0.2" ,
90
91
"jest" : " ^24.8.0" ,
95
96
"relay-runtime" : " ^10.0.0" ,
96
97
"relay-test-utils-internal" : " ^10.0.0" ,
97
98
"ts-jest" : " ^22.0.1" ,
99
+ "ts-node" : " ^8.10.2" ,
98
100
"tslint" : " ^5.18.0" ,
99
101
"tslint-config-prettier" : " ^1.18.0" ,
100
102
"typescript" : " 3.6.4"
Original file line number Diff line number Diff line change
1
+ import * as fs from "fs" ;
2
+ import * as glob from "glob" ;
3
+ import * as path from "path" ;
4
+
5
+ type SyncFixturesType = {
6
+ souceFilePaths : Array < {
7
+ cwd : string ;
8
+ pattern : string ;
9
+ } > ;
10
+ dest : string ;
11
+ } ;
12
+
13
+ const syncFixtures = ( { souceFilePaths, dest } : SyncFixturesType ) => {
14
+ souceFilePaths . forEach ( ( { cwd, pattern } ) => {
15
+ glob
16
+ . sync ( pattern , {
17
+ cwd
18
+ } )
19
+ . forEach ( filePath => {
20
+ const file = getFileNameFromPath ( filePath ) ;
21
+ try {
22
+ fs . copyFileSync (
23
+ path . join ( __dirname , `${ cwd } /${ filePath } ` ) ,
24
+ `${ dest } /${ file } `
25
+ ) ;
26
+ console . log ( `${ filePath } was copied` ) ;
27
+ } catch ( error ) {
28
+ console . error ( error ) ;
29
+ }
30
+ } ) ;
31
+ } ) ;
32
+ } ;
33
+
34
+ const getFileNameFromPath = ( filePath : string ) => filePath . split ( "/" ) . pop ( ) ;
35
+
36
+ const souceFilePaths = [
37
+ {
38
+ cwd :
39
+ "../relay/packages/relay-compiler/language/javascript/__tests__/fixtures/flow-generator" ,
40
+ pattern : "**/*.graphql"
41
+ }
42
+ ] ;
43
+
44
+ syncFixtures ( { souceFilePaths, dest : "./test/fixtures/type-generator" } ) ;
You can’t perform that action at this time.
0 commit comments