Skip to content

Commit 1a648f2

Browse files
committed
Add VSCode launch
1 parent f736006 commit 1a648f2

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

.vscode/launch.json

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@
55
"version": "0.2.0",
66
"configurations": [
77
{
8-
"name": "Attach",
9-
"port": 9229,
10-
"request": "attach",
11-
"sourceMaps": true,
8+
"name": "Debug",
9+
"type": "node",
10+
"request": "launch",
11+
"runtimeExecutable": "npm",
12+
"runtimeArgs": ["run", "debug", "pnpm", "run", "test:unit"],
1213
"skipFiles": ["<node_internals>/**"],
13-
"type": "node"
14+
"sourceMaps": true,
15+
"cwd": "${workspaceFolder}"
1416
}
1517
]
1618
}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"build": "tsc",
1515
"start": "node dist/index.js",
1616
"dev": "tsx src/index.ts",
17+
"debug": "tsx --inspect src/index.ts",
1718
"test": "vitest --watch=false",
1819
"test:unit": "vitest run src/__tests__/fix-parser.test.ts",
1920
"prepublish": "npm run build"

src/fix.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,10 @@ async function processFileFix(
139139
options: { autoApply?: boolean }
140140
) {
141141
const fullPath = path.join(process.cwd(), file.filePath);
142+
if (!fs.existsSync(fullPath)) {
143+
ui.appendOutputLog(`${file.filePath} does not exist. Creating it...\n`);
144+
fs.writeFileSync(fullPath, "", "utf8");
145+
}
142146
const originalContent = await fs.promises.readFile(fullPath, "utf8");
143147

144148
const messages = createFixMessages(file, originalContent, config);

0 commit comments

Comments
 (0)