Skip to content

Commit

Permalink
Merge pull request #8 from TouK/dev
Browse files Browse the repository at this point in the history
chore: release
  • Loading branch information
JulianWielga authored Aug 2, 2021
2 parents e31b3d9 + 8139c84 commit 10de242
Show file tree
Hide file tree
Showing 5 changed files with 341 additions and 174 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# [1.1.0-beta.1](https://github.com/touk/federated-types/compare/v1.0.0...v1.1.0-beta.1) (2021-08-02)


### Features

* use custom config path with --config arg ([e85dea5](https://github.com/touk/federated-types/commit/e85dea5994b8f8a0ff050fe0c62c8751fdd20bcd))

# 1.0.0 (2021-07-21)


Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,13 @@ scripts: {
"make-types": "make-federated-types --outputDir ../../my_types/"
}
```

#### `package.json`

If you would like to specify custom path to the config, you can pass `--config` parameter like so:

```json
scripts: {
"make-types": "make-federated-types --config ./path/to/my/config.json --outputDir ../../my_types/"
}
```
13 changes: 12 additions & 1 deletion cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ const outputDir = outDirArg
? path.resolve('./', outDirArg)
: path.resolve(nodeModules, '@types/__federated_types/');

const configPathArg = getArg('--config');
const configPath = configPathArg
? path.resolve(configPathArg)
: null;

const findFederationConfig = (base) => {
let files = fs.readdirSync(base);
let queue = [];
Expand All @@ -46,7 +51,13 @@ const findFederationConfig = (base) => {
}
};

const federationConfigPath = findFederationConfig('./');
if (configPath && !fs.existsSync(configPath)) {
console.error(`ERROR: Unable to find a provided config: ${configPath}`);
process.exit(1);
}

const federationConfigPath = configPath || findFederationConfig('./');


if (federationConfigPath === undefined) {
console.error(`ERROR: Unable to find a federation.config.json file in this package`);
Expand Down
Loading

0 comments on commit 10de242

Please sign in to comment.