Skip to content

Commit

Permalink
perf: remove unused packages
Browse files Browse the repository at this point in the history
  • Loading branch information
kokororin committed Dec 10, 2023
1 parent f662cad commit 4637ee2
Show file tree
Hide file tree
Showing 5 changed files with 167 additions and 660 deletions.
11 changes: 4 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
"description": "Integrates phpfmt into VS Code",
"main": "./out/src/extension",
"scripts": {
"build": "npm run trash && tsc -p ./",
"build": "npm run clean && tsc",
"prebuild": "npm run generate",
"watch": "tsc -watch -p ./",
"trash": "trash out",
"clean": "rimraf out",
"generate": "tsx scripts/generate.ts",
"postinstall": "node ./node_modules/phpfmt/v2/install",
"pretest": "npm run build",
"test": "cross-env CODE_TESTS_WORKSPACE=testProject node ./out/test/runTest.js",
"test": "node ./out/test/runTest.js",
"format": "prettier --write .",
"lint": "eslint --ext .ts,.js --fix src test scripts",
"prepublishOnly": "npm run build && vsce publish"
Expand Down Expand Up @@ -620,7 +620,6 @@
"@kokororin/prettierrc": "^0.1.1",
"@types/adm-zip": "^0.5.0",
"@types/debug": "^4.1.8",
"@types/fs-extra": "^11.0.1",
"@types/md5": "^2.3.2",
"@types/mocha": "^9.1.0",
"@types/node": "^17.0.13",
Expand All @@ -630,7 +629,6 @@
"@typescript-eslint/parser": "^6.13.2",
"@vscode/test-electron": "^2.3.8",
"adm-zip": "^0.5.10",
"cross-env": "^7.0.3",
"eslint": "^8.55.0",
"eslint-config-prettier": "^9.1.0",
"eslint-config-standard-with-typescript": "^42.0.0",
Expand All @@ -640,12 +638,11 @@
"eslint-plugin-prettier": "^5.0.1",
"eslint-plugin-promise": "^6.1.1",
"fast-glob": "^3.3.2",
"fs-extra": "^11.1.1",
"md5": "^2.3.0",
"mocha": "^9.2.0",
"prettier": "^3.1.0",
"rimraf": "^5.0.5",
"simple-git": "^3.19.1",
"trash-cli": "^5.0.0",
"tsx": "^4.6.2",
"typescript": "^5.3.3"
},
Expand Down
2 changes: 1 addition & 1 deletion scripts/generate.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import path from 'path';
import os from 'os';
import * as fs from 'fs-extra';
import fs from 'fs/promises';
import phpfmt from 'phpfmt';
import { Transformation } from '../src/Transformation';

Expand Down
6 changes: 2 additions & 4 deletions scripts/release.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import path from 'path';
import os from 'os';
import * as fs from 'fs-extra';
import fs from 'fs/promises';
import phpfmt from 'phpfmt';
import AdmZip from 'adm-zip';
import md5 from 'md5';
Expand Down Expand Up @@ -28,9 +28,7 @@ void (async () => {
console.log(`Download url: ${pharUrl}`);

const tmpDir = path.join(os.tmpdir(), 'vscode-phpfmt');
if (!(await fs.pathExists(tmpDir))) {
await fs.mkdirp(tmpDir);
}
await fs.mkdir(tmpDir, { recursive: true });
const currentVsixPath = path.join(tmpDir, `${currentVersion}.vsix`);
const latestPharPath = path.join(tmpDir, phpfmt.v2.pharName);
const latestPharVersionPath = path.join(
Expand Down
12 changes: 6 additions & 6 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ import childProcess, { type ExecOptions } from 'child_process';
import fs, { type ObjectEncodingOptions } from 'fs';
import https from 'https';

export const exec = async (
export async function exec(
command: string,
options?: (ObjectEncodingOptions & ExecOptions) | undefined | null
): Promise<{
stdout: string;
stderr: string;
code: number | null;
}> => {
}> {
return await new Promise((resolve, reject) => {
const child = childProcess.exec(
command,
Expand All @@ -29,12 +29,12 @@ export const exec = async (

child.on('error', reject);
});
};
}

export const downloadFile = async (
export async function downloadFile(
url: string,
filePath: string
): Promise<void> => {
): Promise<void> {
await new Promise<void>((resolve, reject) => {
https
.get(url, res => {
Expand All @@ -49,4 +49,4 @@ export const downloadFile = async (
reject(err);
});
});
};
}
Loading

0 comments on commit 4637ee2

Please sign in to comment.