1

我正在尝试使用 dojo 构建工具来创建类似这样的发布结构:

relDir
  ->dojo
  ->dijit
  ->dojox
  ->mynamespace
     ->package1
     ->package2

在构建配置文件中,我给出了以下指示:

"packages":[
    {
        "name":"dojo",
        "location":"vendor\/dojo\/dojo"
    },
    {
        "name":"dijit",
        "location":"vendor\/dojo\/dijit"
    },
    {
        "name":"dojox",
        "location":"vendor\/dojo\/dojox"
    },
    {
        "name":"mynamespace\/package1",
        "location":"vendor\/mynamespace\/package1"
    },
    {
        "name":"mynamespace\/package2",
        "location":"vendor\/mynamespace\/package2"
    }
]

但是构建工具似乎不喜欢两部分包名称,并吐出这样的目录结构:

relDir
   ->dojo
   ->dijit
   ->dojox
   ->mynamespace
       ->package1
           All package1 copyOnly files
       ->package2
           All package2 copyOnly files
   ->package1
       All package1 js and uncompressed.js files, but all files are empty
   ->package2
       All package2 js and uncompressed.js files, but all files are empty

如果我更改packages::name为 remove mynamespace,则没有空的 js 文件,输出目录结构为:

relDir
   ->dojo
   ->dijit
   ->dojox
   ->package1
   ->package2

如何在mynamespace不破坏构建工具的情况下将目录放入构建结构中?

4

1 回答 1

2

在挖掘源代码后,我找到了解决方案——而且很简单。需要使用destLocationpackage 指令上的 key。所以:

"packages":[
    {
        "name":"dojo",
        "location":"vendor\/dojo\/dojo"
    },
    {
        "name":"dijit",
        "location":"vendor\/dojo\/dijit"
    },
    {
        "name":"dojox",
        "location":"vendor\/dojo\/dojox"
    },
    {
        "name":"mynamespace\/package1",
        "location":"vendor\/mynamespace\/package1",
        "destLocation": "mynamespace\/package1"
    },
    {
        "name":"mynamespace\/package2",
        "location":"vendor\/mynamespace\/package2",
        "destLocation": "mynamespace\/package2"
    }
]
于 2012-08-15T23:31:40.877 回答