@stacksjs/buddy 0.75.336 → 0.75.337
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/commands/release.js +2 -2
- package/dist/commands/upgrade.js +1 -1
- package/dist/release-ios.d.ts +7 -0
- package/dist/release-ios.js +1 -1
- package/package.json +55 -55
package/dist/commands/release.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{execFileSync}from"node:child_process";import{existsSync,readFileSync,renameSync,rmSync,writeFileSync}from"node:fs";import{join}from"node:path";import{pathToFileURL}from"node:url";import process from"node:process";import{resolveXcodegen}from"@stacksjs/actions/build/ios-toolchain";import{describeGitHubRelease,publishGitHubRelease,resolveGitHubToken}from"@stacksjs/actions/github-release";import{validateReleaseEvidencePlan,verifyReleaseEvidence}from"@stacksjs/actions/release-evidence";import{assertPublicationAllowed}from"@stacksjs/actions/publication-preflight";import{runAction}from"@stacksjs/actions/run-action";import{intro,italic,log,onUnknownSubcommand,outro}from"@stacksjs/cli";import{printAsync}from"@stacksjs/cli/output";import{Action}from"@stacksjs/enums";import{ExitCode}from"@stacksjs/types";import{AppStoreConnect,appStoreConnectCredentials,buildsToExpire,waitForBuild}from"../app-store-connect";import{bumpedVersion,iosReleaseSummary,iosVersionIn,nextBuildTag,withIosVersion}from"../release-ios";import{appStoreLocales,commitsBetween,committedWhatToTest,fitNotes,NO_VISIBLE_CHANGES,PLAY_NOTES_LIMIT,previousMobileTag,resolveNotes,TESTFLIGHT_NOTES_LIMIT,testerNotes,writeWhatToTest,XCODE_CLOUD_NOTES_LIMIT}from"@stacksjs/actions/release-notes";import{resultFailed}from"../result";const descriptions={release:"Release a new version of your libraries/packages",project:"Target a specific project",dryRun:"Run the release without actually releasing",bump:"Non-interactive bump: patch | minor | major | prepatch | preminor | premajor | prerelease | pre | release | build | calendar | x.y.z",verbose:"Enable verbose output",skipGithubRelease:"Push the tag without creating its GitHub release"},IOS_PROJECT_DIR="storage/framework/mobile/ios",DEFAULT_WAIT_MINUTES=60;async function loadMobileConfig(configPath){return(await import(pathToFileURL(configPath).href)).default??{}}export function waitMinutes(value){if(value===void 0||value===!1)return null;if(value===!0||value==="")return DEFAULT_WAIT_MINUTES;const minutes=Number(value);if(!Number.isFinite(minutes)||minutes<0)throw Error(`--wait takes minutes, not ${String(value)}`);return minutes}function buildNumberOf(tag){const match=/^v(\d+\.\d+\.\d+)-build\.(\d+)$/.exec(tag);if(!match)throw Error(`${tag} is not an iOS build tag (v<version>-build.<n>)`);return{version:match[1],number:Number(match[2])}}function notesLocales(mobile){return mobile.release?.locales?.length?[...new Set(mobile.release.locales)]:appStoreLocales(mobile.ios?.nativeMessages?.languages)}async function applyWhatToTest(store,tag,notes,locales,minutes){try{const{version,number}=buildNumberOf(tag);if(minutes>0)log.info(`Waiting up to ${minutes} min for TestFlight build ${number} to reach App Store Connect\u2026`);const build=await waitForBuild(store.api,store.appId,version,number,{timeoutMs:minutes*60000,onWait:(elapsed)=>log.debug(`TestFlight build ${number} not there yet (${Math.round(elapsed/1000)}s)`)});if(!build){log.warn(`TestFlight build ${number} is not in App Store Connect yet; once it is, run \`buddy release:notes ${tag} --testflight\`.`);return!1}const text=fitNotes(notes,TESTFLIGHT_NOTES_LIMIT);await store.api.setWhatToTest(build.id,Object.fromEntries(locales.map((locale)=>[locale,text])));log.info(`Set What to Test on TestFlight build ${number} (${locales.join(", ")})`);return!0}catch(error){log.warn(`Could not set What to Test: ${error instanceof Error?error.message:String(error)}. Retry with \`buddy release:notes ${tag} --testflight\`.`);return!1}}function githubSummary(summary,notes){return`${summary.trim()}
|
|
1
|
+
import{execFileSync}from"node:child_process";import{existsSync,readFileSync,renameSync,rmSync,writeFileSync}from"node:fs";import{join}from"node:path";import{pathToFileURL}from"node:url";import process from"node:process";import{resolveXcodegen}from"@stacksjs/actions/build/ios-toolchain";import{describeGitHubRelease,publishGitHubRelease,resolveGitHubToken}from"@stacksjs/actions/github-release";import{validateReleaseEvidencePlan,verifyReleaseEvidence}from"@stacksjs/actions/release-evidence";import{assertPublicationAllowed}from"@stacksjs/actions/publication-preflight";import{runAction}from"@stacksjs/actions/run-action";import{intro,italic,log,onUnknownSubcommand,outro}from"@stacksjs/cli";import{printAsync}from"@stacksjs/cli/output";import{Action}from"@stacksjs/enums";import{withholdEnv}from"@stacksjs/env";import{ExitCode}from"@stacksjs/types";import{AppStoreConnect,appStoreConnectCredentials,buildsToExpire,waitForBuild}from"../app-store-connect";import{bumpedVersion,iosReleaseSummary,iosVersionIn,nextBuildTag,unreleasableSite,withIosVersion}from"../release-ios";import{appStoreLocales,commitsBetween,committedWhatToTest,fitNotes,NO_VISIBLE_CHANGES,PLAY_NOTES_LIMIT,previousMobileTag,resolveNotes,TESTFLIGHT_NOTES_LIMIT,testerNotes,writeWhatToTest,XCODE_CLOUD_NOTES_LIMIT}from"@stacksjs/actions/release-notes";import{resultFailed}from"../result";const descriptions={release:"Release a new version of your libraries/packages",project:"Target a specific project",dryRun:"Run the release without actually releasing",bump:"Non-interactive bump: patch | minor | major | prepatch | preminor | premajor | prerelease | pre | release | build | calendar | x.y.z",verbose:"Enable verbose output",skipGithubRelease:"Push the tag without creating its GitHub release"},IOS_PROJECT_DIR="storage/framework/mobile/ios",DEFAULT_WAIT_MINUTES=60;async function loadMobileConfig(configPath){return(await import(pathToFileURL(configPath).href)).default??{}}export function waitMinutes(value){if(value===void 0||value===!1)return null;if(value===!0||value==="")return DEFAULT_WAIT_MINUTES;const minutes=Number(value);if(!Number.isFinite(minutes)||minutes<0)throw Error(`--wait takes minutes, not ${String(value)}`);return minutes}function buildNumberOf(tag){const match=/^v(\d+\.\d+\.\d+)-build\.(\d+)$/.exec(tag);if(!match)throw Error(`${tag} is not an iOS build tag (v<version>-build.<n>)`);return{version:match[1],number:Number(match[2])}}function notesLocales(mobile){return mobile.release?.locales?.length?[...new Set(mobile.release.locales)]:appStoreLocales(mobile.ios?.nativeMessages?.languages)}async function applyWhatToTest(store,tag,notes,locales,minutes){try{const{version,number}=buildNumberOf(tag);if(minutes>0)log.info(`Waiting up to ${minutes} min for TestFlight build ${number} to reach App Store Connect\u2026`);const build=await waitForBuild(store.api,store.appId,version,number,{timeoutMs:minutes*60000,onWait:(elapsed)=>log.debug(`TestFlight build ${number} not there yet (${Math.round(elapsed/1000)}s)`)});if(!build){log.warn(`TestFlight build ${number} is not in App Store Connect yet; once it is, run \`buddy release:notes ${tag} --testflight\`.`);return!1}const text=fitNotes(notes,TESTFLIGHT_NOTES_LIMIT);await store.api.setWhatToTest(build.id,Object.fromEntries(locales.map((locale)=>[locale,text])));log.info(`Set What to Test on TestFlight build ${number} (${locales.join(", ")})`);return!0}catch(error){log.warn(`Could not set What to Test: ${error instanceof Error?error.message:String(error)}. Retry with \`buddy release:notes ${tag} --testflight\`.`);return!1}}function githubSummary(summary,notes){return`${summary.trim()}
|
|
2
2
|
|
|
3
3
|
## What to Test
|
|
4
4
|
|
|
@@ -7,7 +7,7 @@ ${notes.trim()}`}function git(...args){return execFileSync("git",args,{encoding:
|
|
|
7
7
|
|
|
8
8
|
${fitNotes(notes.text,XCODE_CLOUD_NOTES_LIMIT)}`);if(store){const retiring=buildsToExpire(await store.api.builds(store.appId),keep);log.info(retiring.length?`Would expire TestFlight builds ${retiring.map((b)=>b.number).join(", ")}`:"No TestFlight builds to expire")}if(!options.skipGithubRelease){const preview=await publishGitHubRelease({cwd:root,tag,ref:"HEAD",name:summary.name,summary:githubSummary(summary.body,githubNotes),dryRun:!0});log.info(preview.draft?`Would create the GitHub release ${tag} (${preview.draft.name}):
|
|
9
9
|
|
|
10
|
-
${preview.draft.body}`:describeGitHubRelease(tag,preview))}return tag}const paths=["config/mobile.ts","storage/framework/mobile/ios"];if(version!==current){writeFileSync(configPath,withIosVersion(source,version));const pkgPath=join(root,"package.json");if(existsSync(pkgPath)){const pkg=readFileSync(pkgPath,"utf8");writeFileSync(pkgPath,pkg.replace(/("version"\s*:\s*)"[^"]*"/,`$1"${version}"`));paths.push("package.json")}}
|
|
10
|
+
${preview.draft.body}`:describeGitHubRelease(tag,preview))}return tag}const paths=["config/mobile.ts","storage/framework/mobile/ios"];if(version!==current){writeFileSync(configPath,withIosVersion(source,version));const pkgPath=join(root,"package.json");if(existsSync(pkgPath)){const pkg=readFileSync(pkgPath,"utf8");writeFileSync(pkgPath,pkg.replace(/("version"\s*:\s*)"[^"]*"/,`$1"${version}"`));paths.push("package.json")}}const devOverrides=["MOBILE_URL","IOS_APP_VERSION","IOS_BUILD_NUMBER"];for(const key of devOverrides)delete process.env[key];const result=await runAction(Action.BuildIos,{env:withholdEnv(devOverrides)});if(resultFailed(result))throw result.error??Error("the iOS build failed");const craftConfigPath=join(root,IOS_PROJECT_DIR,"craft.config.json");if(existsSync(craftConfigPath)){const problem=unreleasableSite(JSON.parse(readFileSync(craftConfigPath,"utf8")));if(problem)throw Error(`${problem}. Set ios.url in config/mobile.ts to the production site. Nothing was committed, tagged or pushed; restore the build output and any version bump with \`git checkout -- ${paths.join(" ")}\`.`)}const written=writeWhatToTest(root,IOS_PROJECT_DIR,notes.text,locales);log.info(`What to Test from ${origin}: ${written.join(", ")}`);git("add","--",...paths);if(git("diff","--cached","--name-only"))git("commit","--quiet","-m",`chore(release): ${tag}`);git("tag","-a",tag,"-m",tag);git("push","--quiet","--atomic","origin","main",tag);if(!options.skipGithubRelease){const published=await publishGitHubRelease({cwd:root,tag,name:summary.name,summary:githubSummary(summary.body,githubNotes)});if(published.status==="failed")log.warn(describeGitHubRelease(tag,published));else log.info(describeGitHubRelease(tag,published))}if(store){try{const retiring=buildsToExpire(await store.api.builds(store.appId),keep);for(const build of retiring)await store.api.expire(build.id);if(retiring.length)log.info(`Expired TestFlight builds ${retiring.map((b)=>b.number).join(", ")}`)}catch(error){log.warn(`Could not expire older TestFlight builds: ${error instanceof Error?error.message:String(error)}`)}if(wait!==null&&numberedByXcodeCloud)await applyWhatToTest(store,tag,notes.text,locales,wait)}return tag}function notesForTag(root,tag,mobile,options){const releaseConfig=mobile.release??{},generateOptions={types:releaseConfig.noteTypes,excludeScopes:releaseConfig.excludeScopes},from=options.from||previousMobileTag(root,`${tag}^`),commits=commitsBetween(root,from,tag),plainGenerated=testerNotes(commits,generateOptions)||NO_VISIBLE_CHANGES,committed=options.from?null:committedWhatToTest(root,tag,IOS_PROJECT_DIR),handWritten=committed&&committed.trim()!==fitNotes(plainGenerated,XCODE_CLOUD_NOTES_LIMIT)?committed.trim():null,notes=resolveNotes({cwd:root,flags:options,config:releaseConfig,generate:()=>handWritten??plainGenerated});if(notes.source!=="generated"||handWritten)return{text:notes.text,plain:notes.text};return{text:options.markdown?testerNotes(commits,{...generateOptions,markdown:!0})||NO_VISIBLE_CHANGES:plainGenerated,plain:plainGenerated}}async function releaseNotesCommand(tagArgument,options){const root=process.cwd(),configPath=join(root,"config/mobile.ts"),mobile=existsSync(configPath)?await loadMobileConfig(configPath):{},tag=tagArgument||previousMobileTag(root,"HEAD");if(!tag||!git("tag","--list",tag))throw Error(tagArgument?`there is no tag ${tagArgument}`:"there is no mobile release tag (v*-build.*) yet");const notes=notesForTag(root,tag,mobile,options);if(options.testflight){const credentials=appStoreConnectCredentials();if(!credentials)throw Error("--testflight needs an App Store Connect API key (APP_STORE_CONNECT_KEY_ID, _ISSUER_ID, _PRIVATE_KEY_PATH)");const bundleId=mobile.ios?.bundleId;if(!bundleId)throw Error("config/mobile.ts declares no ios.bundleId");const api=await AppStoreConnect.connect(credentials),store={api,appId:await api.appId(bundleId)};if(!await applyWhatToTest(store,tag,notes.plain,notesLocales(mobile),waitMinutes(options.wait)??0))process.exitCode=ExitCode.FatalError;return}const limit=options.play?PLAY_NOTES_LIMIT:options.markdown?Number.POSITIVE_INFINITY:TESTFLIGHT_NOTES_LIMIT;await printAsync(Number.isFinite(limit)?fitNotes(notes.text,limit):notes.text)}export function release(buddy){buddy.command("release",descriptions.release).option("--dry-run",descriptions.dryRun,{default:!1}).option("-p, --project [project]",descriptions.project,{default:!1}).option("--bump <type>",descriptions.bump).option("--preid <identifier>","Prerelease channel, for example beta or rc").option("--skip-github-release",descriptions.skipGithubRelease,{default:!1}).option("--verbose",descriptions.verbose,{default:!1}).action(async(options)=>{log.debug("Running `buddy release` ...",options);if(options.dryRun)log.warn("Dry run enabled. No changes will be made or committed.");const startTime=await intro("buddy release"),result=await runAction(Action.Release,options);if(resultFailed(result)){await log.error("Failed to release",result.error);process.exit(ExitCode.FatalError)}await outro(options.dryRun?"Dry run complete. Nothing was committed, tagged or pushed.":"Triggered CI/CD Release via GitHub Actions",{startTime,useSeconds:!0});if(!options.dryRun)log.info(`Follow along: ${italic(resolveGitHubActionsUrl(readOriginRemote()))}`)});buddy.command("release:ios","Ship the iOS app: regenerate its project for production, commit, tag and push").option("--bump <type>","build | patch | minor | major | x.y.z (default: a new build of the current marketing version)").option("--keep-builds <n>","TestFlight builds to keep besides the new one; older ones are expired (needs an App Store Connect API key)",{default:1}).option("--skip-github-release",descriptions.skipGithubRelease,{default:!1}).option("--notes <text>","What to Test for this build, instead of the notes generated from the commits since the previous build").option("--notes-file <path>","Read What to Test from a file (also RELEASE_NOTES / RELEASE_NOTES_FILE, or release.notes in config/mobile.ts)").option("--wait [minutes]","Wait for the build to reach App Store Connect, then set its What to Test there too (default 60 minutes; needs an App Store Connect API key)").option("--dry-run",descriptions.dryRun,{default:!1}).action(async(options)=>{const startTime=await intro("buddy release:ios");try{const tag=await releaseIos(options);await outro(options.dryRun?`Dry run complete: would release ${tag}`:`Released ${tag}`,{startTime,useSeconds:!0});if(!options.dryRun)log.info('A CI that builds tags (Xcode Cloud: Tag Changes, prefix "v") turns it into a TestFlight build now.')}catch(error){await log.error("Failed to release the iOS app",error);process.exit(ExitCode.FatalError)}});buddy.command("release:notes [tag]","Print the tester notes of a mobile release tag (default: the newest v*-build.* tag), or set them as its TestFlight What to Test").option("--from <ref>","Generate from the commits since this ref instead of the previous build tag").option("--play","Fit the notes to Google Play's 500-character What's new",{default:!1}).option("--markdown","Markdown, as the GitHub release shows the notes",{default:!1}).option("--testflight","Set the notes as the TestFlight build's What to Test through App Store Connect",{default:!1}).option("--wait [minutes]","With --testflight: wait this long for the build to appear (default 60)").option("--notes <text>","Use this text instead").option("--notes-file <path>","Read the text from a file instead").action(async(tag,options)=>{try{await releaseNotesCommand(tag,options)}catch(error){await log.error("Failed to produce the release notes",error);process.exit(ExitCode.FatalError)}});buddy.command("release:github [tag]","Create the GitHub release for a pushed tag (default: the newest), with the changes since the tag before it").option("--dry-run","Print the release instead of creating it",{default:!1}).action(async(tag,options)=>{const startTime=await intro("buddy release:github");try{if(!options.dryRun)await assertPublicationAllowed({cwd:process.cwd(),channel:"github-release"});const target=tag||git("describe","--tags","--abbrev=0");if(!git("tag","--list",target))throw Error(`there is no tag ${target}`);const ios=/^v\d+\.\d+\.\d+-build\.\d+$/.test(target)?iosReleaseSummary(target,{numberedByXcodeCloud:appStoreConnectCredentials()!==null}):null;let summary=ios?.body;if(ios){const configPath=join(process.cwd(),"config/mobile.ts"),mobile=existsSync(configPath)?await loadMobileConfig(configPath):{};summary=githubSummary(ios.body,notesForTag(process.cwd(),target,mobile,{markdown:!0}).text)}const result=await publishGitHubRelease({cwd:process.cwd(),tag:target,name:ios?.name,summary,dryRun:options.dryRun});if(result.status==="failed")throw Error(describeGitHubRelease(target,result));log.info(options.dryRun&&result.draft?`Would create the GitHub release ${target} (${result.draft.name}):
|
|
11
11
|
|
|
12
12
|
${result.draft.body}`:describeGitHubRelease(target,result));await outro(options.dryRun?"Dry run complete. Nothing was created.":`GitHub release for ${target}`,{startTime,useSeconds:!0})}catch(error){await log.error("Failed to create the GitHub release",error);process.exit(ExitCode.FatalError)}});buddy.command("release:verify <plan>","Verify exact source gates, published archives and installed consumer checks").option("--output <path>","Save the successful verification receipt as JSON").action(async(planPath,options)=>{let temporary;try{const plan=JSON.parse(readFileSync(planPath,"utf8"));validateReleaseEvidencePlan(plan);const receipt=await verifyReleaseEvidence(plan,{cwd:process.cwd(),token:resolveGitHubToken()??void 0}),json=`${JSON.stringify(receipt,null,2)}
|
|
13
13
|
`;if(options.output){temporary=`${options.output}.${crypto.randomUUID()}.tmp`;writeFileSync(temporary,json,{flag:"wx",mode:384});renameSync(temporary,options.output);temporary=void 0;await printAsync(`Verified release evidence saved to ${options.output}`)}else await printAsync(json.trimEnd())}catch(error){if(temporary)rmSync(temporary,{force:!0});await log.error("Release verification failed",error);process.exitCode=ExitCode.FatalError}});onUnknownSubcommand(buddy,"release")}export function resolveGitHubActionsUrl(remoteUrl,repository=process.env.GITHUB_REPOSITORY,serverUrl=process.env.GITHUB_SERVER_URL??"https://github.com"){const repo=repository?.trim()||remoteUrl?.trim().match(/github\.com[/:]([^/\s]+\/[^/\s]+?)(?:\.git)?$/)?.[1];return repo?`${serverUrl.replace(/\/$/,"")}/${repo}/actions`:"https://github.com/stacksjs/stacks/actions"}function readOriginRemote(){try{return execFileSync("git",["config","--get","remote.origin.url"],{encoding:"utf8"}).trim()}catch{return}}
|
package/dist/commands/upgrade.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import process from"node:process";import{runAction}from"@stacksjs/actions";import{intro,log,onUnknownSubcommand,outro}from"@stacksjs/cli";import{Action}from"@stacksjs/enums";import{ExitCode}from"@stacksjs/types";import{resultFailed}from"../result";export function upgrade(buddy){const descriptions={upgrade:"Upgrade the Stacks framework to the latest version",version:"Install a specific version (e.g., 0.70.23)",canary:"Upgrade to the latest canary (bleeding-edge `main`) build",stable:"Switch to the latest vetted stable release",dryRun:"Preview the upgrade (which dependencies would change) without writing or installing",force:"Force re-download, bypassing cache and version checks",from:"Sync from a local stacks checkout (e.g. ~/Code/stacks). Skips GitHub.",noPostinstall:"Skip post-sync hooks (auto-imports, bun install, migrate)",verbose:"Enable verbose output",dependencies:"Upgrade your dependencies (pantry.yaml & package.json)",bun:"Upgrade Bun to the latest version",shell:"Upgrade the shell integration (currently only supports Oh My Zsh)",binary:"Upgrade the `stacks` binary to the latest version",project:"Target a specific project",all:"Upgrade framework, dependencies, Bun, and binary"};buddy.command("upgrade",descriptions.upgrade).option("-V, --version <version>",descriptions.version).option("--canary",descriptions.canary,{default:!1}).option("--stable",descriptions.stable,{default:!1}).option("--dry-run",descriptions.dryRun,{default:!1}).option("-f, --force",descriptions.force,{default:!1}).option("--from <path>",descriptions.from).option("--no-postinstall",descriptions.noPostinstall).option("--verbose",descriptions.verbose,{default:!1}).alias("update").example("buddy upgrade").example("buddy update").example("buddy upgrade --from ~/Code/stacks").example("buddy upgrade --version 0.70.23").example("buddy upgrade --dry-run").example("buddy upgrade --canary").example("buddy upgrade --stable").example("buddy upgrade --force").action(async(options)=>{log.debug("Running `buddy upgrade` ...",options);const opts={...options};if(opts.postinstall===!1){delete opts.postinstall;opts.noPostinstall=!0}const perf=await intro("buddy upgrade"),result=await runAction(Action.UpgradeFramework,opts);if(resultFailed(result)){await outro("While running buddy upgrade, there was an issue",{startTime:perf,useSeconds:!0},result.error);process.exit(ExitCode.FatalError)}await outro("Upgrade complete.",{startTime:perf,useSeconds:!0});process.exit(ExitCode.Success)});buddy.command("upgrade:all",descriptions.all).option("--canary",descriptions.canary,{default:!1}).option("-f, --force",descriptions.force,{default:!1}).option("-p, --project [project]",descriptions.project,{default:!1}).option("--verbose",descriptions.verbose,{default:!1}).example("buddy upgrade:all").action(async(options)=>{log.debug("Running `buddy upgrade:all` ...",options);const perf=await intro("buddy upgrade:all");options.all=!0;const result=await runAction(Action.Upgrade,options);if(resultFailed(result)){await outro("While running buddy upgrade:all, there was an issue",{startTime:perf,useSeconds:!0},result.error);process.exit(ExitCode.FatalError)}await outro("All upgrades complete.",{startTime:perf,useSeconds:!0});process.exit(ExitCode.Success)});buddy.command("upgrade:dependencies",descriptions.dependencies).option("-p, --project [project]",descriptions.project,{default:!1}).option("--verbose",descriptions.verbose,{default:!1}).alias("upgrade:deps").example("buddy upgrade:dependencies").action(async(options)=>{log.debug("Running `buddy upgrade:dependencies` ...",options);const perf=await intro("buddy upgrade:dependencies");options.dependencies=!0;const result=await runAction(Action.Upgrade,options);if(resultFailed(result)){await outro("While running buddy upgrade:dependencies, there was an issue",{startTime:perf,useSeconds:!0},result.error);process.exit(ExitCode.FatalError)}await outro("Dependencies upgraded.",{startTime:perf,useSeconds:!0});process.exit(ExitCode.Success)});buddy.command("upgrade:bun",descriptions.bun).option("--verbose",descriptions.verbose,{default:!1}).example("buddy upgrade:bun").action(async(options)=>{log.debug("Running `buddy upgrade:bun` ...",options);const perf=await intro("buddy upgrade:bun"),result=await runAction(Action.UpgradeBun,options);if(resultFailed(result)){await outro("While running buddy upgrade:bun, there was an issue",{startTime:perf,useSeconds:!0},result.error);process.exit(ExitCode.FatalError)}await outro("Bun upgraded.",{startTime:perf,useSeconds:!0});process.exit(ExitCode.Success)});buddy.command("upgrade:shell",descriptions.shell).option("--verbose",descriptions.verbose,{default:!1}).example("buddy upgrade:shell").action(async(options)=>{log.debug("Running `buddy upgrade:shell` ...",options);const perf=await intro("buddy upgrade:shell"),result=await runAction(Action.UpgradeShell,options);if(resultFailed(result)){await outro("While running buddy upgrade:shell, there was an issue",{startTime:perf,useSeconds:!0},result.error);process.exit(ExitCode.FatalError)}await outro("Shell integration upgraded.",{startTime:perf,useSeconds:!0});process.exit(ExitCode.Success)});buddy.command("upgrade:binary",descriptions.binary).option("--verbose",descriptions.verbose,{default:!1}).example("buddy upgrade:binary").action(async(options)=>{if(process.getuid&&process.getuid()!==0){log.warn("To upgrade the binary, you need to run this command with sudo, or as root.");await log.flush();process.exit(ExitCode.FatalError)}log.debug("Running `buddy upgrade:binary` ...",options);const perf=await intro("buddy upgrade:binary"),result=await runAction(Action.UpgradeBinary,options);if(resultFailed(result)){await outro("While running buddy upgrade:binary, there was an issue",{startTime:perf,useSeconds:!0},result.error);process.exit(ExitCode.FatalError)}await outro("Binary upgraded.",{startTime:perf,useSeconds:!0});process.exit(ExitCode.Success)});onUnknownSubcommand(buddy,"upgrade")}
|
|
1
|
+
import process from"node:process";import{runAction}from"@stacksjs/actions";import{intro,log,onUnknownSubcommand,outro}from"@stacksjs/cli";import{Action}from"@stacksjs/enums";import{ExitCode}from"@stacksjs/types";import{resultFailed}from"../result";export function upgrade(buddy){const descriptions={upgrade:"Upgrade the Stacks framework to the latest version",version:"Install a specific version (e.g., 0.70.23)",canary:"Upgrade to the latest canary (bleeding-edge `main`) build",stable:"Switch to the latest vetted stable release",dryRun:"Preview the upgrade (which dependencies would change) without writing or installing",allowDowngrade:"Accept a release that moves a dependency this app declares to an older version (refused by default)",force:"Force re-download, bypassing cache and version checks",from:"Sync from a local stacks checkout (e.g. ~/Code/stacks). Skips GitHub.",noPostinstall:"Skip post-sync hooks (auto-imports, bun install, migrate)",verbose:"Enable verbose output",dependencies:"Upgrade your dependencies (pantry.yaml & package.json)",bun:"Upgrade Bun to the latest version",shell:"Upgrade the shell integration (currently only supports Oh My Zsh)",binary:"Upgrade the `stacks` binary to the latest version",project:"Target a specific project",all:"Upgrade framework, dependencies, Bun, and binary"};buddy.command("upgrade",descriptions.upgrade).option("-V, --version <version>",descriptions.version).option("--canary",descriptions.canary,{default:!1}).option("--stable",descriptions.stable,{default:!1}).option("--dry-run",descriptions.dryRun,{default:!1}).option("--allow-downgrade",descriptions.allowDowngrade,{default:!1}).option("-f, --force",descriptions.force,{default:!1}).option("--from <path>",descriptions.from).option("--no-postinstall",descriptions.noPostinstall).option("--verbose",descriptions.verbose,{default:!1}).alias("update").example("buddy upgrade").example("buddy update").example("buddy upgrade --from ~/Code/stacks").example("buddy upgrade --version 0.70.23").example("buddy upgrade --dry-run").example("buddy upgrade --allow-downgrade").example("buddy upgrade --canary").example("buddy upgrade --stable").example("buddy upgrade --force").action(async(options)=>{log.debug("Running `buddy upgrade` ...",options);const opts={...options};if(opts.postinstall===!1){delete opts.postinstall;opts.noPostinstall=!0}const perf=await intro("buddy upgrade"),result=await runAction(Action.UpgradeFramework,opts);if(resultFailed(result)){await outro("While running buddy upgrade, there was an issue",{startTime:perf,useSeconds:!0},result.error);process.exit(ExitCode.FatalError)}await outro("Upgrade complete.",{startTime:perf,useSeconds:!0});process.exit(ExitCode.Success)});buddy.command("upgrade:all",descriptions.all).option("--canary",descriptions.canary,{default:!1}).option("-f, --force",descriptions.force,{default:!1}).option("-p, --project [project]",descriptions.project,{default:!1}).option("--verbose",descriptions.verbose,{default:!1}).example("buddy upgrade:all").action(async(options)=>{log.debug("Running `buddy upgrade:all` ...",options);const perf=await intro("buddy upgrade:all");options.all=!0;const result=await runAction(Action.Upgrade,options);if(resultFailed(result)){await outro("While running buddy upgrade:all, there was an issue",{startTime:perf,useSeconds:!0},result.error);process.exit(ExitCode.FatalError)}await outro("All upgrades complete.",{startTime:perf,useSeconds:!0});process.exit(ExitCode.Success)});buddy.command("upgrade:dependencies",descriptions.dependencies).option("-p, --project [project]",descriptions.project,{default:!1}).option("--verbose",descriptions.verbose,{default:!1}).alias("upgrade:deps").example("buddy upgrade:dependencies").action(async(options)=>{log.debug("Running `buddy upgrade:dependencies` ...",options);const perf=await intro("buddy upgrade:dependencies");options.dependencies=!0;const result=await runAction(Action.Upgrade,options);if(resultFailed(result)){await outro("While running buddy upgrade:dependencies, there was an issue",{startTime:perf,useSeconds:!0},result.error);process.exit(ExitCode.FatalError)}await outro("Dependencies upgraded.",{startTime:perf,useSeconds:!0});process.exit(ExitCode.Success)});buddy.command("upgrade:bun",descriptions.bun).option("--verbose",descriptions.verbose,{default:!1}).example("buddy upgrade:bun").action(async(options)=>{log.debug("Running `buddy upgrade:bun` ...",options);const perf=await intro("buddy upgrade:bun"),result=await runAction(Action.UpgradeBun,options);if(resultFailed(result)){await outro("While running buddy upgrade:bun, there was an issue",{startTime:perf,useSeconds:!0},result.error);process.exit(ExitCode.FatalError)}await outro("Bun upgraded.",{startTime:perf,useSeconds:!0});process.exit(ExitCode.Success)});buddy.command("upgrade:shell",descriptions.shell).option("--verbose",descriptions.verbose,{default:!1}).example("buddy upgrade:shell").action(async(options)=>{log.debug("Running `buddy upgrade:shell` ...",options);const perf=await intro("buddy upgrade:shell"),result=await runAction(Action.UpgradeShell,options);if(resultFailed(result)){await outro("While running buddy upgrade:shell, there was an issue",{startTime:perf,useSeconds:!0},result.error);process.exit(ExitCode.FatalError)}await outro("Shell integration upgraded.",{startTime:perf,useSeconds:!0});process.exit(ExitCode.Success)});buddy.command("upgrade:binary",descriptions.binary).option("--verbose",descriptions.verbose,{default:!1}).example("buddy upgrade:binary").action(async(options)=>{if(process.getuid&&process.getuid()!==0){log.warn("To upgrade the binary, you need to run this command with sudo, or as root.");await log.flush();process.exit(ExitCode.FatalError)}log.debug("Running `buddy upgrade:binary` ...",options);const perf=await intro("buddy upgrade:binary"),result=await runAction(Action.UpgradeBinary,options);if(resultFailed(result)){await outro("While running buddy upgrade:binary, there was an issue",{startTime:perf,useSeconds:!0},result.error);process.exit(ExitCode.FatalError)}await outro("Binary upgraded.",{startTime:perf,useSeconds:!0});process.exit(ExitCode.Success)});onUnknownSubcommand(buddy,"upgrade")}
|
package/dist/release-ios.d.ts
CHANGED
|
@@ -15,3 +15,10 @@ export declare function nextBuildTag(version: string, tags: string[], latestRun?
|
|
|
15
15
|
* key it is only a count of tags, and the release says so rather than claim it.
|
|
16
16
|
*/
|
|
17
17
|
export declare function iosReleaseSummary(tag: string, options: { numberedByXcodeCloud: boolean }): { name: string, body: string };
|
|
18
|
+
/**
|
|
19
|
+
* Why a built project cannot ship: its `devServerURL` (what the app talks to)
|
|
20
|
+
* is the developer's own machine or network, which no tester's phone reaches.
|
|
21
|
+
* Checked on the generated `craft.config.json`, so it catches the address
|
|
22
|
+
* whatever set it - a `.env` override, a shell, or the config itself (#3028).
|
|
23
|
+
*/
|
|
24
|
+
export declare function unreleasableSite(craftConfig: { devServerURL?: unknown }): string | null;
|
package/dist/release-ios.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{incrementVersion,nextBuildNumber,SemVer}from"@stacksjs/bumpx";function marketingVersion(version){const parsed=new SemVer(version);if(parsed.prerelease.length||parsed.build.length||parsed.toString()!==version)throw Error("An iOS marketing version must be a stable version such as 1.0.0");return parsed.toString()}function iosBlock(source){const start=source.search(/\bios\s*:\s*\{/);if(start===-1)return null;const after=source.slice(start+1).search(/\n\s*(?:android|desktop|watch|web)\s*:\s*\{/);return{start,end:after===-1?source.length:start+1+after}}const VERSION_ENTRY=/(\bversion\s*:\s*(?:[^,\n]*?\?\?\s*)?)(['"])(\d+\.\d+\.\d+)\2/;export function iosVersionIn(source){const block=iosBlock(source);if(!block)return null;return VERSION_ENTRY.exec(source.slice(block.start,block.end))?.[3]??null}export function withIosVersion(source,version){marketingVersion(version);const block=iosBlock(source);if(!block||!VERSION_ENTRY.test(source.slice(block.start,block.end)))throw Error("config/mobile.ts declares no iOS `version`");const ios=source.slice(block.start,block.end).replace(VERSION_ENTRY,(_,lead,quote)=>`${lead}${quote}${version}${quote}`);return source.slice(0,block.start)+ios+source.slice(block.end)}export function bumpedVersion(current,bump){marketingVersion(current);if(bump==="build")return current;if(["patch","minor","major"].includes(bump))return marketingVersion(incrementVersion(current,bump));return marketingVersion(bump)}export function nextBuildTag(version,tags,latestRun=0){marketingVersion(version);const prefix=`v${version}-build.`,builds=tags.filter((tag)=>tag.startsWith(prefix)).map((tag)=>tag.slice(prefix.length)).filter((number)=>/^[1-9]\d*$/.test(number)).map(Number).filter(Number.isSafeInteger);return`${prefix}${nextBuildNumber(latestRun,builds)}`}export function iosReleaseSummary(tag,options){const match=/^v(\d+\.\d+\.\d+)-build\.(\d+)$/.exec(tag);if(!match)throw Error(`${tag} is not an iOS build tag (v<version>-build.<n>)`);const[,version,build]=match;return{name:`${version} (build ${build})`,body:options.numberedByXcodeCloud?`Version ${version}, TestFlight build **${build}**: Xcode Cloud builds this tag, and its run number is the build number TestFlight shows.`:`Version ${version}, build tag ${build}. Xcode Cloud builds this tag; it was cut without an App Store Connect key, so the build number TestFlight shows may differ.`}}
|
|
1
|
+
import{incrementVersion,nextBuildNumber,SemVer}from"@stacksjs/bumpx";import{isLocalSite}from"@stacksjs/actions/build/mobile-target";function marketingVersion(version){const parsed=new SemVer(version);if(parsed.prerelease.length||parsed.build.length||parsed.toString()!==version)throw Error("An iOS marketing version must be a stable version such as 1.0.0");return parsed.toString()}function iosBlock(source){const start=source.search(/\bios\s*:\s*\{/);if(start===-1)return null;const after=source.slice(start+1).search(/\n\s*(?:android|desktop|watch|web)\s*:\s*\{/);return{start,end:after===-1?source.length:start+1+after}}const VERSION_ENTRY=/(\bversion\s*:\s*(?:[^,\n]*?\?\?\s*)?)(['"])(\d+\.\d+\.\d+)\2/;export function iosVersionIn(source){const block=iosBlock(source);if(!block)return null;return VERSION_ENTRY.exec(source.slice(block.start,block.end))?.[3]??null}export function withIosVersion(source,version){marketingVersion(version);const block=iosBlock(source);if(!block||!VERSION_ENTRY.test(source.slice(block.start,block.end)))throw Error("config/mobile.ts declares no iOS `version`");const ios=source.slice(block.start,block.end).replace(VERSION_ENTRY,(_,lead,quote)=>`${lead}${quote}${version}${quote}`);return source.slice(0,block.start)+ios+source.slice(block.end)}export function bumpedVersion(current,bump){marketingVersion(current);if(bump==="build")return current;if(["patch","minor","major"].includes(bump))return marketingVersion(incrementVersion(current,bump));return marketingVersion(bump)}export function nextBuildTag(version,tags,latestRun=0){marketingVersion(version);const prefix=`v${version}-build.`,builds=tags.filter((tag)=>tag.startsWith(prefix)).map((tag)=>tag.slice(prefix.length)).filter((number)=>/^[1-9]\d*$/.test(number)).map(Number).filter(Number.isSafeInteger);return`${prefix}${nextBuildNumber(latestRun,builds)}`}export function iosReleaseSummary(tag,options){const match=/^v(\d+\.\d+\.\d+)-build\.(\d+)$/.exec(tag);if(!match)throw Error(`${tag} is not an iOS build tag (v<version>-build.<n>)`);const[,version,build]=match;return{name:`${version} (build ${build})`,body:options.numberedByXcodeCloud?`Version ${version}, TestFlight build **${build}**: Xcode Cloud builds this tag, and its run number is the build number TestFlight shows.`:`Version ${version}, build tag ${build}. Xcode Cloud builds this tag; it was cut without an App Store Connect key, so the build number TestFlight shows may differ.`}}export function unreleasableSite(craftConfig){const site=craftConfig.devServerURL;if(typeof site!=="string"||!site)return null;let url;try{url=new URL(site)}catch{return`devServerURL ${JSON.stringify(site)} is not a URL`}return isLocalSite(url)?`devServerURL ${url.origin}${url.pathname} is a local address, which a tester's phone cannot reach`:null}
|
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.337",
|
|
6
6
|
"description": "Meet Buddy. The Stacks runtime.",
|
|
7
7
|
"author": "Chris Breuer",
|
|
8
8
|
"contributors": [
|
|
@@ -95,69 +95,69 @@
|
|
|
95
95
|
"prepublishOnly": "bun run build"
|
|
96
96
|
},
|
|
97
97
|
"dependencies": {
|
|
98
|
-
"@stacksjs/actions": "0.75.
|
|
99
|
-
"@stacksjs/ai": "0.75.
|
|
100
|
-
"@stacksjs/alias": "0.75.
|
|
101
|
-
"@stacksjs/analytics": "0.75.
|
|
102
|
-
"@stacksjs/api": "0.75.
|
|
103
|
-
"@stacksjs/arrays": "0.75.
|
|
104
|
-
"@stacksjs/auth": "0.75.
|
|
105
|
-
"@stacksjs/browser-extension": "0.75.
|
|
106
|
-
"@stacksjs/build": "0.75.
|
|
98
|
+
"@stacksjs/actions": "0.75.337",
|
|
99
|
+
"@stacksjs/ai": "0.75.337",
|
|
100
|
+
"@stacksjs/alias": "0.75.337",
|
|
101
|
+
"@stacksjs/analytics": "0.75.337",
|
|
102
|
+
"@stacksjs/api": "0.75.337",
|
|
103
|
+
"@stacksjs/arrays": "0.75.337",
|
|
104
|
+
"@stacksjs/auth": "0.75.337",
|
|
105
|
+
"@stacksjs/browser-extension": "0.75.337",
|
|
106
|
+
"@stacksjs/build": "0.75.337",
|
|
107
107
|
"@stacksjs/bumpx": "^0.2.26",
|
|
108
|
-
"@stacksjs/cache": "0.75.
|
|
109
|
-
"@stacksjs/chat": "0.75.
|
|
108
|
+
"@stacksjs/cache": "0.75.337",
|
|
109
|
+
"@stacksjs/chat": "0.75.337",
|
|
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.337",
|
|
112
|
+
"@stacksjs/cloud": "0.75.337",
|
|
113
|
+
"@stacksjs/cms": "0.75.337",
|
|
114
|
+
"@stacksjs/collections": "0.75.337",
|
|
115
|
+
"@stacksjs/commerce": "0.75.337",
|
|
116
|
+
"@stacksjs/config": "0.75.337",
|
|
117
|
+
"@stacksjs/database": "0.75.337",
|
|
118
|
+
"@stacksjs/desktop-build": "0.75.337",
|
|
119
|
+
"@stacksjs/dns": "0.75.337",
|
|
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.337",
|
|
122
|
+
"@stacksjs/enums": "0.75.337",
|
|
123
|
+
"@stacksjs/env": "0.75.337",
|
|
124
|
+
"@stacksjs/error-handling": "0.75.337",
|
|
125
|
+
"@stacksjs/events": "0.75.337",
|
|
126
|
+
"@stacksjs/features": "0.75.337",
|
|
127
|
+
"@stacksjs/git": "0.75.337",
|
|
128
128
|
"@stacksjs/gitit": "^0.2.5",
|
|
129
|
-
"@stacksjs/health": "0.75.
|
|
129
|
+
"@stacksjs/health": "0.75.337",
|
|
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.
|
|
141
|
-
"@stacksjs/security": "0.75.
|
|
131
|
+
"@stacksjs/image": "0.75.337",
|
|
132
|
+
"@stacksjs/lint": "0.75.337",
|
|
133
|
+
"@stacksjs/logging": "0.75.337",
|
|
134
|
+
"@stacksjs/notifications": "0.75.337",
|
|
135
|
+
"@stacksjs/objects": "0.75.337",
|
|
136
|
+
"@stacksjs/orm": "0.75.337",
|
|
137
|
+
"@stacksjs/path": "0.75.337",
|
|
138
|
+
"@stacksjs/payments": "0.75.337",
|
|
139
|
+
"@stacksjs/realtime": "0.75.337",
|
|
140
|
+
"@stacksjs/router": "0.75.337",
|
|
141
|
+
"@stacksjs/security": "0.75.337",
|
|
142
142
|
"@stacksjs/rpx": "^0.11.54",
|
|
143
|
-
"@stacksjs/scheduler": "0.75.
|
|
144
|
-
"@stacksjs/search-engine": "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.
|
|
143
|
+
"@stacksjs/scheduler": "0.75.337",
|
|
144
|
+
"@stacksjs/search-engine": "0.75.337",
|
|
145
|
+
"@stacksjs/server": "0.75.337",
|
|
146
|
+
"@stacksjs/sites": "0.75.337",
|
|
147
|
+
"@stacksjs/skills": "0.75.337",
|
|
148
|
+
"@stacksjs/socials": "0.75.337",
|
|
149
|
+
"@stacksjs/storage": "0.75.337",
|
|
150
|
+
"@stacksjs/strings": "0.75.337",
|
|
151
151
|
"@stacksjs/stx": "0.2.736",
|
|
152
|
-
"@stacksjs/testing": "0.75.
|
|
153
|
-
"@stacksjs/tinker": "0.75.
|
|
152
|
+
"@stacksjs/testing": "0.75.337",
|
|
153
|
+
"@stacksjs/tinker": "0.75.337",
|
|
154
154
|
"@stacksjs/tlsx": "^0.13.19",
|
|
155
155
|
"@stacksjs/ts-cloud": "^0.16.69",
|
|
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.337",
|
|
157
|
+
"@stacksjs/types": "0.75.337",
|
|
158
|
+
"@stacksjs/ui": "0.75.337",
|
|
159
|
+
"@stacksjs/utils": "0.75.337",
|
|
160
|
+
"@stacksjs/validation": "0.75.337",
|
|
161
161
|
"ajv": "^8.20.0",
|
|
162
162
|
"ajv-formats": "^3.0.1",
|
|
163
163
|
"bun-plugin-stx": "0.2.736",
|