tsconfig - 如何为多个目录设置正确的编译器输出位置(Atom)

时间:2015-04-28 00:21:56

标签: typescript

假设我有这样的目录结构:

04-27 16:46:56.406  24668-24668/org.azurespot D/ViewRootImpl﹕ ViewPostImeInputStage ACTION_DOWN
04-27 17:04:28.176  24668-24668/org.azurespot D/ViewRootImpl﹕ ViewPostImeInputStage ACTION_DOWN
04-27 17:04:28.326  24668-24668/org.azurespot D/TAG﹕ Items in audioAdapter1: 0
04-27 17:04:28.376  24668-24668/org.azurespot D/TAG﹕ Value of audioTitle: Sound54.3gpp
04-27 17:04:28.376  24668-24668/org.azurespot D/TAG﹕ Value of rootName: Sound54
04-27 17:04:28.386  24668-24668/org.azurespot D/TAG﹕ Value of audioTitle: Sound54.3gpp
04-27 17:04:28.386  24668-24668/org.azurespot D/TAG﹕ Value of rootName: Sound54
04-27 17:04:28.446  24668-24668/org.azurespot D/TAG﹕ Value of audioTitle: Sound54.3gpp
04-27 17:04:28.446  24668-24668/org.azurespot D/TAG﹕ Value of rootName: Sound54
04-27 17:04:28.446  24668-24668/org.azurespot D/TAG﹕ Value of audioTitle: Sound54.3gpp
04-27 17:04:28.446  24668-24668/org.azurespot D/TAG﹕ Value of rootName: Sound54
04-27 17:04:28.466  24668-24668/org.azurespot D/TAG﹕ Value of audioTitle: Sound54.3gpp
04-27 17:04:28.466  24668-24668/org.azurespot D/TAG﹕ Value of rootName: Sound54
04-27 17:04:28.466  24668-24668/org.azurespot D/TAG﹕ Value of audioTitle: Sound66.3gpp
04-27 17:04:28.466  24668-24668/org.azurespot D/TAG﹕ Value of rootName: Sound66
04-27 17:04:28.476  24668-24668/org.azurespot D/TAG﹕ Value of audioTitle: Sound19.3gpp
04-27 17:04:28.476  24668-24668/org.azurespot D/TAG﹕ Value of rootName: Sound19
04-27 17:04:28.476  24668-24668/org.azurespot D/TAG﹕ Value of audioTitle: Sound47.3gpp
04-27 17:04:28.486  24668-24668/org.azurespot D/TAG﹕ Value of rootName: Sound47
04-27 17:04:28.486  24668-24668/org.azurespot D/TAG﹕ Value of audioTitle: Sound49.3gpp
04-27 17:04:28.486  24668-24668/org.azurespot D/TAG﹕ Value of rootName: Sound49
04-27 17:04:28.486  24668-24668/org.azurespot D/TAG﹕ Value of audioTitle: Sound51.3gpp
04-27 17:04:28.486  24668-24668/org.azurespot D/TAG﹕ Value of rootName: Sound51
04-27 17:04:28.606  24668-24668/org.azurespot D/TAG﹕ Items in audioFiles: 6
04-27 17:04:28.606  24668-24668/org.azurespot D/TAG﹕ Number of item in audioAdapter2: 12
04-27 17:04:28.606  24668-24668/org.azurespot D/TAG﹕ Number of item in audioAdapter3: 21
04-27 17:04:28.606  24668-24668/org.azurespot D/TAG﹕ Number of items in SD Card files: 6
04-27 17:04:28.616  24668-24668/org.azurespot D/TAG﹕ Value of audioTitle: Sound54.3gpp
04-27 17:04:28.616  24668-24668/org.azurespot D/TAG﹕ Value of rootName: Sound54
04-27 17:04:28.616  24668-24668/org.azurespot D/TAG﹕ Value of audioTitle: Sound54.3gpp
04-27 17:04:28.616  24668-24668/org.azurespot D/TAG﹕ Value of rootName: Sound54
04-27 17:04:28.616  24668-24668/org.azurespot D/TAG﹕ Value of audioTitle: Sound54.3gpp
04-27 17:04:28.616  24668-24668/org.azurespot D/TAG﹕ Value of rootName: Sound54
04-27 17:04:28.616  24668-24668/org.azurespot D/TAG﹕ Value of audioTitle: Sound54.3gpp
04-27 17:04:28.616  24668-24668/org.azurespot D/TAG﹕ Value of rootName: Sound54
04-27 17:04:28.626  24668-24668/org.azurespot D/TAG﹕ Value of audioTitle: Sound54.3gpp
04-27 17:04:28.626  24668-24668/org.azurespot D/TAG﹕ Value of rootName: Sound54
04-27 17:04:28.626  24668-24668/org.azurespot D/TAG﹕ Value of audioTitle: Sound66.3gpp
04-27 17:04:28.626  24668-24668/org.azurespot D/TAG﹕ Value of rootName: Sound66
04-27 17:04:28.626  24668-24668/org.azurespot D/TAG﹕ Value of audioTitle: Sound19.3gpp
04-27 17:04:28.626  24668-24668/org.azurespot D/TAG﹕ Value of rootName: Sound19
04-27 17:04:28.626  24668-24668/org.azurespot D/TAG﹕ Value of audioTitle: Sound47.3gpp
04-27 17:04:28.636  24668-24668/org.azurespot D/TAG﹕ Value of rootName: Sound47
04-27 17:04:28.636  24668-24668/org.azurespot D/TAG﹕ Value of audioTitle: Sound49.3gpp
04-27 17:04:28.636  24668-24668/org.azurespot D/TAG﹕ Value of rootName: Sound49
04-27 17:04:28.636  24668-24668/org.azurespot D/TAG﹕ Value of audioTitle: Sound51.3gpp
04-27 17:04:28.636  24668-24668/org.azurespot D/TAG﹕ Value of rootName: Sound51
04-27 17:04:28.636  24668-24668/org.azurespot D/TAG﹕ Value of audioTitle: Sound54.3gpp
04-27 17:04:28.636  24668-24668/org.azurespot D/TAG﹕ Value of rootName: Sound54
04-27 17:04:28.636  24668-24668/org.azurespot D/TAG﹕ Value of audioTitle: Sound66.3gpp
04-27 17:04:28.636  24668-24668/org.azurespot D/TAG﹕ Value of rootName: Sound66
04-27 17:04:28.646  24668-24668/org.azurespot D/TAG﹕ Value of audioTitle: Sound19.3gpp
04-27 17:04:28.646  24668-24668/org.azurespot D/TAG﹕ Value of rootName: Sound19
04-27 17:04:28.646  24668-24668/org.azurespot D/TAG﹕ Value of audioTitle: Sound47.3gpp
04-27 17:04:28.646  24668-24668/org.azurespot D/TAG﹕ Value of rootName: Sound47
04-27 17:04:28.646  24668-24668/org.azurespot D/TAG﹕ Value of audioTitle: Sound49.3gpp
04-27 17:04:28.646  24668-24668/org.azurespot D/TAG﹕ Value of rootName: Sound49
04-27 17:04:28.656  24668-24668/org.azurespot D/TAG﹕ Value of audioTitle: Sound51.3gpp
04-27 17:04:28.656  24668-24668/org.azurespot D/TAG﹕ Value of rootName: Sound51
04-27 17:04:28.656  24668-24668/org.azurespot D/TAG﹕ Value of audioTitle: null
04-27 17:04:28.656  24668-24668/org.azurespot D/TAG﹕ Value of rootName: null
04-27 17:04:28.666  24668-24668/org.azurespot D/TAG﹕ Value of audioTitle: null
04-27 17:04:28.666  24668-24668/org.azurespot D/TAG﹕ Value of rootName: null
04-27 17:04:28.666  24668-24668/org.azurespot D/TAG﹕ Value of audioTitle: null
04-27 17:04:28.666  24668-24668/org.azurespot D/TAG﹕ Value of rootName: null
04-27 17:04:29.876  24668-24668/org.azurespot D/ViewRootImpl﹕ ViewPostImeInputStage ACTION_DOWN
04-27 17:04:30.516  24668-24668/org.azurespot D/TAG﹕ Value of audioTitle: null
04-27 17:04:30.516  24668-24668/org.azurespot D/TAG﹕ Value of rootName: null
04-27 17:04:30.516  24668-24668/org.azurespot D/TAG﹕ Value of audioTitle: null
04-27 17:04:30.516  24668-24668/org.azurespot D/TAG﹕ Value of rootName: null
04-27 17:04:30.516  24668-24668/org.azurespot D/TAG﹕ Value of audioTitle: null
04-27 17:04:30.516  24668-24668/org.azurespot D/TAG﹕ Value of rootName: null
04-27 17:04:31.696  24668-24668/org.azurespot D/TAG﹕ Value of audioTitle: Sound54.3gpp
04-27 17:04:31.696  24668-24668/org.azurespot D/TAG﹕ Value of rootName: Sound54
04-27 17:04:31.696  24668-24668/org.azurespot D/TAG﹕ Value of audioTitle: Sound66.3gpp
04-27 17:04:31.696  24668-24668/org.azurespot D/TAG﹕ Value of rootName: Sound66
04-27 17:04:31.696  24668-24668/org.azurespot D/TAG﹕ Value of audioTitle: Sound19.3gpp
04-27 17:04:31.696  24668-24668/org.azurespot D/TAG﹕ Value of rootName: Sound19

