Skip to content

Commit

Permalink
feat(schema): Remove divergent schemas in favor of common ones
Browse files Browse the repository at this point in the history
  • Loading branch information
mrmeku committed Feb 15, 2019
1 parent db77afb commit 9bde567
Show file tree
Hide file tree
Showing 37 changed files with 1,980 additions and 173 deletions.
2 changes: 1 addition & 1 deletion apps/vscode/src/app/tree-item/workspace-route.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { WorkspaceDefinition } from '@angular-console/server';
import { WorkspaceDefinition } from '@angular-console/schema';
import { join } from 'path';
import {
TreeItem,
Expand Down
2 changes: 1 addition & 1 deletion apps/vscode/src/app/tree-item/workspace.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Uri, TreeItemCollapsibleState, TreeItem } from 'vscode';
import { join } from 'path';
import { WorkspaceDefinition } from '@angular-console/server';
import { WorkspaceDefinition } from '@angular-console/schema';

export class Workspace extends TreeItem {
iconPath = Uri.file(join(this.extensionPath, 'assets', 'extension_icon.png'));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import {
settingsChange$,
WorkspaceDefinition,
Settings
} from '@angular-console/server';
import { WorkspaceDefinition, Settings } from '@angular-console/schema';
import { settingsChange$ } from '@angular-console/server';
import { readFileSync } from 'fs';
import { join } from 'path';
import { TreeDataProvider } from 'vscode';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { settingsChange$, WorkspaceDefinition } from '@angular-console/server';
import { WorkspaceDefinition } from '@angular-console/schema';
import { settingsChange$ } from '@angular-console/server';

import { TreeDataProvider } from 'vscode';

import { Workspace } from '../tree-item/workspace';
Expand Down
2 changes: 1 addition & 1 deletion apps/vscode/src/app/webview.factory.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { WorkspaceDefinition } from '@angular-console/server';
import { WorkspaceDefinition } from '@angular-console/schema';
import { ExtensionContext, ViewColumn, WebviewPanel, window } from 'vscode';

import {
Expand Down
3 changes: 2 additions & 1 deletion apps/vscode/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { WorkspaceDefinition, readSettings } from '@angular-console/server';
import { WorkspaceDefinition } from '@angular-console/schema';
import { readSettings } from '@angular-console/server';
import { Store } from '@nrwl/angular-console-enterprise-electron';
import { Server } from 'http';
import {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export class ExtensionComponent implements OnInit {
}),
tap((extension: Extension) => {
const contextTitle = this.getContextTitle(extension);
this.ngAddDisabled$.next(extension.installed);
this.ngAddDisabled$.next(Boolean(extension.installed));
this.contextActionService.contextualActions$.next({
contextTitle,
actions: [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { ActivatedRoute, NavigationEnd, Router } from '@angular/router';
import { Extension, ExtensionGroup } from '@angular-console/schema';
import { Extension } from '@angular-console/schema';
import { combineLatest, Observable } from 'rxjs';
import {
distinctUntilChanged,
Expand All @@ -18,6 +18,11 @@ interface ExtensionId {
name: string | undefined;
}

export interface ExtensionGroup {
name: string;
extensions: Extension[];
}

@Component({
changeDetection: ChangeDetectionStrategy.OnPush,
selector: 'angular-console-extensions',
Expand Down
2 changes: 1 addition & 1 deletion libs/feature-run/src/lib/graphql/npm-run.graphql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
mutation NpmRun($path: String!, $npmClient: String!, $runCommand: [String!]!) {
mutation NpmRun($path: String!, $npmClient: String, $runCommand: [String!]!) {
runNpm(path: $path, npmClient: $npmClient, runCommand: $runCommand) {
id
}
Expand Down
72 changes: 10 additions & 62 deletions libs/schema/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,47 +1,28 @@
import { Observable } from 'rxjs';
import { Schema, NpmScript } from './lib/generated/graphql-types';

export type AutocompletionType =
| 'localModules'
| 'absoluteModules'
| 'projects'
| 'file';
export * from './lib/generated/graphql-types';

export type LocalFileType = 'file' | 'directory' | 'angularDirectory';

export interface LocalFile {
export interface File {
name: string;
type: LocalFileType;
}

export interface Directory {
path: string;
exists: boolean;
files: Array<LocalFile>;
}

export interface CompletetionValue {
value: string | null;
display?: string;
files: Array<File>;
}

export interface Field {
name: string;
enum: string[];
type: string;
description: string;
defaultValue: any;
required: boolean;
positional: boolean;
important?: boolean;
completion?: AutocompletionType;
completionValues?: Observable<Array<CompletetionValue>>;
}
export type AutocompletionType =
| 'localModules'
| 'absoluteModules'
| 'projects'
| 'file';

export interface Schematic {
collection: string;
name: string;
description: string;
schema: Field[];
schema: Schema[];
npmClient: string | null;
npmScript: string | null;
}
Expand All @@ -51,39 +32,6 @@ export interface SchematicCollection {
schematics: Array<Schematic>;
}

export interface ExtensionGroup {
name: string;
extensions: Extension[];
}

export interface Extension {
name: string;
description: string;
detailedDescription: string;
installed: boolean;
}

export interface Builder {
name: string;
description: string;
builder: string;
project: string;
schema: Field[];
}

export interface Project {
name: string;
projectType: string;
root: string;
architect: Builder[];
}

export interface NpmScript {
name: string;
npmClient: string;
schema: Field[];
}

export interface NpmScripts {
name: string;
scripts: NpmScript[];
Expand Down
Loading

0 comments on commit 9bde567

Please sign in to comment.