@take-out/scripts 0.4.25 → 0.4.26

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@take-out/scripts",
3
- "version": "0.4.25",
3
+ "version": "0.4.26",
4
4
  "type": "module",
5
5
  "main": "./src/cmd.ts",
6
6
  "sideEffects": false,
@@ -29,8 +29,8 @@
29
29
  },
30
30
  "dependencies": {
31
31
  "@clack/prompts": "^0.8.2",
32
- "@take-out/helpers": "0.4.25",
33
- "@take-out/run": "0.4.25",
32
+ "@take-out/helpers": "0.4.26",
33
+ "@take-out/run": "0.4.26",
34
34
  "picocolors": "^1.1.1"
35
35
  }
36
36
  }
@@ -1,68 +0,0 @@
1
- #!/usr/bin/env bun
2
-
3
- import { execFileSync } from 'node:child_process'
4
- import fs from 'node:fs'
5
-
6
- import { cmd } from './cmd'
7
-
8
- function getCurrentNodeVersion() {
9
- // under bun, process.version is bun's bundled node-COMPAT string (a fixed
10
- // value like v24.3.0), not the project's actual node toolchain — comparing
11
- // it against engines.node rejects any pin newer than bun's compat level.
12
- // the check exists to guard native-addon ABI for the real `node` binary
13
- // child processes will run, so resolve that binary's version from PATH.
14
- if (process.versions.bun) {
15
- try {
16
- return execFileSync('node', ['--version'], { encoding: 'utf-8' }).trim()
17
- } catch {
18
- // no node on PATH — nothing for the version pin to guard
19
- return null
20
- }
21
- }
22
- return process.version
23
- }
24
-
25
- async function getRequiredNodeVersion() {
26
- const path = await import('node:path')
27
-
28
- // try .node-version file first
29
- try {
30
- const nodeVersionContent = await fs.promises.readFile(
31
- path.join(process.cwd(), '.node-version'),
32
- 'utf-8',
33
- )
34
- return `v${nodeVersionContent.trim()}`
35
- } catch {}
36
-
37
- // fallback to package.json engines.node
38
- try {
39
- const packageJson = JSON.parse(
40
- await fs.promises.readFile(path.join(process.cwd(), 'package.json'), 'utf-8'),
41
- )
42
- return packageJson?.engines?.node ? `v${packageJson.engines.node}` : null
43
- } catch {
44
- return null
45
- }
46
- }
47
-
48
- export async function checkNodeVersion() {
49
- const currentNodeVersion = getCurrentNodeVersion()
50
- const requiredNodeVersion = await getRequiredNodeVersion()
51
-
52
- if (requiredNodeVersion && currentNodeVersion) {
53
- if (currentNodeVersion !== requiredNodeVersion) {
54
- throw new Error(
55
- `\u001b[33mWarning: Incorrect Node.js version. Expected ${requiredNodeVersion} but got ${currentNodeVersion}\u001b[0m`,
56
- )
57
- }
58
- }
59
- }
60
-
61
- if (import.meta.main) {
62
- await cmd`verify node version matches project requirements`.run(async () => {
63
- checkNodeVersion().catch((e: unknown) => {
64
- console.error((e as Error).message)
65
- process.exit(1)
66
- })
67
- })
68
- }