如何配置它以将public/ js/ lib/ test/ ts/ lib/ ts/ 编译为lib/ts/*.tspublic/js/lib/*.js编译为test/ts/*.ts

我已尝试在每个ts目录中使用所需的public/js/*.js设置单独的tsconfig.json,但只要我将outDir添加到文件中,编译器就会输出不需要的目录树(在保存和构建时。)

2 个答案:

答案 0 :(得分:19)

我最终得到了我想要的布局:

public/
    js/
        lib/
        test/
src/
    ts/
        lib/
        test/

在src / ts / test / tsconfig.json中:

"outDir": "../../../public/js"

在src / ts / lib / tsconfig.json中:

"outDir": "../../../public/js/lib"

在src / ts / test / test.ts中:

/// <reference path="../lib/CoolStuff.ts" />

在Atom中,如果你在src / ts / lib中工作,build会将这些文件编译成public / js / lib。

如果您正在使用src / ts / test,则构建将在test - 以及所有引用的文件中编译* .ts。我没有看到防止引用文件编译的方法,但至少在这种布局下它们会转到相同的位置。

答案 1 :(得分:6)

  

如何配置它以将lib / ts / .ts编译为public / js / lib / .js并将test / ts / .ts编译为public / js / 的.js?

如果要在单个编译上下文中编译testpublic,那么有效的ts树是:

test/
    ts/
lib/
    ts/

因此,如果您使用outDir ./public/js,您将获得:

public/
    js/
        test/
            ts/
        lib/
            ts/

这是因为lib/tstest/ts相对性质需要由outDir保留。这是您尝试组织项目的方式。

将项目重新组织为

ts/
    test/
    lib/