Skip to content
This repository was archived by the owner on Nov 21, 2024. It is now read-only.

Commit bc572a2

Browse files
committed
fix(generators): Fix small errors on application generator
1 parent facdda6 commit bc572a2

38 files changed

Lines changed: 96 additions & 283 deletions

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,4 @@ temp_*.json
4949
/test/fixture/**/src/app/index.ts
5050
/test/fixture/**/i18n/ru.i18n.ts
5151
/test/fixture/**/i18n/template.pot
52+
/test/fixture/ananas

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"scripts": {
1515
"clean": "del-cli dist",
1616
"build": "npm run clean && tsc --pretty",
17-
"test": "npm run build && mocha --timeout 300000 --require ts-node/register --recursive test/**/*-spec.ts",
17+
"test": "npm run build && mocha --timeout 300000 --require ts-node/register --recursive test/**/*.spec.ts",
1818
"watch": "npm run build -- --watch",
1919
"watch:test": "npm run test -- --watch"
2020
},

src/generators/app-empty.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ export class AppEmptyGenerator extends Base {
3535
'name': _.kebabCase(appName),
3636
'classPrefix': _.upperFirst(_.camelCase(appName)),
3737
'title': _.upperFirst(_.words(appName).join(' '))
38-
}
38+
},
39+
'spec': 'spec'
3940
}
4041
);
4142
return await this.srcgen(

src/generators/frame.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ export class FrameGenerator extends Base {
5050
const options = _.merge(
5151
{
5252
'app': {
53-
'name': appName,
53+
'name': _.kebabCase(appName),
54+
'classPrefix': _.upperFirst(_.camelCase(appName)),
55+
'title': _.upperFirst(_.words(appName).join(' ')),
5456
'folder': appFolder
5557
},
5658
'page': {

src/generators/grid.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,9 @@ export class GridGenerator extends Base {
101101
const options = _.merge(
102102
{
103103
'app': {
104-
'name': appName
104+
'name': _.kebabCase(appName),
105+
'classPrefix': _.upperFirst(_.camelCase(appName)),
106+
'title': _.upperFirst(_.words(appName).join(' '))
105107
},
106108
'libs': {
107109
'core': coreLib,

src/generators/page-and-frame.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ export class PageAndFrameGenerator extends Base {
5050
const options = _.merge(
5151
{
5252
'app': {
53-
'name': appName,
53+
'name': _.kebabCase(appName),
54+
'classPrefix': _.upperFirst(_.camelCase(appName)),
55+
'title': _.upperFirst(_.words(appName).join(' ')),
5456
'folder': appFolder
5557
},
5658
'page': {

src/generators/page.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@ export class PageGenerator extends Base {
4545
const options = _.merge(
4646
{
4747
'app': {
48-
'name': appName,
48+
'name': _.kebabCase(appName),
49+
'classPrefix': _.upperFirst(_.camelCase(appName)),
50+
'title': _.upperFirst(_.words(appName).join(' ')),
4951
'folder': appFolder
5052
},
5153
'page': {

srcgen/utils-make.list.ts.files/loader#.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ recursive(scanPath, ['!*.ts', '*node_modules*'], function (err, files) {
9797
founded = true;
9898
}
9999
}
100-
if (!founded && '/index' !== classFile) {
100+
if (!founded && '/index' !== classFile && className.indexOf('AppModule') === -1) {
101101
var importLine = 'import { ' + className + ' } from \'.' + classFile + '\';';
102102
exportArray.push(importLine);
103103
var exportLine = 'export { ' + className + ' } from \'.' + classFile + '\';';

srcgen/web-app-empty/README!.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@
33
<prompt name="app.name" message="Application name">app-name</prompt>
44
<prompt name="app.classPrefix" message="Application class prefix">AppName</prompt>
55
<prompt name="app.title" message="Application title">Frame title</prompt>
6+
<prompt name="spec" message="No change">spec</prompt>
67
```

srcgen/web-app-empty/apps/%app.name%/src/app/app.module.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
TokenService,
1515
} from '@rucken/core';
1616
import { <%=app.classPrefix%>CoreServices } from '@<%=app.name%>/core';
17+
import { <%=app.classPrefix%>WebServices } from '@<%=app.name%>/web';
1718
import {
1819
AlertModalModule,
1920
AuthModalModule,
@@ -37,12 +38,15 @@ import {
3738
TooltipConfig,
3839
} from 'ngx-bootstrap';
3940

40-
import { <%=app.classPrefix%>AppComponent } from './app.component';
41-
import { <%=app.classPrefix%>Routes } from './app.routes';
42-
import { <%=app.classPrefix%>NavbarModule } from './controls/navbar/navbar.module';
43-
import { <%=app.classPrefix%>HomeGuardService } from './shared/guards/home-guard.service';
44-
import { <%=app.classPrefix%>EndpointHelper } from './shared/helpers/endpoint.helper';
45-
import { <%=app.classPrefix%>HttpHelper } from './shared/helpers/http.helper';
41+
import {
42+
<%=app.classPrefix%>AppComponent,
43+
<%=app.classPrefix%>Routes,
44+
<%=app.classPrefix%>NavbarModule,
45+
<%=app.classPrefix%>HomeGuardService,
46+
<%=app.classPrefix%>EndpointHelper,
47+
<%=app.classPrefix%>HttpHelper,
48+
<%=app.classPrefix%>Services
49+
} from './index';
4650

4751
@NgModule({
4852
declarations: [
@@ -75,6 +79,8 @@ import { <%=app.classPrefix%>HttpHelper } from './shared/helpers/http.helper';
7579
RuckenCoreServices,
7680
RuckenWebServices,
7781
<%=app.classPrefix%>CoreServices,
82+
<%=app.classPrefix%>WebServices,
83+
<%=app.classPrefix%>Services,
7884
BaseResourceSelectInputConfig,
7985
TextInputConfig,
8086
SelectInputConfig,

0 commit comments

Comments
 (0)