Skip to content

Build gen files #1822

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Apr 24, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ demo
.DS_Store
release.txt
test/fixtures/bower.json
test/fixtures/package.json
test/fixtures/package.json
generators
8 changes: 8 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
angular-fullstack-deps
test
.idea
src
scripts
ISSUE_TEMPLATE.md
PULL_REQUEST_TEMPLATE.md
.travis.yml
gulpfile.babel.js
Gruntfile.js
.jshintrc
6 changes: 3 additions & 3 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ module.exports = function (grunt) {
curly: false,
node: true
},
all: ['Gruntfile.js', '*/index.js']
all: ['Gruntfile.js', 'src/**/*.js']
},
env: {
fast: {
Expand Down Expand Up @@ -276,8 +276,8 @@ module.exports = function (grunt) {
fs.writeFileSync(path.resolve(d), JSON.stringify(json, null, 2));
};

processJson('app/templates/_package.json', dest + 'package.json');
processJson('app/templates/_bower.json', dest + 'bower.json');
processJson('templates/app/_package.json', dest + 'package.json');
processJson('templates/app/_bower.json', dest + 'bower.json');
});

grunt.registerTask('installFixtures', 'install package and bower fixtures', function() {
Expand Down
9 changes: 0 additions & 9 deletions app/index.js

This file was deleted.

9 changes: 0 additions & 9 deletions endpoint/index.js

This file was deleted.

35 changes: 35 additions & 0 deletions gulpfile.babel.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
'use strict';
// import _ from 'lodash';
// import fs from 'fs';
import gulp from 'gulp';
import babel from 'gulp-babel';
import del from 'del';
import runSequence from 'run-sequence';

gulp.task('clean', () => {
return del(['generators/**/*']);
});

gulp.task('babel', () => {
return gulp.src(['src/**/*.js'])
.pipe(babel())
.pipe(gulp.dest('generators'));
});

gulp.task('watch', () => {
return gulp.watch('src/**/*.js', ['babel']);
});

gulp.task('copy', () => {
return gulp.src(['src/**/*', '!src/**/*.js'])
.pipe(gulp.dest('generators'));
});

gulp.task('build', cb => {
return runSequence(
'clean',
'babel',
'copy',
cb
);
});
12 changes: 7 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,12 @@
"url": "git://github.com/angular-fullstack/generator-angular-fullstack.git"
},
"scripts": {
"test": "grunt test"
"test": "gulp build && grunt test"
},
"dependencies": {
"babel-core": "^6.7.0",
"babel-plugin-syntax-class-properties": "^6.5.0",
"babel-plugin-syntax-flow": "^6.5.0",
"babel-plugin-transform-class-properties": "^6.6.0",
"babel-plugin-transform-flow-strip-types": "^6.7.0",
"babel-preset-es2015": "^6.6.0",
"babel-register": "^6.6.5",
"chalk": "^1.1.0",
"generator-ng-component": "~0.2.1",
"glob": "^7.0.3",
Expand All @@ -54,7 +50,11 @@
"yeoman-welcome": "^1.0.1"
},
"devDependencies": {
"babel-plugin-transform-class-properties": "^6.6.0",
"babel-preset-es2015": "^6.6.0",
"babel-register": "^6.6.5",
"chai": "^3.2.0",
"del": "^2.2.0",
"grunt": "^1.0.1",
"grunt-build-control": "^0.7.0",
"grunt-contrib-clean": "^1.0.0",
Expand All @@ -64,10 +64,12 @@
"grunt-env": "^0.4.1",
"grunt-mocha-test": "^0.12.7",
"grunt-release": "^0.13.0",
"gulp": "^3.9.1",
"jit-grunt": "~0.10.0",
"mocha": "^2.2.5",
"q": "^1.0.1",
"recursive-readdir": "^2.0.0",
"run-sequence": "^1.1.5",
"shelljs": "^0.6.0",
"yeoman-assert": "^2.0.0",
"yeoman-test": "^1.1.0"
Expand Down
File renamed without changes.
6 changes: 4 additions & 2 deletions app/generator.js → src/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import babelStream from 'gulp-babel';
import beaufityStream from 'gulp-beautify';
import filter from 'gulp-filter';

export default class Generator extends Base {
export class Generator extends Base {
constructor(...args) {
super(...args);

Expand Down Expand Up @@ -496,7 +496,7 @@ export default class Generator extends Base {
]);

let self = this;
this.sourceRoot(path.join(__dirname, './templates'));
this.sourceRoot(path.join(__dirname, '../../templates/app'));
this.processDirectory('.', '.');
},
generateEndpoint: function() {
Expand Down Expand Up @@ -531,3 +531,5 @@ export default class Generator extends Base {
return {};
}
}

module.exports = Generator;
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 7 additions & 3 deletions endpoint/generator.js → src/endpoint/index.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
'use strict';

import path from 'path';
import {NamedBase} from 'yeoman-generator';
import {Base} from 'yeoman-generator';
import {genNamedBase} from '../generator-base';

export default class Generator extends NamedBase {
export class Generator extends Base {

constructor(...args) {
super(...args);

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

this.option('route', {
desc: 'URL for the endpoint',
type: String
Expand Down Expand Up @@ -99,7 +101,7 @@ export default class Generator extends NamedBase {
}

writing() {
this.sourceRoot(path.join(__dirname, './templates'));
this.sourceRoot(path.join(__dirname, '../../templates/endpoint'));
this.processDirectory('.', this.routeDest);
}

Expand Down Expand Up @@ -145,3 +147,5 @@ export default class Generator extends NamedBase {
}
}
}

module.exports = Generator;
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion insight-init.js → src/insight-init.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';
var Insight = require('insight');
var pkg = require('./package.json');
var pkg = require('../package.json');

var insight = new Insight({
// Google Analytics tracking code
Expand Down
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.
10 changes: 5 additions & 5 deletions test/test-file-creation.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe('angular-fullstack generator', function () {
function generatorTest(generatorType, name, mockPrompt, callback) {
gen.run(function () {
var afGenerator;
var deps = [path.join('../..', generatorType)];
var deps = [path.join('../../generators', generatorType)];
afGenerator = helpers.createGenerator('angular-fullstack:' + generatorType, deps, [name], {
skipInstall: true
});
Expand Down Expand Up @@ -351,8 +351,8 @@ describe('angular-fullstack generator', function () {
beforeEach(function (done) {
this.timeout(10000);
var deps = [
'../../app',
'../../endpoint',
'../../generators/app',
'../../generators/endpoint',
[
helpers.createDummyGenerator(),
'ng-component:app'
Expand Down Expand Up @@ -484,8 +484,8 @@ describe('angular-fullstack generator', function () {
this.timeout(60000);
copySync(__dirname + '/fixtures/.yo-rc.json', __dirname + '/temp/.yo-rc.json');
var gen = helpers.createGenerator('angular-fullstack:app', [
'../../app',
'../../endpoint',
'../../generators/app',
'../../generators/endpoint',
[
helpers.createDummyGenerator(),
'ng-component:app'
Expand Down