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

.gitignore

Lines changed: 2 additions & 1 deletion
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

.npmignore

Lines changed: 4 additions & 0 deletions
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

app/index.js

Lines changed: 0 additions & 9 deletions
This file was deleted.

endpoint/index.js

Lines changed: 0 additions & 9 deletions
This file was deleted.

gulpfile.babel.js

Lines changed: 35 additions & 0 deletions
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+
});

package.json

Lines changed: 5 additions & 4 deletions
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"

app/USAGE renamed to src/app/USAGE

File renamed without changes.

app/generator.js renamed to src/app/index.js

Lines changed: 4 additions & 2 deletions
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.

0 commit comments

Comments
 (0)