lukasgeiter/gettext-extractor

illegal operation on a directory

Closed this issue · 3 comments

Copied the example code, unmodified on one line.
running it in node REPL
on the keybase/client code base
read/write access to all files, fresh checkout
node v12.21.0

anything else that I can try?
thanks

> extractor.createJsParser([ JsExtractors.callExpression('getText', { arguments: { text: 0, context: 1 } }), JsExtractors.callExpression('getPlural', { arguments: { text: 1, textPlural: 2, context: 3 } }) ]).parseFilesGlob('./src/**/*.@(ts|js|tsx|jsx)');

Uncaught Error: EISDIR: illegal operation on a directory, read
    at Object.readSync (fs.js:568:3)
    at tryReadSync (fs.js:353:20)
    at Object.readFileSync (fs.js:390:19)
    at JsParser.parseFile (/home/mathieu/projects/opensource/node_modules/gettext-extractor/dist/parser.js:57:29)
    at JsParser.parseFilesGlob (/home/mathieu/projects/opensource/node_modules/gettext-extractor/dist/parser.js:65:18) {
  errno: -21,
  syscall: 'read',
  code: 'EISDIR'
}

Could it be that your glob expression also matches a directory? You can try excluding directories using the nodir option:

parseFilesGlob('./src/**/*.@(ts|js|tsx|jsx)', { nodir: true });

If that's the issue, I should probably enable this option by default...

indeed, there are two folders under src that ends with .ts

 ls custom-d.ts/ override-d.ts/
custom-d.ts/:
framed-msgpack-rpc

override-d.ts/:
@react-navigation  popper  react-native-fast-image  react-native-gesture-handler  react-native-reanimated  react-navigation  react-navigation-stack  react-navigation-tabs  react-redux  redux  rn-fetch-blob

Thank you, I renamed the two folders and that solved my issue