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

Commit

Permalink
feat(typescript): adding typescript to protractor
Browse files Browse the repository at this point in the history
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
cnishina committed Feb 16, 2016
1 parent a7734f8 commit 9608201
Show file tree
Hide file tree
Showing 26 changed files with 434 additions and 385 deletions.
3 changes: 3 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Language: JavaScript
BasedOnStyle: Google
ColumnLimit: 80
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ built/
node_modules/
selenium/
testapp/inbrowsertest/
typings/
website/bower_components/
website/build/
website/docgen/build/
Expand Down
63 changes: 38 additions & 25 deletions gulpfile.js
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']);
232 changes: 0 additions & 232 deletions lib/configParser.js

This file was deleted.

Loading

0 comments on commit 9608201

Please sign in to comment.