本文整理汇总了TypeScript中bower.commands类的典型用法代码示例。如果您正苦于以下问题:TypeScript commands类的具体用法?TypeScript commands怎么用?TypeScript commands使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了commands类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: updatePackages
function updatePackages(pkg: any) {
var pkgNames = null;
var updateALL = true;
if (pkg.all !== true) {
pkgNames = [pkg.name];
updateALL = false;
}
progressIndicator.beginTask("bower update");
bower.commands
.update(pkgNames)
.on('error', function(error) {
progressIndicator.endTask("bower update");
adapter.logError(error);
vscode.window.showErrorMessage('bower update failed! View Output window for further details');
}).on('log', function(msg) {
adapter.log(msg);
}).on('end', function() {
progressIndicator.endTask("bower update");
var msg = "";
if (updateALL) {
msg = "bower packages updated successfully";
}
else {
msg = "bower package '" + pkgNames[0] + "' updated successfully";
}
vscode.window.showInformationMessage(msg);
}).on('prompt', function(prompts, callback) {
adapter.prompt(prompts, callback);
});
}
示例2: done
(done) => {
bower.commands
.install(null,
{ save: true },
{ interactive: false }
)
.on('error',
console.error.bind(console))
.on('end', () => {
done();
});
});
示例3: uninstallPackage
function uninstallPackage(name: string, options: any) {
bower.commands
.uninstall([name], options)
.on('error', function(error) {
adapter.logError(error);
vscode.window.showErrorMessage('bower uninstall failed! View Output window for further details');
}).on('end', function(msg) {
vscode.window.showInformationMessage("bower package '" + name + "' successfully uninstalled!");
}).on('log', function(msg) {
adapter.log(msg);
}).on('prompt', function(prompts, callback) {
adapter.prompt(prompts, callback);
});
}
示例4: init
// this method is called when your extension is activated
// your extension is activated the very first time the command is executed
export default function init(adapter: CodeAdapter, progressIndicator: ProgressIndicator) {
var bower = require('bower');
bower.commands
.init({ interactive: true })
.on('error', function(error) {
adapter.logError(error);
vscode.window.showErrorMessage('bower init failed! View Output window for further details');
}).on('log', function(msg) {
adapter.log(msg);
}).on('end', function(msg) {
vscode.window.showInformationMessage('bower init completed!');
}).on('prompt', function(prompts, callback) {
adapter.prompt(prompts, callback);
});
}
示例5: installPackage
function installPackage(name: string, options: any) {
progressIndicator.beginTask("bower install");
bower.commands
.install([name], options, { interactive: true })
.on('error', function(error) {
progressIndicator.endTask("bower install");
adapter.logError(error);
vscode.window.showErrorMessage('bower install failed! View Output window for further details');
}).on('log', function(msg) {
adapter.log(msg);
}).on('end', function() {
progressIndicator.endTask("bower install");
vscode.window.showInformationMessage("bower package '" + name + "' successfully installed!");
}).on('prompt', function(prompts, callback) {
adapter.prompt(prompts, callback);
});
}
示例6: resolve
(resolve, _reject) =>
bower.commands.list({}, {offline: true})
.on('end',
(result: any) => {
if (result && result.dependencies &&
result.dependencies.polymer &&
result.dependencies.polymer.pkgMeta &&
result.dependencies.polymer.pkgMeta.version) {
resolve(result.dependencies.polymer.pkgMeta.version);
} else {
resolve('');
}
})
.on('error', (oops: Error) => {
resolve('');
console.warn(oops.message);
}));
示例7: list
// this method is called when your extension is activated
// your extension is activated the very first time the command is executed
export default function list(adapter: CodeAdapter, progressIndicator:ProgressIndicator) {
var bower = require('bower');
bower.commands
.list({ xrelative: true, xpaths: true }, { offline: false })
.on('error', function(error) {
adapter.logError(error);
vscode.window.showErrorMessage('bower install failed! View Output window for further details');
}).on('log', function(msg) {
adapter.log(msg);
}).on('end', function(installed) {
adapter.log(installed);
adapter.log(installed.dependencies);
})
.on('prompt', function(prompts, callback) {
adapter.prompt(prompts, callback);
});
}
示例8: restore
// this method is called when your extension is activated
// your extension is activated the very first time the command is executed
export default function restore(adapter: CodeAdapter, progressIndicator:ProgressIndicator) {
progressIndicator.beginTask("bower install");
var bower = require('bower');
bower.commands
.install(null, null, { interactive: true })
.on('error', function(error) {
progressIndicator.endTask("bower install");
adapter.logError(error);
vscode.window.showErrorMessage('bower install failed! View Output window for further details');
}).on('log', function(msg) {
adapter.log(msg);
}).on('end', function(msg) {
progressIndicator.endTask("bower install");
vscode.window.showInformationMessage('bower install completed!');
}).on('prompt', function(prompts, callback) {
adapter.prompt(prompts, callback);
});
}
示例9: search
vscode.window.showInputBox({ placeHolder: "Enter package name to search (bower search <name>)" }).then(function(searchString) {
if (typeof (searchString) !== "string" || searchString.length === 0) {
return;
}
progressIndicator.beginTask("bower search");
bower.commands
.search(searchString)
.on('error', function(error) {
progressIndicator.endTask("bower search");
adapter.logError(error);
vscode.window.showErrorMessage('bower search failed! View Output window for further details');
}).on('log', function(msg) {
adapter.log(msg);
}).on('end', function(results) {
progressIndicator.endTask("bower search");
var packages = results.map(item=> { return { label: item.name, description: item.url, name: item.name } });
displayPackageList(packages);
}).on('prompt', function(prompts, callback) {
adapter.prompt(prompts, callback);
});
});
示例10: greeter
/*
This is a demo for using typescript in node.js
https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/node
https://github.com/soywiz/typescript-node-definitions
*/
function greeter(person:string) {
return "Hello, " + person;
}
var user = "Jane User";
console.log(greeter("world"));
var bower = require('bower');
var logger = bower.commands.info("jquery#2.1.4");
logger
.on('end', function (data) {
console.log("end : ", data);
})
.on('error', function (err) {
console.log("error : ", err);
});