Skip to content
This repository has been archived by the owner on Jul 29, 2024. It is now read-only.

Commit

Permalink
dep(types): typescript and typings dependencies (#3485)
Browse files Browse the repository at this point in the history
- remove typings dependency, scripts, and gulp task
- add @types dependencies
- clean up globals.ts from npm publishing
- add declaration flag for tsc globals gulp task
- ignore globals.d.ts from tsconfig and .gitignore

closes #3484
  • Loading branch information
cnishina committed Aug 19, 2016
1 parent df37c30 commit 4252000
Show file tree
Hide file tree
Showing 12 changed files with 40 additions and 52 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ npm-debug.log

*.swp
globals.js
globals.d.ts
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ libpeerconnection.log
npm-debug.log
xmloutput*
release.md
globals.ts
1 change: 1 addition & 0 deletions exampleTypescript/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
*.js
node_modules
11 changes: 6 additions & 5 deletions exampleTypescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@
"license": "MIT",
"scripts": {
"tsc": "tsc",
"typings": "typings install",
"postinstall": "typings install",
"pretest": "tsc",
"pretest": "npm run tsc",
"test": "protractor tmp/conf.js"
},
"dependencies": {
"jasmine": "^2.4.1",
"protractor": "file:../",
"typescript": "^1.8.10",
"typings": "^1.0.5"
"typescript": "^2.0.0"
},
"devDependencies": {
"@types/jasmine": "^2.2.31",
"@types/node": "^6.0.35"
}
}
1 change: 0 additions & 1 deletion exampleTypescript/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
},
"exclude": [
"node_modules",
"typings/globals",
"asyncAwait",
"plugins.ts"
]
Expand Down
6 changes: 0 additions & 6 deletions exampleTypescript/typings.json

This file was deleted.

10 changes: 3 additions & 7 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,27 +61,23 @@ gulp.task('format', () => {
format.format('file', clangFormat)).pipe(gulp.dest('.'));
});

gulp.task('typings', function(done) {
runSpawn(done, 'node', ['node_modules/typings/dist/bin.js', 'install']);
});

gulp.task('tsc', function(done) {
runSpawn(done, 'node', ['node_modules/typescript/bin/tsc']);
});

gulp.task('tsc:globals', function(done) {
runSpawn(done, 'node', ['node_modules/typescript/bin/tsc', 'globals.ts'],
runSpawn(done, 'node', ['node_modules/typescript/bin/tsc', '-d', 'globals.ts'],
'ignore');
});

gulp.task('prepublish', function(done) {
runSequence(['typings', 'jshint', 'format'], 'tsc', 'tsc:globals', 'types',
runSequence(['jshint', 'format'], 'tsc', 'tsc:globals', 'types',
'ambient', 'built:copy', done);
});

gulp.task('pretest', function(done) {
runSequence(
['webdriver:update', 'typings', 'jshint', 'format'], 'tsc', 'tsc:globals',
['webdriver:update', 'jshint', 'format'], 'tsc', 'tsc:globals',
'types', 'ambient', 'built:copy', done);
});

Expand Down
2 changes: 1 addition & 1 deletion lib/browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as net from 'net';
import * as url from 'url';
import * as util from 'util';

import {ElementArrayFinder, ElementFinder, build$, build$$} from './element';
import {build$, build$$, ElementArrayFinder, ElementFinder} from './element';
import {ProtractorExpectedConditions} from './expectedConditions';
import {Locator, ProtractorBy} from './locators';
import {Logger} from './logger';
Expand Down
34 changes: 17 additions & 17 deletions lib/element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -429,23 +429,23 @@ export class ElementArrayFinder extends WebdriverWebElement {
*/
applyAction_(actionFn: Function): ElementArrayFinder {
let callerError = new Error();
let actionResults =
this.getWebElements()
.then((arr: any) => {
return webdriver.promise.all(arr.map(actionFn));
})
.then(null, (e: Error) => {
let noSuchErr: any;
let stack: string;
if (e instanceof Error) {
noSuchErr = (e as any)
noSuchErr.stack = noSuchErr.stack + (callerError as any).stack;
} else {
noSuchErr = (new Error(e.toString()) as any);
noSuchErr.stack = (callerError as any).stack;
}
throw noSuchErr;
});
let actionResults = this.getWebElements()
.then((arr: any) => {
return webdriver.promise.all(arr.map(actionFn));
})
.then(null, (e: Error | string) => {
let noSuchErr: any;
let stack: string;
if (e instanceof Error) {
noSuchErr = e;
noSuchErr.stack =
noSuchErr.stack + callerError.stack;
} else {
noSuchErr = new Error(e as string);
noSuchErr.stack = callerError.stack;
}
throw noSuchErr;
});
return new ElementArrayFinder(
this.browser_, this.getWebElements, this.locator_, actionResults);
}
Expand Down
11 changes: 9 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@
"webdriver-manager": "^10.2.2"
},
"devDependencies": {
"@types/chalk": "^0.4.28",
"@types/glob": "^5.0.29",
"@types/jasmine": "^2.2.31",
"@types/minimatch": "^2.0.28",
"@types/minimist": "^1.1.28",
"@types/node": "^6.0.35",
"@types/optimist": "0.0.28",
"@types/q": "0.0.28",
"body-parser": "~1.15.2",
"chai": "~3.5.0",
"chai-as-promised": "~5.3.0",
Expand All @@ -39,8 +47,7 @@
"mocha": "2.5.3",
"rimraf": "~2.5.3",
"run-sequence": "^1.1.5",
"typescript": "^1.8.10",
"typings": "^1.0.4"
"typescript": "^2.0.0"
},
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
"node_modules",
"testapp",
"website",
"typings/globals",
"scripts",
"globals.ts",
"globals.d.ts",
"exampleTypescript",
"spec"
]
Expand Down
12 changes: 0 additions & 12 deletions typings.json

This file was deleted.

0 comments on commit 4252000

Please sign in to comment.