Skip to content

Commit

Permalink
feat(tsfmt): update dependencies, switch to typescript@1.6.2, change …
Browse files Browse the repository at this point in the history
…build process (tsconfig.json oriented)
  • Loading branch information
vvakame committed Sep 20, 2015
1 parent ea4401c commit d8f5670
Show file tree
Hide file tree
Showing 25 changed files with 923 additions and 611 deletions.
4 changes: 4 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ typings/
# codes
test/

# for https://github.com/Microsoft/TypeScript/issues/4667
lib/**/*.ts
!lib/**/*.d.ts

# misc
.gitignore
.editorconfig
Expand Down
40 changes: 11 additions & 29 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,15 @@ module.exports = function (grunt) {
},

ts: {
options: {
compile: true, // perform compilation. [true (default) | false]
comments: true, // same as !removeComments. [true | false (default)]
target: 'es5', // target javascript language. [es3 (default) | es5]
module: 'commonjs', // target javascript module style. [amd (default) | commonjs]
noImplicitAny: true,
sourceMap: false, // generate a source map for every output js file. [true (default) | false]
sourceRoot: '', // where to locate TypeScript files. [(default) '' == source ts location]
mapRoot: '', // where to locate .map.js files. [(default) '' == generated js location.]
declaration: true // generate a declaration .d.ts file for every output js file. [true | false (default)]
},
clientMain: {
src: ['<%= opt.client.tsMain %>/cli.ts']
},
clientTest: {
src: ['<%= opt.client.tsTest %>/indexSpec.ts']
default: {
tsconfig: {
tsconfig: "./tsconfig.json",
updateFiles:false
}
}
},
tsconfig: {
main: {
}
},
tslint: {
Expand Down Expand Up @@ -67,17 +60,6 @@ module.exports = function (grunt) {
]
}
},
dts_bundle: {
build: {
options: {
name: "typescript-formatter",
main: "lib/index.d.ts",
baseDir: "",
out: "typescript-formatter.d.ts",
prefix: ''
}
}
},
mochaTest: {
test: {
options: {
Expand Down Expand Up @@ -131,11 +113,11 @@ module.exports = function (grunt) {

grunt.registerTask(
'default',
['clean:clientScript', 'ts:clientMain', 'tslint', 'dts_bundle']);
['clean:clientScript', 'tsconfig', 'ts', 'tslint']);

grunt.registerTask(
'test',
['default', 'ts:clientTest', 'mochaTest']);
['default', 'mochaTest']);

require('load-grunt-tasks')(grunt);
};
11 changes: 4 additions & 7 deletions dtsm.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,13 @@
},
"dependencies": {
"node/node.d.ts": {
"ref": "02271c53872b38f2f669f3162438c4c837a6fe20"
},
"es6-promise/es6-promise.d.ts": {
"ref": "02271c53872b38f2f669f3162438c4c837a6fe20"
"ref": "273a567b0a0bcc34cbf2a2470b2febc95796b644"
},
"mocha/mocha.d.ts": {
"ref": "02271c53872b38f2f669f3162438c4c837a6fe20"
"ref": "273a567b0a0bcc34cbf2a2470b2febc95796b644"
},
"power-assert/power-assert.d.ts": {
"ref": "02271c53872b38f2f669f3162438c4c837a6fe20"
"ref": "273a567b0a0bcc34cbf2a2470b2febc95796b644"
}
}
}
}
2 changes: 0 additions & 2 deletions example/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/// <reference path="../typescript-formatter.d.ts" />

import tsfmt = require("typescript-formatter");

var result = tsfmt.processFiles(["./index.ts"], {
Expand Down
1 change: 1 addition & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./lib";
3 changes: 0 additions & 3 deletions lib/cli.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
/// <reference path="../typings/node/node.d.ts" />
/// <reference path="../node_modules/commandpost/commandpost.d.ts" />

require("es6-promise").polyfill();

import fs = require("fs");
Expand Down
4 changes: 0 additions & 4 deletions lib/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/// <reference path="../typings/node/node.d.ts" />
/// <reference path="../node_modules/typescript/bin/typescript.d.ts" />
/// <reference path="../node_modules/typescript/bin/lib.es6.d.ts" />

"use strict";

import ts = require("typescript");
Expand Down
4 changes: 4 additions & 0 deletions lib/provider/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ interface TsfmtSettings {
insertSpaceAfterFunctionKeywordForAnonymousFunctions?: boolean;
// かっこ内が空でない場合に始め括弧の後ろと終わりカッコの前にスペースを挿入する
insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis?: boolean;
insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets?: boolean;
// 新しい行に関数の始め中括弧を配置する
placeOpenBraceOnNewLineForFunctions?: boolean;
// 新しい行にコントロールブロックの始め中括弧を配置する
Expand Down Expand Up @@ -75,6 +76,9 @@ export function makeFormatCodeOptions(fileName: string, options: ts.FormatCodeOp
if (typeof config.insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis === "boolean") {
options.InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis = config.insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis;
}
if (typeof config.insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets === "boolean") {
options.InsertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets = config.insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets;
}
if (typeof config.placeOpenBraceOnNewLineForFunctions === "boolean") {
options.PlaceOpenBraceOnNewLineForFunctions = config.placeOpenBraceOnNewLineForFunctions;
}
Expand Down
1 change: 1 addition & 0 deletions lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export function createDefaultFormatCodeOptions(): ts.FormatCodeOptions {
InsertSpaceAfterKeywordsInControlFlowStatements: true,
InsertSpaceAfterFunctionKeywordForAnonymousFunctions: false,
InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: false,
InsertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: false,
PlaceOpenBraceOnNewLineForFunctions: false,
PlaceOpenBraceOnNewLineForControlBlocks: false
};
Expand Down
Loading

0 comments on commit d8f5670

Please sign in to comment.