How to use the @angular/cli/package.json.version function in @angular/cli

To help you get started, we’ve selected a few @angular/cli 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 pnp / generator-spfx / generators / angularelements / promptConfig.js View on Github external
"use strict"

const path = require('path');
const process = require('process');

let defaultOpts = '--style=scss --routing=false --skip-git';

try {

    const ngVersion = require('@angular/cli/package.json');

    if (ngVersion.version.startsWith('7') ||
        ngVersion.version.startsWith('8')) {
        defaultOpts = defaultOpts + ' --enable-ivy'
    };

} catch (error) {}

// check if user want to have exntend linking capability
const configOptions = [{
        type: 'input',
        message: 'What is your solution name?',
        name: 'solutionName',
        when: (answers) => answers.framework === 'angularelements',
        default: path.basename(process.cwd()),
        validate: (input) => input.indexOf('-') === -1 && input.indexOf('_') === -1 ? true : 'Dashes or underscores are not allowed in solution name'
    },
    {
        type: 'input',
github pnp / generator-spfx / app / promptConfig.js View on Github external
const checkAngular = () => {

    try {

        const ngVersion = require('@angular/cli/package.json');

        if (ngVersion.version.startsWith('7')) {
            return false;
        };

        if (ngVersion.version.startsWith('6')) {
            return false;
        };

        return true;

    } catch (error) {

        // Angular is disabled because no Valid client could be found
        return true;

    }
github pnp / generator-spfx / generators / angularelements / promptConfig.js View on Github external
"use strict"

const path = require('path');
const process = require('process');

let defaultOpts = '--style=scss --routing=false --skip-git';

try {

    const ngVersion = require('@angular/cli/package.json');

    if (ngVersion.version.startsWith('7') ||
        ngVersion.version.startsWith('8')) {
        defaultOpts = defaultOpts + ' --enable-ivy'
    };

} catch (error) {}

// check if user want to have exntend linking capability
const configOptions = [{
        type: 'input',
        message: 'What is your solution name?',
        name: 'solutionName',
        when: (answers) => answers.framework === 'angularelements',
        default: path.basename(process.cwd()),
        validate: (input) => input.indexOf('-') === -1 && input.indexOf('_') === -1 ? true : 'Dashes or underscores are not allowed in solution name'
    },
    {
github pnp / generator-spfx / app / promptConfig.js View on Github external
const checkAngular = () => {

    try {

        const ngVersion = require('@angular/cli/package.json');

        if (ngVersion.version.startsWith('7')) {
            return false;
        };

        if (ngVersion.version.startsWith('6')) {
            return false;
        };

        return true;

    } catch (error) {

        // Angular is disabled because no Valid client could be found
        return true;

    }

}