:
{
"compilerOptions": {
"module": "commonjs",
"outDir": "dist"
},
"exclude": [
"node_modules",
"dist",
"typings/browser.d.ts",
"typings/browser/**"
]
}
Bu testleri ve uygulamanın js dosyaları karışmadan 'dist' klasöründe orijinal yapısını koruyacak çoklu yapılandırma dosyaları ve bunları basitleştirmek için extends
kullanın. tsconfig.json
ve tsconfig.build.json
// tsconfig.json
{
...
"exclude": [...]
}
// tsconfig.build.json
{
...
"files": [ "typings/index.d.ts", "src/index.ts" ]
}
Bu şekilde, ben iyi (tsc -p tsconfig.build.json
kullanarak) inşa etmek ne kontrol ve ne ts language service
(IDE) kolları sahip olabilir:
İki dosya var varsayalım.
UPDATE: Artık projelerim büyüdükçe daha fazla yapılandırma dosyasına sahip oldum. Ben daktilo artık kullanılabilir "genişletmek" özelliğini kullanın: Bu Kullandığınız ne olursa olsun test çerçevesi bağlı olup ama benim test dosyaları derlemek için ts-node kullanmak ister
// tsconfig.base.json
{
// your common settings. Mostly "compilerOptions".
// Do not include "files" and "include" here,
// let individual config handles that.
// You can use "exclude" here, but with "include",
// It's pretty much not necessary.
}
// tsconfig.json
{
// This is used by `ts language service` and testing.
// Includes source and test files.
"extends": "./tsconfig.base.json",
"atom": { ... },
"compilerOptions": {
// I set outDir to place all test build in one place,
// and avoid accidentally running `tsc` littering test build to my `src` folder.
"outDir": "out/spec"
}
"include": [ ... ]
}
// tsconfig.commonjs.json or tsconfig.systemjs.json or tsconfig.global.json etc
{
"extends": "./tsconfig.base.json",
"compilerOptions": {
// for some build this does not apply
"declaration": true/false,
"outDir": "dist/<cjs, sys, global, etc>",
"sourceRoot": "..."
},
// Only point to typings and the start of your source, e.g. `src/index.ts`
"files": [ ... ],
"include": [ ... ]
}
Çoklu yapılandırma dosyalarına ayırma, pakete fazladan (test) dosyaları dağıtmanın dezavantajına sahiptir. Ayrıca, iki 'içerir 'gereksizdir. Sadece src/**/*. Ts ' – unional
btw'ye ihtiyacınız var,' *** '' typings/*** 'içinde olduğu gibi? Hiç duymadım. – unional
"**", sadece bir yazım hatası olmalı – barndog