@raycast/api 1.88.3 → 1.88.4
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/publish/index.js +1 -1
- package/dist/commands/pull-contributions/index.js +20 -20
- package/dist/commands/version/index.js +1 -1
- package/dist/utils/publish/publish-to-public-repo.js +1 -1
- package/dist/utils/publish/pull-contributions.js +1 -1
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var $=Object.create;var m=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var G=Object.getOwnPropertyNames;var R=Object.getPrototypeOf,L=Object.prototype.hasOwnProperty;var A=(t,n)=>()=>(n||t((n={exports:{}}).exports,n),n.exports),O=(t,n)=>{for(var o in n)m(t,o,{get:n[o],enumerable:!0})},T=(t,n,o,c)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of G(n))!L.call(t,i)&&i!==o&&m(t,i,{get:()=>n[i],enumerable:!(c=P(n,i))||c.enumerable});return t};var h=(t,n,o)=>(o=t!=null?$(R(t)):{},T(n||!t||!t.__esModule?m(o,"default",{value:t,enumerable:!0}):o,t)),D=t=>T(m({},"__esModule",{value:!0}),t);var B=A((Z,E)=>{var J=require("node:tty"),Y=J?.WriteStream?.prototype?.hasColors?.()??!1,r=(t,n)=>{if(!Y)return i=>i;let o=`\x1B[${t}m`,c=`\x1B[${n}m`;return i=>{let u=i+"",p=u.indexOf(c);if(p===-1)return o+u+c;let x=o,g=0;for(;p!==-1;)x+=u.slice(g,p)+o,g=p+c.length,p=u.indexOf(c,g);return x+=u.slice(g)+c,x}},e={};e.reset=r(0,0);e.bold=r(1,22);e.dim=r(2,22);e.italic=r(3,23);e.underline=r(4,24);e.overline=r(53,55);e.inverse=r(7,27);e.hidden=r(8,28);e.strikethrough=r(9,29);e.black=r(30,39);e.red=r(31,39);e.green=r(32,39);e.yellow=r(33,39);e.blue=r(34,39);e.magenta=r(35,39);e.cyan=r(36,39);e.white=r(37,39);e.gray=r(90,39);e.bgBlack=r(40,49);e.bgRed=r(41,49);e.bgGreen=r(42,49);e.bgYellow=r(43,49);e.bgBlue=r(44,49);e.bgMagenta=r(45,49);e.bgCyan=r(46,49);e.bgWhite=r(47,49);e.bgGray=r(100,49);e.redBright=r(91,39);e.greenBright=r(92,39);e.yellowBright=r(93,39);e.blueBright=r(94,39);e.magentaBright=r(95,39);e.cyanBright=r(96,39);e.whiteBright=r(97,39);e.bgRedBright=r(101,49);e.bgGreenBright=r(102,49);e.bgYellowBright=r(103,49);e.bgBlueBright=r(104,49);e.bgMagentaBright=r(105,49);e.bgCyanBright=r(106,49);e.bgWhiteBright=r(107,49);E.exports=e});var j=A((ie,q)=>{q.exports={name:"ray",description:"Build extensions for Raycast with React and Node.js.",version:"1.88.
|
|
1
|
+
"use strict";var $=Object.create;var m=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var G=Object.getOwnPropertyNames;var R=Object.getPrototypeOf,L=Object.prototype.hasOwnProperty;var A=(t,n)=>()=>(n||t((n={exports:{}}).exports,n),n.exports),O=(t,n)=>{for(var o in n)m(t,o,{get:n[o],enumerable:!0})},T=(t,n,o,c)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of G(n))!L.call(t,i)&&i!==o&&m(t,i,{get:()=>n[i],enumerable:!(c=P(n,i))||c.enumerable});return t};var h=(t,n,o)=>(o=t!=null?$(R(t)):{},T(n||!t||!t.__esModule?m(o,"default",{value:t,enumerable:!0}):o,t)),D=t=>T(m({},"__esModule",{value:!0}),t);var B=A((Z,E)=>{var J=require("node:tty"),Y=J?.WriteStream?.prototype?.hasColors?.()??!1,r=(t,n)=>{if(!Y)return i=>i;let o=`\x1B[${t}m`,c=`\x1B[${n}m`;return i=>{let u=i+"",p=u.indexOf(c);if(p===-1)return o+u+c;let x=o,g=0;for(;p!==-1;)x+=u.slice(g,p)+o,g=p+c.length,p=u.indexOf(c,g);return x+=u.slice(g)+c,x}},e={};e.reset=r(0,0);e.bold=r(1,22);e.dim=r(2,22);e.italic=r(3,23);e.underline=r(4,24);e.overline=r(53,55);e.inverse=r(7,27);e.hidden=r(8,28);e.strikethrough=r(9,29);e.black=r(30,39);e.red=r(31,39);e.green=r(32,39);e.yellow=r(33,39);e.blue=r(34,39);e.magenta=r(35,39);e.cyan=r(36,39);e.white=r(37,39);e.gray=r(90,39);e.bgBlack=r(40,49);e.bgRed=r(41,49);e.bgGreen=r(42,49);e.bgYellow=r(43,49);e.bgBlue=r(44,49);e.bgMagenta=r(45,49);e.bgCyan=r(46,49);e.bgWhite=r(47,49);e.bgGray=r(100,49);e.redBright=r(91,39);e.greenBright=r(92,39);e.yellowBright=r(93,39);e.blueBright=r(94,39);e.magentaBright=r(95,39);e.cyanBright=r(96,39);e.whiteBright=r(97,39);e.bgRedBright=r(101,49);e.bgGreenBright=r(102,49);e.bgYellowBright=r(103,49);e.bgBlueBright=r(104,49);e.bgMagentaBright=r(105,49);e.bgCyanBright=r(106,49);e.bgWhiteBright=r(107,49);E.exports=e});var j=A((ie,q)=>{q.exports={name:"ray",description:"Build extensions for Raycast with React and Node.js.",version:"1.88.4",author:"mathieudutour",private:!0,bin:{ray:"./bin/run.js"},dependencies:{"@oclif/core":"^4.0.33","@oclif/plugin-autocomplete":"^3.2.10","@oclif/plugin-help":"^6.2.18","@oclif/plugin-not-found":"^3.2.28","@raycast/eslint-plugin":"^1.0.15","@raycast/extract-tools-info":"file:../extract-tools-info",ajv:"^8.17.1",archiver:"^7.0.1",camelcase:"^8.0.0",chokidar:"^4.0.1","cli-progress":"^3.12.0",clipboardy:"^2.3.0",execa:"^9.5.1","json-source-map":"^0.6.1",json5:"^2.2.3","node-fetch-cjs":"^3.3.2",open:"^8.4.2",ora:"^8.1.1","terminal-link":"^3.0.0",yaml:"^2.6.1","yoctocolors-cjs":"^2.1.2"},devDependencies:{"@raycast/eslint-config":"^1.0.11","@types/archiver":"^6.0.3","@types/cli-progress":"^3.11.6","@types/node":"20.8.4",esbuild:"^0.24.0",eslint:"^8","json-schema-to-typescript":"^15.0.3",oclif:"^4.15.28",typescript:"^5.6.3"},files:["/bin","/dist","/oclif.manifest.json"],license:"MIT",main:"dist/index.js",oclif:{bin:"ray",dirname:"ray",commands:"./dist/commands",plugins:["@oclif/plugin-autocomplete","@oclif/plugin-help","@oclif/plugin-not-found"]},scripts:{"json-schema-to-ts":"json2ts ../../api/schema.json -y > src/types/manifest-schema.d.ts","build-scripts":'./node_modules/.bin/tsc "./scripts/build.ts" "./scripts/build-command.ts" "./scripts/dev-command.ts" --outDir ./scripts/dist --esModuleInterop',"build-extract-tools-info":"cd ../extract-tools-info && npm ci && npm run build",prebuild:"npm run build-extract-tools-info && npm run json-schema-to-ts && npm run build-scripts",build:"node ./scripts/dist/build-command.js",predev:"npm run json-schema-to-ts && npm run build-scripts",dev:"node ./scripts/dist/dev-command.js",lint:"eslint . --ext .ts"},types:"dist/index.d.ts"}});var K={};O(K,{default:()=>b});module.exports=D(K);var l=require("@oclif/core");var f=h(require("node:fs")),w=h(require("node:path")),v=h(require("node:os"));var S="KqAdcGhNfBKiUpfjD3nU3VNgh1t0iMPoX2hYEkN9d4I",F="e69bae0ec90f5e838555",a={},C;function I(t){C=t;try{a=JSON.parse(f.readFileSync(w.join(M(),"config.json"),"utf8"))}catch(n){if(n instanceof Error&&n.code==="ENOENT")return;throw new Error(`Failed to read config file: ${n}`)}}function U(t){switch(t){case"raycastApiURL":return process.env.RAY_APIURL||a.APIURL||"https://www.raycast.com";case"raycastAccessToken":return process.env.RAY_Token||a.Token||a.AccessToken||"";case"raycastClientId":return process.env.RAY_ClientID||a.ClientID||S;case"githubClientId":return process.env.RAY_GithubClientID||a.GithubClientID||F;case"githubAccessToken":return process.env.GITHUB_ACCESS_TOKEN||a.GithubAccessToken||"";case"flavorName":return process.env.RAY_Target||(typeof a.Target>"u"?k("release"):a.Target)}}function k(t){switch(t){case"debug":return"debug";case"internal":return"internal";case"release":return"";case void 0:return U("flavorName")}}function _(){let t=k(C);return t==""?"raycast":`raycast-${t}`}function M(){let t=w.join(v.default.homedir(),".config",_());return f.mkdirSync(t,{recursive:!0}),t}var s=h(B());var ee=(0,s.blue)((0,s.dim)("internal only"));var d={wait:`\u{1F550}${(0,s.blue)("wait")} - `,info:`${process.env.GITHUB_ACTIONS==="true"?"\u2139\uFE0F":"\u2139\uFE0F "}${(0,s.cyan)("info")} - `,success:`\u2705${(0,s.green)("ready")} - `,warn:`${process.env.GITHUB_ACTIONS==="true"?"\u26A0\uFE0F":"\u26A0\uFE0F "}${(0,s.yellow)("warn")} - `,error:`\u{1F4A5}${(0,s.red)("error")} - `,event:`\u26A1\uFE0F${(0,s.magenta)("event")} - `,paymentPrompt:`\u{1F4B0}${(0,s.yellowBright)("plan")} - `},H=!0;function N(t,n){t||(d.wait=`${(0,s.blue)("wait")} - `,d.info=`${(0,s.cyan)("info")} - `,d.success=`${(0,s.green)("ready")} - `,d.warn=`${(0,s.yellow)("warn")} - `,d.error=`${(0,s.red)("error")} - `,d.event=`${(0,s.magenta)("event")} - `,d.paymentPrompt=`${(0,s.yellowBright)("plan")} - `),n&&(H=!1)}var y=class extends l.Command{static baseFlags={"exit-on-error":l.Flags.boolean({default:!0,helpGroup:"GLOBAL",aliases:["exitOnError"],deprecateAliases:!0,summary:"Always exit with non-zero code on error",allowNo:!0}),emoji:l.Flags.boolean({default:!1,helpGroup:"GLOBAL",summary:"Prefix output with emojis \u{1F308}"}),help:l.Flags.boolean({default:!1,helpGroup:"GLOBAL",summary:"Show the help message for the command"}),"non-interactive":l.Flags.boolean({char:"I",default:!1,helpGroup:"GLOBAL",summary:"Disable interactive outputs, useful for CI"}),target:l.Flags.option({char:"t",description:"Raycast app target",helpGroup:"GLOBAL",multiple:!1,options:["debug","internal","release"],hidden:!0})()};flags;args;async init(){await super.init(),process.on("SIGINT",()=>process.exit(1));let{args:n,flags:o}=await this.parse({flags:this.ctor.flags,baseFlags:super.ctor.baseFlags,enableJsonFlag:this.ctor.enableJsonFlag,args:this.ctor.args,strict:this.ctor.strict});this.flags=o,this.args=n,I(this.flags.target),N(this.flags.emoji,this.flags["non-interactive"])}error(n,o){return o?.message&&n instanceof Error&&(n.message=`${o.message} (${n.message})`,delete o.message),super.error(n,o)}async catch(n){return super.catch(n)}async finally(n){return super.finally(n)}};var b=class t extends y{static description="Print the version number";async run(){await this.parse(t),this.log(`${j().version}`)}};
|
|
@@ -34,7 +34,7 @@ To automate this process, you have to authenticate with GitHub.
|
|
|
34
34
|
First copy your one-time code: ${r.user_code}
|
|
35
35
|
Press Enter to open github.com in your browser...`),process.stdin.setRawMode(!0),process.stdin.resume(),await new Promise(i=>process.stdin.once("data",a=>{let l=[...a];l.length>0&&l[0]===3&&(console.log("^C"),process.exit(1)),process.stdin.setRawMode(!1),i(void 0)})),Au(r.verification_uri);let o=r.interval*1e3;for(;;){await new Promise(i=>setTimeout(i,o));try{let i=await _e("https://github.com/login/oauth/access_token",{method:"POST",body:JSON.stringify({client_id:e,device_code:r.device_code,grant_type:"urn:ietf:params:oauth:grant-type:device_code"})});if(!i.error){rn("githubAccessToken",i.access_token);return}if(i.error!=="authorization_pending")throw new Error(i.error_description)}catch(i){throw new Error(`failed to get the access token (${i.message})`)}}}async function Tu(e,r){let o=ne("githubAccessToken"),i=await _e(`https://api.github.com/repos/${e.owner.login}/${e.name}/forks`,{method:"POST",token:o,body:JSON.stringify({name:r,default_branch_only:!0})});for(let a=0;a<=30;a++){try{await _e(`https://api.github.com/repos/${i.owner.login}/${i.name}/commits?per_page=1`,{token:o});break}catch(l){if(a===30)throw new Error(`fork not ready after 1min (${l.message})`)}await new Promise(l=>setTimeout(l,2e3))}return i}async function Pu(e){let r=ne("githubAccessToken");try{await _e(`https://api.github.com/repos/${e.owner.login}/${e.name}/merge-upstream`,{method:"POST",token:r,body:JSON.stringify({branch:"main"})})}catch(o){throw new Error(`could not get the latest changes. Head to https://github.com/${e.owner.login}/${e.name}, select the Sync fork dropdown menu above the list of files, and then click Update branch. Once you've done that, try running this command again
|
|
36
36
|
|
|
37
|
-
Error: ${o.message}`)}}async function Ou(e){let r=ne("githubAccessToken");await _e(`https://api.github.com/repos/${e.owner.login}/${e.name}`,{method:"POST",token:r,body:JSON.stringify({delete_branch_on_merge:"true"})})}function xu(e,r){return Ea(`https://oauth2:${ne("githubAccessToken")}@github.com/${e.owner.login}/${e.name}`,r)}function ui(e,r){return Ca(e,`https://oauth2:${ne("githubAccessToken")}@github.com/${r.owner.login}/${r.name}`)}async function ku(e,r,o){let i=`"\\"name\\": \\"${r}\\"" "\\"author\\": \\"${o}\\"" repo:raycast/extensions in:file path:extensions extension:json`,a=ne("githubAccessToken"),f=(await _e(`https://api.github.com/search/code?q=${encodeURIComponent(i)}&per_page=3`,{token:a})).items.filter(d=>d.name==="package.json");if(f.length===0)return ai.default.join("extensions",r);if(f.length>1)throw new Error(`found more than one extension with name ${r}`);return ai.default.dirname(f[0].path)}async function Iu(e){let r=`type:pr repo:raycast/extensions ${e} is:merged`,o=ne("githubAccessToken");return(await _e(`https://api.github.com/search/issues?q=${encodeURIComponent(r)}&per_page=1`,{token:o})).items.length>0}async function Wu(e,r,o){return(await _e(`https://api.github.com/repos/${e.owner.login}/${e.name}/pulls?base=main&head=${r.owner.login}:${encodeURIComponent(o)}`,{token:ne("githubAccessToken")})).find(a=>a.head.ref===o&&a.head.user.login===r.owner.login)}function $u(e,r,o,i,a){return _e(`https://api.github.com/repos/${e.owner.login}/${e.name}/pulls`,{method:"POST",token:ne("githubAccessToken"),body:JSON.stringify({title:i,head:`${r.owner.login}:${o}`,base:"main",body:a,maintainer_can_modify:!0})})}var li=x(require("path")),Rt=x(require("fs"));function Fn(e,r,o=[".git",".github","node_modules","raycast-env.d.ts",".raycast-swift-build",".swiftpm","compiled_raycast_swift"]){let i=Rt.default.readdirSync(e);try{Rt.default.mkdirSync(r,{recursive:!0})}catch{}for(let a of i){let l=li.default.join(e,a),f=li.default.join(r,a);if(Rt.default.lstatSync(l).isDirectory()){if(!o.includes(a)){try{Rt.default.mkdirSync(f,{recursive:!0})}catch{}Fn(l,f,o)}}else o.includes(a)||Rt.default.copyFileSync(l,f)}}var ci=x(require("path")),Lu=x(require("fs"));var Mu=!1;async function fi(e){if(!await ya())throw new Error("please create a git repository first (git init)");if(await Zt())throw new Error("please commit or discard your uncommited changes first (git commit -a -m 'your changes')");await Bu();let r={owner:{login:"raycast"},name:"extensions"},o=ci.default.join(Mo(),"public-extensions-fork"),i=`ext/${e.name}`,a="",l,f=await ke("getting fork",async()=>{try{l=await Tu(r,"raycast-extensions"),await Pu(l),await Ou(l)}catch(d){throw new Error(`fork extensions repo: ${d.message}`)}},{printError:!1});if(f){if(f.message.includes("not authorized \u2013 please log in first using `npx ray login`")){if(Mu)throw new Error("fork extensions repo: not authorized");return Mu=!0,rn("githubAccessToken",void 0),fi(e)}throw f}else l=l;if(!Lu.default.existsSync(o)){let d=await ke("cloning repo",async()=>{await xu(l,o)},{printError:!1});if(d)throw d}if(re(o),await ui("origin",l),await ui("upstream",r),f=await ke("preparing clone",async()=>{let d=await ku(r,e.name,e.author);a=ci.default.join(o,d),re(void 0);let g=await Bo("user.name"),m=await Bo("user.email");if(re(o),await To("user.name",g),await To("user.email",m),await wa(d),await Ie("main"),await Oo("upstream","main"),await va("upstream/main"),await en(i)){await Xr(i),await Oo("origin",i);let P=await _a();await Iu(P)&&(await Sa(i),await Xr(i))}else await Po(i),await Xr(i)},{printError:!1}),f)throw f;return{upstream:r,fork:l,clonePath:o,extensionPathInClone:a,branch:i}}async function Ed(e){let{upstream:r,fork:o,clonePath:i,extensionPathInClone:a,branch:l}=await fi(e),f=Nu.default.existsSync(qu.default.join(a,"package.json")),{latestPublishTag:d,latestPullTag:g}=Pa(l);re(i);let m=await ke("checking for new contributions",async()=>{if(f){if(await en(l)){if(!await Ra(l))throw new Error("some contributions are available. Pull them using `npx @raycast/api@latest pull-contributions`");return}if(Ie("main"),!(await tn(g)&&!await Aa(a,g))){re(void 0),await tn(d)?await Ie(d):await Ie(Fa);try{if(Fn(a,process.cwd()),await Zt())throw await Ba(),await Ie(ga),new Error("some contributions are available. Pull them using `npx @raycast/api@latest pull-contributions`")}finally{await Ie(ba)}}}});m&&process.exit(1),re(i),Ie(l),m=await ke("preparing extension",async()=>{if(Fn(process.cwd(),a),!await Zt())throw re(i),xo(l),re(void 0),ko(d,"Used by the Ray CLI to track the latest commit that was published"),new Error("seems like there is nothing new to publish")}),m&&process.exit(1),m=await ke("pushing extension",async()=>{await Ta(a,await Cd(e,f,i,d)),await xo(l)}),m&&process.exit(1),re(
|
|
37
|
+
Error: ${o.message}`)}}async function Ou(e){let r=ne("githubAccessToken");await _e(`https://api.github.com/repos/${e.owner.login}/${e.name}`,{method:"POST",token:r,body:JSON.stringify({delete_branch_on_merge:"true"})})}function xu(e,r){return Ea(`https://oauth2:${ne("githubAccessToken")}@github.com/${e.owner.login}/${e.name}`,r)}function ui(e,r){return Ca(e,`https://oauth2:${ne("githubAccessToken")}@github.com/${r.owner.login}/${r.name}`)}async function ku(e,r,o){let i=`"\\"name\\": \\"${r}\\"" "\\"author\\": \\"${o}\\"" repo:raycast/extensions in:file path:extensions extension:json`,a=ne("githubAccessToken"),f=(await _e(`https://api.github.com/search/code?q=${encodeURIComponent(i)}&per_page=3`,{token:a})).items.filter(d=>d.name==="package.json");if(f.length===0)return ai.default.join("extensions",r);if(f.length>1)throw new Error(`found more than one extension with name ${r}`);return ai.default.dirname(f[0].path)}async function Iu(e){let r=`type:pr repo:raycast/extensions ${e} is:merged`,o=ne("githubAccessToken");return(await _e(`https://api.github.com/search/issues?q=${encodeURIComponent(r)}&per_page=1`,{token:o})).items.length>0}async function Wu(e,r,o){return(await _e(`https://api.github.com/repos/${e.owner.login}/${e.name}/pulls?base=main&head=${r.owner.login}:${encodeURIComponent(o)}`,{token:ne("githubAccessToken")})).find(a=>a.head.ref===o&&a.head.user.login===r.owner.login)}function $u(e,r,o,i,a){return _e(`https://api.github.com/repos/${e.owner.login}/${e.name}/pulls`,{method:"POST",token:ne("githubAccessToken"),body:JSON.stringify({title:i,head:`${r.owner.login}:${o}`,base:"main",body:a,maintainer_can_modify:!0})})}var li=x(require("path")),Rt=x(require("fs"));function Fn(e,r,o=[".git",".github","node_modules","raycast-env.d.ts",".raycast-swift-build",".swiftpm","compiled_raycast_swift"]){let i=Rt.default.readdirSync(e);try{Rt.default.mkdirSync(r,{recursive:!0})}catch{}for(let a of i){let l=li.default.join(e,a),f=li.default.join(r,a);if(Rt.default.lstatSync(l).isDirectory()){if(!o.includes(a)){try{Rt.default.mkdirSync(f,{recursive:!0})}catch{}Fn(l,f,o)}}else o.includes(a)||Rt.default.copyFileSync(l,f)}}var ci=x(require("path")),Lu=x(require("fs"));var Mu=!1;async function fi(e){if(!await ya())throw new Error("please create a git repository first (git init)");if(await Zt())throw new Error("please commit or discard your uncommited changes first (git commit -a -m 'your changes')");await Bu();let r={owner:{login:"raycast"},name:"extensions"},o=ci.default.join(Mo(),"public-extensions-fork"),i=`ext/${e.name}`,a="",l,f=await ke("getting fork",async()=>{try{l=await Tu(r,"raycast-extensions"),await Pu(l),await Ou(l)}catch(d){throw new Error(`fork extensions repo: ${d.message}`)}},{printError:!1});if(f){if(f.message.includes("not authorized \u2013 please log in first using `npx ray login`")){if(Mu)throw new Error("fork extensions repo: not authorized");return Mu=!0,rn("githubAccessToken",void 0),fi(e)}throw f}else l=l;if(!Lu.default.existsSync(o)){let d=await ke("cloning repo",async()=>{await xu(l,o)},{printError:!1});if(d)throw d}if(re(o),await ui("origin",l),await ui("upstream",r),f=await ke("preparing clone",async()=>{let d=await ku(r,e.name,e.author);a=ci.default.join(o,d),re(void 0);let g=await Bo("user.name"),m=await Bo("user.email");if(re(o),await To("user.name",g),await To("user.email",m),await wa(d),await Ie("main"),await Oo("upstream","main"),await va("upstream/main"),await en(i)){await Xr(i),await Oo("origin",i);let P=await _a();await Iu(P)&&(await Sa(i),await Xr(i))}else await Po(i),await Xr(i)},{printError:!1}),f)throw f;return{upstream:r,fork:l,clonePath:o,extensionPathInClone:a,branch:i}}async function Ed(e){let{upstream:r,fork:o,clonePath:i,extensionPathInClone:a,branch:l}=await fi(e),f=Nu.default.existsSync(qu.default.join(a,"package.json")),{latestPublishTag:d,latestPullTag:g}=Pa(l);re(i);let m=await ke("checking for new contributions",async()=>{if(f){if(await en(l)){if(!await Ra(l))throw new Error("some contributions are available. Pull them using `npx @raycast/api@latest pull-contributions`");return}if(await Ie("main"),!(await tn(g)&&!await Aa(a,g))){re(void 0),await tn(d)?await Ie(d):await Ie(Fa);try{if(Fn(a,process.cwd()),await Zt())throw await Ba(),await Ie(ga),new Error("some contributions are available. Pull them using `npx @raycast/api@latest pull-contributions`")}finally{await Ie(ba)}}}});m&&process.exit(1),re(i),await Ie(l),m=await ke("preparing extension",async()=>{if(Fn(process.cwd(),a),!await Zt())throw re(i),await xo(l),re(void 0),await ko(d,"Used by the Ray CLI to track the latest commit that was published"),new Error("seems like there is nothing new to publish")}),m&&process.exit(1),m=await ke("pushing extension",async()=>{await Ta(a,await Cd(e,f,i,d)),await xo(l)}),m&&process.exit(1),re(void 0),await ko(d,"Used by the Ray CLI to track the latest commit that was published"),m=await ke("opening PR",async()=>{let P=await Wu(r,o,l);if(P)return`
|
|
38
38
|
|
|
39
39
|
\u{1F680} Your submission has been updated!
|
|
40
40
|
|
|
@@ -33,7 +33,7 @@ To automate this process, you have to authenticate with GitHub.
|
|
|
33
33
|
First copy your one-time code: ${r.user_code}
|
|
34
34
|
Press Enter to open github.com in your browser...`),process.stdin.setRawMode(!0),process.stdin.resume(),await new Promise(i=>process.stdin.once("data",u=>{let l=[...u];l.length>0&&l[0]===3&&(console.log("^C"),process.exit(1)),process.stdin.setRawMode(!1),i(void 0)})),Sa(r.verification_uri);let o=r.interval*1e3;for(;;){await new Promise(i=>setTimeout(i,o));try{let i=await Ie("https://github.com/login/oauth/access_token",{method:"POST",body:JSON.stringify({client_id:e,device_code:r.device_code,grant_type:"urn:ietf:params:oauth:grant-type:device_code"})});if(!i.error){tn("githubAccessToken",i.access_token);return}if(i.error!=="authorization_pending")throw new Error(i.error_description)}catch(i){throw new Error(`failed to get the access token (${i.message})`)}}}async function Aa(e,r){let o=pe("githubAccessToken"),i=await Ie(`https://api.github.com/repos/${e.owner.login}/${e.name}/forks`,{method:"POST",token:o,body:JSON.stringify({name:r,default_branch_only:!0})});for(let u=0;u<=30;u++){try{await Ie(`https://api.github.com/repos/${i.owner.login}/${i.name}/commits?per_page=1`,{token:o});break}catch(l){if(u===30)throw new Error(`fork not ready after 1min (${l.message})`)}await new Promise(l=>setTimeout(l,2e3))}return i}async function Ra(e){let r=pe("githubAccessToken");try{await Ie(`https://api.github.com/repos/${e.owner.login}/${e.name}/merge-upstream`,{method:"POST",token:r,body:JSON.stringify({branch:"main"})})}catch(o){throw new Error(`could not get the latest changes. Head to https://github.com/${e.owner.login}/${e.name}, select the Sync fork dropdown menu above the list of files, and then click Update branch. Once you've done that, try running this command again
|
|
35
35
|
|
|
36
|
-
Error: ${o.message}`)}}async function Ba(e){let r=pe("githubAccessToken");await Ie(`https://api.github.com/repos/${e.owner.login}/${e.name}`,{method:"POST",token:r,body:JSON.stringify({delete_branch_on_merge:"true"})})}function Ta(e,r){return gu(`https://oauth2:${pe("githubAccessToken")}@github.com/${e.owner.login}/${e.name}`,r)}function ii(e,r){return bu(e,`https://oauth2:${pe("githubAccessToken")}@github.com/${r.owner.login}/${r.name}`)}async function Pa(e,r,o){let i=`"\\"name\\": \\"${r}\\"" "\\"author\\": \\"${o}\\"" repo:raycast/extensions in:file path:extensions extension:json`,u=pe("githubAccessToken"),f=(await Ie(`https://api.github.com/search/code?q=${encodeURIComponent(i)}&per_page=3`,{token:u})).items.filter(d=>d.name==="package.json");if(f.length===0)return oi.default.join("extensions",r);if(f.length>1)throw new Error(`found more than one extension with name ${r}`);return oi.default.dirname(f[0].path)}async function Oa(e){let r=`type:pr repo:raycast/extensions ${e} is:merged`,o=pe("githubAccessToken");return(await Ie(`https://api.github.com/search/issues?q=${encodeURIComponent(r)}&per_page=1`,{token:o})).items.length>0}var xa=!1;async function ui(e){if(!await mu())throw new Error("please create a git repository first (git init)");if(await Xt())throw new Error("please commit or discard your uncommited changes first (git commit -a -m 'your changes')");await va();let r={owner:{login:"raycast"},name:"extensions"},o=si.default.join(Io(),"public-extensions-fork"),i=`ext/${e.name}`,u="",l,f=await bt("getting fork",async()=>{try{l=await Aa(r,"raycast-extensions"),await Ra(l),await Ba(l)}catch(d){throw new Error(`fork extensions repo: ${d.message}`)}},{printError:!1});if(f){if(f.message.includes("not authorized \u2013 please log in first using `npx ray login`")){if(xa)throw new Error("fork extensions repo: not authorized");return xa=!0,tn("githubAccessToken",void 0),ui(e)}throw f}else l=l;if(!ka.default.existsSync(o)){let d=await bt("cloning repo",async()=>{await Ta(l,o)},{printError:!1});if(d)throw d}if(et(o),await ii("origin",l),await ii("upstream",r),f=await bt("preparing clone",async()=>{let d=await Pa(r,e.name,e.author);u=si.default.join(o,d),et(void 0);let p=await Ao("user.name"),g=await Ao("user.email");if(et(o),await Ro("user.name",p),await Ro("user.email",g),await Fu(d),await Oe("main"),await To("upstream","main"),await yu("upstream/main"),await en(i)){await Ft(i),await To("origin",i);let x=await pu();await Oa(x)&&(await _u(i),await Ft(i))}else await Bo(i),await Ft(i)},{printError:!1}),f)throw f;return{upstream:r,fork:l,clonePath:o,extensionPathInClone:u,branch:i}}async function gd(e){let{clonePath:r,extensionPathInClone:o,branch:i}=await ui(e),u=Wa.default.existsSync(Ia.default.join(o,"package.json")),{latestPublishTag:l,latestPullTag:f}=Ru(i);et(r),await bt("pulling new contributions",async()=>{if(!u)return"no new contributions";if(await en(i)?await Eu(i)||(await Oe(i),await vu(i)):(Oe("main"),wu(f,"Used by the Ray CLI to track the latest commit that was pulled")),et(void 0),await Cu(l)?await Oe(l):await Oe(hu),xo(o,process.cwd()),await Xt()){let p=`contributions/merge-${new Date().getTime()}`;await Ft(p),await Su("Pull contributions"),await Oe("@{-2}");try{await Au(p)}catch(g){if(await Xt())return"Some contributions conflict with your changes.\n\nYou can do two things:\n\n- Decide not to merge but you won't be able to publish your changes. The only clean-ups you need are to run `git merge --abort`.\n\n- Resolve the conflicts. Edit the files into shape and `git add` them. Use `git merge --continue` to seal the deal. You will be able to run `npm run publish` afterwards.";throw g}throw new Error("some contributions are available. Pull them using `npx @raycast/api@latest pull-contributions`")}else return await Oe(Du),"no new contributions"})&&process.exit(1)}0&&(module.exports={pullContributions});
|
|
36
|
+
Error: ${o.message}`)}}async function Ba(e){let r=pe("githubAccessToken");await Ie(`https://api.github.com/repos/${e.owner.login}/${e.name}`,{method:"POST",token:r,body:JSON.stringify({delete_branch_on_merge:"true"})})}function Ta(e,r){return gu(`https://oauth2:${pe("githubAccessToken")}@github.com/${e.owner.login}/${e.name}`,r)}function ii(e,r){return bu(e,`https://oauth2:${pe("githubAccessToken")}@github.com/${r.owner.login}/${r.name}`)}async function Pa(e,r,o){let i=`"\\"name\\": \\"${r}\\"" "\\"author\\": \\"${o}\\"" repo:raycast/extensions in:file path:extensions extension:json`,u=pe("githubAccessToken"),f=(await Ie(`https://api.github.com/search/code?q=${encodeURIComponent(i)}&per_page=3`,{token:u})).items.filter(d=>d.name==="package.json");if(f.length===0)return oi.default.join("extensions",r);if(f.length>1)throw new Error(`found more than one extension with name ${r}`);return oi.default.dirname(f[0].path)}async function Oa(e){let r=`type:pr repo:raycast/extensions ${e} is:merged`,o=pe("githubAccessToken");return(await Ie(`https://api.github.com/search/issues?q=${encodeURIComponent(r)}&per_page=1`,{token:o})).items.length>0}var xa=!1;async function ui(e){if(!await mu())throw new Error("please create a git repository first (git init)");if(await Xt())throw new Error("please commit or discard your uncommited changes first (git commit -a -m 'your changes')");await va();let r={owner:{login:"raycast"},name:"extensions"},o=si.default.join(Io(),"public-extensions-fork"),i=`ext/${e.name}`,u="",l,f=await bt("getting fork",async()=>{try{l=await Aa(r,"raycast-extensions"),await Ra(l),await Ba(l)}catch(d){throw new Error(`fork extensions repo: ${d.message}`)}},{printError:!1});if(f){if(f.message.includes("not authorized \u2013 please log in first using `npx ray login`")){if(xa)throw new Error("fork extensions repo: not authorized");return xa=!0,tn("githubAccessToken",void 0),ui(e)}throw f}else l=l;if(!ka.default.existsSync(o)){let d=await bt("cloning repo",async()=>{await Ta(l,o)},{printError:!1});if(d)throw d}if(et(o),await ii("origin",l),await ii("upstream",r),f=await bt("preparing clone",async()=>{let d=await Pa(r,e.name,e.author);u=si.default.join(o,d),et(void 0);let p=await Ao("user.name"),g=await Ao("user.email");if(et(o),await Ro("user.name",p),await Ro("user.email",g),await Fu(d),await Oe("main"),await To("upstream","main"),await yu("upstream/main"),await en(i)){await Ft(i),await To("origin",i);let x=await pu();await Oa(x)&&(await _u(i),await Ft(i))}else await Bo(i),await Ft(i)},{printError:!1}),f)throw f;return{upstream:r,fork:l,clonePath:o,extensionPathInClone:u,branch:i}}async function gd(e){let{clonePath:r,extensionPathInClone:o,branch:i}=await ui(e),u=Wa.default.existsSync(Ia.default.join(o,"package.json")),{latestPublishTag:l,latestPullTag:f}=Ru(i);et(r),await bt("pulling new contributions",async()=>{if(!u)return"no new contributions";if(await en(i)?await Eu(i)||(await Oe(i),await vu(i)):(await Oe("main"),await wu(f,"Used by the Ray CLI to track the latest commit that was pulled")),et(void 0),await Cu(l)?await Oe(l):await Oe(hu),xo(o,process.cwd()),await Xt()){let p=`contributions/merge-${new Date().getTime()}`;await Ft(p),await Su("Pull contributions"),await Oe("@{-2}");try{await Au(p)}catch(g){if(await Xt())return"Some contributions conflict with your changes.\n\nYou can do two things:\n\n- Decide not to merge but you won't be able to publish your changes. The only clean-ups you need are to run `git merge --abort`.\n\n- Resolve the conflicts. Edit the files into shape and `git add` them. Use `git merge --continue` to seal the deal. You will be able to run `npm run publish` afterwards.";throw g}throw new Error("some contributions are available. Pull them using `npx @raycast/api@latest pull-contributions`")}else return await Oe(Du),"no new contributions"})&&process.exit(1)}0&&(module.exports={pullContributions});
|
|
37
37
|
/*! Bundled license information:
|
|
38
38
|
|
|
39
39
|
node-fetch-cjs/dist/index.js:
|
package/oclif.manifest.json
CHANGED