Skip to content

Commit

Permalink
chore(deps): update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
vvakame committed Sep 23, 2016
1 parent ecc4397 commit 2d46318
Show file tree
Hide file tree
Showing 25 changed files with 289 additions and 355 deletions.
1 change: 1 addition & 0 deletions .vscode/settings.json
@@ -1,5 +1,6 @@
// Place your settings in this file to overwrite default and user settings.
{
"typescript.tsdk": "./node_modules/typescript/lib/",
"files.exclude": {
"**/.git": true,
"**/.DS_Store": true,
Expand Down
41 changes: 5 additions & 36 deletions Gruntfile.js
@@ -1,6 +1,4 @@
module.exports = function (grunt) {
require("time-grunt")(grunt);

grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
opt: {
Expand All @@ -13,18 +11,10 @@ module.exports = function (grunt) {
}
},

ts: {
default: {
tsconfig: {
tsconfig: "./tsconfig.json",
updateFiles: false
}
}
},
tsconfig: {
main: {
}
},
exec: {
tsc: "tsc -p ./",
tsfmt: "tsfmt -r"
},
tslint: {
options: {
configuration: grunt.file.readJSON("tslint.json")
Expand All @@ -50,14 +40,6 @@ module.exports = function (grunt) {
]
}
},
dtsm: {
client: {
options: {
// optional: specify config file
confog: './dtsm.json'
}
}
},
clean: {
clientScript: {
src: [
Expand All @@ -70,12 +52,6 @@ module.exports = function (grunt) {
'<%= opt.client.jsTestOut %>/*.js.map',
'<%= opt.client.jsTestOut %>/*.d.ts'
]
},
dtsm: {
src: [
// dtsm installed
"typings/"
]
}
},
mochaTest: {
Expand All @@ -89,9 +65,6 @@ module.exports = function (grunt) {
cwd: process.cwd() + '/' + grunt.config.get("opt.client.jsTestOut"),
pattern: '**/*.js'
});
},
function () {
assert = require('power-assert');
}
]
},
Expand Down Expand Up @@ -125,13 +98,9 @@ module.exports = function (grunt) {
}
});

grunt.registerTask(
'setup',
['clean', 'dtsm']);

grunt.registerTask(
'default',
['tsconfig', 'ts', 'tslint']);
['exec:tsfmt', 'exec:tsc', 'tslint']);

