Skip to content

Commit 17052a5

Browse files
committed
refactor(gen): set up whole generator to not need babel-register at runtime
move all subgenerators to `src/`, all templates to `templates/`; use Gulp to build project; dist code is sent to `generators`
1 parent 2b051b4 commit 17052a5

File tree

185 files changed

+55
-28
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

185 files changed

+55
-28
lines changed

Diff for: .gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ demo
66
.DS_Store
77
release.txt
88
test/fixtures/bower.json
9-
test/fixtures/package.json
9+
test/fixtures/package.json
10+
generators

Diff for: .npmignore

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
angular-fullstack-deps
22
test
33
.idea
4+
src
5+
scripts
6+
ISSUE_TEMPLATE.md
7+
PULL_REQUEST_TEMPLATE.md

Diff for: app/index.js

-9
This file was deleted.

Diff for: endpoint/index.js

-9
This file was deleted.

Diff for: gulpfile.babel.js

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
'use strict';
2+
// import _ from 'lodash';
3+
// import fs from 'fs';
4+
import gulp from 'gulp';
5+
import babel from 'gulp-babel';
6+
import del from 'del';
7+
import runSequence from 'run-sequence';
8+
9+
gulp.task('clean', () => {
10+
return del(['generators/**/*']);
11+
});
12+
13+
gulp.task('babel', () => {
14+
return gulp.src(['src/**/*.js'])
15+
.pipe(babel())
16+
.pipe(gulp.dest('generators'));
17+
});
18+
19+
gulp.task('watch', () => {
20+
return gulp.watch('src/**/*.js', ['babel']);
21+
});
22+
23+
gulp.task('copy', () => {
24+
return gulp.src(['src/**/*', '!src/**/*.js'])
25+
.pipe(gulp.dest('generators'));
26+
});
27+
28+
gulp.task('build', cb => {
29+
return runSequence(
30+
'clean',
31+
'babel',
32+
'copy',
33+
cb
34+
);
35+
});

Diff for: package.json

+5-4
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,9 @@
3434
"test": "grunt test"
3535
},
3636
"dependencies": {
37-
"babel-core": "^6.7.0",
3837
"babel-plugin-syntax-class-properties": "^6.5.0",
3938
"babel-plugin-syntax-flow": "^6.5.0",
40-
"babel-plugin-transform-class-properties": "^6.6.0",
4139
"babel-plugin-transform-flow-strip-types": "^6.7.0",
42-
"babel-preset-es2015": "^6.6.0",
43-
"babel-register": "^6.6.5",
4440
"chalk": "^1.1.0",
4541
"generator-ng-component": "~0.2.1",
4642
"glob": "^7.0.3",
@@ -55,6 +51,10 @@
5551
},
5652
"devDependencies": {
5753
"chai": "^3.2.0",
54+
"babel-register": "^6.6.5",
55+
"babel-preset-es2015": "^6.6.0",
56+
"babel-plugin-transform-class-properties": "^6.6.0",
57+
"del": "^2.2.0",
5858
"grunt": "^1.0.1",
5959
"grunt-build-control": "^0.7.0",
6060
"grunt-contrib-clean": "^1.0.0",
@@ -68,6 +68,7 @@
6868
"mocha": "^2.2.5",
6969
"q": "^1.0.1",
7070
"recursive-readdir": "^2.0.0",
71+
"run-sequence": "^1.1.5",
7172
"shelljs": "^0.6.0",
7273
"yeoman-assert": "^2.0.0",
7374
"yeoman-test": "^1.1.0"

Diff for: app/USAGE renamed to src/app/USAGE

File renamed without changes.

Diff for: app/generator.js renamed to src/app/index.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import babelStream from 'gulp-babel';
1111
import beaufityStream from 'gulp-beautify';
1212
import filter from 'gulp-filter';
1313

14-
export default class Generator extends Base {
14+
export class Generator extends Base {
1515
constructor(...args) {
1616
super(...args);
1717

@@ -496,7 +496,7 @@ export default class Generator extends Base {
496496
]);
497497

498498
let self = this;
499-
this.sourceRoot(path.join(__dirname, './templates'));
499+
this.sourceRoot(path.join(__dirname, '../../templates/app'));
500500
this.processDirectory('.', '.');
501501
},
502502
generateEndpoint: function() {
@@ -531,3 +531,5 @@ export default class Generator extends Base {
531531
return {};
532532
}
533533
}
534+
535+
module.exports = Generator;
File renamed without changes.
File renamed without changes.
File renamed without changes.

Diff for: endpoint/generator.js renamed to src/endpoint/index.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import path from 'path';
44
import {NamedBase} from 'yeoman-generator';
55
import {genNamedBase} from '../generator-base';
66

7-
export default class Generator extends NamedBase {
7+
export class Generator extends NamedBase {
88

99
constructor(...args) {
1010
super(...args);
@@ -99,7 +99,7 @@ export default class Generator extends NamedBase {
9999
}
100100

101101
writing() {
102-
this.sourceRoot(path.join(__dirname, './templates'));
102+
this.sourceRoot(path.join(__dirname, '../../templates/endpoint'));
103103
this.processDirectory('.', this.routeDest);
104104
}
105105

@@ -145,3 +145,5 @@ export default class Generator extends NamedBase {
145145
}
146146
}
147147
}
148+
149+
module.exports = Generator;

Diff for: factory/index.js renamed to src/factory/index.js

File renamed without changes.

Diff for: filter/index.js renamed to src/filter/index.js

File renamed without changes.
File renamed without changes.

Diff for: heroku/USAGE renamed to src/heroku/USAGE

File renamed without changes.

Diff for: heroku/index.js renamed to src/heroku/index.js

File renamed without changes.
File renamed without changes.

Diff for: insight-init.js renamed to src/insight-init.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict';
22
var Insight = require('insight');
3-
var pkg = require('./package.json');
3+
var pkg = require('../package.json');
44

55
var insight = new Insight({
66
// Google Analytics tracking code

Diff for: openshift/USAGE renamed to src/openshift/USAGE

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

Diff for: route/index.js renamed to src/route/index.js

File renamed without changes.

Diff for: service/index.js renamed to src/service/index.js

File renamed without changes.

Diff for: util.js renamed to src/util.js

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)