Build正在创建'-p'文件夹

Spe*_*ott 4 node.js coffeescript

我不是100%导致这种情况的原因,但是使用CoffeeScript编译器(coffee.cmd)已经超出了我的想法.我刚刚在我的Windows机器上安装了node.js和CoffeeScript.如果我编译这样的文件:

coffee.cmd -c test.coffee
Run Code Online (Sandbox Code Playgroud)

我把test.js完全搞定了.我有一个在Sublime Text 2中设置的构建脚本,它是通用的,所以我可以从任何目录构建.编译时,它使用文件的完整路径,如下所示:

coffee.cmd -c C:\Users\Spencer\test.coffee
Run Code Online (Sandbox Code Playgroud)

现在,这会按预期输出test.js但由于某种原因,它还会在同一目录中创建一个空的'-p'.我不确定为什么会这样做.任何帮助都会非常感激.谢谢!

mu *_*ort 6

我不确定,因为我没有Windows方便,但command.coffee有这个:

# Write out a JavaScript source file with the compiled code. By default, files
# are written out in `cwd` as `.js` files with the same name, but the output
# directory can be customized with `--output`.
writeJs = (source, js, base) ->
  #...
  path.exists jsDir, (exists) ->
    if exists then compile() else exec "mkdir -p #{jsDir}", compile
Run Code Online (Sandbox Code Playgroud)

这似乎是您问题根源的绝佳候选人.在Unixish系统(Linux,OSX,FreeBSD,Cygwin,...)上,mkdir -p将创建所需的目录和所需的任何中间目录.我怀疑标准的Windows mkdir不知道是什么-p意思,所以它会生成两个目录.

您可以修复CoffeeScript编译器源的本地版本以使用特定于Windows的版本,mkdir -p或者您可以尝试安装Cygwin以获取mkdir知道-p含义的内容.向CoffeeScript维护者发送错误报告也是一个不错的选择(但可能没有必要,因为他们会自己找到这个问题).