mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-08-31 11:40:47 +08:00
@@ -0,0 +1,42 @@
|
||||
/// <reference path="gulp-shell.d.ts" />
|
||||
/// <reference path="../gulp/gulp.d.ts" />
|
||||
|
||||
import shell = require('gulp-shell');
|
||||
import gulp = require('gulp');
|
||||
|
||||
gulp.task('example', function () {
|
||||
return gulp.src('*.js', {read: false})
|
||||
.pipe(shell([
|
||||
'echo <%= f(file.path) %>',
|
||||
'ls -l <%= file.path %>'
|
||||
], {
|
||||
templateData: {
|
||||
f: function (s: string) {
|
||||
return s.replace(/$/, '.bak')
|
||||
}
|
||||
}
|
||||
}))
|
||||
});
|
||||
|
||||
gulp.task('shorthand', shell.task([
|
||||
'echo hello',
|
||||
'echo world'
|
||||
]));
|
||||
|
||||
var paths: any = {
|
||||
js: ['*.js', 'test/*.js']
|
||||
};
|
||||
|
||||
gulp.task('test', shell.task('mocha -R spec'));
|
||||
|
||||
gulp.task('coverage', ['test'], shell.task('istanbul cover _mocha -- -R spec'));
|
||||
|
||||
gulp.task('coveralls', ['coverage'], shell.task('cat coverage/lcov.info | coveralls'));
|
||||
|
||||
gulp.task('lint', shell.task('eslint ' + paths.js.join(' ')));
|
||||
|
||||
gulp.task('default', ['coverage', 'lint']);
|
||||
|
||||
gulp.task('watch', function () {
|
||||
gulp.watch(paths.js, ['default'])
|
||||
});
|
||||
Vendored
+68
@@ -0,0 +1,68 @@
|
||||
// Type definitions for gulp-shell
|
||||
// Project: https://github.com/sun-zheng-an/gulp-shell
|
||||
// Definitions by: Qubo <https://github.com/tkqubo>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module "gulp-shell" {
|
||||
|
||||
namespace shell {
|
||||
interface Shell {
|
||||
(commands: string|string[], options?: Option): NodeJS.ReadWriteStream;
|
||||
task(commands: string|string[], options?: Option): () => NodeJS.ReadWriteStream;
|
||||
}
|
||||
|
||||
interface Option {
|
||||
/**
|
||||
* You can add a custom error message for when the command fails. This can be a template which can be
|
||||
* interpolated with the current command, some file info (e.g. file.path) and some error info
|
||||
* (e.g. error.code).
|
||||
* @default 'Command `<%= command %>` failed with exit code <%= error.code %>'
|
||||
*/
|
||||
errorMessage?: string;
|
||||
/**
|
||||
* By default, it will emit an error event when the command finishes unsuccessfully.
|
||||
* @default false
|
||||
*/
|
||||
ignoreErrors?: boolean;
|
||||
/**
|
||||
* By default, it will print the command output.
|
||||
* @default false
|
||||
*/
|
||||
quiet?: boolean;
|
||||
/**
|
||||
* Sets the current working directory for the command.
|
||||
* @default process.cwd()
|
||||
*/
|
||||
cwd?: string;
|
||||
/**
|
||||
* The data that can be accessed in template.
|
||||
*/
|
||||
templateData?: any;
|
||||
/**
|
||||
* You won't need to set this option unless you encounter a "stdout maxBuffer exceeded" error.
|
||||
* @default 16MB(16 * 1024 * 1024)
|
||||
*/
|
||||
maxBuffer?: number;
|
||||
/**
|
||||
* The maximum amount of time in milliseconds the process is allowed to run.
|
||||
* @default
|
||||
*/
|
||||
timeout?: number;
|
||||
/**
|
||||
* By default, all the commands will be executed in an environment with all the variables in process.env
|
||||
* and PATH prepended by ./node_modules/.bin (allowing you to run executables in your Node's dependencies).
|
||||
* You can override any environment variables with this option.
|
||||
* For example, setting it to {PATH: process.env.PATH} will reset the PATH
|
||||
* if the default one brings your some troubles.
|
||||
*/
|
||||
env?: any;
|
||||
}
|
||||
}
|
||||
|
||||
var shell: shell.Shell;
|
||||
|
||||
export = shell;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user