How to use the @nrwl/workspace.createOrUpdate function in @nrwl/workspace

To help you get started, weโ€™ve selected a few @nrwl/workspace 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 / feature / index.spec.ts View on Github external
it('should create feature module for specified project WITH Routing and adjustSandbox', async () => {
    const options: XplatFeatureHelpers.Schema = {
      ...defaultOptions,
      projects: 'nativescript-viewer'
    };
    appTree = Tree.empty();
    appTree = createXplatWithNativeScriptWeb(appTree, true);

    // manually update home.component to prep for sandobx
    const homeCmpPath = `/apps/nativescript-viewer/src/features/home/components/home.component.html`;
    createOrUpdate(appTree, homeCmpPath, sandboxHomeSetup());
    // console.log('homecmp:', getFileContent(tree, homeCmpPath));

    options.onlyProject = true;
    options.adjustSandbox = true;
    options.routing = true;
    options.name = 'foo-with-dash';
    let tree = await runSchematic('feature', options, appTree);
    // console.log('---------')
    // console.log('homecmp:', getFileContent(tree, homeCmpPath));
  });
});
github nrwl / nx / packages / schematics / migrations / update-6-0-0 / update-6-0-0.ts View on Github external
function createKarma(host: Tree, project: any) {
  const offset = offsetFromRoot(project.root);

  createOrUpdate(
    host,
    `${project.root}/karma.conf.js`,
    `
// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html

module.exports = function (config) {
  config.set({
    basePath: '',
    frameworks: ['jasmine', '@angular-devkit/build-angular'],
    plugins: [
      require('karma-jasmine'),
      require('karma-chrome-launcher'),
      require('karma-jasmine-html-reporter'),
      require('karma-coverage-istanbul-reporter'),
      require('@angular-devkit/build-angular/plugins/karma')
github nstudio / xplat / packages / angular / src / schematics / helpers / applitools / index.ts View on Github external
return (tree: Tree, context: SchematicContext) => {
    // update support index
    helperChains.push(
      createOrUpdate(
        tree,
        `/apps/${options.target}-e2e/src/support/index.ts`,
        updateCypressIndex()
      )
    );
    // update plugin index
    helperChains.push(
      createOrUpdate(
        tree,
        `/apps/${options.target}-e2e/src/plugins/index.ts`,
        updateCypressPlugins()
      )
    );
    // ensure supportFile points to updates
    const cypressConfigPath = `/apps/${options.target}-e2e/cypress.json`;
    const cypressConfig = getJsonFromFile(tree, cypressConfigPath);
github nrwl / nx / packages / schematics / migrations / update-6-0-0 / update-6-0-0.ts View on Github external
function createProtractor(host: Tree, project: any) {
  createOrUpdate(
    host,
    `${project.root}/protractor.conf.js`,
    `
// Protractor configuration file, see link for more information
// https://github.com/angular/protractor/blob/master/lib/config.ts

const { SpecReporter } = require('jasmine-spec-reporter');

exports.config = {
  allScriptsTimeout: 11000,
  specs: [
    './src/**/*.e2e-spec.ts'
  ],
  capabilities: {
    'browserName': 'chrome'
  },
github nrwl / nx / packages / schematics / migrations / update-6-0-0 / update-6-0-0.ts View on Github external
function createTsconfigSpecJson(host: Tree, project: any) {
  const files = ['src/test.ts'];

  const offset = offsetFromRoot(project.root);

  const compilerOptions = {
    outDir: `${offset}dist/out-tsc/${project.root}`,
    types: ['jasmine', 'node']
  };

  if (project.projectType === 'application') {
    files.push('src/polyfills.ts');
    compilerOptions['module'] = 'commonjs';
  }

  createOrUpdate(
    host,
    `${project.root}/tsconfig.spec.json`,
    serializeJson({
      extends: `${offset}tsconfig.json`,
      compilerOptions,
      files,
      include: ['**/*.spec.ts', '**/*.d.ts']
    })
  );
}
github nrwl / nx / packages / schematics / migrations / update-6-0-0 / update-6-0-0.ts View on Github external
function createBrowserlist(host: Tree, project: any) {
  createOrUpdate(
    host,
    `${project.root}/browserslist`,
    stripIndents`
      # This file is currently used by autoprefixer to adjust CSS to support the below specified browsers
      # For additional information regarding the format and rule options, please see:
      # https://github.com/browserslist/browserslist#queries
      # For IE 9-11 support, please uncomment the last line of the file and adjust as needed
      > 0.5%
      last 2 versions
      Firefox ESR
      not dead
      # IE 9-11
    `
  );
}
github nrwl / nx / packages / schematics / migrations / update-6-0-0 / update-6-0-0.ts View on Github external
function createTslintJson(host: Tree, project: any) {
  const offset = offsetFromRoot(project.root);

  createOrUpdate(
    host,
    `${project.root}/tslint.json`,
    serializeJson({
      extends: `${offset}tslint.json`,
      rules: {
        'directive-selector': [true, 'attribute', project.prefix, 'camelCase'],
        'component-selector': [true, 'element', project.prefix, 'kebab-case']
      }
    })
  );
}
github nrwl / nx / packages / schematics / migrations / update-6-0-0 / update-6-0-0.ts View on Github external
function createDefaultAppTsConfig(host: Tree, project: any) {
  const offset = offsetFromRoot(project.root);

  const defaultAppTsConfig = {
    extends: `${offset}tsconfig.json`,
    compilerOptions: {
      outDir: `${offset}dist/out-tsc/${project.root}`,
      module: 'es2015'
    },
    include: ['**/*.ts'],
    exclude: ['src/test.ts', '**/*.spec.ts']
  };
  createOrUpdate(
    host,
    `${project.root}/tsconfig.app.json`,
    serializeJson(defaultAppTsConfig)
  );
}
github nrwl / nx / packages / schematics / migrations / update-6-0-0 / update-6-0-0.ts View on Github external
function createDefaultE2eTsConfig(host: Tree, project: any) {
  const offset = offsetFromRoot(project.root);

  const defaultE2eTsConfig = {
    extends: `${offset}tsconfig.json`,
    compilerOptions: {
      outDir: `${offset}dist/out-tsc/${project.root}`,
      module: 'commonjs',
      target: 'es5',
      types: ['jasmine', 'jasminewd2', 'node']
    }
  };
  createOrUpdate(
    host,

    `${project.root}/tsconfig.e2e.json`,
    serializeJson(defaultE2eTsConfig)
  );
}