Skip to content

Commit

Permalink
Merge pull request #125 from b3nab/master
Browse files Browse the repository at this point in the history
Fix issue #111 and fix generation of sdk different from ng2web
  • Loading branch information
jonathan-casarrubias authored Oct 5, 2017
2 parents 6c7adbb + 68b1860 commit 26110a3
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 21 deletions.
6 changes: 3 additions & 3 deletions generator-fireloop/generators/ng2native/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion generator-fireloop/generators/ng2native/index.js.map

This file was deleted.

7 changes: 4 additions & 3 deletions generator-fireloop/generators/sdk/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion generator-fireloop/generators/sdk/index.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions generator-fireloop/src/ng2native/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ module.exports = generators.extend({
let dest = this.destinationPath(this.options.current);
if (this.options.current) {
this.spawnCommand(
`npm`, ['install', '--save', 'nativescript-socketio'], {
`npm`, ['install', '--save', 'nativescript-socket.io'], {
cwd: dest
});
} else {
Expand All @@ -74,7 +74,7 @@ module.exports = generators.extend({
[
{
template: 'templates/nativescript/app.module.ts',
output: `${this.options.current}/app/main.ts`,
output: `${this.options.current}/app/app.module.ts`,
params: {}
}
].forEach(
Expand Down
6 changes: 4 additions & 2 deletions generator-fireloop/src/sdk/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,16 @@ module.exports = generators.extend({
}
});

console.log('SDK Driver: ', this.client.type);

this.spawnCommand(
this.destinationPath(path.join(serverPath, 'node_modules/.bin/lb-sdk')),
[
'server/server',
this.destinationPath(this.sdkPath || 'webapp/src/app/shared/sdk'),
'-d', !this.options.clientType || this.options.clientType.match(/(ng2web|ng2ionic)/)
'-d', !this.client.type || this.client.type.match(/(ng2web|ng2ionic)/)
? 'ng2web'
: this.options.clientType.trim(),
: this.client.type.trim(),
'-w', 'enabled',
'-i', (this.sdkFeatures.indexOf(this.sdkOptions.IO) > -1) ? 'enabled' : 'disabled',
'-f', (this.sdkFeatures.indexOf(this.sdkOptions.FIRELOOP) > -1) ? 'enabled' : 'disabled',
Expand Down
44 changes: 35 additions & 9 deletions generator-fireloop/templates/nativescript/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,43 @@
// this import should be first in order to load some required settings (like globals and reflect-metadata)
import { platformNativeScriptDynamic, NativeScriptModule } from "nativescript-angular/platform";
import { NgModule } from "@angular/core";
import { NgModule, NO_ERRORS_SCHEMA } from "@angular/core";
import { NativeScriptModule } from "nativescript-angular/nativescript.module";
import { AppRoutingModule } from "./app.routing";
import { AppComponent } from "./app.component";

// Loopback NativeScript SDK Module
import { SDKNativeModule } from './shared/sdk/index';

import { ItemService } from "./item/item.service";
import { ItemsComponent } from "./item/items.component";
import { ItemDetailComponent } from "./item/item-detail.component";

// Uncomment and add to NgModule imports if you need to use two-way binding
// import { NativeScriptFormsModule } from "nativescript-angular/forms";

// Uncomment and add to NgModule imports if you need to use the HTTP wrapper
// import { NativeScriptHttpModule } from "nativescript-angular/http";

@NgModule({
declarations: [AppComponent],
bootstrap: [AppComponent],
bootstrap: [
AppComponent
],
imports: [
NativeScriptModule,
SDKNativeModule.forRoot()
SDKNativeModule.forRoot(),
AppRoutingModule
],
declarations: [
AppComponent,
ItemsComponent,
ItemDetailComponent
],
providers: [
ItemService
],
schemas: [
NO_ERRORS_SCHEMA
]
})
class AppComponentModule {}

platformNativeScriptDynamic().bootstrapModule(AppComponentModule);
/*
Pass your application module to the bootstrapModule function located in main.ts to start your app
*/
export class AppModule { }

0 comments on commit 26110a3

Please sign in to comment.