@stacksjs/buddy 0.75.239 → 0.75.240
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/dist/deployment-revision.js +2 -2
- package/package.json +56 -56
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{execFile}from"node:child_process";import process from"node:process";import{promisify}from"node:util";const execute=promisify(execFile);export function automatedDeploymentRevision(environment,variables=process.env){if(environment!=="production")return;const prefix=variables.REVIEWOS==="true"?"REVIEWOS":variables.GITHUB_ACTIONS==="true"?"GITHUB":void 0;if(!prefix)return;const ref=variables[`${prefix}_REF`],sha=variables[`${prefix}_SHA`];if(!ref?.startsWith("refs/heads/")||!sha||!/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/i.test(sha))throw Error("Automated production deployment requires a branch ref and full commit SHA from the CI provider.");return Object.freeze({ref,sha:sha.toLowerCase()})}export async function assertCurrentDeploymentRevision(revision,cwd=process.cwd()){if(!revision)return;const git=async(args,options={})=>{try{return(await execute("git",args,{cwd,timeout:60000,maxBuffer:16777216,env:{...process.env,GIT_TERMINAL_PROMPT:"0",GCM_INTERACTIVE:"never"}})).stdout.trim()}catch{if(options.allowFailure)return null;throw Error(
|
|
2
|
-
`).map((line)=>line.split(/\s+/));if(lines.length!==1||lines[0]?.[1]!==revision.ref||!/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/i.test(lines[0]?.[0]??""))throw Error("Origin did not return one authoritative branch head; production deployment stopped.");if(lines[0][0].toLowerCase()===revision.sha)return Object.freeze({revision,newer:[]});const shallow=await git(["rev-parse","--is-shallow-repository"])==="true";await git(["fetch","--quiet","--no-tags",...shallow?["--unshallow"]:[],"origin",revision.ref]);if(await git(["rev-parse","--is-shallow-repository"])==="true")throw Error("Cannot verify complete origin history; production deployment stopped.");const tip=String(await git(["rev-parse","--verify","FETCH_HEAD^{commit}"])).toLowerCase();if(await git(["merge-base","--is-ancestor",revision.sha,tip],{allowFailure:!0})===null)throw Error("This CI commit is no longer on the origin branch; production deployment stopped. Deploy the current branch head.");const newer=String(await git(["rev-list",`${revision.sha}..${tip}`])).split(`
|
|
1
|
+
import{execFile}from"node:child_process";import process from"node:process";import{promisify}from"node:util";const execute=promisify(execFile);export function automatedDeploymentRevision(environment,variables=process.env){if(environment!=="production")return;const prefix=variables.REVIEWOS==="true"?"REVIEWOS":variables.GITHUB_ACTIONS==="true"?"GITHUB":void 0;if(!prefix)return;const ref=variables[`${prefix}_REF`],sha=variables[`${prefix}_SHA`];if(!ref?.startsWith("refs/heads/")||!sha||!/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/i.test(sha))throw Error("Automated production deployment requires a branch ref and full commit SHA from the CI provider.");return Object.freeze({ref,sha:sha.toLowerCase()})}export async function assertCurrentDeploymentRevision(revision,cwd=process.cwd()){if(!revision)return;const git=async(operation,args,options={})=>{try{return(await execute("git",args,{cwd,timeout:60000,maxBuffer:16777216,env:{...process.env,GIT_TERMINAL_PROMPT:"0",GCM_INTERACTIVE:"never"}})).stdout.trim()}catch(error){if(options.allowFailure)return null;let status="Git failed to execute";if(error instanceof Error){if("code"in error&&error.code==="ERR_CHILD_PROCESS_STDIO_MAXBUFFER")status="Git exceeded its output limit";else if("killed"in error&&error.killed===!0)status="Git exceeded its 60-second limit";else if("code"in error&&typeof error.code==="number"&&Number.isSafeInteger(error.code)&&error.code>=0)status=`Git exited with status ${error.code}`}throw Error(`Cannot verify the automated deployment revision against origin while ${operation}: ${status}; production deployment stopped.`)}};await git("validating the branch ref",["check-ref-format",revision.ref]);if((await git("reading the checkout revision",["rev-parse","--verify","HEAD"]))?.toLowerCase()!==revision.sha)throw Error("The deployment checkout does not match the CI commit; production deployment stopped.");const remote=await git("reading the origin branch head",["ls-remote","--exit-code","--refs","origin",revision.ref]),lines=String(remote).split(`
|
|
2
|
+
`).map((line)=>line.split(/\s+/));if(lines.length!==1||lines[0]?.[1]!==revision.ref||!/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/i.test(lines[0]?.[0]??""))throw Error("Origin did not return one authoritative branch head; production deployment stopped.");if(lines[0][0].toLowerCase()===revision.sha)return Object.freeze({revision,newer:[]});const shallow=await git("checking repository history depth",["rev-parse","--is-shallow-repository"])==="true";await git("fetching the origin branch history",["fetch","--quiet","--no-tags",...shallow?["--unshallow"]:[],"origin",revision.ref]);if(await git("checking repository history depth",["rev-parse","--is-shallow-repository"])==="true")throw Error("Cannot verify complete origin history; production deployment stopped.");const tip=String(await git("reading the fetched branch head",["rev-parse","--verify","FETCH_HEAD^{commit}"])).toLowerCase();if(await git("checking revision ancestry",["merge-base","--is-ancestor",revision.sha,tip],{allowFailure:!0})===null)throw Error("This CI commit is no longer on the origin branch; production deployment stopped. Deploy the current branch head.");const newer=String(await git("listing newer branch revisions",["rev-list",`${revision.sha}..${tip}`])).split(`
|
|
3
3
|
`).map((line)=>line.trim().toLowerCase()).filter(Boolean);return Object.freeze({revision,newer})}export function assertNotBehindLiveRelease(check,liveReleases){if(!check||check.newer.length===0)return;for(const raw of liveReleases){const id=String(raw??"").trim().toLowerCase();if(!/^[a-f0-9]{7,64}$/.test(id))continue;if(check.newer.some((sha)=>sha.startsWith(id)))throw Error(`Production already runs ${id}, which is newer than this CI commit; production deployment stopped. Deploy the current branch head.`)}}export function liveReleasesCommand(slug){if(!/^[a-z0-9][a-z0-9-]*$/i.test(slug))throw Error("A project slug is letters, digits and dashes.");return`for d in /var/www/${slug}-*/current; do [ -L "$d" ] && basename "$(readlink -f "$d")"; done; true`}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@stacksjs/buddy",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"sideEffects": false,
|
|
5
|
-
"version": "0.75.
|
|
5
|
+
"version": "0.75.240",
|
|
6
6
|
"description": "Meet Buddy. The Stacks runtime.",
|
|
7
7
|
"author": "Chris Breuer",
|
|
8
8
|
"contributors": [
|
|
@@ -96,72 +96,72 @@
|
|
|
96
96
|
},
|
|
97
97
|
"dependencies": {
|
|
98
98
|
"@stacksjs/bumpx": "^0.2.25",
|
|
99
|
-
"@stacksjs/actions": "0.75.
|
|
100
|
-
"@stacksjs/ai": "0.75.
|
|
101
|
-
"@stacksjs/alias": "0.75.
|
|
102
|
-
"@stacksjs/analytics": "0.75.
|
|
103
|
-
"@stacksjs/api": "0.75.
|
|
104
|
-
"@stacksjs/arrays": "0.75.
|
|
105
|
-
"@stacksjs/auth": "0.75.
|
|
106
|
-
"@stacksjs/browser-extension": "0.75.
|
|
107
|
-
"@stacksjs/build": "0.75.
|
|
108
|
-
"@stacksjs/cache": "0.75.
|
|
109
|
-
"@stacksjs/chat": "0.75.
|
|
99
|
+
"@stacksjs/actions": "0.75.240",
|
|
100
|
+
"@stacksjs/ai": "0.75.240",
|
|
101
|
+
"@stacksjs/alias": "0.75.240",
|
|
102
|
+
"@stacksjs/analytics": "0.75.240",
|
|
103
|
+
"@stacksjs/api": "0.75.240",
|
|
104
|
+
"@stacksjs/arrays": "0.75.240",
|
|
105
|
+
"@stacksjs/auth": "0.75.240",
|
|
106
|
+
"@stacksjs/browser-extension": "0.75.240",
|
|
107
|
+
"@stacksjs/build": "0.75.240",
|
|
108
|
+
"@stacksjs/cache": "0.75.240",
|
|
109
|
+
"@stacksjs/chat": "0.75.240",
|
|
110
110
|
"@stacksjs/clapp": "^0.2.16",
|
|
111
|
-
"@stacksjs/cli": "0.75.
|
|
112
|
-
"@stacksjs/cloud": "0.75.
|
|
113
|
-
"@stacksjs/cms": "0.75.
|
|
114
|
-
"@stacksjs/collections": "0.75.
|
|
115
|
-
"@stacksjs/commerce": "0.75.
|
|
116
|
-
"@stacksjs/config": "0.75.
|
|
117
|
-
"@stacksjs/database": "0.75.
|
|
118
|
-
"@stacksjs/desktop-build": "0.75.
|
|
119
|
-
"@stacksjs/dns": "0.75.
|
|
111
|
+
"@stacksjs/cli": "0.75.240",
|
|
112
|
+
"@stacksjs/cloud": "0.75.240",
|
|
113
|
+
"@stacksjs/cms": "0.75.240",
|
|
114
|
+
"@stacksjs/collections": "0.75.240",
|
|
115
|
+
"@stacksjs/commerce": "0.75.240",
|
|
116
|
+
"@stacksjs/config": "0.75.240",
|
|
117
|
+
"@stacksjs/database": "0.75.240",
|
|
118
|
+
"@stacksjs/desktop-build": "0.75.240",
|
|
119
|
+
"@stacksjs/dns": "0.75.240",
|
|
120
120
|
"@stacksjs/dnsx": "^0.2.3",
|
|
121
|
-
"@stacksjs/email": "0.75.
|
|
122
|
-
"@stacksjs/enums": "0.75.
|
|
123
|
-
"@stacksjs/env": "0.75.
|
|
124
|
-
"@stacksjs/error-handling": "0.75.
|
|
125
|
-
"@stacksjs/events": "0.75.
|
|
126
|
-
"@stacksjs/features": "0.75.
|
|
127
|
-
"@stacksjs/git": "0.75.
|
|
121
|
+
"@stacksjs/email": "0.75.240",
|
|
122
|
+
"@stacksjs/enums": "0.75.240",
|
|
123
|
+
"@stacksjs/env": "0.75.240",
|
|
124
|
+
"@stacksjs/error-handling": "0.75.240",
|
|
125
|
+
"@stacksjs/events": "0.75.240",
|
|
126
|
+
"@stacksjs/features": "0.75.240",
|
|
127
|
+
"@stacksjs/git": "0.75.240",
|
|
128
128
|
"@stacksjs/gitit": "^0.2.5",
|
|
129
|
-
"@stacksjs/health": "0.75.
|
|
129
|
+
"@stacksjs/health": "0.75.240",
|
|
130
130
|
"@stacksjs/httx": "^0.1.10",
|
|
131
|
-
"@stacksjs/image": "0.75.
|
|
132
|
-
"@stacksjs/lint": "0.75.
|
|
133
|
-
"@stacksjs/logging": "0.75.
|
|
134
|
-
"@stacksjs/notifications": "0.75.
|
|
135
|
-
"@stacksjs/objects": "0.75.
|
|
136
|
-
"@stacksjs/orm": "0.75.
|
|
137
|
-
"@stacksjs/path": "0.75.
|
|
138
|
-
"@stacksjs/payments": "0.75.
|
|
139
|
-
"@stacksjs/realtime": "0.75.
|
|
140
|
-
"@stacksjs/router": "0.75.
|
|
131
|
+
"@stacksjs/image": "0.75.240",
|
|
132
|
+
"@stacksjs/lint": "0.75.240",
|
|
133
|
+
"@stacksjs/logging": "0.75.240",
|
|
134
|
+
"@stacksjs/notifications": "0.75.240",
|
|
135
|
+
"@stacksjs/objects": "0.75.240",
|
|
136
|
+
"@stacksjs/orm": "0.75.240",
|
|
137
|
+
"@stacksjs/path": "0.75.240",
|
|
138
|
+
"@stacksjs/payments": "0.75.240",
|
|
139
|
+
"@stacksjs/realtime": "0.75.240",
|
|
140
|
+
"@stacksjs/router": "0.75.240",
|
|
141
141
|
"@stacksjs/rpx": "^0.11.54",
|
|
142
|
-
"@stacksjs/scheduler": "0.75.
|
|
143
|
-
"@stacksjs/search-engine": "0.75.
|
|
144
|
-
"@stacksjs/security": "0.75.
|
|
145
|
-
"@stacksjs/server": "0.75.
|
|
146
|
-
"@stacksjs/sites": "0.75.
|
|
147
|
-
"@stacksjs/skills": "0.75.
|
|
148
|
-
"@stacksjs/socials": "0.75.
|
|
149
|
-
"@stacksjs/storage": "0.75.
|
|
150
|
-
"@stacksjs/strings": "0.75.
|
|
142
|
+
"@stacksjs/scheduler": "0.75.240",
|
|
143
|
+
"@stacksjs/search-engine": "0.75.240",
|
|
144
|
+
"@stacksjs/security": "0.75.240",
|
|
145
|
+
"@stacksjs/server": "0.75.240",
|
|
146
|
+
"@stacksjs/sites": "0.75.240",
|
|
147
|
+
"@stacksjs/skills": "0.75.240",
|
|
148
|
+
"@stacksjs/socials": "0.75.240",
|
|
149
|
+
"@stacksjs/storage": "0.75.240",
|
|
150
|
+
"@stacksjs/strings": "0.75.240",
|
|
151
151
|
"@stacksjs/stx": "^0.2.604",
|
|
152
|
-
"@stacksjs/testing": "0.75.
|
|
153
|
-
"@stacksjs/tinker": "0.75.
|
|
152
|
+
"@stacksjs/testing": "0.75.240",
|
|
153
|
+
"@stacksjs/tinker": "0.75.240",
|
|
154
154
|
"@stacksjs/tlsx": "^0.13.19",
|
|
155
155
|
"@stacksjs/ts-cloud": "^0.16.58",
|
|
156
|
-
"@stacksjs/tunnel": "0.75.
|
|
157
|
-
"@stacksjs/types": "0.75.
|
|
158
|
-
"@stacksjs/ui": "0.75.
|
|
159
|
-
"@stacksjs/utils": "0.75.
|
|
160
|
-
"@stacksjs/validation": "0.75.
|
|
156
|
+
"@stacksjs/tunnel": "0.75.240",
|
|
157
|
+
"@stacksjs/types": "0.75.240",
|
|
158
|
+
"@stacksjs/ui": "0.75.240",
|
|
159
|
+
"@stacksjs/utils": "0.75.240",
|
|
160
|
+
"@stacksjs/validation": "0.75.240",
|
|
161
161
|
"ajv": "^8.20.0",
|
|
162
162
|
"ajv-formats": "^3.0.1",
|
|
163
163
|
"bun-plugin-stx": "^0.2.604",
|
|
164
|
-
"ts-pantry": "^0.11.
|
|
164
|
+
"ts-pantry": "^0.11.104"
|
|
165
165
|
},
|
|
166
166
|
"devDependencies": {
|
|
167
167
|
"better-dx": "^0.2.24"
|