tapas4java / generator-ng-appgen Goto Github PK
View Code? Open in Web Editor NEWYeomen/Angular app generator for enterprise applications with best folder structure and end to end development workflow support.
License: MIT License
Yeomen/Angular app generator for enterprise applications with best folder structure and end to end development workflow support.
License: MIT License
i want to create a 'complex' service (like the complex directive template) but the difference is that i want it to have a .command suffix instead of the .service suffix while creating a 'command' type service.
what happens now is the generator creates the files still with the .service suffix and omits the file name all together...
here's my code for the service index.js:
`
'use strict';
var util = require('util');
var yeoman = require('yeoman-generator');
var path = require('path');
var cgUtils = require('../utils.js');
var chalk = require('chalk');
var _ = require('underscore');
var fs = require('fs');
_.str = require('underscore.string');
.mixin(.str.exports());
var ServiceGenerator = module.exports = function ServiceGenerator(args, options, config) {
cgUtils.getNameArg(this, args);
yeoman.generators.Base.apply(this, arguments);
};
util.inherits(ServiceGenerator, yeoman.generators.Base);
ServiceGenerator.prototype.askFor = function askFor() {
var cb = this.async();
var prompts = [{
type: 'confirm',
name: 'isCommand',
message: 'Will this service act as a command?',
default: false
}];
cgUtils.addNamePrompt(this, prompts, 'service');
this.prompt(prompts, function(props) {
if (props.name) {
this.name = props.name;
}
this.isCommand = props.isCommand;
cgUtils.askForModuleAndDir('service', this, false, cb); //Tapas: no need to ask for own directory(this.isCommand)
}.bind(this));
};
ServiceGenerator.prototype.files = function files() {
var configName = 'serviceSimpleTemplates';
var defaultDir = 'templates/simple';
var suffix = 'service';
if (this.isCommand) {
configName = 'commandComplexTemplates';
defaultDir = 'templates/complex';
suffix = 'command';
}
this.htmlPath = path.join(this.dir, this.name + '.service.html').replace(/\\/g, '/');
this.htmlPath = this.htmlPath.replace('app/', '');
cgUtils.processTemplates(this.name, this.dir, suffix, this, defaultDir, configName, this.module);
};
`
any suggestions will be most welcome!
The default karma.conf.js list of files only includes angular-ui-router.js by default. But if during yo scaffolding you choose ngRoute you run into two grunt test
problems.
A warning that angular-route.js isn't installed:
WARN [watcher]: Pattern "/Users/me/Angular/angular-ng-appgen/bower_components/angular-ui-router/release/angular-ui-router.js"
does not match any file.
And, an an ugly set of errors indicating angular-route.js is not among karma.conf.js files (a part of one error):
homeService
โ should return welcome message
Chrome 41.0.2272 (Mac OS X 10.9.5)
Error: [$injector:modulerr] Failed to instantiate module home due to:
Error: [$injector:modulerr] Failed to instantiate module ngRoute due to:
Error: [$injector:nomod] Module 'ngRoute' is not available! You either misspelled the module name or
forgot to load it. If registering a module ensure that you specify the dependencies as the second
argument.
One simple (though not elegant) solution would be to include in the generator's karma.conf.js a reference to angular-route.js along with the default angular-ui-router.js.
files : [
'bower_components/angular/angular.js',
'bower_components/angular-mocks/angular-mocks.js',
'bower_components/underscore/underscore.js',
'bower_components/angular-ui-router/release/angular-ui-router.js',
***'bower_components/angular-route/angular-route.js', ***
'bower_components/angular-bootstrap/ui-bootstrap-tpls.js',
'bower_components/angular-ui-utils/ui-utils.js',
'bower_components/angular-animate/angular-animate.js',
'bower_components/restangular/dist/restangular.js',
'app/*/*.js',
'app/**/**/*.js',
'test/specs/**/**/*-spec.js'
],
Then, testing produces only a benign file not found warning which ever router you choose. Seems like a reasonable trade off when compared with the time it would take to build karma.conf.js dynamically :)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.