Skip to content

Commit bd3c965

Browse files
committed
Merge branch 'master' into v10-update
# Conflicts: # package.json # yarn.lock
2 parents 117a5f2 + 5fcf35c commit bd3c965

File tree

3 files changed

+60
-2
lines changed

3 files changed

+60
-2
lines changed

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
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+
113
# v12.0.3 (Wed May 20 2020)
214

315
#### 🐛 Bug Fix

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "relay-compiler-language-typescript",
3-
"version": "12.0.3",
3+
"version": "12.0.4",
44
"description": "A language plugin for Relay that adds TypeScript support, including emitting type definitions.",
55
"keywords": [
66
"graphql",
@@ -38,7 +38,7 @@
3838
"prettier": "prettier --write '{src,types,test}/**/*.ts'",
3939
"prepublish": "npm run build",
4040
"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",
4242
"test": "npm run type-check && jest",
4343
"watch": "concurrently 'tsc --watch' 'chokidar \"lib/**/*.js\" -c \"yalc publish --force --push\"'",
4444
"type-check": "tsc --noEmit --pretty"
@@ -85,6 +85,7 @@
8585
"babel-plugin-relay": "^10.0.0",
8686
"chokidar-cli": "^2.0.0",
8787
"concurrently": "^5.0.0",
88+
"glob": "^7.1.6",
8889
"graphql": "^15.3.0",
8990
"husky": "^3.0.2",
9091
"jest": "^24.8.0",
@@ -95,6 +96,7 @@
9596
"relay-runtime": "^10.0.0",
9697
"relay-test-utils-internal": "^10.0.0",
9798
"ts-jest": "^22.0.1",
99+
"ts-node": "^8.10.2",
98100
"tslint": "^5.18.0",
99101
"tslint-config-prettier": "^1.18.0",
100102
"typescript": "3.6.4"

syncFixtures.ts

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
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" });

0 commit comments

Comments
 (0)