Skip to content

Removed deprecated tsd and added typings instead #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ hooks/

# autogenerated files
www/*
tsd/*
!tsd/tsd.d.ts
typings/*
test_out/*

# Created by https://www.gitignore.io
Expand Down
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
sudo: false
language: node_js
node_js:
- "0.10"
- "v6.2.1"

before_script:
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
- npm install -g typescript
- npm install tsd@next -g
- npm install -g typings
- npm install -g gulp
- npm install -g ionic
- npm install -g bower
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ Cucumber tests are located at `features/**/*.feature` -- these were placed outsi
Adding dependencies
-----------------------

* For [TSDs](http://definitelytyped.org/tsd/) (to have TypeScript detection), use `tsd install <package> --save`. This may break the `.tsd.d.ts` file -- if this happens, just review the generated file paths carefully before proceeding.
* For [typings](http://definitelytyped.org/) (to have TypeScript detection), use `typings install dt~<package> --ambient --save`. For more information about how to use typings, see [typings](https://github.com/typings/typings)
* For bower (things used in the browser), use `bower install <package> --save`
* For npm (things used to build stuff), use `npm install <package> --save-dev`
* For 3rd party, non-TSD definitions, placed them in `lib/definitions/`, and don't touch `lib/definitions/e2e-definitions/` unless you want something added to the E2E test build
Expand Down Expand Up @@ -116,7 +116,7 @@ Notes

* The `module` syntax is used to create actual TypeScript modules -- code inside a module is scoped to it. Each feature folder uses its own module name and the shared scope is used in the unit tests to access the declarations without requiring verbose prefixes.
* The `angular.module` syntax is an Angular thing for componentizing code. To avoid confusion, wherever possible, the two types of module references should be the same in a file/feature.
* You will need to add new `src/**/.ts` files to `src/definitions.d.ts` to ensure the TypeScript compiler doesn't get confused (see next caveat); if anything breaks in your `tsd/tsd.d.ts` file, [double check the paths didn't get munged](https://github.com/DefinitelyTyped/tsd/issues/112)
* You will need to add new `src/**/.ts` files to `src/definitions.d.ts` to ensure the TypeScript compiler doesn't get confused
* When creating interfaces in `.d.ts` files, you can declare them by [prefixing the `module` declaration with `declare`](http://stackoverflow.com/questions/17635033/error-ts1046-declare-modifier-required-for-top-level-element).
* Always assume the `www/` folder is scratch space -- including `index.html`!
* Place images, fonts, scss, etc. in `assets/`
Expand Down
4 changes: 2 additions & 2 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "typeScriptIonic",
"private": "true",
"devDependencies": {
"ionic": "driftyco/ionic-bower#1.0.0-beta.14",
"angular-mocks": "1.3.6"
"ionic": "driftyco/ionic-bower#1.3.1",
"angular-mocks": "1.5.3"
}
}
66 changes: 50 additions & 16 deletions cucumber.conf.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,54 @@
// protractor configuration file for cucumber
exports.config = {
allScriptsTimeout: 11000,
'use strict';

const SHARD_COUNT = exports.SHARD_COUNT || 2;

const _ = require('lodash');
const glob = require('glob');
const fs = require('fs');

const cucumberOpts = {
format: ['pretty', 'json:results.json'],
require: 'features/step_definitions/**/*.js',
'no-source': true
};

function getShardedFeatures(allFeatures) {
const featuresPerShard = Math.floor(allFeatures.length / SHARD_COUNT);

specs: [
'features/**/*.feature'
],
return _.reduce(allFeatures, function (memo, feature) {
let lastShard = _.last(memo);

capabilities: {
'browserName': 'chrome'
},
if (lastShard.length >= featuresPerShard) {
lastShard = [];
memo.push(lastShard);
}

baseUrl: 'http://localhost:8000/',
lastShard.push(feature);
return memo;
}, [[]]);
}

framework: 'cucumber',
cucumberOpts: {
require: 'features/',
format: "pretty"
}
};
function getMultiCapabilities () {
const shards = getShardedFeatures(glob.sync('features/**/*.feature'));

return _.map(shards, function (files, i) {
const shardNumber = ++i;

return {
browserName: 'chrome',
specs: files,
cucumberOpts: _.tap(_.clone(cucumberOpts), function (options) {
options.format = _.map(options.format, function (format) {
return format.replace(/\.json/, `-${shardNumber}.json`);
});
})
};
});
}

exports.config = {
framework: 'custom',
frameworkPath: 'node_modules/protractor-cucumber-framework',
cucumberOpts,
getMultiCapabilities
};
4 changes: 2 additions & 2 deletions features/step_definitions/pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ chai.use(require('chai-as-promised'));
var expect = chai.expect;

var steps = function () {
var Given = When = Then = this.defineStep
var Given = When = Then = this.defineStep;

// centralize page definitions and navigation to them
var pages = {
'home': '/app/home',
'login': '/app/login'
}
};

Given(/visit the (\w+) page$/, function (pageName, next) {
this.browser.get('http://localhost:8000/#' + pages[pageName]);
Expand Down
8 changes: 4 additions & 4 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ var paths = {
e2e: ['src/**/*.e2e.ts', './lib/definitions/e2e-definitions/**/*.d.ts'],
sass: ['./assets/scss/**/*.scss', './assets/scss/*.scss'],
ts: ['src/*.ts', 'src/**/*.ts', 'lib/**/*.ts', '!lib/definitions/e2e-definitions/**/*.d.ts', '!src/*.js', '!src/**/*.js'],
tsds: ['*.d.ts', 'tsd/**/*.d.ts', 'src/*.d.ts', 'src/**/*.d.ts', 'lib/definitions/**/*.d.ts', '!lib/definitions/e2e-definitions/**/*.d.ts', '!src/**/*.e2e.ts'],
typings: ['*.d.ts', 'typings/**/*.d.ts', 'src/*.d.ts', 'src/**/*.d.ts', 'lib/definitions/**/*.d.ts', '!lib/definitions/e2e-definitions/**/*.d.ts', '!src/**/*.e2e.ts'],
tsSpec: ['src/**/*.spec.ts'],
html: ['src/**/*.html'],
lib: ['lib/**/*.js'],
Expand Down Expand Up @@ -51,14 +51,14 @@ gulp.task('watch', function () {
gulp.task('watch-tasks', function () {
gulp.watch(paths.e2e, ['tsE2E', 'tslint']);
gulp.watch(paths.sass, ['css']);
gulp.watch(paths.ts.concat(paths.tsds), ['ts', 'tsTest', 'tsE2E', 'tslint']);
gulp.watch(paths.ts.concat(paths.typings), ['ts', 'tsTest', 'tsE2E', 'tslint']);
gulp.watch(paths.html, ['html']);
gulp.watch(paths.fonts, ['fonts']);
gulp.watch(paths.images, ['images']);
gulp.watch(paths.index, ['index']);
gulp.watch(paths.lib, ['lib']);
gulp.watch(paths.testJs, ['runJustTest']);
})
});

/*
* purges all generated files
Expand Down Expand Up @@ -154,7 +154,7 @@ var tsProject = ts.createProject({
noExternalResolve: true
});
gulp.task('ts', function () {
return gulp.src(paths.ts.concat(paths.tsds, ['!' + testFilePattern]))
return gulp.src(paths.ts.concat(paths.typings, ['!' + testFilePattern]))
.pipe(sourcemaps.init({debug: true}))
.pipe(ts(tsProject))
.pipe(concat('app.js'))
Expand Down
Loading