Skip to content

Commit

Permalink
Override os line endings
Browse files Browse the repository at this point in the history
  • Loading branch information
lacell75 committed Apr 7, 2022
1 parent 3e7c2df commit 10eba43
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 4 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ If you use TypeScript make sure you apply a different parser as parameter, e.g.:
$ npx jscodeshift -t ./node_modules/@wdio/codemod/protractor --parser=tsx ./e2e/*.ts
```

If you use a different line terminator from your os, you can override it as parameter, e.g.:

```sh
$ npx jscodeshift -t ./node_modules/@wdio/codemod/async --printOptions='{\"lineTerminator\":\"\n\"}' ./e2e/
```

You can transform tests as well as config files, e.g.:

![Codemod Usage Example][example]
Expand Down
2 changes: 1 addition & 1 deletion async/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -515,5 +515,5 @@ module.exports = function transformer(file, api, opts) {

compilers.update(j, root, auto_compile_opts, opts);

return root.toSource();
return root.toSource(opts.printOptions);
}
2 changes: 1 addition & 1 deletion protractor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -873,5 +873,5 @@ module.exports = function transformer(file, api, opts) {
})

compilers.update(j, root, autoCompileOpts, opts)
return root.toSource()
return root.toSource(opts.printOptions)
}
2 changes: 1 addition & 1 deletion v6/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,5 +114,5 @@ module.exports = function transformer(file, api, opts) {
}))
))

return root.toSource()
return root.toSource(opts.printOptions)
}
2 changes: 1 addition & 1 deletion v7/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ module.exports = function transformer(file, api, opts) {
))

compilers.update(j, root, autoCompileOpts, opts)
return root.toSource()
return root.toSource(opts.printOptions)
}

0 comments on commit 10eba43

Please sign in to comment.