Skip to content

Commit fa4839f

Browse files
authored
Merge pull request #2570 from angular-fullstack/chore/yo-gen-1
chore(gen): update yeoman-generator to 1.x
2 parents a170fa5 + 7e0fab8 commit fa4839f

File tree

4 files changed

+17
-19
lines changed

4 files changed

+17
-19
lines changed

Diff for: package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
"lodash": "^4.17.0",
5151
"semver": "^5.1.0",
5252
"underscore.string": "^3.1.1",
53-
"yeoman-generator": "~0.24.1",
53+
"yeoman-generator": "^1.1.1",
5454
"yeoman-welcome": "^1.0.1"
5555
},
5656
"devDependencies": {

Diff for: src/generators/app/index.js

+6-8
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ export class Generator extends Base {
124124
this.filters = {};
125125
this.forceConfig = true;
126126
this.config.set('filters', this.filters);
127-
this.config.forceSave();
127+
this.config.save();
128128
}
129129
});
130130
},
@@ -382,7 +382,7 @@ export class Generator extends Base {
382382
this.config.set('modelsNeedle', '// Insert models below');
383383

384384
this.config.set('filters', this.filters);
385-
this.config.forceSave();
385+
this.config.save();
386386
},
387387
// TODO: switch to ng2 component generator
388388
// ngComponent: function() {
@@ -575,12 +575,10 @@ export class Generator extends Base {
575575
} else if(this.filters.sequelizeModels) {
576576
models = 'sequelize';
577577
}
578-
this.composeWith('angular-fullstack:endpoint', {
579-
options: {
580-
route: '/api/things',
581-
models: models
582-
},
583-
args: ['thing']
578+
this.composeWith(require.resolve('../endpoint'), {
579+
route: '/api/things',
580+
models: models,
581+
arguments: ['thing'],
584582
});
585583
}
586584
};

Diff for: src/generators/endpoint/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export class Generator extends NamedBase {
5454
}
5555
}
5656

57-
var name = this.name;
57+
var name = this.options.name;
5858

5959
var base = this.config.get('routesBase') || '/api/';
6060
if(base.charAt(base.length - 1) !== '/') {
@@ -86,7 +86,7 @@ export class Generator extends NamedBase {
8686
configuring() {
8787
this.routeDest = path.join(this.options.endpointDirectory
8888
|| this.config.get('endpointDirectory')
89-
|| 'server/api/', this.name);
89+
|| 'server/api/', this.options.name);
9090
}
9191

9292
writing() {

Diff for: src/generators/generator-base.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
import path from 'path';
44
import _ from 'lodash';
55
import s from 'underscore.string';
6-
import { Base as YoBase } from 'yeoman-generator';
6+
import Generator from 'yeoman-generator';
77
import yoWelcome from 'yeoman-welcome';
88
import * as genUtils from './util';
99

1010
// extend lodash with underscore.string
1111
_.mixin(s.exports());
1212

13-
export class Base extends YoBase {
13+
export class Base extends Generator {
1414
constructor(...args) {
1515
super(...args);
1616

@@ -37,7 +37,7 @@ export class Base extends YoBase {
3737
}
3838

3939
determineAppname() {
40-
if(this.name) return this.name;
40+
if(this.options.name) return this.options.name;
4141
else return super.determineAppname();
4242
}
4343

@@ -63,15 +63,15 @@ export class NamedBase extends Base {
6363

6464
this.argument('name', { type: String, required: true });
6565

66-
var name = this.name.replace(/\//g, '-');
66+
var name = this.options.name.replace(/\//g, '-');
6767

6868
this.cameledName = _.camelize(name);
6969
this.classedName = _.classify(name);
7070

71-
this.basename = path.basename(this.name);
72-
this.dirname = this.name.includes('/')
73-
? path.dirname(this.name)
74-
: this.name;
71+
this.basename = path.basename(this.options.name);
72+
this.dirname = this.options.name.includes('/')
73+
? path.dirname(this.options.name)
74+
: this.options.name;
7575
}
7676
}
7777

0 commit comments

Comments
 (0)