This repository has been archived by the owner on Jul 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(typescript): adding typescript to protractor
Converting a 3 files over to typescript. Adding an `npm prepublish` step that will use gulp to download the typings, transpile the files with tscto the built/ directory and copy the rest of the javascript files from lib/ to the built/ folder. Also adding scripts to package.json for `npm run tsc` and `npm run tsc:w` for transpiling help.
- Loading branch information
Showing
26 changed files
with
434 additions
and
385 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Language: JavaScript | ||
BasedOnStyle: Google | ||
ColumnLimit: 80 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,52 @@ | ||
'use strict'; | ||
|
||
var gulp = require('gulp'); | ||
var clangFormat = require('clang-format'); | ||
var gulpFormat = require('gulp-clang-format'); | ||
var runSequence = require('run-sequence'); | ||
var spawnSync = require('child_process').spawnSync; | ||
var spawn = require('child_process').spawn; | ||
|
||
var runSpawn = function(done, task, opt_arg) { | ||
var child = spawn(task, opt_arg, {stdio: 'inherit'}); | ||
child.on('close', function() { | ||
done(); | ||
}); | ||
}; | ||
|
||
gulp.task('built:copy', function() { | ||
var srcFiles = ['lib/**/*']; | ||
var dist = 'built/'; | ||
return gulp.src(srcFiles).pipe(gulp.dest(dist)); | ||
return gulp.src(['lib/**/*','!lib/**/*.ts']) | ||
.pipe(gulp.dest('built/')); | ||
}); | ||
|
||
gulp.task('webdriver:update', function(done) { | ||
runSpawn(done, 'bin/webdriver-manager', ['update']); | ||
}); | ||
|
||
gulp.task('jslint', function(done) { | ||
runSpawn(done, './node_modules/.bin/jshint', ['lib','spec', 'scripts']); | ||
}); | ||
|
||
gulp.task('clang', function() { | ||
return gulp.src(['lib/**/*.ts']) | ||
.pipe(gulpFormat.checkFormat('file', clangFormat)) | ||
.on('warning', function(e) { | ||
console.log(e); | ||
}); | ||
}); | ||
|
||
gulp.task('typings', function(done) { | ||
runSpawn(done, 'node_modules/.bin/typings', ['install']); | ||
}); | ||
|
||
gulp.task('webdriver:update', function() { | ||
var child = spawnSync('bin/webdriver-manager', ['update']); | ||
if (child.stdout != null) { | ||
console.log(child.stdout.toString()); | ||
} | ||
if (child.status !== 0) { | ||
throw new Error('webdriver-manager update: child error'); | ||
} | ||
gulp.task('tsc', function(done) { | ||
runSpawn(done, 'node_modules/typescript/bin/tsc'); | ||
}); | ||
|
||
gulp.task('jslint', function() { | ||
var child = spawnSync('./node_modules/.bin/jshint', ['lib','spec', 'scripts']); | ||
if (child != null && child.stdout != null ) { | ||
console.log(child.stdout.toString()); | ||
} | ||
if (child.status !== 0) { | ||
throw new Error('jslint: child error'); | ||
} | ||
gulp.task('prepublish', function(done) { | ||
runSequence(['typings', 'jslint', 'clang'],'tsc', 'built:copy', done); | ||
}); | ||
|
||
gulp.task('pretest', function() { | ||
gulp.task('pretest', function(done) { | ||
runSequence( | ||
['webdriver:update', 'jslint'], | ||
'built:copy' | ||
); | ||
['webdriver:update', 'typings', 'jslint', 'clang'], 'tsc', 'built:copy', done); | ||
}); | ||
gulp.task('prepublish', ['built:copy']); |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.