Skip to content

Commit

Permalink
refactor: disable getNpmOutdated (#2486)
Browse files Browse the repository at this point in the history
* feat: disable getNpmOutdated

* fix: disable socket

* refactor: disable get latestVersion

* chore: remove import
  • Loading branch information
alvinhui authored and chenbin92 committed Jul 18, 2019
1 parent a48e8c1 commit 49ecd27
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion packages/iceworks-client/src/hooks/useTask.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const useTask = ({ type, writeLog, writeChunk }) => {
reset: installDependency,
onResetModal: installDependencyVisible,
setResetModal: setInstallDependencyVisible,
} = useDependency(false, writeChunk, false);
} = useDependency(true, writeChunk, false);
const taskErrorEventName = `adapter.task.error`;

async function onStart() {
Expand Down
2 changes: 1 addition & 1 deletion packages/iceworks-server/src/interface/dependency.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export interface IDependency {
/**
* 最新版本
*/
latestVestion?: string;
latestVersion?: string;

/**
* 是否本地依赖 devDependencies ?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as fsExtra from 'fs-extra';
import * as util from 'util';
import * as rimraf from 'rimraf';
import * as execa from 'execa';
import * as latestVersion from 'latest-version';
// import * as latestVersion from 'latest-version';
import getNpmClient from '../../../getNpmClient';

import { IDependency, IProject, ICreateDependencyParam, IDependencyModule, ISocket, IContext } from '../../../../interface';
Expand Down Expand Up @@ -81,7 +81,6 @@ export default class Dependency implements IDependencyModule {
return version;
}

// TODO any other way?
private async getNpmOutdated(): Promise<INpmOutdatedData[]> {
let npmOutdated = [];

Expand Down Expand Up @@ -142,7 +141,9 @@ export default class Dependency implements IDependencyModule {
specifyVersion,
dev,
localVersion,
latestVersion: await latestVersion(packageName),

// TODO get latestVersion is so slow, so we disable it now
// latestVersion: await latestVersion(packageName),
};
}));
};
Expand All @@ -157,7 +158,8 @@ export default class Dependency implements IDependencyModule {
devDependencies = await getAll(packageDevDependencies, true);
}

const npmOutdated: INpmOutdatedData[] = await this.getNpmOutdated();
// TODO getNpmOutdated is so slow, so we disable it now
const npmOutdated: INpmOutdatedData[] = []; // await this.getNpmOutdated();
npmOutdated.forEach(({ package: _outPackage, wanted }: INpmOutdatedData) => {
const dependency = dependencies.find(({ package: packageName }) => packageName === _outPackage);
if (dependency && dependency.localVersion && dependency.localVersion !== wanted) {
Expand Down

0 comments on commit 49ecd27

Please # to comment.