Add typescript and typings as devDependencies and use npm scripts for install, build, and test related actions to prevent need for global dependencies

This commit is contained in:
Matt Mazzola 2016-08-05 13:46:48 -07:00
Родитель 23083d03ab
Коммит 7e5dcf4780
4 изменённых файлов: 29 добавлений и 35 удалений

Просмотреть файл

@ -1,13 +1,6 @@
language: node_js
node_js:
- node
install:
- npm install -g typings typescript
- npm link typescript
- typings install
- npm install
script:
- gulp test
deploy:
provider: npm
email: nugetpowerbi@microsoft.com

21
.vscode/tasks.json поставляемый
Просмотреть файл

@ -2,28 +2,19 @@
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "0.1.0",
"command": "gulp",
"command": "npm",
"isShellCommand": true,
"args": [
"--no-color"
],
"showOutput": "always",
"suppressTaskName": true,
"tasks": [
{
"taskName": "build",
"args": [],
"isBuildCommand": true,
"isWatching": false,
"problemMatcher": [
"$lessCompile",
"$tsc",
"$jshint"
]
"args": ["run", "build"],
"isBuildCommand": true
},
{
"taskName": "test",
"args": [
"--chrome"
],
"args": ["run", "test", "--", "--chrome"],
"isTestCommand": true
}
]

Просмотреть файл

@ -7,20 +7,16 @@ Clone the repository:
git clone https://github.com/Microsoft/powerbi-router
```
Install global dependencies if needed:
```
npm install -g typescript gulp typings
```
Navigate to the cloned directory
Install local dependencies:
```
typings install
npm install
```
## Building
```
gulp build
npm run build
```
Or if using VSCode: `Ctrl + Shift + B`
@ -28,17 +24,27 @@ Or if using VSCode: `Ctrl + Shift + B`
```
npm test
```
or use gulp directly:
By default the tests run using PhantomJS
There are various command line arguments that can be passed to the test command to facilitate debugging:
Run tests with Chrome
```
gulp test
npm test -- --chrome
```
Run tests with Chrome and close when finished
Enable debug level logging for karma, and remove code coverage
```
gulp test --debug
npm test -- --debug
```
Run tests with Chrome and remain open for debugging
Disable single run to remain open for debugging
```
gulp test --debug --watch
npm test -- --watch
```
These are often combined and typical command for debugging tests is:
```
npm test -- --chrome --debug --watch
```

Просмотреть файл

@ -5,7 +5,9 @@
"main": "dist/router.js",
"typings": "dist/router.d.ts",
"scripts": {
"test": "gulp test --chrome",
"build": "gulp build",
"test": "gulp test",
"postinstall": "typings install",
"prepublish": "gulp build"
},
"repository": {
@ -45,6 +47,8 @@
"run-sequence": "^1.2.0",
"ts-loader": "^0.8.2",
"typedoc": "^0.4.4",
"typescript": "^1.8.10",
"typings": "^1.3.2",
"webpack-stream": "^3.2.0",
"yargs": "^4.7.1"
},