Closed YamCrack closed 2 years ago
the command works fine on actionhero 28.1.9
Hi!
Can you confirm that the directory you tried actionhero generate
in is empty? Also, run npx actionhero --version
to confirm which version you have locally.
I have no access to a windows machine to do debug this... so let me know if you are able to work on this issue yourself!
yes i have tried with empty directory and after npm i -s actionhero, none of them works, i can try to fix it.
I found the problem is the update of glob from 7.20 to 8.0.1
Since glob 7.2.1 backslash “\” is not supported and it only uses slash “/”, everytime something like this is used:
glob.sync(path.join(configPath, “**“, “**/*(*.js|*.ts)“))
path.join adds a backslash. Therefore, the path is no longer valid. If you agree, we can change it to:
glob.sync(path.join(configPath, “**“, “**/*(*.js|*.ts)“), { windowsPathsNoEscape: true })
or join the paths manually.
Please let me know your thoughts.
That's a shame that windowsPathsNoEscape
isn't automatically enabled if a windows environment is detected. Ideally, that would be a feature added to glob itself. If that isn't possible, I guess we could wrap it in a utility...
Can you try working with the glob maintainers first to create a "windows compat" mode?
There are issues related to this problem and they are refusing to change it. They recommend doing something like this:
path.join(__dirname, '*.txt').split(path.sep).join("/")
sorry for my bad english
Can you link the conversation in the Glob repo please? I wonder if they make good points that we should follow as well.
sure, there is:
https://github.com/isaacs/node-glob/issues/480 https://github.com/isaacs/node-glob/issues/468 https://github.com/isaacs/node-glob/issues/419
-- we can write a utility function that check por path.sep, and change the \ to /. like this:
This conversation does a good job of explaining why replacing the slashes probably isn't a good idea - https://github.com/isaacs/node-glob/issues/468
I think the path forward is to replace all uses in the project of glob
with safeGlob()
which internally attempts to detect which OS the project is running on. If windows is detected, then we enable windowsPathsNoEscape
as we call into glob.
function safeGlobSync(match: string, ...args) {
const isWindows: process.platform === "win32" || process.platform === "win64";
return glob.sync(match, {...args, windowsPathsNoEscape: isWindows})
}
i did a PR, let me know your thoughts
https://github.com/actionhero/actionhero/pull/2278/commits/398241e44f55e9004745d254dec90d3ff4a7daed
Ia have been pull new changes:
Is there an existing issue for this?
Current Behavior
when i run command
npx actionhero generate
nothing happens.
Expected Behavior
New project created
Stack Trace
No response
Environment
OS: Windwos 11, Window 10 Actionhero Verision: 28.1.11 Nodejs: 14.20.0
Additional context
No response