Skip to content

Commit 3342425

Browse files
committed
Extract getOptions() function
1 parent e37a93b commit 3342425

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

transforms/angle-brackets/index.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const { getOptions } = require('codemod-cli');
1+
const { getOptions: getCLIOptions } = require('codemod-cli');
22
const glimmer = require('@glimmer/syntax');
33
const prettier = require('prettier');
44
const path = require('path');
@@ -511,11 +511,14 @@ function transform(fileInfo, config) {
511511
return prettier.format(dataOk, { parser: 'glimmer' });
512512
}
513513

514+
function getOptions() {
515+
let options = getCLIOptions();
516+
return new Config(options);
517+
}
518+
514519
module.exports = function(file) {
515520
try {
516-
let options = getOptions();
517-
let config = new Config(options);
518-
return transform(file, config);
521+
return transform(file, getOptions());
519522
} catch (e) {
520523
throw new Error(
521524
`Transformation errored on file ${file.path}. Reason ${e}. Please report this in https://github.com/ember-codemods/ember-angle-brackets-codemod/issues\n\nStack trace:\n${e.stack}`

0 commit comments

Comments
 (0)