Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: No longer poll for updates #690

Merged
merged 1 commit into from
May 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v11.13.0
v10.15.3
1 change: 1 addition & 0 deletions .yarnrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
no-optional true
3 changes: 0 additions & 3 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@
"externalDependencies": [
"vscode",
"source-map-explorer",
"semver",
"tmp",
"fast-glob",
"node-pty-prebuilt"
Expand Down Expand Up @@ -228,7 +227,6 @@
"externalDependencies": [
"electron",
"source-map-explorer",
"semver",
"tmp",
"node-pty-prebuilt"
],
Expand Down Expand Up @@ -277,7 +275,6 @@
"extractLicenses": true,
"externalDependencies": [
"source-map-explorer",
"semver",
"tmp",
"node-pty-prebuilt"
],
Expand Down
18 changes: 15 additions & 3 deletions apps/angular-console/src/polyfills.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,21 @@
* user can disable parts of macroTask/DomEvents patch by setting following flags
*/

// (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame
// (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick
// (window as any).__zone_symbol__BLACK_LISTED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames
(window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame
(window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick
(window as any).__zone_symbol__BLACK_LISTED_EVENTS = [
'scroll',
'resize',
'mouseenter',
'mouseleave',
'mousemove',
'mouseover',
'mouseout',
'mousewheel',
'pointermove',
'keypress',
'keyup'
]; // disable patch specified eventNames

/*
* in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js
Expand Down
7 changes: 0 additions & 7 deletions apps/electron/src/assets/new-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

const { execSync } = require('child_process');
const { dirSync } = require('tmp');
const { lt } = require('semver');
const path = require('path');

const ngNewArgs = process.argv.slice(2);
Expand All @@ -15,12 +14,6 @@ const collection = (
try {
// check the correct version of the NPM is installed
const output = execSync('npm --version').toString();
if (lt(output, '5.0.0')) {
console.error(
'To create a workspace you must have NPM >= 5.0.0 installed.'
);
process.exit(1);
}
} catch (e) {
throw new Error('Cannot find npm. Do you have node installed?');
}
Expand Down
5 changes: 2 additions & 3 deletions apps/electron/src/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@
"main": "main.js",
"license": "MIT",
"dependencies": {
"semver": "5.6.0",
"tmp": "^0.1.0",
"tmp": "0.1.0",
"node-pty-prebuilt": "0.7.6",
"source-map-explorer": "^1.7.0"
"source-map-explorer": "1.8.0"
}
}
5 changes: 2 additions & 3 deletions apps/intellij/src/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@
"main": "main.js",
"license": "MIT",
"dependencies": {
"semver": "5.6.0",
"tmp": "^0.1.0",
"tmp": "0.1.0",
"node-pty-prebuilt": "0.7.6",
"source-map-explorer": "^1.7.0"
"source-map-explorer": "1.8.0"
}
}
5 changes: 2 additions & 3 deletions apps/vscode/src/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "angular-console",
"displayName": "Angular Console",
"description": "Angular Console for Visual Studio Code. The user interface app for the Angular CLI",
"version": "7.4.21",
"version": "7.4.22",
"repository": {
"type": "git",
"url": "https://github.com/nrwl/angular-console"
Expand Down Expand Up @@ -61,10 +61,9 @@
}
},
"dependencies": {
"semver": "5.6.0",
"tmp": "^0.1.0",
"node-pty-prebuilt": "0.7.6",
"fast-glob": "^2.2.6",
"source-map-explorer": "^1.7.0"
"source-map-explorer": "1.8.0"
}
}
18 changes: 7 additions & 11 deletions libs/feature-extensions/src/lib/extensions/extensions.component.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { Extension } from '@angular-console/schema';
import { Task, TaskCollection, TaskCollections } from '@angular-console/ui';
import { RouterNavigation } from '@angular-console/utils';
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { ActivatedRoute, NavigationEnd, Router } from '@angular/router';
import { Extension } from '@angular-console/schema';
import { combineLatest, Observable } from 'rxjs';
import {
distinctUntilChanged,
Expand All @@ -10,8 +12,7 @@ import {
startWith,
switchMap
} from 'rxjs/operators';
import { TaskCollection, TaskCollections, Task } from '@angular-console/ui';
import { EXTENSIONS_POLLING, RouterNavigation } from '@angular-console/utils';

import { WorkspaceAndExtensionsGQL } from '../generated/graphql';

interface ExtensionId {
Expand All @@ -34,14 +35,9 @@ export class ExtensionsComponent {
> = this.route.params.pipe(
map(m => m.path),
switchMap(path => {
return this.workspaceAndExtensionsGQL.watch(
{
path
},
{
pollInterval: EXTENSIONS_POLLING
}
).valueChanges;
return this.workspaceAndExtensionsGQL.fetch({
path
});
}),
map(r => {
const availableExtensions: Array<Extension> = (r as any).data
Expand Down
20 changes: 8 additions & 12 deletions libs/feature-generate/src/lib/schematics/schematics.component.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { Component, ChangeDetectionStrategy } from '@angular/core';
import { ActivatedRoute, NavigationEnd, Router } from '@angular/router';
import { Schematic, SchematicCollection } from '@angular-console/schema';
import { Task, TaskCollection, TaskCollections } from '@angular-console/ui';
import { SchematicCollection, Schematic } from '@angular-console/schema';
import { RouterNavigation } from '@angular-console/utils';
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { ActivatedRoute, NavigationEnd, Router } from '@angular/router';
import { combineLatest, Observable } from 'rxjs';
import {
distinctUntilChanged,
Expand All @@ -11,7 +12,7 @@ import {
startWith,
switchMap
} from 'rxjs/operators';
import { RouterNavigation, SCHEMATICS_POLLING } from '@angular-console/utils';

import { SchematicCollectionsGQL } from '../generated/graphql';

interface SchematicId {
Expand All @@ -30,14 +31,9 @@ export class SchematicsComponent {
> = this.route.params.pipe(
map(m => m.path),
switchMap(path => {
return this.schematicCollectionsGQL.watch(
{
path
},
{
pollInterval: SCHEMATICS_POLLING
}
).valueChanges;
return this.schematicCollectionsGQL.fetch({
path
});
}),
map(r => {
const collections: Array<SchematicCollection> = (r as any).data.workspace
Expand Down
28 changes: 12 additions & 16 deletions libs/feature-run/src/lib/targets/targets.component.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import { Component, ChangeDetectionStrategy } from '@angular/core';
import { ActivatedRoute, Router, NavigationEnd } from '@angular/router';
import { Task, TaskCollection, TaskCollections } from '@angular-console/ui';
import { NpmScripts, Project } from '@angular-console/schema';
import { Observable, combineLatest } from 'rxjs';
import { Task, TaskCollection, TaskCollections } from '@angular-console/ui';
import { RouterNavigation } from '@angular-console/utils';
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { ActivatedRoute, NavigationEnd, Router } from '@angular/router';
import { combineLatest, Observable } from 'rxjs';
import {
map,
switchMap,
distinctUntilChanged,
filter,
map,
startWith,
distinctUntilChanged
switchMap
} from 'rxjs/operators';
import { RouterNavigation, TARGET_POLLING } from '@angular-console/utils';

import { WorkspaceAndProjectsGQL } from '../generated/graphql';

interface Target {
Expand All @@ -29,14 +30,9 @@ export class TargetsComponent {
> = this.route.params.pipe(
map(m => m.path),
switchMap(path => {
return this.workspaceAndProjectsGQL.watch(
{
path
},
{
pollInterval: TARGET_POLLING
}
).valueChanges;
return this.workspaceAndProjectsGQL.fetch({
path
});
}),
map(r => {
const sortedProjects = (r as any).data.workspace.projects
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,8 @@ export class ProjectsComponent implements OnInit {
return combineLatest(
this.workspaceGQL.watch({ path }, POLLING).valueChanges,
this.workspaceSchematicsGQL
.watch({ path }, POLLING)
.valueChanges.pipe(
catchError(() => SCHEMATIC_COLLECTION_ERROR_RESPONSE)
)
.fetch({ path })
.pipe(catchError(() => SCHEMATIC_COLLECTION_ERROR_RESPONSE))
);
}),
filter(([r1, r2]) => Boolean(r1 && r2)),
Expand Down
17 changes: 4 additions & 13 deletions libs/feature-workspaces/src/lib/workspace/workspace.component.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import { IS_ELECTRON, IS_INTELLIJ } from '@angular-console/environment';
import { FADE_IN } from '@angular-console/ui';
import {
BASIC_WORKSPACE_POLLING,
EditorSupport,
Settings
} from '@angular-console/utils';
import { EditorSupport, Settings } from '@angular-console/utils';
import {
animate,
state,
Expand Down Expand Up @@ -130,14 +126,9 @@ export class WorkspaceComponent implements OnDestroy {
}> = this.route.params.pipe(
map(m => m.path),
switchMap(path => {
return this.basicWorkspaceGQL.watch(
{
path
},
{
pollInterval: BASIC_WORKSPACE_POLLING
}
).valueChanges;
return this.basicWorkspaceGQL.fetch({
path
});
}),
map((r: any) => r.data.workspace),
publishReplay(1),
Expand Down
6 changes: 3 additions & 3 deletions libs/server/src/lib/api/run-command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,14 @@ export const nodePtyPseudoTerminalFactory: PseudoTerminalFactory = ({
cwd
};

const nodePtyPrebilt = require('node-pty-prebuilt');
const nodePty = require('node-pty-prebuilt');
const commandRunning = isWsl
? nodePtyPrebilt.spawn(
? nodePty.spawn(
'wsl.exe',
['-e', 'bash', '-l', '-i', '-c', `${program} ${args.join(' ')}`],
opts
)
: nodePtyPrebilt.spawn(program, args, opts);
: nodePty.spawn(program, args, opts);

let currentCols = DEFAULT_COLS;
let terminated = false;
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,7 @@
"@nrwl/nx": "7.7.2",
"ij-rpc-client": "^0.3.2",
"node-pty-prebuilt": "0.7.6",
"semver": "5.6.0",
"source-map-explorer": "^1.7.0",
"source-map-explorer": "^1.8.0",
"stylelint": "^9.10.1",
"stylelint-config-standard": "^18.2.0",
"tmp": "^0.1.0"
Expand Down
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
"noUnusedLocals": true,
"noUnusedParameters": true,
"allowUnreachableCode": false,
"allowUnusedLabels": false,
"allowUnusedLabels": true,
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"typeRoots": [
"node_modules/@types",
"node_modules/node-pty-prebuilt/typings"
"node_modules/node-pty/typings"
],
"downlevelIteration": true,
"lib": ["es2017", "dom", "esnext.asynciterable"],
Expand Down
18 changes: 4 additions & 14 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -659,16 +659,6 @@
ts-simple-ast "^21.0.0"
uuid "3.3.2"

"@ngrx/[email protected]":
version "7.2.0"
resolved "https://registry.yarnpkg.com/@ngrx/schematics/-/schematics-7.2.0.tgz#2802a6f7533904967416de09c306e4149f58d1e6"
integrity sha512-BG1Sg3bWjrJBmwbCgmrjmaeWwqOHcQsZeavWx1oCkrrSR+7u2h6mwzIFiVZUqhs8DQw5THr91pe6rtpHKcQ6Yw==

"@ngrx/[email protected]":
version "7.2.0"
resolved "https://registry.yarnpkg.com/@ngrx/store-devtools/-/store-devtools-7.2.0.tgz#91e2287f0d67d4e79c51bd3d649a5013e71bbcad"
integrity sha512-t+8K1IG8+MvFqLIuRSM+ZE1EkZIuUExJ0JsqZR4r4K3MRPRoGy1ZqlStBWYaYLumEToesiCOGxuJYQ4zyVwlZg==

"@ngtools/json-schema@^1.1.0":
version "1.1.0"
resolved "https://registry.yarnpkg.com/@ngtools/json-schema/-/json-schema-1.1.0.tgz#c3a0c544d62392acc2813a42c8a0dc6f58f86922"
Expand Down Expand Up @@ -10903,9 +10893,9 @@ [email protected], postcss@^7.0.0, postcss@^7.0.1, postcss@^7.0.13, postcss@^7.0.14
supports-color "^6.1.0"

prebuild-install@^5.0.0:
version "5.2.5"
resolved "https://registry.yarnpkg.com/prebuild-install/-/prebuild-install-5.2.5.tgz#c7485911fe98950b7f7cd15bb9daee11b875cc44"
integrity sha512-6uZgMVg7yDfqlP5CPurVhtq3hUKBFNufiar4J5hZrlHTo59DDBEtyxw01xCdFss9j0Zb9+qzFVf/s4niayba3w==
version "5.3.0"
resolved "https://registry.yarnpkg.com/prebuild-install/-/prebuild-install-5.3.0.tgz#58b4d8344e03590990931ee088dd5401b03004c8"
integrity sha512-aaLVANlj4HgZweKttFNUVNRxDukytuIuxeK2boIMHjagNJCiVKWFsKF4tCE3ql3GbrD2tExPQ7/pwtEJcHNZeg==
dependencies:
detect-libc "^1.0.3"
expand-template "^2.0.3"
Expand Down Expand Up @@ -12405,7 +12395,7 @@ source-list-map@~0.1.7:
resolved "https://registry.yarnpkg.com/source-list-map/-/source-list-map-0.1.8.tgz#c550b2ab5427f6b3f21f5afead88c4f5587b2106"
integrity sha1-xVCyq1Qn9rPyH1r+rYjE9Vh7IQY=

source-map-explorer@^1.7.0:
source-map-explorer@^1.8.0:
version "1.8.0"
resolved "https://registry.yarnpkg.com/source-map-explorer/-/source-map-explorer-1.8.0.tgz#61cb8ffaff65d10ae2e6b60228fc625f523c41ff"
integrity sha512-1Q0lNSw5J7pChKmjqniOCLbvLFi4KJfrtixk99CzvRcqFiGBJvRHMrw0PjLwKOvbuAo8rNOukJhEPA0Nj85xDw==
Expand Down