@radhya/mach 1.4.21 → 1.4.22
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/index.js +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -732,7 +732,7 @@ ${Te.dim("Note: Links are valid for 7 days.")}`)}else O&&He.warn("Simulator buil
|
|
|
732
732
|
`)}if(await H("read_package"),e.nodeVersion){let k=process.env.NVM_DIR||P.join(_e.homedir(),".nvm"),U=P.join(k,"versions","node"),q;if(E.existsSync(U)){let R=E.readdirSync(U).sort().reverse(),Z=e.nodeVersion.startsWith("v")?e.nodeVersion:`v${e.nodeVersion}`,V=R.find(Y=>Y===Z||Y.startsWith(Z+".")||Y.startsWith(`v${e.nodeVersion}.`));V&&(q=P.join(U,V,"bin"))}if(q&&E.existsSync(q)){let R=process.env.PATH||"";process.env.PATH=`${q}:${R}`,await x(`[NODE] Switched to Node ${e.nodeVersion} \u2014 using ${q}
|
|
733
733
|
`),A.info(S.green(`\u2713 Node switched to ${e.nodeVersion} (${q})`))}else await x(`[NODE] Warning: Node ${e.nodeVersion} not found in nvm. Run: nvm install ${e.nodeVersion} on the build machine.
|
|
734
734
|
`),A.warn(S.yellow(`Node ${e.nodeVersion} not found in nvm \u2014 using system default`))}await H("deps"),r.start("Checking dependencies...");let w=no(g),I=to(process.cwd()),b=E.existsSync("node_modules"),O=E.existsSync("yarn.lock"),G=E.existsSync("bun.lockb");b&&w.node&&w.node!==I&&(r.stop("Dependency fingerprint changed \u2014 clearing node_modules for clean install..."),await x(`[CACHE] package.json/lockfile changed \u2014 wiping node_modules
|
|
735
|
-
`),E.rmSync(P.join(process.cwd(),"node_modules"),{recursive:!0,force:!0}),b=!1);let M="npm",T=["install","--prefer-offline"];O?(M="yarn",T=["install","--prefer-offline"]):G&&(M="bun",T=["install"]),b?r.stop("Cached node_modules found. Syncing dependencies..."):r.stop("No cached dependencies. Running fresh install..."),A.info(S.dim(`Running ${M} ${T.join(" ")}...`)),await X(M,T,process.cwd(),t),w.node=I,bi(g,w);let L=JSON.parse(E.readFileSync("package.json","utf-8")),Q=L.dependencies?.expo||L.devDependencies?.expo,K=e.iosBundleIdentifier||"",j=e.name||"";if(Q){r.start(`Enforcing ${f.name} configuration...`);let k=P.join(process.cwd(),"app.json"),U=null;if(E.existsSync(k)){U=E.readFileSync(k,"utf-8");let R=JSON.parse(U);R.expo=R.expo||{},j||(j=R.expo.name||""),c==="ios"&&!K&&(K=R.expo?.ios?.bundleIdentifier||""),e.name&&(R.expo.name=e.name),e.scheme&&(R.expo.scheme=e.scheme),c==="ios"&&e.iosBundleIdentifier?(R.expo.ios=R.expo.ios||{},R.expo.ios.bundleIdentifier=e.iosBundleIdentifier):c==="android"&&e.androidPackage&&(R.expo.android=R.expo.android||{},R.expo.android.package=e.androidPackage),E.writeFileSync(k,JSON.stringify(R,null,2))}let q=["exec","--","expo","prebuild","--platform",c,"--no-install"];try{if(await H("prebuild"),await X("npm",q,process.cwd(),t),c==="ios"&&E.existsSync("ios")){await H("pods"),A.info(S.blue("Running pod install..."));try{let R=P.resolve("ios"),Z=P.join(R,"Podfile");if(!E.existsSync(Z))throw new Error("ios/Podfile not found. Skipping pod install.");let V=E.readFileSync(Z,"utf-8"),Y=e.iosDeploymentTarget||"13.4";if(!e.developmentClient&&(A.info(S.blue("\u2139\uFE0F Patching Podfile to EXCLUDE expo-dev-client...")),V.includes("use_expo_modules!")&&!V.includes("exclude:"))){let ae=/use_expo_modules!(\s*)$/m;ae.test(V)?V=V.replace(ae,'use_expo_modules!(exclude: ["expo-dev-client"])$1'):V=V.replace("use_expo_modules!",'use_expo_modules!(exclude: ["expo-dev-client"])')}let oe=`
|
|
735
|
+
`),E.rmSync(P.join(process.cwd(),"node_modules"),{recursive:!0,force:!0}),b=!1);let M="npm",T=["install","--prefer-offline"];O?(M="yarn",T=["install","--prefer-offline"]):G&&(M="bun",T=["install"]),b?r.stop("Cached node_modules found. Syncing dependencies..."):r.stop("No cached dependencies. Running fresh install..."),A.info(S.dim(`Running ${M} ${T.join(" ")}...`)),await X(M,T,process.cwd(),t),w.node=I,bi(g,w),e.preBuild&&(A.info(S.blue("Running pre-install hook...")),A.info(S.dim(`> ${e.preBuild}`)),await H("prebuild"),await X("bash",[e.preBuild],process.cwd(),t));let L=JSON.parse(E.readFileSync("package.json","utf-8")),Q=L.dependencies?.expo||L.devDependencies?.expo,K=e.iosBundleIdentifier||"",j=e.name||"";if(Q){r.start(`Enforcing ${f.name} configuration...`);let k=P.join(process.cwd(),"app.json"),U=null;if(E.existsSync(k)){U=E.readFileSync(k,"utf-8");let R=JSON.parse(U);R.expo=R.expo||{},j||(j=R.expo.name||""),c==="ios"&&!K&&(K=R.expo?.ios?.bundleIdentifier||""),e.name&&(R.expo.name=e.name),e.scheme&&(R.expo.scheme=e.scheme),c==="ios"&&e.iosBundleIdentifier?(R.expo.ios=R.expo.ios||{},R.expo.ios.bundleIdentifier=e.iosBundleIdentifier):c==="android"&&e.androidPackage&&(R.expo.android=R.expo.android||{},R.expo.android.package=e.androidPackage),E.writeFileSync(k,JSON.stringify(R,null,2))}let q=["exec","--","expo","prebuild","--platform",c,"--no-install"];try{if(await H("prebuild"),await X("npm",q,process.cwd(),t),c==="ios"&&E.existsSync("ios")){await H("pods"),A.info(S.blue("Running pod install..."));try{let R=P.resolve("ios"),Z=P.join(R,"Podfile");if(!E.existsSync(Z))throw new Error("ios/Podfile not found. Skipping pod install.");let V=E.readFileSync(Z,"utf-8"),Y=e.iosDeploymentTarget||"13.4";if(!e.developmentClient&&(A.info(S.blue("\u2139\uFE0F Patching Podfile to EXCLUDE expo-dev-client...")),V.includes("use_expo_modules!")&&!V.includes("exclude:"))){let ae=/use_expo_modules!(\s*)$/m;ae.test(V)?V=V.replace(ae,'use_expo_modules!(exclude: ["expo-dev-client"])$1'):V=V.replace("use_expo_modules!",'use_expo_modules!(exclude: ["expo-dev-client"])')}let oe=`
|
|
736
736
|
installer.generated_projects.each do |project|
|
|
737
737
|
project.targets.each do |target|
|
|
738
738
|
target.build_configurations.each do |config|
|
|
@@ -751,7 +751,7 @@ post_install do |installer|
|
|
|
751
751
|
${oe}
|
|
752
752
|
end
|
|
753
753
|
`;E.appendFileSync(Z,ae)}let qe="/opt/homebrew/bin/pod",Lt=E.existsSync(qe)?qe:"pod",Fe=io(R);E.existsSync(P.join(R,"Pods"))&&w.pods&&w.pods!==Fe&&(await x(`[CACHE] Podfile/Podfile.lock changed \u2014 wiping ios/Pods
|
|
754
|
-
`),A.info(S.dim("Podfile fingerprint changed \u2014 clearing Pods for clean install...")),E.rmSync(P.join(R,"Pods"),{recursive:!0,force:!0})),A.info(S.dim(`Using pod command: ${Lt} in ${R}`)),await X(Lt,["install"],R,t),w.pods=Fe,bi(g,w)}catch(R){let Z=R.message||"Unknown error";A.warn(S.yellow(`Native "pod" command failed: ${Z}`)),A.info(S.dim("Falling back to npm exec pod-install...")),A.info(S.magenta(`${f.nameUpper}_DEBUG: Executing pod-install override via npx --yes pod-install@latest`)),await X("npx",["--yes","pod-install@latest","ios"],process.cwd(),t)}if(E.existsSync("ios/Pods")){A.info(S.dim("Disabling signing for Pod targets to prevent conflicts..."));try{F(`find ios/Pods -name "project.pbxproj" -exec sed -i '' 's/buildSettings = {/buildSettings = { CODE_SIGNING_ALLOWED = NO; CODE_SIGNING_REQUIRED = NO; PROVISIONING_PROFILE_SPECIFIER = ""; EXPANDED_CODE_SIGN_IDENTITY = "";/g' {} +`,{stdio:"ignore"})}catch{}}}}finally{U&&E.writeFileSync(k,U)}r.stop(`Expo prebuild complete (${f.name} config enforced).`)}
|
|
754
|
+
`),A.info(S.dim("Podfile fingerprint changed \u2014 clearing Pods for clean install...")),E.rmSync(P.join(R,"Pods"),{recursive:!0,force:!0})),A.info(S.dim(`Using pod command: ${Lt} in ${R}`)),await X(Lt,["install"],R,t),w.pods=Fe,bi(g,w)}catch(R){let Z=R.message||"Unknown error";A.warn(S.yellow(`Native "pod" command failed: ${Z}`)),A.info(S.dim("Falling back to npm exec pod-install...")),A.info(S.magenta(`${f.nameUpper}_DEBUG: Executing pod-install override via npx --yes pod-install@latest`)),await X("npx",["--yes","pod-install@latest","ios"],process.cwd(),t)}if(E.existsSync("ios/Pods")){A.info(S.dim("Disabling signing for Pod targets to prevent conflicts..."));try{F(`find ios/Pods -name "project.pbxproj" -exec sed -i '' 's/buildSettings = {/buildSettings = { CODE_SIGNING_ALLOWED = NO; CODE_SIGNING_REQUIRED = NO; PROVISIONING_PROFILE_SPECIFIER = ""; EXPANDED_CODE_SIGN_IDENTITY = "";/g' {} +`,{stdio:"ignore"})}catch{}}}}finally{U&&E.writeFileSync(k,U)}r.stop(`Expo prebuild complete (${f.name} config enforced).`)}let B=[];if(c==="android")await H("build"),B=await co(e,s,t,k=>x(k),u);else if(c==="ios"){await H("signing"),A.info(S.dim("Preparing credentials..."));let k=o?.distributionType;B=await lo(e,n,s,t,i,U=>x(U),u,k,U=>H(U))}e.postBuild&&(A.info(S.blue("Running post-build hook...")),A.info(S.dim(`> ${e.postBuild}`)),await X(e.postBuild,[],process.cwd(),t));let Se=ao(Date.now()-a);if(A.success(S.green(`
|
|
755
755
|
\u2713 Local build completed successfully in ${Se}`)),await l("building",{...K&&{bundleId:K},...j&&{appName:j}}),B.length>0&&(A.info(S.cyan(`
|
|
756
756
|
\u{1F4E6} Generated Artifacts:`)),B.forEach(k=>{let U=P.resolve(k);A.info(S.dim(` - ${k}`)),A.info(S.gray(` Path: ${U}`))}),e.interactive)){let k=await Qn({message:"Install on connected device?"});if(!yt(k)&&k){if(c==="android"){let U=B.find(q=>q.endsWith(".apk"))||B[0];await po(U,q=>x(q))}else if(c==="ios"){let U=B.find(R=>R.endsWith(".ipa"))||B.find(R=>R.endsWith(".app"))||B[0],q=Oe("ios");e.simulator?await fo(U,q||"",R=>x(R)):await mo(U,q||"",R=>x(R))}}}await H("upload");let Ae=[];for(let k of B)try{let U=P.join(_e.tmpdir(),`${n}-${P.basename(k)}`);E.copyFileSync(k,U),Ae.push(U),A.info(S.dim(` \u{1F4CB} Preserved artifact: ${P.basename(k)}`))}catch{A.warn(S.yellow(` Failed to preserve artifact: ${P.basename(k)}`))}B=Ae,A.info(S.dim("\u{1F9F9} Cleaning workspace (preserving dependency cache)..."));try{let k=process.cwd(),U=new Set(["node_modules"]),q=E.readdirSync(k),R=0;for(let Z of q)if(!U.has(Z)){if(Z==="ios"){let V=P.join(k,"ios"),Y=E.readdirSync(V);for(let oe of Y)if(oe!=="Pods")try{E.rmSync(P.join(V,oe),{recursive:!0,force:!0}),R++}catch{}continue}try{E.rmSync(P.join(k,Z),{recursive:!0,force:!0}),R++}catch{}}try{let Z=P.join(_e.tmpdir(),`${f.buildPrefix}-${n}.keychain-db`);E.existsSync(Z)&&F(`security delete-keychain "${Z}"`,{stdio:"ignore"})}catch{}A.info(S.dim(` Cleaned ${R} items. Cached: node_modules${E.existsSync(P.join(k,"ios","Pods"))?", ios/Pods":""}`)),A.info(S.green("\u{1F512} Security: No source code retained on build server. Only public dependencies cached."))}catch{A.warn(S.yellow("Post-build cleanup encountered errors (non-fatal)."))}try{let U=P.join(_e.homedir(),f.workspacesDir),q=F(`df -k "${U}" | tail -1 | awk '{print $4}'`,{encoding:"utf8"}).trim(),R=parseInt(q,10)*1024;if(R<53687091200&&E.existsSync(U)){A.info(S.dim(` \u26A0\uFE0F Low disk space (${(R/1024/1024/1024).toFixed(0)} GB free). Running cache eviction...`));let Z=P.basename(process.cwd()),V=E.readdirSync(U).filter(Y=>Y!==Z).map(Y=>{let oe=P.join(U,Y);try{let Ee=E.statSync(oe);return Ee.isDirectory()?{name:Y,dir:oe,mtime:Ee.mtimeMs}:null}catch{return null}}).filter(Boolean);V.sort((Y,oe)=>Y.mtime-oe.mtime);for(let Y of V){if(R>=53687091200)break;try{E.rmSync(Y.dir,{recursive:!0,force:!0}),A.info(S.dim(` \u{1F5D1}\uFE0F Evicted stale workspace: ${Y.name}`));let oe=F(`df -k "${U}" | tail -1 | awk '{print $4}'`,{encoding:"utf8"}).trim();if(parseInt(oe,10)*1024>=53687091200)break}catch{}}}}catch{}return await C(),B}catch(y){throw await C(),y.message==="Command aborted"?(A.warn(S.yellow(`
|
|
757
757
|
\u274C Build aborted.`)),await l("failed",{error:"Aborted by user"}),y):(A.error(S.red(`
|