Skip to content

Commit

Permalink
Added CLI glob overwrite
Browse files Browse the repository at this point in the history
  • Loading branch information
raouldeheer committed Dec 1, 2022
1 parent d26254c commit 874d808
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,11 @@ Here are all the available options:
<td>The output object tsc-alias will send logs to.</td>
<td><code>new Output(options.verbose)</code></td>
</tr>
<tr>
<td>fileExtensions</td>
<td>Overwrite file extensions tsc-alias will use to scan and resolve files.</td>
<td><code>undefined</code></td>
</tr>
</tbody>
</table>
Expand All @@ -143,6 +148,10 @@ Here are all the available options:
"enabled": true,
"file": "./otherReplacer.js"
}
},
"fileExtensions": {
"inputGlob": "js,jsx,mjs",
"outputCheck": ["js", "json", "jsx", "mjs"]
}
}
}
Expand Down
11 changes: 10 additions & 1 deletion src/bin/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ program
.option('-v, --verbose', 'Additional information is send to the terminal')
.option('--debug', 'Debug information is send to the terminal')
.option('-r, --replacer <replacers...>', 'path to optional extra replacer')
.option('--inputglob <glob>', 'Overwrite glob used for file scanning')
.option(
'--outputcheck <extensions...>',
'Overwrite file extensions used for path resolution'
)
.parseAsync(process.argv);

const options = program.opts();
Expand All @@ -35,5 +40,9 @@ replaceTscAliasPaths({
verbose: !!options.verbose,
debug: !!options.debug,
resolveFullPaths: !!options.resolveFullPaths,
replacers: options.replacer
replacers: options.replacer,
fileExtensions: {
inputGlob: options.inputglob,
outputCheck: options.outputcheck

This comment has been minimized.

Copy link
@DerHannes85

DerHannes85 Dec 2, 2022

@raouldeheer Unfortunately this results in

fileExtensions: {
    inputGlob: undefined,
    outputCheck: undefined
}

Which then results in also both been undefined in the Object.assign operation in helpers/config.ts#L52. We need to change this or here, to only add defined values to the fileExtensions object or filter them out in the merge (helpers/config.ts#L52).

This comment has been minimized.

Copy link
@raouldeheer

raouldeheer Dec 2, 2022

Author Contributor

#151 Should fix that issue

}
});

0 comments on commit 874d808

Please sign in to comment.