@raycast/api 1.93.0 → 1.93.1
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/build/index.js +155 -155
- package/dist/commands/develop/index.js +151 -151
- package/dist/commands/publish/index.js +109 -109
- package/dist/commands/pull-contributions/index.js +1 -1
- package/dist/commands/version/index.js +1 -1
- package/dist/utils/publish/publish-to-store.js +192 -192
- package/dist/utils/publish/pull-contributions.js +1 -1
- package/oclif.manifest.json +32 -32
- package/package.json +1 -1
|
@@ -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)})),Wa(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){Gr("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 Ma(e,r){let o=De("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 u=0;u<=30;u++){try{await $e(`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 qa(e){let r=De("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
|
|
35
35
|
|
|
36
|
-
Error: ${o.message}`)}}async function Na(e){let r=De("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 ja(e,r){return Pu(`https://oauth2:${De("githubAccessToken")}@github.com/${e.owner.login}/${e.name}`,r)}function ci(e,r){return Ou(e,`https://oauth2:${De("githubAccessToken")}@github.com/${r.owner.login}/${r.name}`)}async function za(e,r,o){let i=`"\\"name\\": \\"${r}\\"" "\\"author\\": \\"${o}\\"" repo:raycast/extensions in:file path:extensions extension:json`,u=De("githubAccessToken"),f=(await $e(`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 li.default.join("extensions",r);if(f.length>1)throw new Error(`found more than one extension with name ${r}`);return li.default.dirname(f[0].path)}async function Ua(e){let r=`type:pr repo:raycast/extensions ${e} is:merged`,o=De("githubAccessToken");return(await $e(`https://api.github.com/search/issues?q=${encodeURIComponent(r)}&per_page=1`,{token:o})).items.length>0}var Ha=!1;async function di(e){if(!await Bu())throw new Error("please create a git repository first (git init)");if(await rr())throw new Error("please commit or discard your uncommited changes first (git commit -a -m 'your changes')");await La();let r={owner:{login:"raycast"},name:"extensions"},o=fi.default.join(Yr(),"public-extensions-fork"),i=`ext/${e.name}`,u="",l,f=await _t("getting fork",async()=>{try{l=await Ma(r,"raycast-extensions"),await qa(l),await Na(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(Ha)throw new Error("fork extensions repo: not authorized");return Ha=!0,Gr("githubAccessToken",void 0),di(e)}throw f}else l=l;if(!Ga.default.existsSync(o)){let d=await _t("cloning repo",async()=>{await ja(l,o)},{printError:!1});if(d)throw d}if(rt(o),await ci("origin",l),await ci("upstream",r),f=await _t("preparing clone",async()=>{let d=await za(r,e.name,e.author);u=fi.default.join(o,d),rt(void 0);let p=await ko("user.name"),g=await ko("user.email");if(rt(o),await Io("user.name",p),await Io("user.email",g),await xu(d),await xe("main"),await Wo("upstream","main"),await Iu("upstream/main"),await un(i)){await Et(i),await Wo("origin",i);let x=await Tu();await Ua(x)&&(await ku(i),await Et(i))}else await $o(i),await Et(i)},{printError:!1}),f)throw f;return{upstream:r,fork:l,clonePath:o,extensionPathInClone:u,branch:i}}async function Qa(e){let{clonePath:r,extensionPathInClone:o,branch:i}=await di(e),u=Va.default.existsSync(Ya.default.join(o,"package.json")),{latestPublishTag:l,latestPullTag:f}=ju(i);rt(r),await _t("pulling new contributions",async()=>{if(!u)return"no new contributions";if(await un(i)?await $u(i)||(await xe(i),await qu(i)):(await xe("main"),await Lu(f,"Used by the Ray CLI to track the latest commit that was pulled")),rt(void 0),await Wu(l)?await xe(l):await xe(Ru),qo(o,process.cwd()),await rr()){let p=`contributions/merge-${new Date().getTime()}`;await Et(p),await Mu("Pull contributions"),await xe("@{-2}");try{await Nu(p)}catch(g){if(await rr())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}
|
|
36
|
+
Error: ${o.message}`)}}async function Na(e){let r=De("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 ja(e,r){return Pu(`https://oauth2:${De("githubAccessToken")}@github.com/${e.owner.login}/${e.name}`,r)}function ci(e,r){return Ou(e,`https://oauth2:${De("githubAccessToken")}@github.com/${r.owner.login}/${r.name}`)}async function za(e,r,o){let i=`"\\"name\\": \\"${r}\\"" "\\"author\\": \\"${o}\\"" repo:raycast/extensions in:file path:extensions extension:json`,u=De("githubAccessToken"),f=(await $e(`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 li.default.join("extensions",r);if(f.length>1)throw new Error(`found more than one extension with name ${r}`);return li.default.dirname(f[0].path)}async function Ua(e){let r=`type:pr repo:raycast/extensions ${e} is:merged`,o=De("githubAccessToken");return(await $e(`https://api.github.com/search/issues?q=${encodeURIComponent(r)}&per_page=1`,{token:o})).items.length>0}var Ha=!1;async function di(e){if(!await Bu())throw new Error("please create a git repository first (git init)");if(await rr())throw new Error("please commit or discard your uncommited changes first (git commit -a -m 'your changes')");await La();let r={owner:{login:"raycast"},name:"extensions"},o=fi.default.join(Yr(),"public-extensions-fork"),i=`ext/${e.name}`,u="",l,f=await _t("getting fork",async()=>{try{l=await Ma(r,"raycast-extensions"),await qa(l),await Na(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(Ha)throw new Error("fork extensions repo: not authorized");return Ha=!0,Gr("githubAccessToken",void 0),di(e)}throw f}else l=l;if(!Ga.default.existsSync(o)){let d=await _t("cloning repo",async()=>{await ja(l,o)},{printError:!1});if(d)throw d}if(rt(o),await ci("origin",l),await ci("upstream",r),f=await _t("preparing clone",async()=>{let d=await za(r,e.name,e.author);u=fi.default.join(o,d),rt(void 0);let p=await ko("user.name"),g=await ko("user.email");if(rt(o),await Io("user.name",p),await Io("user.email",g),await xu(d),await xe("main"),await Wo("upstream","main"),await Iu("upstream/main"),await un(i)){await Et(i),await Wo("origin",i);let x=await Tu();await Ua(x)&&(await ku(i),await Et(i))}else await $o(i),await Et(i)},{printError:!1}),f)throw f;return{upstream:r,fork:l,clonePath:o,extensionPathInClone:u,branch:i}}async function Qa(e){let{clonePath:r,extensionPathInClone:o,branch:i}=await di(e),u=Va.default.existsSync(Ya.default.join(o,"package.json")),{latestPublishTag:l,latestPullTag:f}=ju(i);rt(r),await _t("pulling new contributions",async()=>{if(!u)return"no new contributions";if(await un(i)?await $u(i)||(await xe(i),await qu(i)):(await xe("main"),await Lu(f,"Used by the Ray CLI to track the latest commit that was pulled")),rt(void 0),await Wu(l)?await xe(l):await xe(Ru),qo(o,process.cwd()),await rr()){let p=`contributions/merge-${new Date().getTime()}`;await Et(p),await Mu("Pull contributions"),await xe("@{-2}");try{await Nu(p)}catch(g){if(await rr())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}return"contributions merged. You can now run `npm run publish` again"}else return await xe(Au),"no new contributions"})&&process.exit(1)}var Cn=class extends sn{static description="Pull contributions of the extension";async run(){let r=ro();Os(r)&&this.error("only available for public extensions"),await Qa(r)}};
|
|
37
37
|
/*! Bundled license information:
|
|
38
38
|
|
|
39
39
|
node-fetch-cjs/dist/index.js:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var $=Object.create;var m=Object.defineProperty;var G=Object.getOwnPropertyDescriptor;var D=Object.getOwnPropertyNames;var O=Object.getPrototypeOf,L=Object.prototype.hasOwnProperty;var I=(t,n)=>()=>(n||t((n={exports:{}}).exports,n),n.exports),R=(t,n)=>{for(var o in n)m(t,o,{get:n[o],enumerable:!0})},A=(t,n,o,c)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of D(n))!L.call(t,i)&&i!==o&&m(t,i,{get:()=>n[i],enumerable:!(c=G(n,i))||c.enumerable});return t};var h=(t,n,o)=>(o=t!=null?$(O(t)):{},A(n||!t||!t.__esModule?m(o,"default",{value:t,enumerable:!0}):o,t)),F=t=>A(m({},"__esModule",{value:!0}),t);var B=I((Q,k)=>{var Y=require("node:tty"),J=Y?.WriteStream?.prototype?.hasColors?.()??!1,r=(t,n)=>{if(!J)return i=>i;let o=`\x1B[${t}m`,c=`\x1B[${n}m`;return i=>{let p=i+"",d=p.indexOf(c);if(d===-1)return o+p+c;let x=o,g=0;for(;d!==-1;)x+=p.slice(g,d)+o,g=d+c.length,d=p.indexOf(c,g);return x+=p.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);k.exports=e});var P=I((ie,H)=>{H.exports={name:"ray",description:"Build extensions for Raycast with React and Node.js.",version:"1.93.
|
|
1
|
+
"use strict";var $=Object.create;var m=Object.defineProperty;var G=Object.getOwnPropertyDescriptor;var D=Object.getOwnPropertyNames;var O=Object.getPrototypeOf,L=Object.prototype.hasOwnProperty;var I=(t,n)=>()=>(n||t((n={exports:{}}).exports,n),n.exports),R=(t,n)=>{for(var o in n)m(t,o,{get:n[o],enumerable:!0})},A=(t,n,o,c)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of D(n))!L.call(t,i)&&i!==o&&m(t,i,{get:()=>n[i],enumerable:!(c=G(n,i))||c.enumerable});return t};var h=(t,n,o)=>(o=t!=null?$(O(t)):{},A(n||!t||!t.__esModule?m(o,"default",{value:t,enumerable:!0}):o,t)),F=t=>A(m({},"__esModule",{value:!0}),t);var B=I((Q,k)=>{var Y=require("node:tty"),J=Y?.WriteStream?.prototype?.hasColors?.()??!1,r=(t,n)=>{if(!J)return i=>i;let o=`\x1B[${t}m`,c=`\x1B[${n}m`;return i=>{let p=i+"",d=p.indexOf(c);if(d===-1)return o+p+c;let x=o,g=0;for(;d!==-1;)x+=p.slice(g,d)+o,g=d+c.length,d=p.indexOf(c,g);return x+=p.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);k.exports=e});var P=I((ie,H)=>{H.exports={name:"ray",description:"Build extensions for Raycast with React and Node.js.",version:"1.93.1",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.25.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={};R(K,{default:()=>b});module.exports=F(K);var l=require("@oclif/core");var f=h(require("node:fs")),w=h(require("node:path")),T=h(require("node:os"));var v={production:{url:"https://www.raycast.com",clientID:"KqAdcGhNfBKiUpfjD3nU3VNgh1t0iMPoX2hYEkN9d4I"},staging:{url:"https://www.rayca.st",clientID:"KqAdcGhNfBKiUpfjD3nU3VNgh1t0iMPoX2hYEkN9d4I"},development:{url:"http://localhost:3000",clientID:"rOCD_LhnXFObSLu9v7788qOGu25FZDqEzGjet4Q45ZY"}}[process.env.API_ENV||"production"],S="e69bae0ec90f5e838555",a={},E;function C(t){E=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||v.url;case"raycastAccessToken":return process.env.RAY_TOKEN||a.Token||a.AccessToken||"";case"raycastClientId":return process.env.RAY_CLIENT_ID||a.ClientID||v.clientID;case"githubClientId":return process.env.RAY_GithubClientID||a.GithubClientID||S;case"githubAccessToken":return process.env.GITHUB_ACCESS_TOKEN||a.GithubAccessToken||"";case"flavorName":return process.env.RAY_Target||(typeof a.Target>"u"?N("release"):a.Target)}}function N(t){switch(t){case"debug":return"debug";case"internal":return"internal";case"release":return"";case void 0:return U("flavorName")}}function _(){let t=N(E);return t==""?"raycast":`raycast-${t}`}function M(){let t=w.join(T.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 u={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")} - `},q=!0;function j(t,n){t||(u.wait=`${(0,s.blue)("wait")} - `,u.info=`${(0,s.cyan)("info")} - `,u.success=`${(0,s.green)("ready")} - `,u.warn=`${(0,s.yellow)("warn")} - `,u.error=`${(0,s.red)("error")} - `,u.event=`${(0,s.magenta)("event")} - `,u.paymentPrompt=`${(0,s.yellowBright)("plan")} - `),n&&(q=!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,C(this.flags.target),j(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(`${P().version}`)}};
|