簡體   English   中英

設置Aurelia,TypeScript和Asp.Net Core RC2

[英]Setting up Aurelia, TypeScript, & Asp.Net Core RC2

我正在嘗試使用Aurelia&Typescript建立一個新項目。

我遵循了可以在網上找到的最新指南。 使用vs模板創建項目后,我在項目根目錄中運行jspm init並將baseurl配置為wwwroot。 我遇到的第一個問題是VS拒絕將jspm_packages作為項目中的文件夾。 因此,我再次運行jspm並將packages文件夾更改為wwwroot / lib。
這似乎可行,但是打字稿不會讓我導入任何Aurelia軟件包。 我下載了骨架項目進行比較。 我注意到兩件事,骨骼使用的Aurelia版本比使用jspm install時獲得的版本要舊。 其次,軟件包與.d.ts文件一起下載。 我懷疑缺少的.d.ts文件是導致智能感知的問題。

到目前為止,我一直無法弄清楚如何獲取jspm來提供較舊的版本,我嘗試更改package.json文件以使其與骨架應用程序中的內容匹配,但是當我運行jspm install時,我總是得到最新版本。

輸入的內容是否已從jspm軟件包中刪除? 使此工作正常的正確工作流程是什么?

處理TypeScript類型的最佳實踐是Typings模塊,以前是DefinitelyTyped。 首先,通過從命令行運行npm install typings --globalnpm install typings --global

接下來,在項目的根目錄中創建一個帶有以下依賴項的typings.json文件:

typings.json

{
  "name": "my-project",
  "globalDependencies": {
    "aurelia-binding": "github:aurelia/binding/dist/aurelia-binding.d.ts#69d54dbebafe87738f89b8ac4109921544d202cb",
    "aurelia-bootstrapper": "github:aurelia/bootstrapper/dist/aurelia-bootstrapper.d.ts#111ee4eb1e5df7af39305d190d635df7d93cb7e5",
    "aurelia-dependency-injection": "github:aurelia/dependency-injection/dist/aurelia-dependency-injection.d.ts#dcb53d40d128f5ff89c6bafa587128583529bd68",
    "aurelia-event-aggregator": "github:aurelia/event-aggregator/dist/aurelia-event-aggregator.d.ts#7a38c51dc9082175461e2d0b21a4c0a9242a8925",
    "aurelia-fetch-client": "github:aurelia/fetch-client/dist/aurelia-fetch-client.d.ts#a97fa7b9484cd78d986b11e537394400c99d02fe",
    "aurelia-framework": "github:aurelia/framework/dist/aurelia-framework.d.ts#e008c4a98147ae39556892a69e5c165947e293a7",
    "aurelia-history": "github:aurelia/history/dist/aurelia-history.d.ts#21e1ecd279b5b6d7525103cf734318103aee5382",
    "aurelia-history-browser": "github:aurelia/history-browser/dist/aurelia-history-browser.d.ts#19e095308a414ab561d3c5b327fcbc756e60f457",
    "aurelia-loader": "github:aurelia/loader/dist/aurelia-loader.d.ts#5bc0bf9424946235bc6d63ce77f4a6b97b0b4742",
    "aurelia-logging": "github:aurelia/logging/dist/aurelia-logging.d.ts#62417b8db6b82ef9c4dfe09eeca5cef6714e3b40",
    "aurelia-logging-console": "github:aurelia/logging-console/dist/aurelia-logging-console.d.ts#a82125fb35a1efc6372c40b7cd5813cfbda1eb11",
    "aurelia-metadata": "github:aurelia/metadata/dist/aurelia-metadata.d.ts#96c4c332fe4669e11b7570d3e8996cced9cf9042",
    "aurelia-pal": "github:aurelia/pal/dist/aurelia-pal.d.ts#adc7e905abf4f76d1c71a19f740cb6bb45d5842e",
    "aurelia-pal-browser": "github:aurelia/pal-browser/dist/aurelia-pal-browser.d.ts#ce3451eeeb2feb2c62ec30ec3f6a0122b4209282",
    "aurelia-path": "github:aurelia/path/dist/aurelia-path.d.ts#762d6dd77200672080e6a24e6db9ab37b0dc6137",
    "aurelia-polyfills": "github:aurelia/polyfills/dist/aurelia-polyfills.d.ts#e97d36f958436057ff277c00ce58a0edf42adfed",
    "aurelia-route-recognizer": "github:aurelia/route-recognizer/dist/aurelia-route-recognizer.d.ts#2c89fa3ffd739262cc8f901514f314a25f21c9c1",
    "aurelia-router": "github:aurelia/router/dist/aurelia-router.d.ts#39f05b6c85925829baa8be1256fc9ee9430e5854",
    "aurelia-task-queue": "github:aurelia/task-queue/dist/aurelia-task-queue.d.ts#18ac85b517430a3ad8a390cc6bb114abad499bb1",
    "aurelia-templating": "github:aurelia/templating/dist/aurelia-templating.d.ts#aad25d550f316ac2d7cac29c330059897c7d15bd",
    "aurelia-templating-binding": "github:aurelia/templating-binding/dist/aurelia-templating-binding.d.ts#f90d1082b0aa3be71c23e26c1e152b22593a15b5",
    "aurelia-templating-resources": "github:aurelia/templating-resources/dist/aurelia-templating-resources.d.ts#98f81efd2d7270742bfaa1f3c37d8a71a3936172",
    "aurelia-templating-router": "github:aurelia/templating-router/dist/aurelia-templating-router.d.ts#68460e0398f896c5883be81588bdd5f3855f05c3"
  }
}

最后,通過從命令行運行鍵入typings install來安裝類型。

我分步介紹了此步驟,因為這是一件棘手的事情,可復制/粘貼的答案通常會有所幫助。 如上述評論所述,有關此更改的更多信息可在以下博客文章中找到: http : //blog.durandal.io/2016/06/10/where-did-my-typescript-go/

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM