I have a workspace that's a set of repos: a Meteor application and a variety of related npm modules. RunOnSave has been great for configuring babel to transpile whatever file I just saved, placing it based on the path by substitution of segment (basically, take the file path, and swap 'src' for 'lib').
For slightly more complicated scenarios (i.e., mocha testing), I'm unable to do the same because I need to access the repos' package.json, so I need to go into a node script to traverse up from the file. If captures in the match regex were made available as substitutions, it would simplify my task quite a bit and be generally pretty useful I think.
For example, If I could do this:
"match": "code/client/(.+)/src/.+\\.js$"
And then access it like this:
"cmd": "${workspacePath}/${1}/node_modules/.bin/mocha"
I could avoid dropping into a node script altogether.
I don't use typescript, but from looking at the code it looks like the following would be all that's needed:
At 139, change RegExp(pattern).test to RegExp(pattern).exec; this would return the match and still function as a boolean at 153
Inside the filter starting at 142, augment cfg with the match/notMatch results:
I have a workspace that's a set of repos: a Meteor application and a variety of related npm modules. RunOnSave has been great for configuring babel to transpile whatever file I just saved, placing it based on the path by substitution of segment (basically, take the file path, and swap 'src' for 'lib').
For slightly more complicated scenarios (i.e., mocha testing), I'm unable to do the same because I need to access the repos' package.json, so I need to go into a node script to traverse up from the file. If captures in the match regex were made available as substitutions, it would simplify my task quite a bit and be generally pretty useful I think.
For example, If I could do this:
"match": "code/client/(.+)/src/.+\\.js$"
And then access it like this:"cmd": "${workspacePath}/${1}/node_modules/.bin/mocha"
I could avoid dropping into a node script altogether.I don't use typescript, but from looking at the code it looks like the following would be all that's needed:
RegExp(pattern).test
toRegExp(pattern).exec
; this would return the match and still function as a boolean at 153Inside the filter starting at 142, augment
cfg
with the match/notMatch results:After replacing environment variables, replace matches with something like this around 181:
https://codepen.io/anon/pen/jYQRZW?editors=0012