@10stars/config 15.0.11 → 15.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -3
- package/src/vscode-config.ts +11 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@10stars/config",
|
|
3
|
-
"version": "15.0.
|
|
3
|
+
"version": "15.0.13",
|
|
4
4
|
"private": false,
|
|
5
5
|
"bin": {
|
|
6
6
|
"config": "./src/index.ts"
|
|
@@ -17,14 +17,14 @@
|
|
|
17
17
|
"access": "public"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@10stars/oxlint-plugin-react-hooks": "^1.0.
|
|
20
|
+
"@10stars/oxlint-plugin-react-hooks": "^1.0.5",
|
|
21
21
|
"@oxc-node/core": "0.0.35",
|
|
22
22
|
"@types/node": "^24.0.0",
|
|
23
23
|
"@types/react": "^19.0.0",
|
|
24
24
|
"husky": "^9.0.0",
|
|
25
25
|
"oxfmt": "0.21.0",
|
|
26
26
|
"oxlint": "1.36.0",
|
|
27
|
-
"oxlint-tsgolint": "0.10.
|
|
27
|
+
"oxlint-tsgolint": "0.10.1",
|
|
28
28
|
"tsx": "^4.21.0",
|
|
29
29
|
"type-fest": "^5.0.0",
|
|
30
30
|
"typescript": "~5.9.3"
|
package/src/vscode-config.ts
CHANGED
|
@@ -2,6 +2,12 @@ import fs from "node:fs/promises"
|
|
|
2
2
|
import path from "node:path"
|
|
3
3
|
import { execSync } from "node:child_process"
|
|
4
4
|
|
|
5
|
+
// Strip JSONC comments while preserving strings (regex matches strings first to skip them)
|
|
6
|
+
const stripJsoncComments = (jsonc: string): string =>
|
|
7
|
+
jsonc.replace(/"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'|\/\/[^\n]*|\/\*[\s\S]*?\*\//g, (match) =>
|
|
8
|
+
match.startsWith("/") ? "" : match,
|
|
9
|
+
)
|
|
10
|
+
|
|
5
11
|
const extensionsJson = {
|
|
6
12
|
recommendations: ["oxc.oxc-vscode"],
|
|
7
13
|
unwantedRecommendations: [
|
|
@@ -94,17 +100,16 @@ export const setupVSCode = async (cwd: string) => {
|
|
|
94
100
|
let existingSettings: Record<string, unknown> = {}
|
|
95
101
|
try {
|
|
96
102
|
const existingContent = await fs.readFile(settingsPath, "utf8")
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
} catch {
|
|
103
|
+
existingSettings = JSON.parse(stripJsoncComments(existingContent))
|
|
104
|
+
} catch (error) {
|
|
105
|
+
console.error("Error reading or parsing settings.json:", error)
|
|
101
106
|
// File doesn't exist or is invalid JSON, start fresh
|
|
102
107
|
}
|
|
103
108
|
|
|
104
109
|
const sortedSettings: Record<string, unknown> = sortObjectKeys(settingsJson)
|
|
105
110
|
|
|
106
|
-
if (existingSettings.
|
|
107
|
-
sortedSettings.
|
|
111
|
+
if (existingSettings["serverlessConsole.services"]) {
|
|
112
|
+
sortedSettings["serverlessConsole.services"] = existingSettings["serverlessConsole.services"] // Add serverlessConsole.services last (after sorting) to keep it at the bottom
|
|
108
113
|
}
|
|
109
114
|
|
|
110
115
|
await fs.writeFile(settingsPath, JSON.stringify(sortedSettings, null, 2) + "\n")
|