1"use strict";(globalThis.webpackChunkconfigure_website||=[]).push([[677],{1233(e,n,i){i.r(n),i.d(n,{assets:()=>l,contentTitle:()=>a,default:()=>u,frontMatter:()=>r,metadata:()=>t,toc:()=>c});const t=JSON.parse('{"id":"recipes","title":"Recipes","description":"This page documents various common automation tasks and how to achieve them with Trapeze.","source":"@site/docs/recipes.md","sourceDirName":".","slug":"/recipes","permalink":"/docs/recipes","draft":false,"unlisted":false,"tags":[],"version":"current","sidebarPosition":6,"frontMatter":{"title":"Recipes","sidebar_label":"Recipes","sidebar_position":6},"sidebar":"tutorialSidebar","previous":{"title":"API","permalink":"/docs/project-api"},"next":{"title":"CI/CD","permalink":"/docs/ci-cd"}}');var s=i(4848),o=i(8453);const r={title:"Recipes",sidebar_label:"Recipes",sidebar_position:6},a=void 0,l={},c=[{value:"Auto-incrementing Build Numbers",id:"auto-incrementing-build-numbers",level:2},{value:"Build-specific configuration settings",id:"build-specific-configuration-settings",level:2},{value:"Plugin configuration on install",id:"plugin-configuration-on-install",level:2}];function d(e){const n={a:"a",code:"code",h2:"h2",p:"p",pre:"pre",...(0,o.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n.p,{children:"This page documents various common automation tasks and how to achieve them with Trapeze."}),"\n",(0,s.jsx)(n.h2,{id:"auto-incrementing-build-numbers",children:"Auto-incrementing Build Numbers"}),"\n",(0,s.jsxs)(n.p,{children:["Apps often need to automatically increment build numbers, such as those using a CI/CD workflow in a service like ",(0,s.jsx)(n.a,{href:"https://useappflow.com/",children:"Appflow"}),"."]}),"\n",(0,s.jsxs)(n.p,{children:["Assuming your CI/CD service provides an environment variable that automatically increments (",(0,s.jsx)(n.a,{href:"https://useappflow.com/",children:"Appflow"})," does, using the ",(0,s.jsx)(n.code,{children:"CI_BUILD_NUMBER"})," environment variable), then updating the build number for your app requires supplying that number when updating the iOS build number and Android version code:"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-yaml",metastring:'title="ci.yaml"',children:"vars:\n CI_BUILD_NUMBER:\n default: 1\n\nplatforms:\n ios:\n buildNumber: $CI_BUILD_NUMBER\n android:\n versionCode: $CI_BUILD_NUMBER\n"})}),"\n",(0,s.jsx)(n.p,{children:"Run this before every build in your CI/CD workflow to have auto-incrementing build numbers."}),"\n",(0,s.jsx)(n.h2,{id:"build-specific-configuration-settings",children:"Build-specific configuration settings"}),"\n",(0,s.jsxs)(n.p,{children:["Apps often need to distribute configuration files that contain different values for different builds or environments. For example, ",(0,s.jsx)(n.code,{children:"google-services.json"}),", a common Google configuration file, will often contain different values for dev/qa/prod/etc. builds."]}),"\n",(0,s.jsx)(n.p,{children:"To do this, use an operation that updates the target configuration file and run it before performing a full build of your app."}),"\n",(0,s.jsxs)(n.p,{children:["Using the ",(0,s.jsx)(n.code,{children:"google-services.json"})," example from above, we can set the ",(0,s.jsx)(n.code,{children:"project_id"})," in ",(0,s.jsx)(n.code,{children:"google-services.json"})," to the value in the ",(0,s.jsx)(n.code,{children:"GOOGLE_PROJECT_ID"})," environment variable."]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-yaml",metastring:'title="config.yaml"',children:'vars:\n GOOGLE_PROJECT_ID:\n default: "default_id"\n\nplatforms:\n android:\n json:\n - file: google-services.json\n set:\n project_info:\n project_id: $GOOGLE_PROJECT_ID\n ios:\n targets:\n App:\n json:\n - file: google-services.json\n set:\n project_info:\n project_id: $GOOGLE_PROJECT_ID\n'})}),"\n",(0,s.jsx)(n.h2,{id:"plugin-configuration-on-install",children:"Plugin configuration on install"}),"\n",(0,s.jsx)(n.p,{children:"For authors of native plugins in a cross-platform framework like Capacitor or React Native, Trapeze can be used to automatically configure the developer's project when installing a plugin."}),"\n",(0,s.jsxs)(n.p,{children:["To do this, create a ",(0,s.jsx)(n.code,{children:"yaml"})," file that is distributed alongside the plugin, and then run the command when the plugin is installed, or document to developers how to run the command after install."]}),"\n",(0,s.jsx)(n.p,{children:"To use a Capacitor plugin for Microsoft Intune as an example, let's say the plugin requires some additional settings for iOS and Android. Then, when the plugin is installed, the developer runs the configuration script to fully install and configure the plugin."}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-yaml",metastring:'title="install.yaml"',children:"platforms:\n ios:\n targets:\n App:\n buildSettings:\n ENABLE_BITCODE: false\n STRIP_SWIFT_SYMBOLS: false\n\n plist:\n replace: false\n entr
1ies:\n - CFBundleURLTypes:\n - CFBundleURLSchemes:\n - msauth.$(PRODUCT_BUNDLE_IDENTIFIER)\n - msauth.$(PRODUCT_BUNDLE_IDENTIFIER)-intunemam\n - msauth.com.microsoft.intunemam\n android:\n manifest:\n - file: AndroidManifest.xml\n target: manifest\n inject: |\n <queries>\n \x3c!-- ... --\x3e\n </queries>\n"})}),"\n",(0,s.jsx)(n.p,{children:"The developer then installs the plugin and runs the configuration on install:"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-shell",children:"npm install my-capacitor-plugin\nnpx @trapezedev/configure run node_modules/my-capacitor-plugin/install.yaml\n"})})]})}function u(e={}){const{wrapper:n}={...(0,o.R)(),...e.components};return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(d,{...e})}):d(e)}},8453(e,n,i){i.d(n,{R:()=>r,x:()=>a});var t=i(6540);const s={},o=t.createContext(s);function r(e){const n=t.useContext(o);return t.useMemo(function(){return"function"==typeof e?e(n):{...n,...e}},[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:r(e.components),t.createElement(o.Provider,{value:n},e.children)}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.