@take-out/scripts 0.4.22 → 0.4.24

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.22",
3
+ "version": "0.4.24",
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.22",
33
- "@take-out/run": "0.4.22",
32
+ "@take-out/helpers": "0.4.24",
33
+ "@take-out/run": "0.4.24",
34
34
  "picocolors": "^1.1.1"
35
35
  }
36
36
  }
@@ -126,13 +126,21 @@ export async function pushImage(
126
126
 
127
127
  export async function deployStack(
128
128
  composeFile: string,
129
- options?: { profile?: string } & UncloudConfig,
129
+ options?: { profile?: string; service?: string; recreate?: boolean } & UncloudConfig,
130
130
  ): Promise<void> {
131
- console.info('\nšŸ“¦ deploying stack...\n')
131
+ const service = options?.service
132
+ console.info(`\nšŸ“¦ deploying ${service ?? 'stack'}...\n`)
132
133
 
133
134
  const profileFlag = options?.profile ? `--profile ${options.profile}` : ''
134
- // --recreate ensures containers are recreated even if config unchanged (pulls fresh images)
135
- await run(`${ucCmd(options)} deploy -f ${composeFile} ${profileFlag} --recreate --yes`)
135
+ // --recreate forces fresh containers even when config is unchanged (picks up the new
136
+ // :latest image). pass recreate:false to let uncloud restart a service ONLY when its
137
+ // image/config actually changed — used for zero, whose restarts drop every websocket
138
+ // connection and cause a client reconnect storm.
139
+ const recreateFlag = options?.recreate === false ? '' : '--recreate'
140
+ const serviceArg = service ? ` ${service}` : ''
141
+ await run(
142
+ `${ucCmd(options)} deploy -f ${composeFile} ${profileFlag} ${recreateFlag} --yes${serviceArg}`,
143
+ )
136
144
 
137
145
  console.info('\nāœ… deployment complete!')
138
146
  }
@@ -1,10 +1,24 @@
1
1
  #!/usr/bin/env bun
2
2
 
3
+ import { execFileSync } from 'node:child_process'
3
4
  import fs from 'node:fs'
4
5
 
5
6
  import { cmd } from './cmd'
6
7
 
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
+ }
8
22
  return process.version
9
23
  }
10
24
 
@@ -35,7 +49,7 @@ export async function checkNodeVersion() {
35
49
  const currentNodeVersion = getCurrentNodeVersion()
36
50
  const requiredNodeVersion = await getRequiredNodeVersion()
37
51
 
38
- if (requiredNodeVersion) {
52
+ if (requiredNodeVersion && currentNodeVersion) {
39
53
  if (currentNodeVersion !== requiredNodeVersion) {
40
54
  throw new Error(
41
55
  `\u001b[33mWarning: Incorrect Node.js version. Expected ${requiredNodeVersion} but got ${currentNodeVersion}\u001b[0m`,