Tag: yeoman generator

当启动为产生节点过程时显示来自GIt的反馈

我试图通过创build一个新的yeoman生成器来为新项目设置一个锅炉板,我需要发生的一件事是一个大的Git仓库设置为子模块,然后检出某个标记。 我有一切工作,但我想在结帐提供一些进度反馈。 当你运行submodule add手动submodule add你得到像这样更新: Receiving objects: 14% (22925/163744), 5.41 MiB | 1.30 MiB/s 我想在我的节点脚本子模块添加显示输出,但我似乎无法让它显示任何东西。 这是我有: MyGenerator.prototype.addSubmodule = function() { var done = this.async(); console.log('Initializing submodule. This may take a minute.'); var git = spawn('git', ['submodule', 'add', 'git://github.com/PathTo/Submodule.git', 'submodule']);$ git.stdout.on('data', function(data){ console.log(data); }); git.stderr.on('data', function(data){ console.log(data); }); git.on('close', function(){$ process.chdir('submodule');$ console.log('Checking out %s branch of […]

mem-fs-editor:如何复制相关的符号链接?

我有一个包含大量文件和一个(或多个) symlinkname -> . 符号链接。 我想将整个目录的内容复制到一个新的位置。 下面的代码复制一切正常,虽然它跳过了符号链接。 添加globOptions.follow = true只会使其无限循环,这是有道理的,因为它会尝试对其进行解引用。 我怎样才能使它复制所有的内容+符号链接,而不是试图跟随他们? this.fs.copy( this.destinationPath() + '/**', this.destinationPath('build/html'), { globOptions: { follow: true // This will make the copy loop infinitely, which makes sense. } } });

安装npm依赖关系webtorrent – 错误:无法parsing'fs' – Fountain-Js(Yeoman)

你好我在麻烦试图安装一个NPM Dependencie在我的代码。 我用这个命令安装了模块: npm install –save webtorrent 这是我的package.json ./package.json { "dependencies": { "angular": "^1.5.0", "angular-ui-router": "1.0.0-beta.1", "webtorrent": "^0.97.2" }, "devDependencies": { "angular-mocks": "^1.5.0-beta.2", "gulp-angular-templatecache": "^1.8.0", "del": "^2.0.2", "gulp": "gulpjs/gulp#4ed9a4a3275559c73a396eff7e1fde3824951ebb", "gulp-hub": "frankwallis/gulp-hub#d461b9c700df9010d0a8694e4af1fb96d9f38bf4", "gulp-filter": "^4.0.0", "gulp-util": "^3.0.7", "gulp-angular-filesort": "^1.1.1", "gulp-htmlmin": "^1.3.0", "gulp-insert": "^0.5.0", "gulp-ng-annotate": "^1.1.0", "gulp-sass": "^2.1.1", "browser-sync": "^2.9.11", "browser-sync-spa": "^1.0.3", "karma": "^1.3.0", "karma-coverage": "^1.1.1", "karma-jasmine": "^1.0.2", […]

Yeoman angularjs脚手架错误

我试图运行这个命令: yo angular 但它给了我这个错误: **/usr/local/lib/node_modules/generator-angular/node_modules/wiredep/lib/detect-dependencies.js:84 if (_.isString(componentConfigFile.main)) { ^ TypeError: Cannot read property 'main' of undefined at findMainFiles (/usr/local/lib/node_modules/generator-angular/node_modules/wiredep/lib/detect-dependencies.js:84:37) at /usr/local/lib/node_modules/generator-angular/node_modules/wiredep/lib/detect-dependencies.js:146:17 at forOwn (/usr/local/lib/node_modules/generator-angular/node_modules/wiredep/node_modules/lodash/dist/lodash.js:1301:15) at Function.forEach (/usr/local/lib/node_modules/generator-angular/node_modules/wiredep/node_modules/lodash/dist/lodash.js:2595:9) at detectDependencies (/usr/local/lib/node_modules/generator-angular/node_modules/wiredep/lib/detect-dependencies.js:28:5) at wiredep (/usr/local/lib/node_modules/generator-angular/node_modules/wiredep/wiredep.js:57:39) at Generator._injectDependencies (/usr/local/lib/node_modules/generator-angular/app/index.js:326:5) at /usr/local/lib/node_modules/generator-angular/node_modules/yeoman-generator/node_modules/async/lib/async.js:232:13 at /usr/local/lib/node_modules/generator-angular/node_modules/yeoman-generator/node_modules/async/lib/async.js:113:21 at /usr/local/lib/node_modules/generator-angular/node_modules/yeoman-generator/node_modules/async/lib/async.js:24:16** 我如何解决上述错误? 注意:我正在运行Ubuntu 14.04

Yeoman生成器:复制所有文件后如何运行asynchronous命令

我正在写一个yeoman生成器。 所有文件复制后,我需要运行一些shell脚本。 发电机被称为小孩发电机,所以它应该等到脚本完成。 该脚本是通过spawn运行的一些命令文件: that.spawnCommand('createdb.cmd'); 由于脚本依赖于由生成器创build的文件,因此不能在生成器的方法内运行,因为所有的复制/模板操作都是asynchronous的并且尚未执行: MyGenerator.prototype.serverApp = function serverApp() { if (this.useLocalDb) { this.copy('App_Data/createdb.cmd', 'App_Data/createdb.cmd'); // here I cannot run spawn with createdb.cmd as it doesn't exist } } 所以我唯一能find的地方就是'end'事件处理器: var MyGenerator = module.exports = function MyGenerator (args, options, config) { this.on('end', function () { if (that.useLocalDb) { that.spawnCommand('createdb.cmd') } } } 该脚本成功运行,但生成器比subprocess更早完成。 我需要告诉Yeoman等待我的孩子的过程。 […]

将创作的yeoman生成器的更新应用到npm全局安装/更新

我为inuit.css框架编写了自己的yeoman生成器,并将其发布到npm。 回购在github上生活。 我已经注意到我的生成器中的错误(感谢另一个用户),已经修复,testing并提交给发电机的github回购一个新的版本标签,但是我无法弄清楚如何将某个更新应用到某人运行npm install -g generator-inuit或npm update -g generator-inuit 我是否需要重新发布yeoman生成器回到npm? 另外,如何提醒正在使用生成器的人员提供更新?

维护带有现场的Yeoman发电机

我有一个Yeoman生成器(我维护)支撑Node.js站点。 每个网站然后得到定制。 在定制过程中,我会find一些function,我已经添加到网站(A),我想在我正在定制(B)的网站中使用,也应该返回到生成器中其他网站将需要它。 为了让问题简单化,让我们想象一下,我在Site B中添加了一个单独的模块和相关的testing到站点A. 我可以做的是手动将文件从站点A复制/粘贴到生成器,然后也到站点B. 我可以手动将站点A的文件添加到生成器中。 我想find一种自动的方法来解决从发生器到先前生成的站点的单向丢失文件。 也就是说,Yeoman有没有办法追溯添加生成器的新文件?

如何控制spawnCommand方法在哪里执行

我怎样才能理解和控制从spawnCommand运行? 我正在创build一个哟发生器,作为过程的一部分,我需要调用一个外部工具。 我想这样做的方法是通过从spawnCommand调用powershell脚本。 我遇到了spawnCommand在path中有空格的问题,所以我只是将其封装在powershell文件中。 我看到一些关于superspawn的东西,但是无法运行。 无论如何,我的主要问题是,我正在尝试调用powershell,并将其脚本文件作为参数,但它找不到脚本文件。 这里是代码: signatureKeyFile: function() { var done = this.async(); this.spawnCommand('powershell', ['sign.ps1'], { cwd: this.destinationPath('.') }).on('close', done); }, 我尝试使用procmon来查看它执行的目录,并更好地理解它。 看起来它在很多地方尝试,但似乎所有的环境path。 它不会尝试yo生成器的源或目标path,或者至less这是我看来的。 所以我的问题是1)哪个工作目录spawnCommand默认运行? 2)我怎样才能控制,所以它可以find这个PowerShell文件? spawnCommand不会让我在path中使用空格,所以我不能给它一个完整的path,所以在我看来。 非常感谢!

在yeoman生成器中,不发出结束事件,因此不会驱动“on”方法

背景 我正在为Angular SPA创build脚手架生成器(单页应用程序)。 它将依赖于由标准angular度发生器(“angular度”)设置的环境,并且还依赖于标准angular度子发生器来生成应用所需的一些额外的服务和控制器。 换句话说,我正在“装饰”一个基本的angular度应用程序。 如果用户以前安装了一个angular度的应用程序(我寻找标记文件,并在我的代码中设置booleon'angularAppFound'),生成器将正常工作。 但是,我希望它也是'一站式',因为如果他们没有angular度的应用程序已经设置,我的发电机将为他们调用angular发生器,在我之前安装我的额外的angular度文物运行 。 显然,如果angular度应用程序不适用,我的依赖任务将不起作用。 数据 我的代码如下所示: // need this to complete before running other task subgeneratorsApp: function () { if (!this.angularAppFound) { var done = this.async(); this.log('now creating base Angular app…'); // doesn't work (does not drive .on) //this.composeWith('angular', {args: [ this.appName ]} ) // works (drives .on) this.invoke('angular', {args: […]

是否可以在yeoman生成器安装后运行grunt命令?

基本上我想在我的生成器完成安装依赖关系后运行grunt ,我发现你可以添加一个callback函数到installDependencies方法中,在所有事情都被安装完成后运行: this.on('end', function () { this.installDependencies({ skipInstall: options['skip-install'], callback: function () { console.log('All done!'); } }); }); 但是我不知道如何运行这个grunt任务(就像去往terminal并运行“grunt”一样)