Skip to content

Commit

Permalink
fix(fhir-ts-codegen): read input relative to cwd
Browse files Browse the repository at this point in the history
  • Loading branch information
tangdrew committed Feb 14, 2019
1 parent 2596827 commit e6b1e70
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/fhir-ts-codegen/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Options:
Example:

```sh
fhir-ts-codegen "structure-definitions/**.profile.json" "types"
fhir-ts-codegen --input "structure-definitions/**.profile.canonical.json" types
```

## License
Expand Down
6 changes: 3 additions & 3 deletions packages/fhir-ts-codegen/lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

import { readFileSync } from "fs";
import * as glob from "glob";
import { join } from "path";
import { format } from "prettier";

import { ElementDefinition, StructureDefinition } from "./conformance";
Expand Down Expand Up @@ -44,8 +43,9 @@ export class Generator {
* Read files from input glob pattern
*/
private readInput = (input: string) => {
return glob.sync(input).map(fileName => {
return readFileSync(join(__dirname, "..", fileName)).toString();
const cwd = process.cwd();
return glob.sync(`${cwd}/${input}`).map(fileName => {
return readFileSync(fileName).toString();
});
};

Expand Down

0 comments on commit e6b1e70

Please sign in to comment.