Skip to content

Commit 4c298f3

Browse files
committed
Format
1 parent b4920eb commit 4c298f3

File tree

1 file changed

+43
-41
lines changed

1 file changed

+43
-41
lines changed

scripts/verify-package.mjs

Lines changed: 43 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,19 @@
55
* are included in the packaged .vsix file
66
*/
77

8-
import fs from 'fs';
9-
import path from 'path';
10-
import { fileURLToPath } from 'url';
11-
import { execSync } from 'child_process';
8+
import fs from "fs";
9+
import path from "path";
10+
import { fileURLToPath } from "url";
11+
import { execSync } from "child_process";
1212

1313
const __filename = fileURLToPath(import.meta.url);
1414
const __dirname = path.dirname(__filename);
15-
const ROOT_DIR = path.join(__dirname, '..');
15+
const ROOT_DIR = path.join(__dirname, "..");
1616

1717
// Find .vsix file
18-
const vsixFiles = fs.readdirSync(ROOT_DIR)
19-
.filter(f => f.endsWith('.vsix'))
18+
const vsixFiles = fs
19+
.readdirSync(ROOT_DIR)
20+
.filter((f) => f.endsWith(".vsix"))
2021
.sort((a, b) => {
2122
const statA = fs.statSync(path.join(ROOT_DIR, a));
2223
const statB = fs.statSync(path.join(ROOT_DIR, b));
@@ -32,53 +33,53 @@ const vsixFile = vsixFiles[0];
3233
console.log(`Checking ${vsixFile}...\n`);
3334

3435
// Extract and check contents
35-
const tempDir = path.join(ROOT_DIR, '.vsix-check');
36+
const tempDir = path.join(ROOT_DIR, ".vsix-check");
3637
try {
3738
fs.mkdirSync(tempDir, { recursive: true });
38-
39+
3940
// .vsix is just a zip file
4041
execSync(`unzip -q "${path.join(ROOT_DIR, vsixFile)}" -d "${tempDir}"`, {
41-
stdio: 'inherit'
42+
stdio: "inherit",
4243
});
43-
44-
const extensionDir = path.join(tempDir, 'extension');
45-
const oxcParserDir = path.join(extensionDir, 'node_modules', '@oxc-parser');
46-
44+
45+
const extensionDir = path.join(tempDir, "extension");
46+
const oxcParserDir = path.join(extensionDir, "node_modules", "@oxc-parser");
47+
4748
// Platform-specific bindings that should be included
4849
const platformBindings = [
49-
'@oxc-parser/binding-darwin-arm64',
50-
'@oxc-parser/binding-darwin-x64',
51-
'@oxc-parser/binding-linux-x64-gnu',
52-
'@oxc-parser/binding-win32-x64-msvc',
50+
"@oxc-parser/binding-darwin-arm64",
51+
"@oxc-parser/binding-darwin-x64",
52+
"@oxc-parser/binding-linux-x64-gnu",
53+
"@oxc-parser/binding-win32-x64-msvc",
5354
];
54-
55+
5556
const checks = [
5657
{
57-
name: 'oxc-parser',
58-
path: path.join(extensionDir, 'node_modules', 'oxc-parser'),
59-
required: true
58+
name: "oxc-parser",
59+
path: path.join(extensionDir, "node_modules", "oxc-parser"),
60+
required: true,
6061
},
61-
...platformBindings.map(binding => ({
62+
...platformBindings.map((binding) => ({
6263
name: binding,
63-
path: path.join(oxcParserDir, binding.replace('@oxc-parser/', '')),
64-
required: true
65-
}))
64+
path: path.join(oxcParserDir, binding.replace("@oxc-parser/", "")),
65+
required: true,
66+
})),
6667
];
67-
68+
6869
let allGood = true;
6970
let foundCount = 0;
70-
71+
7172
for (const check of checks) {
7273
const exists = fs.existsSync(check.path);
73-
const status = exists ? '✓' : '✗';
74-
console.log(`${status} ${check.name}: ${exists ? 'FOUND' : 'MISSING'}`);
75-
74+
const status = exists ? "✓" : "✗";
75+
console.log(`${status} ${check.name}: ${exists ? "FOUND" : "MISSING"}`);
76+
7677
if (exists) {
7778
foundCount++;
7879
// Check for key files in bindings
79-
if (check.name.startsWith('@oxc-parser/binding-')) {
80+
if (check.name.startsWith("@oxc-parser/binding-")) {
8081
// Look for .node files (native bindings) or package.json
81-
const packageJson = path.join(check.path, 'package.json');
82+
const packageJson = path.join(check.path, "package.json");
8283
if (fs.existsSync(packageJson)) {
8384
console.log(` ✓ package.json found`);
8485
} else {
@@ -90,17 +91,19 @@ try {
9091
allGood = false;
9192
}
9293
}
93-
94-
console.log('');
94+
95+
console.log("");
9596
console.log(`Found ${foundCount}/${checks.length} required packages`);
96-
97+
9798
if (allGood && foundCount === checks.length) {
98-
console.log('✓ All required files are included in the package!');
99+
console.log("✓ All required files are included in the package!");
99100
} else {
100-
console.log('✗ Some required files are missing!');
101+
console.log("✗ Some required files are missing!");
101102
if (foundCount < platformBindings.length) {
102-
console.log(` Warning: Only ${foundCount - 1} platform bindings found, expected ${platformBindings.length}`);
103-
console.log(' The extension may not work on all platforms.');
103+
console.log(
104+
` Warning: Only ${foundCount - 1} platform bindings found, expected ${platformBindings.length}`,
105+
);
106+
console.log(" The extension may not work on all platforms.");
104107
}
105108
process.exit(1);
106109
}
@@ -110,4 +113,3 @@ try {
110113
fs.rmSync(tempDir, { recursive: true, force: true });
111114
}
112115
}
113-

0 commit comments

Comments
 (0)