WEB-42242 Angular: support Schematics with Angular CLI 9.0.0 - post review fixes
authorPiotr Tomiak <piotr.tomiak@jetbrains.com>
Mon, 4 Nov 2019 16:11:05 +0000 (17:11 +0100)
committerintellij-monorepo-bot <intellij-monorepo-bot-no-reply@jetbrains.com>
Thu, 7 Nov 2019 02:40:58 +0000 (02:40 +0000)
GitOrigin-RevId: ece17b1225d35281140999d2526f167d8a409d52

AngularJS/src/ngCli/schematicsInfoProvider.ts
AngularJS/src/ngCli/schematicsProvider80.ts
AngularJS/src/ngCli/schematicsProvider90.ts

index ff4cb6bae73031b57881c87d4845f94947383091..158d47739f432396f15aa344106ecf333047d03a 100644 (file)
@@ -43,7 +43,7 @@ interface SchematicsInfo {
 
 const includeHidden = process.argv[2] === "--includeHidden";
 
-(async function(){
+(async function () {
   let provider = await providerPromise;
 
   const defaultCollectionName = provider.getDefaultSchematicCollection();
@@ -61,7 +61,7 @@ const includeHidden = process.argv[2] === "--includeHidden";
 
   console.info(JSON.stringify(allSchematics, null, 2))
 
-})()
+})().catch(err => console.error(err.stack || err))
 
 
 function getAvailableSchematicCollections(provider: SchematicsProvider) {
@@ -98,7 +98,6 @@ function getCollectionSchematics(collectionName: string, provider: SchematicsPro
       ? listAllSchematics(collection)
       : provider.listSchematics(collection);
   } catch (e) {
-    console.error(e)
     return [{
       name: collectionName,
       error: "" + e.message
index 39dc2d6818a8e9e2edc3768b0d94f3dc900394dc..9b3ad3a751ec5e2876495c6b3d2772fe1215070c 100644 (file)
@@ -5,7 +5,7 @@ import {SchematicCommand} from "@angular/cli/models/schematic-command";
 import {getWorkspace} from "@angular/cli/utilities/config"
 
 let workspace = getWorkspace() as any
-workspace.root.test
+if (!workspace || !workspace.root) throw new Error("Try 9.0 provider")
 
 let command = new (SchematicCommand as any)({workspace}, null, null);
 let engineHost = command.createWorkflow({interactive: false}).engineHost;
index f9773cdbc1f887587ffec43900175db377dbff56..af9413b0277b226be2f4b5eb9f0a07015921d2b3 100644 (file)
@@ -7,7 +7,7 @@ import {getWorkspace} from "@angular/cli/utilities/config"
 const schematicsProvider: Promise<SchematicsProvider> = (async function () {
   let workspace = await getWorkspace('local');
   let command = new (SchematicCommand as any)({workspace: workspace}, null, null);
-  let engineHost = (await command.createWorkflow({interactive: false})).engineHost;
+  let {listSchematicNames} = (await command.createWorkflow({interactive: false})).engineHost;
   let defaultSchematicCollection = await command.getDefaultSchematicCollection()
 
   return {
@@ -15,7 +15,7 @@ const schematicsProvider: Promise<SchematicsProvider> = (async function () {
       return command.getCollection(collectionName);
     },
     listSchematics(collection): string[] {
-      return engineHost.listSchematicNames(collection.description)
+      return listSchematicNames(collection.description)
     },
     getSchematic(collection: Collection<any, any>, schematicName: string, allowPrivate?: boolean): Schematic<any, any> {
       return command.getSchematic(collection, schematicName, allowPrivate);