Skip to content

Commit

Permalink
Upgrade to typescript 2.0 (#79)
Browse files Browse the repository at this point in the history
* Upgrade to typescript 2.0

* update tests

* switch package.json to 2 spaces and update tsconfig

* Change to typescript ~2.0.3 and correct intern configuration
  • Loading branch information
jdonaghue authored Oct 11, 2016
1 parent b834b99 commit 39f06bc
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 74 deletions.
2 changes: 1 addition & 1 deletion bin/dts-generator
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
var dtsGenerator = require('./dts-generator.js');
/* istanbul ignore if: we use the module interface in testing */
if (!module.parent) {
dtsGenerator(process.argv.slice(2)).then(function (code) {
dtsGenerator.default(process.argv.slice(2)).then(function (code) {
return process.exit(code || 0);
}, function (err) {
throw err;
Expand Down
4 changes: 2 additions & 2 deletions bin/dts-generator.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import generate from '../index';

export = function main(argv: string[]): Promise<number | void> {
export default function main(argv: string[]): Promise<number | void> {
const kwArgs: {
[key: string]: any;
baseDir?: string;
Expand Down Expand Up @@ -73,4 +73,4 @@ export = function main(argv: string[]): Promise<number | void> {
return generate(<any> kwArgs).then(function () {
console.log('Done!');
});
}
};
61 changes: 30 additions & 31 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,33 +1,32 @@
{
"name": "dts-generator",
"description": ".d.ts generator. Generates a single d.ts bundle containing external modules from TypeScript files.",
"version": "1.8.0-pre",
"bugs": {
"url": "https://github.com/SitePen/dts-generator/issues"
},
"license": "BSD-3-Clause",
"repository": {
"type": "git",
"url": "https://github.com/SitePen/dts-generator.git"
},
"bin": {
"dts-generator": "bin/dts-generator"
},
"dependencies": {
"bluebird": "3.3.3",
"glob": "7.0.0",
"mkdirp": "0.5.1"
},
"peerDependencies": {
"typescript": "^1.6.0"
},
"devDependencies": {
"intern": "~3.0.0",
"tsd": "0.6.5",
"tslint": "3.5.0"
},
"scripts": {
"prepublish": "tsc --module commonjs --target es5 typings/tsd.d.ts index.ts bin/dts-generator.ts",
"test": "tests/run.sh"
}
"name": "dts-generator",
"description": ".d.ts generator. Generates a single d.ts bundle containing external modules from TypeScript files.",
"version": "1.8.0-pre",
"bugs": {
"url": "https://github.com/SitePen/dts-generator/issues"
},
"license": "BSD-3-Clause",
"repository": {
"type": "git",
"url": "https://github.com/SitePen/dts-generator.git"
},
"bin": {
"dts-generator": "bin/dts-generator"
},
"dependencies": {
"bluebird": "3.3.3",
"glob": "7.0.0",
"mkdirp": "0.5.1"
},
"devDependencies": {
"dojo-loader": ">=2.0.0-beta.5",
"intern": "~3.0.0",
"tsd": "0.6.5",
"tslint": "3.11.0",
"typescript": "~2.0.3"
},
"scripts": {
"prepublish": "tsc --module umd --target es5 --moduleResolution node typings/tsd.d.ts index.ts bin/dts-generator.ts",
"test": "tests/run.sh"
}
}
11 changes: 8 additions & 3 deletions tests/intern.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
export let loaderOptions = {
export const loaders = {
'host-browser': 'node_modules/dojo-loader/loader.js',
'host-node': 'dojo-loader'
};

export const loaderOptions = {
packages: [
{ name: 'dts-generator', location: '.' }
]
};

export let suites = [ 'dts-generator/tests/unit/all' ];
export const suites = [ 'dts-generator/tests/unit/all' ];

export let excludeInstrumentation = /^(?:tests|node_modules)\//;
export const excludeInstrumentation = /^(?:tests|node_modules)\//;
6 changes: 3 additions & 3 deletions tests/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ cd "$(dirname $0)/.."
echo "Linting files..."
node_modules/.bin/tslint --config tslint.json index.ts bin/dts-generator.ts tests/intern.ts tests/unit/all.ts
echo "Building modules..."
node_modules/.bin/tsc --module umd --target es5 --moduleResolution node node_modules/intern/typings/intern/intern.d.ts typings/tsd.d.ts tests/typings/dts-generator/dts-generator.d.ts tests/intern.ts tests/unit/all.ts
node_modules/.bin/tsc --module commonjs --target es5 --sourcemap --moduleResolution node typings/tsd.d.ts index.ts bin/dts-generator.ts
node_modules/.bin/tsc --module umd --target es5 --moduleResolution node node_modules/intern/typings/intern/intern.d.ts typings/tsd.d.ts tests/intern.ts tests/unit/all.ts
node_modules/.bin/tsc --module umd --target es5 --sourcemap --moduleResolution node typings/tsd.d.ts index.ts bin/dts-generator.ts
echo "Running intern..."
node_modules/.bin/intern-client config=tests/intern reporters=Console
node_modules/.bin/intern-runner config=tests/intern reporters=Console

This comment has been minimized.

Copy link
@dgoldstein0

dgoldstein0 Jan 6, 2017

Contributor

this change here is actually a pretty serious bug - intern-runner seems to do nothing and definitely doesn't run tests, so this makes npm test basically a recompile-and-don't-test command.

took me a while to figure this out since I wasn't familiar with intern. will send a pull request soonish.

echo "Cleanup..."
rm -rf tmp
16 changes: 0 additions & 16 deletions tests/typings/dts-generator/dts-generator.d.ts

This file was deleted.

2 changes: 1 addition & 1 deletion tests/unit/bin/dts-generator.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as registerSuite from 'intern!object';
import * as assert from 'intern/chai!assert';
import * as dtsGenerator from 'intern/dojo/node!../../../bin/dts-generator';
import dtsGenerator from '../../../bin/dts-generator';

registerSuite({
name: 'bin/dts-generator',
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as registerSuite from 'intern!object';
import * as assert from 'intern/chai!assert';
import generate from 'intern/dojo/node!../../index';
import * as fs from 'intern/dojo/node!fs';
import generate from '../../index';
import * as fs from 'fs';

registerSuite({
name: 'index',
Expand Down
19 changes: 4 additions & 15 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,31 +1,20 @@
{
"version": "1.8.0",
"version": "2.0.2",
"compilerOptions": {
"target": "es5",
"module": "umd",
"declaration": false,
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"moduleResolution": "node"
},
"filesGlob": [
"include": [
"./*.ts",
"./bin/**/*.ts",
"./tests/**/*.ts",
"./typings/tsd.d.ts",
"./node_modules/typescript/lib/typescript.d.ts",
"./node_modules/typescript/lib/typescript.ts"
],
"files": [
"./index.ts",
"./bin/dts-generator.ts",
"./tests/intern.ts",
"./tests/support/foo/Bar.ts",
"./tests/support/foo/index.ts",
"./tests/typings/dts-generator/dts-generator.d.ts",
"./tests/unit/all.ts",
"./tests/unit/bin/dts-generator.ts",
"./tests/unit/index.ts",
"./typings/tsd.d.ts",
"./node_modules/typescript/lib/typescript.d.ts"
]
}

0 comments on commit 39f06bc

Please sign in to comment.