grunt.registerTask(
'test',
Expand Down
8 changes: 1 addition & 7 deletions circle.yml
@@ -1,9 +1,3 @@
machine:
node:
version: "0.10"

dependencies:
pre:
- npm install -g grunt-cli
post:
- grunt setup
version: 4
32 changes: 0 additions & 32 deletions dtsm.json

This file was deleted.

4 changes: 1 addition & 3 deletions lib/changeset/changeset.ts
@@ -1,5 +1,3 @@
"use strict";

import Diff from "./diff";

export default class ChangeSet {
Expand All @@ -26,7 +24,7 @@ export default class ChangeSet {
let delta = 0;
this.diffs.forEach(data => {
let result = data.expected.replace(/\$([0-9]{1,2})/g, (match: string, g1: string) => {
let index = parseInt(g1);
let index = parseInt(g1, 10);
if (index === 0 || (data.matches.length - 1) < index) {
return match;
}
Expand Down
4 changes: 1 addition & 3 deletions lib/changeset/diff.ts
@@ -1,13 +1,11 @@
"use strict";

import Rule from "../rule";

export default class Diff {
pattern: RegExp;
expected: string;
index: number;
matches: string[];
rule: Rule;
rule?: Rule;

constructor(pattern: RegExp, expected: string, index: number, matches: string[], rule?: Rule) {
this.pattern = pattern;
Expand Down
6 changes: 1 addition & 5 deletions lib/changeset/index.ts
@@ -1,14 +1,10 @@
"use strict";

import * as r from "../utils/regexp";
import Diff from "./diff";
import ChangeSet from "./changeset";

export {ChangeSet};
export { ChangeSet };

export function makeChangeSet(content: string, pattern: RegExp, expected: string): ChangeSet {
"use strict";

pattern.lastIndex = 0;
let resultList = r.collectAll(pattern, content);
let diffs = resultList.map(result => {
Expand Down
10 changes: 2 additions & 8 deletions lib/cli.ts
@@ -1,5 +1,3 @@
"use strict";

import * as path from "path";
import * as fs from "fs";
import * as yaml from "js-yaml";
Expand Down Expand Up @@ -57,7 +55,7 @@ let root = commandpost
root
.subCommand<{}, {}>("init")
.description("generate prh.yml")
.action((opts, args) => {
.action((_opts, _args) => {
fs.createReadStream(__dirname + "/../misc/prh.yml").pipe(fs.createWriteStream("prh.yml"));
console.log("create prh.yml");
});
Expand All @@ -67,8 +65,6 @@ commandpost
.catch(errorHandler);

function errorHandler(err: any) {
"use strict";

if (err instanceof Error) {
console.error(err.stack);
} else {
Expand All @@ -79,9 +75,7 @@ function errorHandler(err: any) {
});
}

export function getConfigFileName(baseDir: string, configFileName: string): string {
"use strict";

export function getConfigFileName(baseDir: string, configFileName: string): string | null {
let configFilePath = path.resolve(baseDir, configFileName);
if (fs.existsSync(configFilePath)) {
return configFilePath;
Expand Down
8 changes: 2 additions & 6 deletions lib/engine.ts
@@ -1,5 +1,3 @@
"use strict";

import * as fs from "fs";

import * as r from "./utils/regexp";
Expand Down Expand Up @@ -43,10 +41,8 @@ export default class Engine {
this.rules = this.rules.concat(reqRules);
}

makeChangeSet(filePath: string, content?: string): changeSet.ChangeSet {
if (content == null) {
content = fs.readFileSync(filePath, { encoding: "utf8" });
}
makeChangeSet(filePath: string, contentArg?: string): changeSet.ChangeSet {
const content: string = contentArg ? contentArg : fs.readFileSync(filePath, { encoding: "utf8" });
let changeSets = new changeSet.ChangeSet();
this.rules.forEach(rule => {
let set = rule.applyRule(content);
Expand Down
10 changes: 1 addition & 9 deletions lib/index.ts
@@ -1,31 +1,23 @@
"use strict";

import * as fs from "fs";
import * as path from "path";
import * as yaml from "js-yaml";

import * as raw from "./raw";
import Engine from "./engine";

export {Engine};
export { Engine };

export function fromYAMLFilePath(configPath: string): Engine {
"use strict";

let content = fs.readFileSync(configPath, { encoding: "utf8" });
return fromYAML(configPath, content);
}

export function fromYAML(configPath: string, yamlContent: string): Engine {
"use strict";

let rawConfig = yaml.load(yamlContent);
return fromRowConfig(configPath, rawConfig);
}

export function fromRowConfig(configPath: string, rawConfig: raw.Config): Engine {
"use strict";

let engine = new Engine(rawConfig);

if (rawConfig.imports) {
Expand Down
4 changes: 1 addition & 3 deletions lib/options.ts
@@ -1,12 +1,10 @@
"use strict";

import * as raw from "./raw";
import Rule from "./rule";

export default class Options {
wordBoundary: boolean;

constructor(rule: Rule, src: raw.Options) {
constructor(_rule: Rule, src: raw.Options) {
src = src || {};
this.wordBoundary = src.wordBoundary != null ? src.wordBoundary : false;
}
Expand Down
2 changes: 0 additions & 2 deletions lib/raw.ts
@@ -1,5 +1,3 @@
"use strict";

export interface Config {
version: number;
imports?: string | string[];
Expand Down
4 changes: 1 addition & 3 deletions lib/rule.ts
@@ -1,5 +1,3 @@
"use strict";

import * as r from "./utils/regexp";

import Options from "./options";
Expand All @@ -25,7 +23,7 @@ export default class Rule {
let rawRule: raw.Rule;
if (typeof src === "string") {
rawRule = {
expected: src
expected: src,
};
} else {
rawRule = src;
Expand Down
2 changes: 0 additions & 2 deletions lib/ruleSpec.ts
@@ -1,5 +1,3 @@
"use strict";

import * as raw from "./raw";

export default class RuleSpec {
Expand Down
2 changes: 0 additions & 2 deletions lib/target.ts
@@ -1,5 +1,3 @@
"use strict";

import * as r from "./utils/regexp";

import * as raw from "./raw";
Expand Down
2 changes: 0 additions & 2 deletions lib/targetPattern.ts
@@ -1,5 +1,3 @@
"use strict";

import * as r from "./utils/regexp";
import * as raw from "./raw";

Expand Down

0 comments on commit 2d46318

Please sign in to comment.