install.js
function fixMainFile(component) {
  var mainTS = '', mainFile = '../../app/main.ts';
  if (fs.existsSync(mainFile)) {
    mainTS = fs.readFileSync(mainFile).toString();
  } 

  if (mainTS.indexOf('MagicService') === -1) {
    // has not been previously modified
    var fix = '// this import should be first in order to load some required settings (like globals and reflect-metadata)\n' +
      'import { platformNativeScriptDynamic, NativeScriptModule } from "nativescript-angular/platform";\n' +
      'import { NgModule } from "@angular/core";\n' +
      'import { AppComponent } from "./app/app.component";\n' +
      '\n' +
      '@NgModule({\n' +
      '  declarations: [AppComponent],\n' +
      '  bootstrap: [AppComponent],\n' +
      '   imports: [NativeScriptModule],\n' +
      '})\n' +
      'class AppComponentModule {}\n\n' +
      'platformNativeScriptDynamic().bootstrapModule(AppComponentModule);';


    fs.writeFileSync(mainFile, fix, 'utf8');
  }
}
function fixMainFile(component) {
  var mainTS = '', mainFile = '../../app/main.ts';
  if (fs.existsSync(mainFile)) {
    mainTS = fs.readFileSync(mainFile).toString();
  } 

  if (mainTS.indexOf('MagicService') === -1) {
    // has not been previously modified
    var fix = '// this import should be first in order to load some required settings (like globals and reflect-metadata)\n' +
      'import { platformNativeScriptDynamic, NativeScriptModule } from "nativescript-angular/platform";\n' +
      'import { NgModule } from "@angular/core";\n' +
      'import { AppComponent } from "./app/app.component";\n' +
      '\n' +
      '@NgModule({\n' +
      '  declarations: [AppComponent],\n' +
      '  bootstrap: [AppComponent],\n' +
      '   imports: [NativeScriptModule],\n' +
      '})\n' +
      'class AppComponentModule {}\n\n' +
      'platformNativeScriptDynamic().bootstrapModule(AppComponentModule);';


    fs.writeFileSync(mainFile, fix, 'utf8');
  }
}
function fixMainFile ( component ) { var mainTS = '' , mainFile = '../../app/main.ts' ; if ( fs . existsSync ( mainFile ) ) { mainTS = fs . readFileSync ( mainFile ) . toString ( ) ; } if ( mainTS . indexOf ( 'MagicService' ) === - 1 ) { // has not been previously modified var fix = '// this import should be first in order to load some required settings (like globals and reflect-metadata)\n' + 'import { platformNativeScriptDynamic, NativeScriptModule } from "nativescript-angular/platform";\n' + 'import { NgModule } from "@angular/core";\n' + 'import { AppComponent } from "./app/app.component";\n' + '\n' + '@NgModule({\n' + '  declarations: [AppComponent],\n' + '  bootstrap: [AppComponent],\n' + '   imports: [NativeScriptModule],\n' + '})\n' + 'class AppComponentModule {}\n\n' + 'platformNativeScriptDynamic().bootstrapModule(AppComponentModule);' ; fs . writeFileSync ( mainFile , fix , 'utf8' ) ; } }
Fix the Main NativeScript File
@param component
Fix the Main NativeScript File