How to use the @angular/cli/utilities/schematics.getSchematic 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 JetBrains / intellij-plugins / AngularJS / src / ngCli / schematicsProvider60.ts View on Github external
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
import {SchematicsProvider} from "./schematicsProvider";

let schematicsUtils = require('@angular/cli/utilities/schematics');

let defaultCollectionName;
try {
    defaultCollectionName = require('@angular/cli/utilities/config').getDefaultSchematicCollection();
} catch (e) {
    defaultCollectionName = require('@angular/cli/models/config').CliConfig.getValue('defaults.schematics.collection');
}
let engineHost = schematicsUtils.getEngineHost()

const schematicsProvider: Promise = Promise.resolve({
    getCollection: schematicsUtils.getCollection,
    getSchematic: schematicsUtils.getSchematic,
    listSchematics(collection): string[] {
        return engineHost.listSchematics(collection)
    },
    getDefaultSchematicCollection: () => defaultCollectionName
})

export = schematicsProvider;
github JetBrains / intellij-plugins / AngularJS / gen / ngCli / schematicsProvider60.js View on Github external
"use strict";
let schematicsUtils = require('@angular/cli/utilities/schematics');
let defaultCollectionName;
try {
    defaultCollectionName = require('@angular/cli/utilities/config').getDefaultSchematicCollection();
}
catch (e) {
    defaultCollectionName = require('@angular/cli/models/config').CliConfig.getValue('defaults.schematics.collection');
}
let engineHost = schematicsUtils.getEngineHost();
const schematicsProvider = Promise.resolve({
    getCollection: schematicsUtils.getCollection,
    getSchematic: schematicsUtils.getSchematic,
    listSchematics(collection) {
        return engineHost.listSchematics(collection);
    },
    getDefaultSchematicCollection: () => defaultCollectionName
});
module.exports = schematicsProvider;