Skip to content

Commit 5fca882

Browse files
authored
Merge pull request #2655 from angular-fullstack/feat/awk34-dev
Various canary features / fixes
2 parents 96086d1 + ad585d3 commit 5fca882

29 files changed

+139
-179
lines changed

src/generators/app/USAGE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Description:
2-
Creates a Full-Stack AngularJS + Node app
2+
Creates a Full-Stack Angular + Node app
33

44
Example:
55
yo angular-fullstack

src/generators/app/index.js

Lines changed: 32 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ export class Generator extends Base {
158158
}, {
159159
type: 'confirm',
160160
name: 'flow',
161-
default: false,
161+
default: true,
162162
message: 'Would you like to use Flow types with Babel?',
163163
when: answers => answers.transpiler === 'babel'
164164
}, {
@@ -466,35 +466,37 @@ export class Generator extends Base {
466466
const codeshiftStream = tap(function(file, t) {
467467
var contents = file.contents.toString();
468468

469-
// remove `implements Foo` from class declarations
470-
contents = jscodeshift(contents)
471-
.find(jscodeshift.ClassDeclaration)
472-
.forEach(path => {
473-
path.value.implements = null;
474-
})
475-
.toSource();
476-
477-
// remove any type annotations
478-
contents = jscodeshift(contents)
479-
.find(jscodeshift.TypeAnnotation)
480-
.remove()
481-
.toSource();
482-
contents = jscodeshift(contents)
483-
.find(jscodeshift.GenericTypeAnnotation)
484-
.remove()
485-
.toSource();
486-
487-
// remove any `type Foo = { .. }` declarations
488-
contents = jscodeshift(contents)
489-
.find(jscodeshift.TypeAlias)
490-
.remove()
491-
.toSource();
492-
493-
// remove any flow directive comments
494-
contents = jscodeshift(contents)
495-
.find(jscodeshift.Comment, path => path.type === 'CommentLine' && path.value.includes('@flow'))
496-
.forEach(path => path.prune())
497-
.toSource();
469+
if(!flow) {
470+
// remove `implements Foo` from class declarations
471+
contents = jscodeshift(contents)
472+
.find(jscodeshift.ClassDeclaration)
473+
.forEach(path => {
474+
path.value.implements = null;
475+
})
476+
.toSource();
477+
478+
// remove any type annotations
479+
contents = jscodeshift(contents)
480+
.find(jscodeshift.TypeAnnotation)
481+
.remove()
482+
.toSource();
483+
contents = jscodeshift(contents)
484+
.find(jscodeshift.GenericTypeAnnotation)
485+
.remove()
486+
.toSource();
487+
488+
// remove any `type Foo = { .. }` declarations
489+
contents = jscodeshift(contents)
490+
.find(jscodeshift.TypeAlias)
491+
.remove()
492+
.toSource();
493+
494+
// remove any flow directive comments
495+
contents = jscodeshift(contents)
496+
.find(jscodeshift.Comment, path => path.type === 'CommentLine' && path.value.includes('@flow'))
497+
.forEach(path => path.prune())
498+
.toSource();
499+
}
498500

499501
file.contents = new Buffer(contents);
500502
});

src/test/fixtures/.yo-rc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"filters": {
1616
"js": true,
1717
"babel": true,
18-
"flow": false,
18+
"flow": true,
1919
"html": true,
2020
"sass": true,
2121
"ngroute": true,

src/test/get-expected-files.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ export function app(options) {
9090
'.babelrc',
9191
'.buildignore',
9292
'.editorconfig',
93+
'.eslintignore',
9394
'.eslintrc',
9495
'.gitattributes',
9596
'.gitignore',
@@ -156,7 +157,6 @@ export function app(options) {
156157
if (options.auth) {
157158
files = files.concat([
158159
'client/app/account/account.module.' + script,
159-
'client/app/account/account.routes.' + script,
160160
'client/app/account/login/login.' + markup,
161161
'client/app/account/login/login.component.' + script,
162162
'client/app/account/settings/settings.' + markup,
@@ -167,7 +167,6 @@ export function app(options) {
167167
'client/app/admin/admin.' + stylesheet,
168168
'client/app/admin/admin.component.' + script,
169169
'client/app/admin/admin.module.' + script,
170-
'client/app/admin/admin.routes.' + script,
171170
'client/components/auth/auth.module.' + script,
172171
'client/components/auth/auth.service.' + script,
173172
'client/components/auth/interceptor.service.' + script,

src/test/main.test.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import {
1717
const defaultOptions = {
1818
buildtool: 'gulp',
1919
transpiler: 'babel',
20+
flow: true,
2021
markup: 'html',
2122
stylesheet: 'sass',
2223
router: 'ngroute',
@@ -263,6 +264,7 @@ describe('angular-fullstack:app', function() {
263264
var testOptions = {
264265
buildtool: 'gulp',
265266
transpiler: 'babel',
267+
flow: true,
266268
markup: 'pug',
267269
stylesheet: 'css',
268270
router: 'ngroute',

templates/app/.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
client/components/socket/primus.js

templates/app/_package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"version": "0.0.0",
44
"main": "server/index.js",
55
"dependencies": {
6+
"compression": "^1.7.1",
67
"core-js": "^2.4.1",
78
"cors": "^2.8.1",
89
"express": "^4.13.3",
@@ -45,8 +46,7 @@
4546
"primus": "^7.0.1",
4647
"primus-emit": "^1.0.0",
4748
"uws": "^8.14.1",<% } %>
48-
"serve-favicon": "^2.3.0",
49-
"shrink-ray": "^0.1.3"
49+
"serve-favicon": "^2.3.0"
5050
},
5151
"devDependencies": {
5252
<%# CLIENT %>
@@ -213,6 +213,9 @@
213213
"npm": "^3.9.5"
214214
},
215215
"scripts": {
216+
"lint": "npm run lint:client && npm run lint:server",
217+
"lint:client": "eslint ./client/**/*.<%= scriptExt %> -c ./client/.eslintrc --ignore-pattern *.spec.<%= scriptExt %>",
218+
"lint:server": "eslint ./server/**/*.js -c ./server/.eslintrc --ignore-pattern *.spec.js --ignore-pattern *.integration.js",
216219
"test": "gulp test",
217220
"test:client": "karma start ./karma.conf.js --single-run",
218221
<%_ if(filters.flow) { -%>

templates/app/client/.eslintrc(babel)

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,11 @@
33
"env": {
44
"browser": true,
55
"commonjs": true
6+
},
7+
"globals": {
8+
"process": true
9+
},
10+
"rules": {
11+
"no-process-env": 0
612
}
713
}

templates/app/client/app/account(auth)/account.module.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@ import { RouterModule, Routes } from '@angular/router';<% } %>
88
<%_ if(filters.oauth) { -%>
99
import { DirectivesModule } from '../../components/directives.module';<% } %>
1010

11-
<%_ if(filters.uirouter) { -%>
12-
import { STATES } from './account.routes';<% } %>
13-
1411
import { LoginComponent } from './login/login.component';
1512
import { SettingsComponent } from './settings/settings.component';
1613
import { SignupComponent } from './signup/signup.component';
@@ -19,7 +16,6 @@ import { SignupComponent } from './signup/signup.component';
1916
const accountRoutes: Routes = [{
2017
path: 'login',
2118
component: LoginComponent,
22-
//data: { title: 'Home' }
2319
}, {
2420
path: 'settings',
2521
component: SettingsComponent,

templates/app/client/app/account(auth)/account.routes.js

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

0 commit comments

Comments
 (0)