How to use the @nstudio/xplat.stringUtils.classify function in @nstudio/xplat

To help you get started, we’ve selected a few @nstudio/xplat examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nstudio / xplat / packages / angular / src / schematics / elements / index.ts View on Github external
const componentNames = options.components.split(',');
        for (let component of componentNames) {
          // using short name ("menu" for a component named "MenuComponent")
          // convert to fully best practice name
          const isShortName =
            component.toLowerCase().indexOf('component') === -1;
          let selector = `${workspacePrefix ? `${workspacePrefix}-` : ''}`;
          if (isShortName) {
            selector += component.toLowerCase();
          } else {
            const parts = component.toLowerCase().split('component');
            selector += parts[0];
          }
          componentSymbols.push({
            selector,
            symbol: `${stringUtils.classify(component)}${
              isShortName ? 'Component' : ''
            }`
          });
          htmlElementList.push(`<${selector}>`);
        }
        componentSymbolList = componentSymbols.map(c => c.symbol).join(', ');
        htmlElements = htmlElementList.join('\n');

        customElementList = createCustomElementList(componentSymbols);
      }
      return tree;
    },
    // add custom element module
github nstudio / xplat / packages / angular / src / schematics / elements / index.ts View on Github external
function builderElementsContent(name: string) {
  return `import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { ${stringUtils.classify(name)}Module } from '../${name}.module';

platformBrowserDynamic()
  .bootstrapModule(${stringUtils.classify(name)}Module)
  .catch(err => console.log(err));
`;
}
github nstudio / xplat / packages / angular / src / schematics / elements / index.ts View on Github external
function builderElementsContent(name: string) {
  return `import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { ${stringUtils.classify(name)}Module } from '../${name}.module';

platformBrowserDynamic()
  .bootstrapModule(${stringUtils.classify(name)}Module)
  .catch(err => console.log(err));
`;
}
github nstudio / xplat / packages / electron-angular / src / schematics / application / index.ts View on Github external
function electronModule() {
  return `import { NgModule } from '@angular/core';
import { ${stringUtils.classify(
    getPrefix()
  )}ElectronCoreModule } from '@${getNpmScope()}/${XplatHelpers.getXplatFoldername(
    'electron',
    'angular'
  )}';
import { AppModule } from './app.module';
import { AppComponent } from './app.component';

@NgModule({
  imports: [AppModule, ${stringUtils.classify(getPrefix())}ElectronCoreModule],
  bootstrap: [AppComponent]
})
export class AppElectronModule {}`;
}
github nstudio / xplat / packages / nativescript-angular / src / schematics / application / index.spec.ts View on Github external
xplat: {
          prefix: 'tt'
        }
      })
    );
    const tree = await runSchematic('app', options, appTree);
    const appModule = getFileContent(
      tree,
      '/apps/nativescript-foo/src/core/core.module.ts'
    );

    expect(appModule).toMatch(
      isInModuleMetadata(
        'CoreModule',
        'imports',
        `${stringUtils.classify(options.prefix)}CoreModule`,
        true
      )
    );
    expect(appModule).toMatch(
      `import { ${stringUtils.classify(options.prefix)}CoreModule } from \'@${
        options.npmScope
      }/nativescript-angular\'`
    );
  });