Skip to content

Commit

Permalink
fix(rewrite): script ignores list of files (#8777)
Browse files Browse the repository at this point in the history
* fix(rewrite): script ignores files

Co-authored-by: Neta Nir <neta@amazon.com>
  • Loading branch information
NetaNir and Neta Nir committed Jun 29, 2020
1 parent 3a6353e commit bb514c1
Showing 1 changed file with 9 additions and 6 deletions.
Expand Up @@ -18,12 +18,15 @@ async function main() {
'node_modules/**',
];

const files = await glob(process.argv[2], { ignore, matchBase: true });
for (const file of files) {
const input = await fs.promises.readFile(file, { encoding: 'utf8' });
const output = rewriteImports(input, file);
if (output.trim() !== input.trim()) {
await fs.promises.writeFile(file, output);
const args = process.argv.slice(2);
for (const arg of args) {
const files = await glob(arg, { ignore, matchBase: true });
for (const file of files) {
const input = await fs.promises.readFile(file, { encoding: 'utf8' });
const output = rewriteImports(input, file);
if (output.trim() !== input.trim()) {
await fs.promises.writeFile(file, output);
}
}
}
}
Expand Down

0 comments on commit bb514c1

Please sign in to comment.