Skip to content

Commit

Permalink
fix: typo error handler, version and dependence (#160)
Browse files Browse the repository at this point in the history
  • Loading branch information
CAIMEOX authored Feb 19, 2024
1 parent c49972d commit eb32a72
Show file tree
Hide file tree
Showing 14 changed files with 42 additions and 42 deletions.
4 changes: 2 additions & 2 deletions src/handlers/code.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { existsSync } from 'fs';
import IO from '../base/io.js';
import DelayHanlderWithInfo from './delayInfo.js';
import DelayHandlerWithInfo from './delayInfo.js';
import { DefaultCode, TSCONFIG } from '../base/constants.js';

class CodeClass extends DelayHanlderWithInfo {
class CodeClass extends DelayHandlerWithInfo {
constructor() {
super();
this.tsconfig = {};
Expand Down
4 changes: 2 additions & 2 deletions src/handlers/config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import IO from '../base/io.js';
import DelayHanlder from './delay.js';
import DelayHandler from './delay.js';
import InfoHandler from './information.js';
import { existsSync, readFileSync } from 'fs';

class ConfigClass extends DelayHanlder {
class ConfigClass extends DelayHandler {
constructor() {
super();
this.context = {};
Expand Down
4 changes: 2 additions & 2 deletions src/handlers/delay.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class DelayHanlder {
class DelayHandler {
constructor() {
this.updated = false;
}
Expand All @@ -17,4 +17,4 @@ class DelayHanlder {
}
}

export default DelayHanlder;
export default DelayHandler;
4 changes: 2 additions & 2 deletions src/handlers/delayInfo.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import InfoHandler from './information.js';

class DelayHanlderWithInfo {
class DelayHandlerWithInfo {
constructor() {
this.updated = false;
this.info = {};
Expand All @@ -27,4 +27,4 @@ class DelayHanlderWithInfo {
}
}

export default DelayHanlderWithInfo;
export default DelayHandlerWithInfo;
14 changes: 7 additions & 7 deletions src/handlers/extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ import Others from './others.js';
import NpmHandler from './npm.js';
import LogoHandler from './logo.js';
import GulpHandler from './gulp.js';
import DelayHanlder from './delay.js';
import DelayHandler from './delay.js';
import ConfigRender from './config.js';
import MirrorHandler from './mirror.js';
import NetWork from '../base/network.js';
import ModuleResolver from './module.js';
import InfoHandler from './information.js';
import VerionsHandler from './versions.js';
import VersionsHandler from './versions.js';
import ManifestHandler from './manifest.js';
import DelayHanlderWithInfo from './delayInfo.js';
import DelayHandlerWithInfo from './delayInfo.js';
import { done, error, start } from '../base/console.js';

class ExtensionClass {
Expand All @@ -36,7 +36,7 @@ class ExtensionClass {
this.context.extension.push(packageName);
IO.writeJSON('.serein.json', this.context);

done('Intstall extension.');
done('Install extension.');
}

async uninstall(packageName) {
Expand Down Expand Up @@ -72,15 +72,15 @@ class ExtensionClass {
NpmHandler,
LogoHandler,
GulpHandler,
DelayHanlder,
DelayHandler,
ConfigRender,
MirrorHandler,
NetWork,
ModuleResolver,
InfoHandler,
VerionsHandler,
VersionsHandler,
ManifestHandler,
DelayHanlderWithInfo
DelayHandlerWithInfo
});
}
} catch (e) {
Expand Down
4 changes: 2 additions & 2 deletions src/handlers/gulp.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import IO from '../base/io.js';
import NetWork from '../base/network.js';
import DelayHanlder from './delayInfo.js';
import DelayHandler from './delayInfo.js';
import { start, done } from '../base/console.js';

class GulpClass extends DelayHanlder {
class GulpClass extends DelayHandler {
constructor() {
super();
this.context = '';
Expand Down
4 changes: 2 additions & 2 deletions src/handlers/information.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable no-mixed-spaces-and-tabs */
/* eslint-disable indent */
import DelayHanlder from './delay.js';
import DelayHandler from './delay.js';
import { basename, join } from 'path';
import ConfigRender from './config.js';
import { magenta } from '../base/console.js';
Expand All @@ -12,7 +12,7 @@ import {
askProjectInfo
} from '../base/inquirer.js';

class InfoClass extends DelayHanlder {
class InfoClass extends DelayHandler {
constructor() {
super();
this.info = {};
Expand Down
4 changes: 2 additions & 2 deletions src/handlers/logo.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import IO from '../base/io.js';
import Fractal from '../base/fractal.js';
import { start, done } from '../base/console.js';
import DelayHanlderWithInfo from './delayInfo.js';
import DelayHandlerWithInfo from './delayInfo.js';

class LogoClass extends DelayHanlderWithInfo {
class LogoClass extends DelayHandlerWithInfo {
constructor() {
super();
this.png = '';
Expand Down
10 changes: 5 additions & 5 deletions src/handlers/manifest.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import IO from '../base/io.js';
import { existsSync } from 'fs';
import { v4 as uuid } from 'uuid';
import InfoHandler from './information.js';
import DelayHanlderWithInfo from './delayInfo.js';
import DelayHandlerWithInfo from './delayInfo.js';

class ManifestClass extends DelayHanlderWithInfo {
class ManifestClass extends DelayHandlerWithInfo {
constructor() {
super();
this.behContext = {};
Expand Down Expand Up @@ -94,7 +94,7 @@ class ManifestClass extends DelayHanlderWithInfo {
.map((v) => v.module_name);
}

findDependeceIdx(packageName) {
findDependenceIdx(packageName) {
for (const idx in this.behContext.dependencies) {
if (!this.behContext.dependencies[idx].module_name) continue;
if (this.behContext.dependencies[idx].module_name === packageName) {
Expand All @@ -104,12 +104,12 @@ class ManifestClass extends DelayHanlderWithInfo {
}

switchVersion(packageName, version) {
const idx = this.findDependeceIdx(packageName);
const idx = this.findDependenceIdx(packageName);
this.behContext.dependencies[idx].version = version;
}

deleteDependence(packageName) {
const idx = this.findDependeceIdx(packageName);
const idx = this.findDependenceIdx(packageName);
this.behContext.dependencies.splice(idx, 1);
}

Expand Down
4 changes: 2 additions & 2 deletions src/handlers/mirror.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import axios from 'axios';
import DelayHanlder from './delay.js';
import DelayHandler from './delay.js';
import { Mirrors } from '../base/constants.js';
import { magenta, done, start } from '../base/console.js';

class MirrorClass extends DelayHanlder {
class MirrorClass extends DelayHandler {
constructor(mirror) {
super();
this.mirrors = mirror;
Expand Down
12 changes: 6 additions & 6 deletions src/handlers/module.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import NpmHandler from './npm.js';
import NetWork from '../base/network.js';
import VerionsHandler from './versions.js';
import VersionsHandler from './versions.js';
import { warning } from '../base/console.js';
import DelayHanlderWithInfo from './delayInfo.js';
import DelayHandlerWithInfo from './delayInfo.js';
import { SERVER, ALL } from '../base/constants.js';

class ModuleClass extends DelayHanlderWithInfo {
class ModuleClass extends DelayHandlerWithInfo {
constructor() {
super();
this.packages = {};
Expand All @@ -28,22 +28,22 @@ class ModuleClass extends DelayHanlderWithInfo {
'You should make sure the dependencies are well organized if you want to use dependencies (latest version) besides @mc/server.'
)
);
this.packages = await VerionsHandler.getPackageVersions(ALL);
this.packages = await VersionsHandler.getPackageVersions(ALL);
}
} else if (mode === 'switch') {
if (auto) {
this.packages = {
[SERVER]: await NetWork.getLatestVersion(SERVER)
};
} else {
this.packages = await VerionsHandler.getPackageVersions(
this.packages = await VersionsHandler.getPackageVersions(
Object.keys(await NpmHandler.getDependencies()).filter(
(v) => ALL.includes(v)
)
);
}
} else if (mode === 'module') {
this.packages = await VerionsHandler.getPackageVersions(
this.packages = await VersionsHandler.getPackageVersions(
ALL,
Object.keys(await NpmHandler.getDependencies()).filter((v) =>
ALL.includes(v)
Expand Down
4 changes: 2 additions & 2 deletions src/handlers/npm.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { existsSync } from 'fs';
import { deleteSync } from 'del';
import MirrorHandler from './mirror.js';
import { ALL } from '../base/constants.js';
import DelayHanlderWithInfo from './delayInfo.js';
import DelayHandlerWithInfo from './delayInfo.js';
import { accept, start, done } from '../base/console.js';

function checkPnpm() {
Expand All @@ -15,7 +15,7 @@ function checkPnpm() {
return true;
}

class NpmClass extends DelayHanlderWithInfo {
class NpmClass extends DelayHandlerWithInfo {
constructor() {
super();
this.package = {};
Expand Down
4 changes: 2 additions & 2 deletions src/handlers/others.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import IO from '../base/io.js';
import DelayHanlderWithInfo from './delayInfo.js';
import DelayHandlerWithInfo from './delayInfo.js';
import { MCATTRIBUTES } from '../base/constants.js';

class OthersClass extends DelayHanlderWithInfo {
class OthersClass extends DelayHandlerWithInfo {
constructor() {
super();
}
Expand Down
8 changes: 4 additions & 4 deletions src/handlers/versions.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/* eslint-disable indent */
import inquirer from 'inquirer';
import NetWork from '../base/network.js';
import DelayHanlderWithInfo from './delayInfo.js';
import DelayHandlerWithInfo from './delayInfo.js';
import { DATA, SERVER } from '../base/constants.js';
import { start, done, magenta } from '../base/console.js';

Expand All @@ -18,7 +18,7 @@ async function promptUser(message, choices) {
return selected;
}

class Versions extends DelayHanlderWithInfo {
class Versions extends DelayHandlerWithInfo {
constructor() {
super();
}
Expand Down Expand Up @@ -156,6 +156,6 @@ class Versions extends DelayHanlderWithInfo {
}
}

const VerionsHandler = new Versions();
const VersionsHandler = new Versions();

export default VerionsHandler;
export default VersionsHandler;

0 comments on commit eb32a72

Please sign in to comment.