@10stars/config 15.3.0 → 15.5.0

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.
Files changed (2) hide show
  1. package/package.json +11 -10
  2. package/src/index.ts +26 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@10stars/config",
3
- "version": "15.3.0",
3
+ "version": "15.5.0",
4
4
  "private": false,
5
5
  "bin": {
6
6
  "config": "./src/index.ts"
@@ -17,20 +17,21 @@
17
17
  "access": "public"
18
18
  },
19
19
  "scripts": {
20
+ "postinstall": "bun ./src/index.ts prepare",
20
21
  "prepublishOnly": "cd .. && bun run config typecheck && bun run config lint && bunx oxlint --type-aware -c ./config/oxlint.config.browser.json */src */scripts */. --ignore-pattern '**/node_modules/**' --ignore-pattern '**/dist/**' && bun run config --help"
21
22
  },
22
23
  "dependencies": {
23
24
  "@10stars/oxlint-plugin-react-hooks": "^1.0.5",
24
25
  "@oxc-node/core": "0.1.0",
25
- "@types/bun": "^1.0.0",
26
+ "@types/bun": "^1.3.14",
26
27
  "@types/node": "^24.0.0",
27
- "@types/react": "^19.0.0",
28
- "husky": "^9.0.0",
29
- "oxfmt": "^0.45.0",
30
- "oxlint": "^1.60.0",
31
- "oxlint-tsgolint": "^0.21.1",
32
- "tsx": "^4.21.0",
33
- "type-fest": "^5.0.0",
34
- "typescript": "~6.0.2"
28
+ "@types/react": "^19.2.14",
29
+ "husky": "^9.1.7",
30
+ "oxfmt": "^0.50.0",
31
+ "oxlint": "^1.65.0",
32
+ "oxlint-tsgolint": "^0.22.1",
33
+ "tsx": "^4.22.0",
34
+ "type-fest": "^5.6.0",
35
+ "typescript": "~6.0.3"
35
36
  }
36
37
  }
package/src/index.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  #!/usr/bin/env bun
2
2
  import { execSync } from "node:child_process"
3
- import { existsSync } from "node:fs"
4
3
  import fs from "node:fs/promises"
5
4
  import path from "node:path"
6
5
 
@@ -9,7 +8,7 @@ import { checkIsMonorepo, linkPackages } from "./link-packages"
9
8
  import { runConcurrently, type CommandConfig } from "./runner"
10
9
  import { setupVSCode } from "./vscode-config"
11
10
 
12
- const cwd = process.env.PWD!
11
+ const cwd = process.env.INIT_CWD || process.env.PWD!
13
12
 
14
13
  interface Config {
15
14
  linkPackages: string[]
@@ -165,6 +164,31 @@ Examples:
165
164
  await runConcurrently(commands)
166
165
  },
167
166
  },
167
+ killPort: {
168
+ info: `Kill process on port(s)`,
169
+ action: () => {
170
+ const ports = process.argv.slice(3)
171
+ if (!ports.length) {
172
+ console.error(`At least one port required`)
173
+ process.exit(1)
174
+ }
175
+ for (const port of ports) {
176
+ try {
177
+ if (process.platform === "win32") {
178
+ execSync(
179
+ `for /f "tokens=5" %a in ('netstat -aon ^| findstr :${port}') do taskkill /F /PID %a`,
180
+ { stdio: "inherit" },
181
+ )
182
+ } else {
183
+ execSync(`lsof -ti :${port} | xargs kill -9`, { stdio: "inherit" })
184
+ }
185
+ console.info(`Killed process on port ${port}`)
186
+ } catch {
187
+ console.info(`No process found on port ${port}`)
188
+ }
189
+ }
190
+ },
191
+ },
168
192
  } satisfies Record<string, { info: string; action: () => void | Promise<void> }>
169
193
 
170
194
  export const run = async () => {