Last active
October 22, 2015 10:14
-
-
Save zakki/4790bc5aed70756ced49 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function(grunt) { | |
// require("time-grunt")(grunt); | |
grunt.initConfig({ | |
pkg: grunt.file.readJSON('package.json'), | |
opt: { | |
client: { | |
"tsMain": "src", | |
"tsMainLib": "typings", | |
"jsMainOut": "src", | |
} | |
}, | |
ts: { | |
default: { | |
tsconfig: { | |
tsconfig: "./tsconfig.json" | |
} | |
} | |
}, | |
tsconfig: { | |
main: { | |
options: { | |
project: "./" | |
} | |
} | |
}, | |
browserify: { | |
dist: { | |
options: { | |
exclude: [ | |
'<%= opt.client.jsMainOut %>/**/*Test.js' | |
], | |
transform: [ | |
["babelify", { | |
loose: "all" | |
}] | |
] | |
}, | |
files: { | |
"./dist/model.js": ['<%= opt.client.jsMainOut %>/**/*.js'] | |
} | |
}, | |
test: { | |
options: { | |
transform: [ | |
["babelify", { | |
loose: "all" | |
}] | |
] | |
}, | |
files: { | |
"./dist/test.js": ["node_modules/babel-core/external-helpers.js", '<%= opt.client.jsMainOut %>/**/*.js'] | |
} | |
} | |
}, | |
tsd: { | |
refresh: { | |
options: { | |
// execute a command | |
command: 'reinstall', | |
//optional: always get from HEAD | |
latest: true, | |
// specify config file | |
config: './tsd.json', | |
// experimental: options to pass to tsd.API | |
opts: { | |
// props from tsd.Options | |
} | |
} | |
} | |
}, | |
dts_bundle: { | |
build: { | |
options: { | |
name: "foo", | |
main: "lib/index.d.ts", | |
baseDir: "", | |
out: "./foo.d.ts", | |
prefix: '', | |
exclude: function() { return false; }, | |
verbose: false | |
} | |
} | |
}, | |
clean: { | |
clientScript: { | |
src: [ | |
// client | |
'<%= opt.client.jsMainOut %>/**/*.js', | |
'<%= opt.client.jsMainOut %>/**/*.d.ts', | |
'<%= opt.client.jsMainOut %>/**/*.js.map', | |
'!<%= opt.client.jsMainOut %>/typings/**/*.d.ts', | |
// | |
'dist/**/*.js', | |
'dist/**/*.js.map', | |
] | |
}, | |
tsd: { | |
src: [ | |
// tsd installed | |
"typings/" | |
] | |
} | |
}, | |
karma: { | |
unit: { | |
options: { | |
frameworks: ['qunit'], | |
browsers: ['Chrome'], | |
files: [ | |
'node_modules/babel-core/browser-polyfill.js', | |
'dist/test.js' | |
] | |
} | |
} | |
} | |
}); | |
//grunt.loadNpmTasks('grunt-karma'); | |
grunt.registerTask( | |
'setup', | |
['clean', 'tsd']); | |
grunt.registerTask( | |
'default', | |
['clean:clientScript', 'tsconfig', 'ts', | |
'browserify' | |
//, 'tslint' | |
]); | |
grunt.registerTask( | |
'test-preprocess', | |
"テストに必要な前準備を実行する。", | |
['default', 'browserify:test']); | |
grunt.registerTask( | |
'test', | |
['default', 'karma']); | |
require('load-grunt-tasks')(grunt); | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "foo", | |
"version": "0.0.1", | |
"private": true, | |
"engines": { | |
"node": "^4.1.1", | |
"npm": "^2.14.4" | |
}, | |
"scripts": { | |
"start": "grunt serve", | |
"test": "grunt test" | |
}, | |
"devDependencies": { | |
"babelify": "^6.3.0", | |
"browserify": "^11.2.0", | |
"grunt": "^0.4.5", | |
"grunt-browserify": "^4.0.1", | |
"grunt-contrib-clean": "^0.6.0", | |
"grunt-karma": "^0.12.1", | |
"grunt-ts": "^5.1.0", | |
"grunt-tsconfig-update": "0.0.1", | |
"grunt-tsd": "^0.1.0", | |
"grunt-tslint": "^2.5.0", | |
"karma": "^0.13.10", | |
"karma-chrome-launcher": "^0.2.0", | |
"karma-coverage": "^0.5.2", | |
"karma-qunit": "^0.1.5", | |
"load-grunt-tasks": "^3.3.0", | |
"qunitjs": "^1.19.0", | |
"tslint": "^2.5.0", | |
"typescript": "^1.6.2" | |
}, | |
"dependencies": { | |
"babel-core": "^5.8.25", | |
"clone": "^1.0.2" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment