"@babel/cli": "^7.2.3",
Seems really simple.
https://babeljs.io/docs/en/babel-cli#ignore-files
babel src --out-dir lib --ignore "src/**/*.spec.js","src/**/*.test.js"
So I set it up like so:
babel src --out-dir cjs --ignore "**/_*" --copy-file --watch
Glob reference: https://github.com/isaacs/node-glob
But I see this in the output:
add:cjs/__mocks__/@xyz/common-fn.js
add:cjs/middleware/__mocks__/uuid.js
OK I try this:
babel src --out-dir cjs --ignore "**/_+","_+" --copy-file --watch
And these:
babel src --out-dir cjs --ignore "**/_*/*.*\ --copy-file --watch
babel src --out-dir cjs --ignore "**/__mocks__/*.*", --copy-file --watch
babel src --out-dir cjs --ignore "[src|middleware]/**/__mocks__/*.*" --copy-file --watch"
babel src --out-dir cjs --ignore "**/_+/**/*.*" --copy-file --watch
Same result every time. It really seems like that last one should work: ignore any path with zero or more directories followed by a directory that has at least one _ in the name, then zero or more directories then a file matching any pattern. Am I reading that right?
Then I tried being very specific:
babel src --out-dir cjs --ignore "nes/middleware/__mocks__/*.js", --copy-file --watch
And I get:
add:nes/middleware/__mocks__/localize.js
I can't tell if this is a bug in Babel or me misunderstanding glob patterns.
There seems to be some debate about whether Babel fully supports Glob patterns at the CLI level.
I managed to get it working with this ignore pattern:
--ignore "src/**/__mocks__/**/*.js" --ignore "src/**/*.test.js"
This pattern **/__*/**
will work in Glob but fails in Babel.