Skip to content

Commit

Permalink
feat: remove unused pkg
Browse files Browse the repository at this point in the history
  • Loading branch information
kokororin committed Dec 23, 2023
1 parent 7cd966c commit 79250b9
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 20 deletions.
4 changes: 1 addition & 3 deletions .vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,5 @@ node_modules/**/.editorconfig
node_modules/**/LICENSE*
node_modules/**/license*
node_modules/**/test/*
node_modules/dayjs/esm
node_modules/dayjs/locale
node_modules/dayjs/plugin
node_modules/php-parser
node_modules/compare-versions/lib/esm
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -642,17 +642,17 @@
"mocha": "^9.2.0",
"prettier": "^3.1.0",
"rimraf": "^5.0.5",
"semver": "^7.5.4",
"simple-git": "^3.19.1",
"tsx": "^4.6.2",
"typescript": "^5.3.3"
},
"dependencies": {
"dayjs": "^1.11.10",
"compare-versions": "^6.1.0",
"detect-indent": "^6.0.0",
"find-up": "^5.0.0",
"mem": "^8.1.1",
"phpfmt": "^0.0.6",
"pjson": "^1.0.9",
"semver": "^7.5.4"
"pjson": "^1.0.9"
}
}
12 changes: 9 additions & 3 deletions src/PHPFmt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import fs from 'fs/promises';
import os from 'os';
import detectIndent from 'detect-indent';
import findUp from 'find-up';
import * as semver from 'semver';
import { compare } from 'compare-versions';
import phpfmt, { type PHPFmt as IPHPFmt } from 'phpfmt';
import { type Widget, PHPFmtStatus } from './Widget';
import { Transformation } from './Transformation';
Expand Down Expand Up @@ -213,11 +213,17 @@ export class PHPFmt {
const phpVersion = match[1];

if (this.config.use_old_phpfmt) {
if (semver.lt(phpVersion, '5.6.0') || semver.gt(phpVersion, '8.0.0')) {
if (
compare(phpVersion, '5.6.0', '<') ||
compare(phpVersion, '8.0.0', '>')
) {
throw new PHPFmtError('PHP version < 5.6 or > 8.0');
}
} else {
if (semver.lt(phpVersion, '5.6.0') || semver.gt(phpVersion, '8.3.0')) {
if (
compare(phpVersion, '5.6.0', '<') ||
compare(phpVersion, '8.3.0', '>')
) {
throw new PHPFmtError('PHP version < 5.6 or > 8.3');
}
}
Expand Down
7 changes: 2 additions & 5 deletions src/Widget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
type TextEditor,
ThemeColor
} from 'vscode';
import dayjs from 'dayjs';

export enum PHPFmtStatus {
Ready = 'check-all',
Expand Down Expand Up @@ -79,10 +78,8 @@ export class Widget {
}

private logMessage(message: string, logLevel: LogLevel): void {
const now = dayjs();
this.outputChannel.appendLine(
`${now.format('HH:mm:ss.SSS')} [${logLevel}] ${message}`
);
const now = new Date().toLocaleString();
this.outputChannel.appendLine(`${now} [${logLevel}] ${message}`);
}

private logObject(data: unknown): void {
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"sourceMap": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"useUnknownInCatchVariables": false,
"useUnknownInCatchVariables": false
},
"exclude": [
"node_modules",
Expand Down
10 changes: 5 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -674,6 +674,11 @@ color-name@~1.1.4:
resolved "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2"
integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==

compare-versions@^6.1.0:
version "6.1.0"
resolved "https://registry.yarnpkg.com/compare-versions/-/compare-versions-6.1.0.tgz#3f2131e3ae93577df111dba133e6db876ffe127a"
integrity sha512-LNZQXhqUvqUTotpZ00qLSaify3b4VFD588aRr8MKFw4CMUr98ytzCW5wDH5qx/DEY5kCDXcbcRuCqL0szEf2tg==

[email protected]:
version "0.0.1"
resolved "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
Expand All @@ -698,11 +703,6 @@ [email protected]:
resolved "https://registry.yarnpkg.com/crypt/-/crypt-0.0.2.tgz#88d7ff7ec0dfb86f713dc87bbb42d044d3e6c41b"
integrity sha512-mCxBlsHFYh9C+HVpiEacem8FEBnMXgU9gy4zmNC+SXAZNB/1idgp/aulFJ4FgCi7GPEVbfyng092GqL2k2rmow==

dayjs@^1.11.10:
version "1.11.10"
resolved "https://registry.yarnpkg.com/dayjs/-/dayjs-1.11.10.tgz#68acea85317a6e164457d6d6947564029a6a16a0"
integrity sha512-vjAczensTgRcqDERK0SR2XMwsF/tSvnvlv6VcF2GIhg6Sx4yOIt/irsr1RDJsKiIyBzJDpCoXiWWq28MqH2cnQ==

debug@4, debug@^4.1.1, debug@^4.3.2, debug@^4.3.4:
version "4.3.4"
resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865"
Expand Down

0 comments on commit 79250b9

Please sign in to comment.