Skip to content

Enrapt/aurelia-skeleton-navigation-gulp-typescript

Repository files navigation

aurelia-skeleton-navigation

ZenHub Join the chat at https://gitter.im/aurelia/discuss

This is a TypeScript implementation of navigation skeleton of the Aurelia platform. It sets up a standard navigation-style app using gulp to compile your TypeScript code with gulp-typescript plugin. Karma/Jasmine testing is also configured.

This repository does not require Visual Studio to run.

To keep up to date on Aurelia, please visit and subscribe to the official blog. If you have questions, we invite you to join us on Gitter. If you would like to have deeper insight into our development process, please install the ZenHub Chrome Extension and visit any of our repository's boards. You can get an overview of all Aurelia work by visiting the framework board.

Notes regarding conversion of original skeleton application from ES6 to TypeScript

  1. For those who have previous version (0.10.#) installed, it is recommended to make clean install of npm and jspm packages to force update of TS compiler and some other libraties.
  2. Structure of folders was changed in order to let TypeScript compiler, System.js and Karma runner to reference all files correctly.
  3. All dependencies to Babel were removed, instead gulp-typescript plugin is used.
  4. Original skeleton navigation extends Protractor / WebDriver, so we have added appropriate d.ts file to cover this extended functionality (dts/aurelia-protractor.d.ts).
  5. gulp tdd task was updated to enable watching and recompiling of both main and test sources and re-running karma when a change occurs. Note: you will need to use gulp tdd command instead of karma start if you want your TypeScript files to be watched.
  6. gulp e2e command was also updated to include TypeScript compilation step (of only e2e test sources).

Copyrights on the definition files are respective of each contributor listed at the beginning of each definition file. Special thanks to Mike Graham for his Aurelia typings.

Running The App

To run the app, follow these steps.

  1. Ensure that NodeJS is installed. This provides the platform on which the build tooling runs.
  2. From the project folder, execute the following command:
npm install
  1. Ensure that Gulp is installed. If you need to install it, use the following command:
npm install -g gulp
  1. Ensure that jspm is installed. If you need to install it, use the following command:
npm install -g jspm

Note: jspm queries GitHub to install semver packages, but GitHub has a rate limit on anonymous API requests. It is advised that you configure jspm with your GitHub credentials in order to avoid problems. You can do this by executing jspm registry config github and following the prompts.

  1. Install the client-side dependencies with jspm:
jspm install -y

Note: Windows users, if you experience an error of "unknown command unzip" you can solve this problem by doing npm install -g unzip and then re-running jspm install.

  1. To run the app, execute the following command:
gulp watch
  1. Browse to http://localhost:9000 to see the app. You can make changes in the code found under src and the browser should auto-refresh itself as you save files.

Note: At present there is a bug in the HTMLImports polyfill which only occurs on IE. We have submitted a pull request to the team with the fix. In the mean time, if you want to test on IE, you can work around the issue by explicitly adding a script tag before you load system.js. The script tag should look something like this (be sure to confirm the version number):

<script src="jspm_packages/github/webcomponents/webcomponentsjs@0.5.2/HTMLImports.js"></script>

Running The Unit Tests

To run the unit tests, first ensure that you have followed the steps above in order to install all dependencies and successfully build the library. Once you have done that, proceed with these additional steps:

  1. Install Aurelia libs for test visibility:
jspm install aurelia-framework
jspm install aurelia-http-client
jspm install aurelia-router
  1. You can now run the tests once with this command. This command does TypeScript sources compilation (both main and test) and executes tests. The test commands are set up with Gulp in mind, so it is not required to have global installation of Karma:
gulp test

Or if you want to do it TDD style use the following command. This command watches both main and test sources for change and when it detects one it automatically recompiles sources and runs tests again.

gulp tdd

Running The E2E Tests

Integration tests are performed with Protractor.

  1. Place your E2E-Tests into the folder src/test/e2e
  2. Install the necessary webdriver
gulp webdriver_update
  1. Configure the path to the webdriver by opening the file protractor.conf.js and adjusting the seleniumServerJar property. Typically its only needed to adjust the version number.

  2. Make sure your app runs and is accessible

gulp watch
  1. In another console run the E2E-Tests
gulp e2e

日本語バージョン

このリポジトリは、TypeScriptで実装された Aurelia プラットフォームの基礎のナビゲーションサンプルです。gulp-typescript プラグインを利用して、TypeScriptソースをコンパイルするgulpタスクが設定してあります。Karma/Jasmineによるunit testタスクやProtractorによるe2e testタスクも設定してあります。

このリポジトリのコードはVisual Studioに依存していません。

Aureliaの最新情報は、 オフィシャルブログまでお願いします。質問等があれば、専用のGitterチャンネル でお訪ねください。

ES6からTypeScriptへの変換に関するメモ

  1. このリポジトリの前のバージョンをインストールしている方は、npm や jspm のクリーンインストールするのをお勧めします。TSコンパイラや他のライブラリの更新させる必要があるためです。
  2. TypeScriptのコンパイラやSystem.jsやKarmaがファイルを正しく参照できるために、ディレクトリ構成が変更されている。
  3. Babelの依存個所は全てなくなっている。
  4. もともとのサンプルはProtractor / WebDriverの機能を拡張している ので、コンパイルエラーにならないようにd.ts(dts/aurelia-protractor.d.ts)が追加されている。
  5. gulp tddタスクがTypescriptのメインとテストのソースを監視し、変更があったときに再コンパイルし、テストが実施されるように対応してある。
  6. gulp e2eタスクもe2eテストのソースのコンパイルステップが含まれるように更新されている。

TypeScript型定義ファイルの著作権については各d.tsファイルの先頭に記述されています。Aureliaの型の定義を提供してくださったMike Grahamに殊に感謝します。

アプリケーションの起動方法

アプリケーションを起動するのに、以下のステップを実施してください。

  1. NodeJSが必要なので、まだインストールされていなければ、インストールしてください。NodeJSはビルドツールが動くための環境を提供しているものです。
  2. プロジェクトのルートから以下のコマンドを実施してください。
npm install
  1. Gulpが必要なので、まだインストールされていなければ、以下のコマンドでインストールしてください。
npm install -g gulp
  1. jspmが必要なので、まだインストールされていなければ、以下のコマンドでインストールしてください。
npm install -g jspm

注意 jspmはsemverに対応したパッケージをインストールするために、GitHubに対してリクエストを送信しているが、未認証のリクエスト数に対して制限がかけられています。この制限による問題をさけるために、自分のGitHubユーザー情報をjspmに設定するのがおすすめです。まずはこのjspm registry config githubを実行してから、表示される指示に従って設定してください。

  1. jspmを利用して、クライアントのライブラリをインストールします。
jspm install -y

注意 Windowsユーザーは、"unknown command unzip"エラーが発生する場合、npm install -g unzipコマンドを実施してから、再度jspm installを実施してください。

  1. アプリケーションをスタートするのに、以下のコマンドを実施してください。
gulp watch
  1. ブラウザでhttp://localhost:9000を開いてください。src/appの配下のファイルを更新すると、自動的にコンパイルされ、ブラウザの画面も更新されます。

注意:今のところでは、HTMLImports ポリフィルにIEだけで発生するバグがあります。Aureliaチームがこのバグを修正するプルリクエストを出していますが、改修されるまで以下のように直接スクリプトタグを追加して、回避してください(バージョンだけに注意してください)。

<script src="jspm_packages/github/webcomponents/webcomponentsjs@0.5.2/HTMLImports.js"></script>

ユニットテストの実施方法

ユニットテストを実施するのに、ライブラリのインストールをするのに、まずは上記のステップを完成してください。その後に以下のステップを実施してください。

  1. ユニットテストから各ライブラリを参照するために、以下のように個別でインストールしてください。
jspm install aurelia-framework
jspm install aurelia-http-client
jspm install aurelia-router
  1. テストを一回だけ実施したい場合、以下のコマンドを使ってください。このコマンドは、両方メインとテストのTypescriptのソースをコンパイルしてから、テスト実施します。テストはGulpから実施されることが想定されているので、Karmaのグローバルのインストールは不要です。
gulp test

継続的にテストを実施する場合、以下のコマンドを使ってください。両方メインとテストのTypeScriptのソースに変更があったときに、自動的に再コンパイルされ、テストが実施されます。

gulp tdd

E2E(End-To-End)テストの実施方法

結合テストはProtractorを利用しています。

  1. E2Eテストのソースをsrc/test/e2eに配置してください。
  2. WebDriverをインストールしてください。
gulp webdriver_update
  1. protractor.conf.jsでWebDriverへのパスとseleniumServerJarプロパティを調整してください。基本的に、バージョンの調整だけが必要です。

  2. アプリケーションを起動します。

gulp watch
  1. 別なコンソールのウィンドウでE2Eテストを実施します。このコマンドでE2Eテストのソースがコンパイルされてから、テストが実施されます。
gulp e2e

About

Aurelia navigation skeleton implemented with Gulp and Typescript

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published