当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript bower.commands类代码示例

本文整理汇总了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);
			});
	}
开发者ID:Tyriar,项目名称:bowerVSCode,代码行数:32,代码来源:update.ts

示例2: done

 (done) => {
     bower.commands
          .install(null, 
                   { save: true }, 
                   { interactive: false }
          )
          .on('error', 
              console.error.bind(console))
          .on('end', () => {
              done();
          });
 });
开发者ID:pacbiodev,项目名称:node-seed,代码行数:12,代码来源:gulpfile.ts

示例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);
			});
	}
开发者ID:Tyriar,项目名称:bowerVSCode,代码行数:14,代码来源:uninstall.ts

示例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);
		});
}
开发者ID:Tyriar,项目名称:bowerVSCode,代码行数:18,代码来源:init.ts

示例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);
			});
	}
开发者ID:Tyriar,项目名称:bowerVSCode,代码行数:17,代码来源:search.ts

示例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);
         }));
开发者ID:asdfg9822,项目名称:polymer-cli,代码行数:17,代码来源:build.ts

示例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);
		});
}
开发者ID:Tyriar,项目名称:bowerVSCode,代码行数:20,代码来源:list.ts

示例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);
		});
}
开发者ID:Tyriar,项目名称:bowerVSCode,代码行数:21,代码来源:restore.ts

示例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);
				});

		});
开发者ID:Tyriar,项目名称:bowerVSCode,代码行数:23,代码来源:search.ts

示例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);
    });
开发者ID:niuzhiyong,项目名称:btpka3.github.com,代码行数:24,代码来源:greeter.ts


注:本文中的bower.commands类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。