Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@trigger.dev/cli

Package Overview
Dependencies
Maintainers
3
Versions
362
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@trigger.dev/cli - npm Package Compare versions

Comparing version 0.2.1-next.21 to 0.2.1-next.22

19

dist/index.js
#!/usr/bin/env node
import{Command as Dt}from"commander";import M from"inquirer";import u from"fs/promises";import Xe from"inquirer";import l from"path";import{pathToRegexp as pe}from"path-to-regexp";import{simpleGit as Qe}from"simple-git";import Z from"path";import{fileURLToPath as Ae}from"url";var Se=Ae(import.meta.url),Oe=Z.dirname(Se),X=Z.join(Oe,"../"),Q=`
import{Command as Lt}from"commander";import M from"inquirer";import u from"fs/promises";import Xe from"inquirer";import l from"path";import{pathToRegexp as pe}from"path-to-regexp";import{simpleGit as Qe}from"simple-git";import Z from"path";import{fileURLToPath as Ae}from"url";var Se=Ae(import.meta.url),Oe=Z.dirname(Se),X=Z.join(Oe,"../"),Q=`
_____ _ _

@@ -8,3 +8,3 @@ |_ _| ___ |_| ___ ___ ___ ___ _| | ___ _ _

|___||___|
`;var P="@trigger.dev/cli";var v="https://cloud.trigger.dev",ee="https://api.trigger.dev";import $e from"chalk";import{execa as D}from"execa";import U from"ora";import Ne from"path";var I=()=>{let e=process.env.npm_config_user_agent;return e?e.startsWith("yarn")?"yarn":e.startsWith("pnpm")?"pnpm":"npm":"npm"};import te from"fs/promises";import Ue from"node-fetch";import{z as N}from"zod";async function re(e,t){let r=I(),i=U("Adding @trigger.dev dependencies to package.json...").start(),n=await Fe(e,t);i.succeed($e.green(`Successfully added dependencies to package.json: ${n.map(o=>`${o.name}@${o.version}`).join(", ")}`)),(await Me(r,e)||U()).stop()}async function Fe(e,t){let r=Ne.join(e,"package.json"),i=await te.readFile(r),n=JSON.parse(i.toString()),s=await Ge(t);return n.dependencies={...n.dependencies,...Object.fromEntries(s.map(o=>[o.name,`^${o.version}`]))},await te.writeFile(r,JSON.stringify(n,null,2)),s}var Je=N.object({name:N.string(),"dist-tags":N.record(N.string())});async function R(e,t){let r=await Ue(`https://registry.npmjs.org/${e}`);if(!r.ok)return;let i=await r.json(),n=Je.safeParse(i);if(!n.success)return;let s=n.data["dist-tags"][t];if(s)return{name:e,version:s}}async function Ge(e){return(await Promise.all(e.map(r=>R(r.name,r.tag)))).filter(Boolean)}async function Me(e,t){switch(e){case"npm":return await D(e,["install"],{cwd:t,stderr:"inherit"}),null;case"pnpm":let r=U("Running pnpm install...").start(),i=D(e,["install"],{cwd:t,stdout:"pipe"});return await new Promise((o,p)=>{i.stdout?.on("data",c=>{let g=c.toString();g.includes("Progress")&&(r.text=g.includes("|")?g.split(" | ")[1]??"":g)}),i.on("error",c=>p(c)),i.on("close",()=>o())}),r;case"yarn":let n=U("Running yarn...").start(),s=D(e,[],{cwd:t,stdout:"pipe"});return await new Promise((o,p)=>{s.stdout?.on("data",c=>{n.text=c.toString()}),s.on("error",c=>p(c)),s.on("close",()=>o())}),n}}import F from"chalk";var a={error(...e){console.log(F.red(...e))},warn(...e){console.log(F.yellow(...e))},info(...e){console.log(F.cyan(...e))},success(...e){console.log(F.green(...e))}};import Le from"path";var T=e=>Le.resolve(process.cwd(),e);function ne(e){return e.replace(/tr_dev_[a-zA-Z0-9]{6}/g,"tr_dev_********")}import De from"gradient-string";var Ke={blue:"#add7ff",cyan:"#89ddff",green:"#5de4c7",magenta:"#fae4fc",red:"#d0679d",yellow:"#fffac2"},ie=()=>{let e=De(Object.values(Ke)),t=I();(t==="yarn"||t==="pnpm")&&console.log(""),console.log(e.multiline(Q))};import We from"fs/promises";import ze from"path";async function oe(e){try{return await We.access(ze.join(e,"next.config.js")),!0}catch{return!1}}import se from"node-fetch";import{z as d}from"zod";var Ye=/Could not connect to endpoint/i,Be=d.object({id:d.string(),slug:d.string(),type:d.string(),createdAt:d.coerce.date(),updatedAt:d.coerce.date(),project:d.object({id:d.string(),slug:d.string(),name:d.string(),createdAt:d.coerce.date(),updatedAt:d.coerce.date()}),organization:d.object({id:d.string(),slug:d.string(),title:d.string(),createdAt:d.coerce.date(),updatedAt:d.coerce.date()})}),j=class{constructor(t,r){this.apiKey=t;this.baseUrl=r}async whoami(t){let r=await se(`${this.baseUrl}/api/v1/whoami`,{method:"GET",headers:{Accept:"application/json",Authorization:`Bearer ${t}`}});if(r.ok){let i=await r.json(),n=Be.safeParse(i);if(n.success)return n.data}}async registerEndpoint(t){let r=await se(`${this.baseUrl}/api/v1/endpoints`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:JSON.stringify(t)});if(!r.ok){let n=await r.text();if(typeof n=="string"){let s=Ve(n);if(!s)return{ok:!1,error:"An unknown issue occurred when registering with Trigger.dev",retryable:!0};let o=d.object({error:d.string()}).safeParse(s);return o.success?{ok:!1,error:o.data.error,retryable:Ye.test(o.data.error)}:{ok:!1,error:"An unknown issue occurred when registering with Trigger.dev",retryable:!0}}else return{ok:!1,error:"An unknown issue occurred when registering with Trigger.dev",retryable:!0}}return{ok:!0,data:await r.json()}}};function Ve(e){if(typeof e=="string")try{return JSON.parse(e)}catch{return}}import{readFile as le}from"tsconfig";import A,{writeFile as qe}from"fs/promises";import He from"fs";import Ze from"path";async function ae(e,t){return await A.mkdir(Ze.dirname(e),{recursive:!0}),await A.writeFile(e,t),e}async function m(e){try{return await A.access(e),!0}catch{return!1}}async function K(e){return await A.readFile(e,"utf-8")}async function S(e){let t=await A.readFile(e,"utf-8");return JSON.parse(t)}async function W(e,t){await qe(e,JSON.stringify(t,null,2))}function ce(e){let t=He.readFileSync(e,"utf-8");return JSON.parse(t)}var de=async e=>{ie(),e.triggerUrl===v?a.info("\u2728 Initializing project in Trigger.dev Cloud"):typeof e.triggerUrl=="string"?a.info(`\u2728 Initializing project using Trigger.dev at ${e.triggerUrl}`):a.info("\u2728 Initializing Trigger.dev in project");let t=T(e.projectPath);await oe(t)?a.success("\u2705 Detected Next.js project"):(a.error("You must run this command in a Next.js project."),process.exit(1)),await nt(t)&&a.warn("\u26A0\uFE0F You have uncommitted git changes, you may want to commit them before continuing."),await it(t)||(a.error("You must be using TypeScript in your Next.js project to use Trigger.dev."),process.exit(1));let s=await rt(e,t),o=s.apiKey;o||(a.error("You must provide an API key to continue."),process.exit(1));let c=await new j(o,s.apiUrl).whoami(o);c||(a.error(`\u{1F6D1} The API key you provided is not authorized. Try visiting your dashboard at ${s.triggerUrl} to get a new API key.`),process.exit(1)),await re(t,[{name:"@trigger.dev/sdk",tag:"next"},{name:"@trigger.dev/nextjs",tag:"latest"}]),await lt(t,s);let g=await ot(t);g&&a.info("\u{1F4C1} Detected use of src directory");let f=await st(t,g),h=l.join(t,g?"src":"");f==="pages"?await gt(t,h,s,g):await pt(t,h,s,g),await at(t,g),await tt(t,s),await et(s,c),process.exit(0)};async function et(e,t){let r=`${e.triggerUrl}/orgs/${t.organization.slug}/projects/${t.project.slug}`;a.success("\u2705 Successfully initialized Trigger.dev!"),a.info("Next steps:"),a.info(" 1. Run your Next.js project locally with 'npm run dev'"),a.info(" 2. Run 'npx @trigger.dev/cli@latest dev' to watch for changes and automatically register Trigger.dev jobs"),a.info(` 3. View your jobs at ${r}`),a.info("\u{1F517} Head over to our docs at https://trigger.dev/docs to learn more about how to create different kinds of jobs and add integrations.")}async function tt(e,t){let r=l.join(e,"package.json"),i=await u.readFile(r),n=JSON.parse(i.toString());n["trigger.dev"]={endpointId:t.endpointSlug},await u.writeFile(r,JSON.stringify(n,null,2)),a.success("\u2705 Wrote trigger.dev config to package.json")}var rt=async(e,t)=>{let r={...e};try{e.triggerUrl||(r.triggerUrl=await me()),r.triggerUrl===v?r.apiUrl=ee:r.apiUrl=r.triggerUrl,e.apiKey||(r.apiKey=await fe(r.triggerUrl)),e.endpointSlug||(r.endpointSlug=await he(t))}catch(i){if(i instanceof Error&&i.isTTYError){a.warn(`'${P} init' needs an interactive terminal to provide options`);let{shouldContinue:n}=await Xe.prompt({name:"shouldContinue",type:"confirm",message:"Continue initializing your trigger.dev project?",default:!0});n||(a.info("Exiting..."),process.exit(0))}else throw i}return r};async function nt(e){return(await Qe(e).status()).files.length>0}async function it(e){try{return await u.access(l.join(e,"tsconfig.json")),!0}catch{return!1}}async function ot(e){try{return await u.access(l.join(e,"src")),!0}catch{return!1}}async function st(e,t=!1){if((await import(l.join(e,"next.config.js")))?.default?.experimental?.appDir)return"app";{let n=l.join(e,t?"src":"","app","page.tsx");return await m(n)?"app":"pages"}}async function at(e,t=!1){let r=l.join(e,t?"src":"","middleware.ts");if(!await m(r))return;let n=await ct(r);if(!n||n.length===0){a.warn(`\u26A0\uFE0F \u26A0\uFE0F \u26A0\uFE0F It looks like there might be conflicting Next.js middleware in ${l.relative(process.cwd(),r)} which can cause issues with Trigger.dev. Please see https://trigger.dev/docs/documentation/guides/platforms/nextjs#middleware`);return}n.length!==0&&(typeof n=="string"?pe(n).test("/api/trigger")&&a.warn(`\u{1F6A8} It looks like there might be conflicting Next.js middleware in ${l.relative(process.cwd(),r)} which will cause issues with Trigger.dev. Please see https://trigger.dev/docs/documentation/guides/platforms/nextjs#middleware`):Array.isArray(n)&&n.every(s=>typeof s=="string")&&n.map(o=>pe(o)).some(o=>o.test("/api/trigger"))&&a.warn(`\u{1F6A8} It looks like there might be conflicting Next.js middleware in ${l.relative(process.cwd(),r)} which will cause issues with Trigger.dev. Please see https://trigger.dev/docs/documentation/guides/platforms/nextjs#middleware`))}async function ct(e){let t=await u.readFile(e,"utf-8"),i=/matcher:\s*(\[.*\]|".*")/s.exec(t);if(!i)return[];if(i.length<2)return[];let n=i[1];if(n.startsWith("[")&&n.endsWith("]")){n=n.slice(1,-1);let s=/("(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*')/g,o,p=[];for(;(o=s.exec(n))!==null;)p.push(o[1].slice(1,-1));return p}else return[n.slice(1,-1)]}function ue(e,t){if(!e.compilerOptions.paths)return;let r=e.compilerOptions.paths,i=Object.keys(r).find(n=>{let s=r[n];if(s.length!==1)return!1;let o=s[0];return t?o==="./src/*":o==="./*"});if(i)return i.slice(0,-2)}async function pt(e,t,r,i=!1){let n=l.join(e,"tsconfig.json"),s=await le(n),o=ue(s,i),p=o?o+"/":"../../../",c=`
`;var P="@trigger.dev/cli";var v="https://cloud.trigger.dev",ee="https://api.trigger.dev";import $e from"chalk";import{execa as K}from"execa";import F from"ora";import Ne from"path";var I=()=>{let e=process.env.npm_config_user_agent;return e?e.startsWith("yarn")?"yarn":e.startsWith("pnpm")?"pnpm":"npm":"npm"};import te from"fs/promises";import Fe from"node-fetch";import{z as N}from"zod";async function re(e,t){let r=I(),i=F("Adding @trigger.dev dependencies to package.json...").start(),n=await Ue(e,t);i.succeed($e.green(`Successfully added dependencies to package.json: ${n.map(o=>`${o.name}@${o.version}`).join(", ")}`)),(await Me(r,e)||F()).stop()}async function Ue(e,t){let r=Ne.join(e,"package.json"),i=await te.readFile(r),n=JSON.parse(i.toString()),s=await Ge(t);return n.dependencies={...n.dependencies,...Object.fromEntries(s.map(o=>[o.name,`^${o.version}`]))},await te.writeFile(r,JSON.stringify(n,null,2)),s}var Je=N.object({name:N.string(),"dist-tags":N.record(N.string())});async function R(e,t){let r=await Fe(`https://registry.npmjs.org/${e}`);if(!r.ok)return;let i=await r.json(),n=Je.safeParse(i);if(!n.success)return;let s=n.data["dist-tags"][t];if(s)return{name:e,version:s}}async function Ge(e){return(await Promise.all(e.map(r=>R(r.name,r.tag)))).filter(Boolean)}async function Me(e,t){switch(e){case"npm":return await K(e,["install"],{cwd:t,stderr:"inherit"}),null;case"pnpm":let r=F("Running pnpm install...").start(),i=K(e,["install"],{cwd:t,stdout:"pipe"});return await new Promise((o,p)=>{i.stdout?.on("data",c=>{let g=c.toString();g.includes("Progress")&&(r.text=g.includes("|")?g.split(" | ")[1]??"":g)}),i.on("error",c=>p(c)),i.on("close",()=>o())}),r;case"yarn":let n=F("Running yarn...").start(),s=K(e,[],{cwd:t,stdout:"pipe"});return await new Promise((o,p)=>{s.stdout?.on("data",c=>{n.text=c.toString()}),s.on("error",c=>p(c)),s.on("close",()=>o())}),n}}import U from"chalk";var a={error(...e){console.log(U.red(...e))},warn(...e){console.log(U.yellow(...e))},info(...e){console.log(U.cyan(...e))},success(...e){console.log(U.green(...e))}};import De from"path";var T=e=>De.resolve(process.cwd(),e);function ne(e){return e.replace(/tr_dev_[a-zA-Z0-9]{6}/g,"tr_dev_********")}import Ke from"gradient-string";var Le={blue:"#add7ff",cyan:"#89ddff",green:"#5de4c7",magenta:"#fae4fc",red:"#d0679d",yellow:"#fffac2"},ie=()=>{let e=Ke(Object.values(Le)),t=I();(t==="yarn"||t==="pnpm")&&console.log(""),console.log(e.multiline(Q))};import We from"fs/promises";import ze from"path";async function oe(e){try{return await We.access(ze.join(e,"next.config.js")),!0}catch{return!1}}import se from"node-fetch";import{z as d}from"zod";var Ye=/Could not connect to endpoint/i,Be=d.object({id:d.string(),slug:d.string(),type:d.string(),createdAt:d.coerce.date(),updatedAt:d.coerce.date(),project:d.object({id:d.string(),slug:d.string(),name:d.string(),createdAt:d.coerce.date(),updatedAt:d.coerce.date()}),organization:d.object({id:d.string(),slug:d.string(),title:d.string(),createdAt:d.coerce.date(),updatedAt:d.coerce.date()})}),j=class{constructor(t,r){this.apiKey=t;this.baseUrl=r}async whoami(t){let r=await se(`${this.baseUrl}/api/v1/whoami`,{method:"GET",headers:{Accept:"application/json",Authorization:`Bearer ${t}`}});if(r.ok){let i=await r.json(),n=Be.safeParse(i);if(n.success)return n.data}}async registerEndpoint(t){let r=await se(`${this.baseUrl}/api/v1/endpoints`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:JSON.stringify(t)});if(!r.ok){let n=await r.text();if(typeof n=="string"){let s=Ve(n);if(!s)return{ok:!1,error:"An unknown issue occurred when registering with Trigger.dev",retryable:!0};let o=d.object({error:d.string()}).safeParse(s);return o.success?{ok:!1,error:o.data.error,retryable:Ye.test(o.data.error)}:{ok:!1,error:"An unknown issue occurred when registering with Trigger.dev",retryable:!0}}else return{ok:!1,error:"An unknown issue occurred when registering with Trigger.dev",retryable:!0}}return{ok:!0,data:await r.json()}}};function Ve(e){if(typeof e=="string")try{return JSON.parse(e)}catch{return}}import{readFile as le}from"tsconfig";import A,{writeFile as qe}from"fs/promises";import He from"fs";import Ze from"path";async function ae(e,t){return await A.mkdir(Ze.dirname(e),{recursive:!0}),await A.writeFile(e,t),e}async function m(e){try{return await A.access(e),!0}catch{return!1}}async function L(e){return await A.readFile(e,"utf-8")}async function S(e){let t=await A.readFile(e,"utf-8");return JSON.parse(t)}async function W(e,t){await qe(e,JSON.stringify(t,null,2))}function ce(e){let t=He.readFileSync(e,"utf-8");return JSON.parse(t)}var de=async e=>{ie(),e.triggerUrl===v?a.info("\u2728 Initializing project in Trigger.dev Cloud"):typeof e.triggerUrl=="string"?a.info(`\u2728 Initializing project using Trigger.dev at ${e.triggerUrl}`):a.info("\u2728 Initializing Trigger.dev in project");let t=T(e.projectPath);await oe(t)?a.success("\u2705 Detected Next.js project"):(a.error("You must run this command in a Next.js project."),process.exit(1)),await nt(t)&&a.warn("\u26A0\uFE0F You have uncommitted git changes, you may want to commit them before continuing."),await it(t)||(a.error("You must be using TypeScript in your Next.js project to use Trigger.dev."),process.exit(1));let s=await rt(e,t),o=s.apiKey;o||(a.error("You must provide an API key to continue."),process.exit(1));let c=await new j(o,s.apiUrl).whoami(o);c||(a.error(`\u{1F6D1} The API key you provided is not authorized. Try visiting your dashboard at ${s.triggerUrl} to get a new API key.`),process.exit(1)),await re(t,[{name:"@trigger.dev/sdk",tag:"next"},{name:"@trigger.dev/nextjs",tag:"latest"}]),await lt(t,s);let g=await ot(t);g&&a.info("\u{1F4C1} Detected use of src directory");let f=await st(t,g),h=l.join(t,g?"src":"");f==="pages"?await gt(t,h,s,g):await pt(t,h,s,g),await at(t,g),await tt(t,s),await et(s,c),process.exit(0)};async function et(e,t){let r=`${e.triggerUrl}/orgs/${t.organization.slug}/projects/${t.project.slug}`;a.success("\u2705 Successfully initialized Trigger.dev!"),a.info("Next steps:"),a.info(" 1. Run your Next.js project locally with 'npm run dev'"),a.info(" 2. Run 'npx @trigger.dev/cli@latest dev' to watch for changes and automatically register Trigger.dev jobs"),a.info(` 3. View your jobs at ${r}`),a.info("\u{1F517} Head over to our docs at https://trigger.dev/docs to learn more about how to create different kinds of jobs and add integrations.")}async function tt(e,t){let r=l.join(e,"package.json"),i=await u.readFile(r),n=JSON.parse(i.toString());n["trigger.dev"]={endpointId:t.endpointSlug},await u.writeFile(r,JSON.stringify(n,null,2)),a.success("\u2705 Wrote trigger.dev config to package.json")}var rt=async(e,t)=>{let r={...e};try{e.triggerUrl||(r.triggerUrl=await me()),r.triggerUrl===v?r.apiUrl=ee:r.apiUrl=r.triggerUrl,e.apiKey||(r.apiKey=await fe(r.triggerUrl)),e.endpointSlug||(r.endpointSlug=await he(t))}catch(i){if(i instanceof Error&&i.isTTYError){a.warn(`'${P} init' needs an interactive terminal to provide options`);let{shouldContinue:n}=await Xe.prompt({name:"shouldContinue",type:"confirm",message:"Continue initializing your trigger.dev project?",default:!0});n||(a.info("Exiting..."),process.exit(0))}else throw i}return r};async function nt(e){return(await Qe(e).status()).files.length>0}async function it(e){try{return await u.access(l.join(e,"tsconfig.json")),!0}catch{return!1}}async function ot(e){try{return await u.access(l.join(e,"src")),!0}catch{return!1}}async function st(e,t=!1){if((await import(l.join(e,"next.config.js")))?.default?.experimental?.appDir)return"app";{let n=l.join(e,t?"src":"","app","page.tsx");return await m(n)?"app":"pages"}}async function at(e,t=!1){let r=l.join(e,t?"src":"","middleware.ts");if(!await m(r))return;let n=await ct(r);if(!n||n.length===0){a.warn(`\u26A0\uFE0F \u26A0\uFE0F \u26A0\uFE0F It looks like there might be conflicting Next.js middleware in ${l.relative(process.cwd(),r)} which can cause issues with Trigger.dev. Please see https://trigger.dev/docs/documentation/guides/platforms/nextjs#middleware`);return}n.length!==0&&(typeof n=="string"?pe(n).test("/api/trigger")&&a.warn(`\u{1F6A8} It looks like there might be conflicting Next.js middleware in ${l.relative(process.cwd(),r)} which will cause issues with Trigger.dev. Please see https://trigger.dev/docs/documentation/guides/platforms/nextjs#middleware`):Array.isArray(n)&&n.every(s=>typeof s=="string")&&n.map(o=>pe(o)).some(o=>o.test("/api/trigger"))&&a.warn(`\u{1F6A8} It looks like there might be conflicting Next.js middleware in ${l.relative(process.cwd(),r)} which will cause issues with Trigger.dev. Please see https://trigger.dev/docs/documentation/guides/platforms/nextjs#middleware`))}async function ct(e){let t=await u.readFile(e,"utf-8"),i=/matcher:\s*(\[.*\]|".*")/s.exec(t);if(!i)return[];if(i.length<2)return[];let n=i[1];if(n.startsWith("[")&&n.endsWith("]")){n=n.slice(1,-1);let s=/("(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*')/g,o,p=[];for(;(o=s.exec(n))!==null;)p.push(o[1].slice(1,-1));return p}else return[n.slice(1,-1)]}function ue(e,t){if(!e.compilerOptions.paths)return;let r=e.compilerOptions.paths,i=Object.keys(r).find(n=>{let s=r[n];if(s.length!==1)return!1;let o=s[0];return t?o==="./src/*":o==="./*"});if(i)return i.slice(0,-2)}async function pt(e,t,r,i=!1){let n=l.join(e,"tsconfig.json"),s=await le(n),o=ue(s,i),p=o?o+"/":"../../../",c=`
import { createAppRoute } from "@trigger.dev/nextjs";

@@ -85,5 +85,4 @@ import { client } from "${p}trigger";

`);await u.writeFile(o,g),a.success(`\u2705 Set ${r}=${s(i)} in ${t}`)}else await u.appendFile(o,`
${r}=${i}`),a.success(`\u2705 Added ${r}=${s(i)} to ${t}`)}import dt from"path";function J(){let e=dt.join(X,"package.json");return ce(e).version??"1.0.0"}import Kt from"node:path";import ut from"chokidar";import mt from"fs/promises";import ft from"ngrok";import Pe from"ora";import Y from"path";import{z as G}from"zod";var ht=G.object({port:G.coerce.number(),envFile:G.string(),clientId:G.string().optional()}),ye=1e3,yt=new Intl.DateTimeFormat("en",{hour:"numeric",minute:"numeric",second:"numeric"});async function ve(e,t){let r=ht.safeParse(t);r.success||(a.error(r.error.message),process.exit(1));let i=r.data,n=T(e),s=await ke(n,i);s||(a.error("You must run the `init` command first to setup the project \u2013 you are missing \n'trigger.dev': { 'endpointId': 'your-client-id' } from your package.json file, or pass in the --client-id option to this command"),process.exit(1)),a.success(`\u2714\uFE0F [trigger.dev] Detected TriggerClient id: ${s}`);let{apiUrl:o,envFile:p}=await we(n,i.envFile);a.success(`\u2714\uFE0F [trigger.dev] Found API Key in ${p} file`),a.info(` [trigger.dev] Looking for Next.js site on port ${i.port}`);let c=await wt(o,i.port),g=Pe("[trigger.dev] Connecting to Trigger.dev..."),f=0,h=async()=>{g.start();let x=await ke(n,i),{apiKey:E,apiUrl:w}=await we(n,p),L=new j(E,w),$=await Pt(L,x??s,c);if($.success)f=0,g.succeed(`[trigger.dev] \u{1F504} Refreshed ${x??s} ${yt.format(new Date($.data.updatedAt))}`);else{if(f++,f===10||!$.retryable){g.fail(`\u{1F6A8} Failed to connect: ${$.error}`),a.info("Will attempt again on the next file change\u2026"),f=0;return}let Re=jt(f);await vt(Re),h()}};ut.watch([`${n}/**/*.ts`,`${n}/**/*.tsx`,`${n}/**/*.js`,`${n}/**/*.jsx`,`${n}/**/*.json`,`${n}/pnpm-lock.yaml`],{ignored:/(node_modules|\.next)/,ignoreInitial:!0}).on("all",(x,E)=>{xe(h,ye)}),xe(h,ye)}async function ke(e,t){if(t.clientId)return t.clientId;let r=Y.join(e,"package.json"),i=await mt.readFile(r),s=JSON.parse(i.toString())["trigger.dev"]?.endpointId;if(!(!s||typeof s!="string"))return s}async function kt(e,t,r){let i=Y.join(e,t);if(await m(i))return{content:await K(i),fileName:t};for(let s of r){let o=Y.join(e,s);if(await m(o))return{content:await K(o),fileName:s}}}async function we(e,t){let r=await kt(e,t,[".env",".env.local",".env.development.local"]);r||(a.error(`You must add TRIGGER_API_KEY and TRIGGER_API_URL to your ${t} file.`),process.exit(1)),(!r.content.includes("TRIGGER_API_KEY")||!r.content.includes("TRIGGER_API_URL"))&&(a.error(`You must add TRIGGER_API_KEY and TRIGGER_API_URL to your ${t} file.`),process.exit(1));let i=r.content.split(`
`),n=i.find(c=>c.includes("TRIGGER_API_KEY")),s=i.find(c=>c.includes("TRIGGER_API_URL")),o=n?.split("=")[1],p=s?.split("=")[1];return(!o||!p)&&(a.error(`You must add TRIGGER_API_KEY and TRIGGER_API_URL to your ${t} file.`),process.exit(1)),{apiKey:o,apiUrl:p,envFile:r.fileName}}async function wt(e,t){if(new URL(e).hostname==="localhost")return`http://localhost:${t}`;let i=Pe("\u{1F687} Creating tunnel").start(),n=await xt(t);return i.succeed(`\u{1F687} Created tunnel: ${n}`),n}async function xt(e){try{return await ft.connect(e)}catch(t){a.error(`Ngrok failed to create a tunnel for port ${e}.
${t}`),process.exit(1)}}async function Pt(e,t,r){try{let i=await e.registerEndpoint({id:t,url:`${r}/api/trigger`});return i.ok?{success:!0,data:i.data}:{success:!1,error:i.error,retryable:i.retryable}}catch(i){return i instanceof Error?{success:!1,error:i.message,retryable:!0}:{success:!1,error:"Unknown error",retryable:!0}}}async function vt(e){return new Promise(t=>{setTimeout(t,e)})}var z=null;function xe(e,t){z&&clearTimeout(z),z=setTimeout(e,t)}var It=30,Tt=.2;function jt(e){return Math.min((2^e)*Tt,It)*1e3}import O from"inquirer";import y from"node:path";import St from"ora";import{z as b}from"zod";import{OpenAIApi as bt,Configuration as Ct}from"openai";import{z as Ie}from"zod";function Te(e){let t={"index.ts":e.index,"types.ts":e.types,"tasks.ts":e.tasks};return`
${r}=${i}`),a.success(`\u2705 Added ${r}=${s(i)} to ${t}`)}import dt from"path";function J(){let e=dt.join(X,"package.json");return ce(e).version??"1.0.0"}import Wt from"node:path";import ut from"chokidar";import mt from"fs/promises";import ft from"ngrok";import Pe from"ora";import Y from"path";import{z as G}from"zod";import ht from"dotenv";var yt=G.object({port:G.coerce.number(),envFile:G.string(),clientId:G.string().optional()}),ye=1e3,kt=new Intl.DateTimeFormat("en",{hour:"numeric",minute:"numeric",second:"numeric"});async function ve(e,t){let r=yt.safeParse(t);r.success||(a.error(r.error.message),process.exit(1));let i=r.data,n=T(e),s=await ke(n,i);s||(a.error("You must run the `init` command first to setup the project \u2013 you are missing \n'trigger.dev': { 'endpointId': 'your-client-id' } from your package.json file, or pass in the --client-id option to this command"),process.exit(1)),a.success(`\u2714\uFE0F [trigger.dev] Detected TriggerClient id: ${s}`);let{apiUrl:o,envFile:p}=await we(n,i.envFile);a.success(`\u2714\uFE0F [trigger.dev] Found API Key in ${p} file`),a.info(` [trigger.dev] Looking for Next.js site on port ${i.port}`);let c=await xt(o,i.port),g=Pe("[trigger.dev] Connecting to Trigger.dev..."),f=0,h=async()=>{g.start();let x=await ke(n,i),{apiKey:E,apiUrl:w}=await we(n,p),D=new j(E,w),$=await vt(D,x??s,c);if($.success)f=0,g.succeed(`[trigger.dev] \u{1F504} Refreshed ${x??s} ${kt.format(new Date($.data.updatedAt))}`);else{if(f++,f===10||!$.retryable){g.fail(`\u{1F6A8} Failed to connect: ${$.error}`),a.info("Will attempt again on the next file change\u2026"),f=0;return}let Re=bt(f);await It(Re),h()}};ut.watch([`${n}/**/*.ts`,`${n}/**/*.tsx`,`${n}/**/*.js`,`${n}/**/*.jsx`,`${n}/**/*.json`,`${n}/pnpm-lock.yaml`],{ignored:/(node_modules|\.next)/,ignoreInitial:!0}).on("all",(x,E)=>{xe(h,ye)}),xe(h,ye)}async function ke(e,t){if(t.clientId)return t.clientId;let r=Y.join(e,"package.json"),i=await mt.readFile(r),s=JSON.parse(i.toString())["trigger.dev"]?.endpointId;if(!(!s||typeof s!="string"))return s}async function wt(e,t,r){let i=Y.join(e,t);if(await m(i))return{content:await L(i),fileName:t};for(let s of r){let o=Y.join(e,s);if(await m(o))return{content:await L(o),fileName:s}}}async function we(e,t){let r=await wt(e,t,[".env",".env.local",".env.development.local"]);r||(a.error(`You must add TRIGGER_API_KEY and TRIGGER_API_URL to your ${t} file.`),process.exit(1));let i=ht.parse(r.content);(!i.TRIGGER_API_KEY||!i.TRIGGER_API_KEY)&&(a.error(`You must add TRIGGER_API_KEY and TRIGGER_API_URL to your ${t} file.`),process.exit(1));let n=i.TRIGGER_API_KEY,s=i.TRIGGER_API_URL;return(!n||!s)&&(a.error(`You must add TRIGGER_API_KEY and TRIGGER_API_URL to your ${t} file.`),process.exit(1)),{apiKey:n,apiUrl:s,envFile:r.fileName}}async function xt(e,t){if(new URL(e).hostname==="localhost")return`http://localhost:${t}`;let i=Pe("\u{1F687} Creating tunnel").start(),n=await Pt(t);return i.succeed(`\u{1F687} Created tunnel: ${n}`),n}async function Pt(e){try{return await ft.connect(e)}catch(t){a.error(`Ngrok failed to create a tunnel for port ${e}.
${t}`),process.exit(1)}}async function vt(e,t,r){try{let i=await e.registerEndpoint({id:t,url:`${r}/api/trigger`});return i.ok?{success:!0,data:i.data}:{success:!1,error:i.error,retryable:i.retryable}}catch(i){return i instanceof Error?{success:!1,error:i.message,retryable:!0}:{success:!1,error:"Unknown error",retryable:!0}}}async function It(e){return new Promise(t=>{setTimeout(t,e)})}var z=null;function xe(e,t){z&&clearTimeout(z),z=setTimeout(e,t)}var Tt=30,jt=.2;function bt(e){return Math.min((2^e)*jt,Tt)*1e3}import O from"inquirer";import y from"node:path";import Ot from"ora";import{z as b}from"zod";import{OpenAIApi as Ct,Configuration as _t}from"openai";import{z as Ie}from"zod";function Te(e){let t={"index.ts":e.index,"types.ts":e.types,"tasks.ts":e.tasks};return`
Here is an example of what the files should look like for the package "${e.packageName}" using the SDK package "${e.sdkPackage}".

@@ -94,3 +93,3 @@

${JSON.stringify(t,null,2)}
`}function B(e,t,r){return`'I'm wanting to know what the minimal starting point index.ts, types.ts, and tasks.ts files should look like for the package "${e}" using the SDK package "${t}". ${r??""}`}function _t(){return[{role:"user",content:B("@trigger.dev.slack","@slack/web-api","Note that the only auth method support for slack is OAuth2 so shouldn't allow usesLocalAuth set to true")},{role:"assistant",content:Te({packageName:"@trigger.dev/slack",sdkPackage:"@slack/web-api",index:`
`}function B(e,t,r){return`'I'm wanting to know what the minimal starting point index.ts, types.ts, and tasks.ts files should look like for the package "${e}" using the SDK package "${t}". ${r??""}`}function Et(){return[{role:"user",content:B("@trigger.dev.slack","@slack/web-api","Note that the only auth method support for slack is OAuth2 so shouldn't allow usesLocalAuth set to true")},{role:"assistant",content:Te({packageName:"@trigger.dev/slack",sdkPackage:"@slack/web-api",index:`
import { WebClient } from "@slack/web-api";

@@ -279,4 +278,4 @@ import type { IntegrationClient, TriggerIntegration } from "@trigger.dev/sdk";

export type GetFormResponse = Prettify<Typeform.Form>;
`})}]}async function je(e){if(!process.env.OPENAI_API_KEY)return;let t=new bt(new Ct({apiKey:process.env.OPENAI_API_KEY,organization:process.env.OPENAI_ORGANIZATION}));try{let n=(await t.createChatCompletion({model:"gpt-4",messages:[{role:"system",content:"You will be provided with the task of creating the typescript files necessary for a new Trigger.dev integration package. You will be provided the name of the integration package and the name of the SDK package."},..._t(),{role:"user",content:B(e.packageName,e.sdkPackage,e.extraInfo)}],function_call:{name:"createTypescriptFiles"},functions:[{name:"createTypescriptFiles",description:"Creates the initial typescript files for a new Trigger.dev package",parameters:{type:"object",properties:{"index.ts":{type:"string",description:"The contents of the index.ts file"},"tasks.ts":{type:"string",description:"The contents of the tasks.ts file"},"types.ts":{type:"string",description:"The contents of the types.ts file"}}}}]})).data.choices[0];if(!n)return;let s=n.message;if(!s||!s.function_call||!s.function_call.arguments)return;let o=Et(s.function_call.arguments);if(!o)return;let c=Ie.record(Ie.string()).safeParse(o);return c.success?c.data:void 0}catch(r){console.error(r);return}}function Et(e){try{return JSON.parse(e)}catch{return null}}import q from"ora";import Rt from"chalk";import{execa as V}from"execa";async function be(e){a.info("Installing dependencies...");let t=I();(await At(t,e)||q()).succeed(Rt.green(`Successfully installed dependencies!
`))}async function At(e,t){switch(e){case"npm":return await V(e,["install"],{cwd:t,stderr:"inherit"}),null;case"pnpm":let r=q("Running pnpm install...").start(),i=V(e,["install"],{cwd:t,stdout:"pipe"});return await new Promise((o,p)=>{i.stdout?.on("data",c=>{let g=c.toString();g.includes("Progress")&&(r.text=g.includes("|")?g.split(" | ")[1]??"":g)}),i.on("error",c=>p(c)),i.on("close",()=>o())}),r;case"yarn":let n=q("Running yarn...").start(),s=V(e,[],{cwd:t,stdout:"pipe"});return await new Promise((o,p)=>{s.stdout?.on("data",c=>{n.text=c.toString()}),s.on("error",c=>p(c)),s.on("close",()=>o())}),n}}var Ot=b.object({packageName:b.string().optional(),sdkPackage:b.string().optional(),extraInfo:b.string().optional(),skipGeneratingCode:b.coerce.boolean().optional(),authMethod:b.enum(["api-key","oauth","both-methods"]).optional()});async function _e(e,t){let r=Ot.safeParse(t);r.success||(a.error(r.error.message),process.exit(1));let i=r.data,n=T(e);await m(n)&&(a.error(`The path ${n} already exists. Please try again with a different path.`),process.exit(1));let o=await Nt(i,n),p=await R(o.sdkPackage,"latest");p||(a.error(`Could not find the latest version of ${o.sdkPackage}. Please try again later.`),process.exit(1));let c=await Mt(n),g=await Ce({path:"packages/trigger-sdk",packageName:"@trigger.dev/sdk",tag:"next",monorepoPath:c});g||(a.error("Could not find the latest version of @trigger.dev/sdk. Please try again later."),process.exit(1));let f=await Ce({path:"packages/integration-kit",packageName:"@trigger.dev/integration-kit",tag:"latest",monorepoPath:c});f||(a.error("Could not find the latest version of @trigger.dev/integration-kit. Please try again later."),process.exit(1));let h={name:o.packageName,version:"0.0.1",description:`Trigger.dev integration for ${o.sdkPackage}`,main:"./dist/index.js",types:"./dist/index.d.ts",publishConfig:{access:"public"},files:["dist/index.js","dist/index.d.ts","dist/index.js.map"],devDependencies:{"@types/node":"16.x",rimraf:"^3.0.2",tsup:"7.1.x",typescript:"4.9.4"},scripts:{clean:"rimraf dist",build:"npm run clean && npm run build:tsup","build:tsup":"tsup",typecheck:"tsc --noEmit"},dependencies:{[p.name]:`^${p.version}`,[g.name]:g.version,[f.name]:f.version},engines:{node:">=16.8.0"}};await C(n,"package.json",JSON.stringify(h,null,2)),await C(n,"tsconfig.json",JSON.stringify({compilerOptions:{composite:!1,declaration:!1,declarationMap:!1,esModuleInterop:!0,forceConsistentCasingInFileNames:!0,inlineSources:!1,isolatedModules:!0,moduleResolution:"node16",noUnusedLocals:!1,noUnusedParameters:!1,preserveWatchOutput:!0,skipLibCheck:!0,strict:!0,experimentalDecorators:!0,emitDecoratorMetadata:!0,sourceMap:!0,resolveJsonModule:!0,lib:["es2019"],module:"commonjs",target:"es2021"},include:["./src/**/*.ts","tsup.config.ts"],exclude:["node_modules"]},null,2));let x=`
`})}]}async function je(e){if(!process.env.OPENAI_API_KEY)return;let t=new Ct(new _t({apiKey:process.env.OPENAI_API_KEY,organization:process.env.OPENAI_ORGANIZATION}));try{let n=(await t.createChatCompletion({model:"gpt-4",messages:[{role:"system",content:"You will be provided with the task of creating the typescript files necessary for a new Trigger.dev integration package. You will be provided the name of the integration package and the name of the SDK package."},...Et(),{role:"user",content:B(e.packageName,e.sdkPackage,e.extraInfo)}],function_call:{name:"createTypescriptFiles"},functions:[{name:"createTypescriptFiles",description:"Creates the initial typescript files for a new Trigger.dev package",parameters:{type:"object",properties:{"index.ts":{type:"string",description:"The contents of the index.ts file"},"tasks.ts":{type:"string",description:"The contents of the tasks.ts file"},"types.ts":{type:"string",description:"The contents of the types.ts file"}}}}]})).data.choices[0];if(!n)return;let s=n.message;if(!s||!s.function_call||!s.function_call.arguments)return;let o=Rt(s.function_call.arguments);if(!o)return;let c=Ie.record(Ie.string()).safeParse(o);return c.success?c.data:void 0}catch(r){console.error(r);return}}function Rt(e){try{return JSON.parse(e)}catch{return null}}import q from"ora";import At from"chalk";import{execa as V}from"execa";async function be(e){a.info("Installing dependencies...");let t=I();(await St(t,e)||q()).succeed(At.green(`Successfully installed dependencies!
`))}async function St(e,t){switch(e){case"npm":return await V(e,["install"],{cwd:t,stderr:"inherit"}),null;case"pnpm":let r=q("Running pnpm install...").start(),i=V(e,["install"],{cwd:t,stdout:"pipe"});return await new Promise((o,p)=>{i.stdout?.on("data",c=>{let g=c.toString();g.includes("Progress")&&(r.text=g.includes("|")?g.split(" | ")[1]??"":g)}),i.on("error",c=>p(c)),i.on("close",()=>o())}),r;case"yarn":let n=q("Running yarn...").start(),s=V(e,[],{cwd:t,stdout:"pipe"});return await new Promise((o,p)=>{s.stdout?.on("data",c=>{n.text=c.toString()}),s.on("error",c=>p(c)),s.on("close",()=>o())}),n}}var $t=b.object({packageName:b.string().optional(),sdkPackage:b.string().optional(),extraInfo:b.string().optional(),skipGeneratingCode:b.coerce.boolean().optional(),authMethod:b.enum(["api-key","oauth","both-methods"]).optional()});async function _e(e,t){let r=$t.safeParse(t);r.success||(a.error(r.error.message),process.exit(1));let i=r.data,n=T(e);await m(n)&&(a.error(`The path ${n} already exists. Please try again with a different path.`),process.exit(1));let o=await Ft(i,n),p=await R(o.sdkPackage,"latest");p||(a.error(`Could not find the latest version of ${o.sdkPackage}. Please try again later.`),process.exit(1));let c=await Dt(n),g=await Ce({path:"packages/trigger-sdk",packageName:"@trigger.dev/sdk",tag:"next",monorepoPath:c});g||(a.error("Could not find the latest version of @trigger.dev/sdk. Please try again later."),process.exit(1));let f=await Ce({path:"packages/integration-kit",packageName:"@trigger.dev/integration-kit",tag:"latest",monorepoPath:c});f||(a.error("Could not find the latest version of @trigger.dev/integration-kit. Please try again later."),process.exit(1));let h={name:o.packageName,version:"0.0.1",description:`Trigger.dev integration for ${o.sdkPackage}`,main:"./dist/index.js",types:"./dist/index.d.ts",publishConfig:{access:"public"},files:["dist/index.js","dist/index.d.ts","dist/index.js.map"],devDependencies:{"@types/node":"16.x",rimraf:"^3.0.2",tsup:"7.1.x",typescript:"4.9.4"},scripts:{clean:"rimraf dist",build:"npm run clean && npm run build:tsup","build:tsup":"tsup",typecheck:"tsc --noEmit"},dependencies:{[p.name]:`^${p.version}`,[g.name]:g.version,[f.name]:f.version},engines:{node:">=16.8.0"}};await C(n,"package.json",JSON.stringify(h,null,2)),await C(n,"tsconfig.json",JSON.stringify({compilerOptions:{composite:!1,declaration:!1,declarationMap:!1,esModuleInterop:!0,forceConsistentCasingInFileNames:!0,inlineSources:!1,isolatedModules:!0,moduleResolution:"node16",noUnusedLocals:!1,noUnusedParameters:!1,preserveWatchOutput:!0,skipLibCheck:!0,strict:!0,experimentalDecorators:!0,emitDecoratorMetadata:!0,sourceMap:!0,resolveJsonModule:!0,lib:["es2019"],module:"commonjs",target:"es2021"},include:["./src/**/*.ts","tsup.config.ts"],exclude:["node_modules"]},null,2));let x=`
# ${o.packageName}

@@ -307,5 +306,5 @@ `;await C(n,"README.md",x),await C(n,"tsup.config.ts",`

`),o.skipGeneratingCode?await C(n,"src/index.ts","export {}"):await $t(y.join(n,"src"),o),c&&await Lt(c,n,o),await be(n),a.success(`\u2705 Successfully initialized ${o.packageName} at ${n}`),a.info("Next steps:"),a.info(" 1. If you generated code, double check it for errors."),a.info(' 2. Read the "Creating an Integration" guide at https://trigger.dev/docs/integrations/create'),c&&a.info(" 3. Write some test jobs in the examples/nextjs-example project")}async function $t(e,t){let r=St("Generating integration code (may take ~30s)").start();function i(o,p){let c="";switch(o){case"api-key":{c="Note that the only auth method that this integration supports is API keys so can only useLocalAuth to true and don't use the clientFactory option";break}case"oauth":{c="Note that the only auth method that this integration supports is OAuth so can only useLocalAuth to false and make sure to use the clientFactory option";break}case"both-methods":{c="Note that this integration supports both API keys and OAuth so the options passed to the constructor must support both.";break}}return`${c}
`),o.skipGeneratingCode?await C(n,"src/index.ts","export {}"):await Nt(y.join(n,"src"),o),c&&await Kt(c,n,o),await be(n),a.success(`\u2705 Successfully initialized ${o.packageName} at ${n}`),a.info("Next steps:"),a.info(" 1. If you generated code, double check it for errors."),a.info(' 2. Read the "Creating an Integration" guide at https://trigger.dev/docs/integrations/create'),c&&a.info(" 3. Write some test jobs in the examples/nextjs-example project")}async function Nt(e,t){let r=Ot("Generating integration code (may take ~30s)").start();function i(o,p){let c="";switch(o){case"api-key":{c="Note that the only auth method that this integration supports is API keys so can only useLocalAuth to true and don't use the clientFactory option";break}case"oauth":{c="Note that the only auth method that this integration supports is OAuth so can only useLocalAuth to false and make sure to use the clientFactory option";break}case"both-methods":{c="Note that this integration supports both API keys and OAuth so the options passed to the constructor must support both.";break}}return`${c}
${p??""}`}let n=i(t.authMethod,t.extraInfo),s=await je({packageName:t.packageName,sdkPackage:t.sdkPackage,extraInfo:n});s?(await Promise.all(Object.entries(s).map(([o,p])=>C(e,o,p))),r.succeed(`Generated integration code in ${e}`)):r.fail("Failed to generate integration code")}async function C(e,t,r){await ae(y.join(e,t),r)}var Nt=async(e,t)=>{let r={...e};try{e.packageName||(r.packageName=await Ut(t)),e.sdkPackage||(r.sdkPackage=await Ft()),process.env.OPENAI_API_KEY||(r.skipGeneratingCode=!0),r.skipGeneratingCode||(r.authMethod=await Gt(),r.extraInfo=await Jt())}catch(i){if(i instanceof Error&&i.isTTYError){a.warn(`'${P} create-integration' needs an interactive terminal to provide options`);let{shouldContinue:n}=await O.prompt({name:"shouldContinue",type:"confirm",message:"Continue initializing your trigger.dev project?",default:!0});n||(a.info("Exiting..."),process.exit(0))}else throw i}return r},Ut=async e=>{let t=y.basename(e),{packageName:r}=await O.prompt({type:"input",name:"packageName",default:`@trigger.dev/${t}`,message:"What is the name of your integration package?",validate:i=>i?!0:"Please enter a package name"});return r},Ft=async()=>{let{sdkPackage:e}=await O.prompt({type:"input",name:"sdkPackage",message:"What is the name of the npm package of the integration?",validate:t=>t?!0:"Please enter an SDK package name"});return e},Jt=async()=>{let{extraInfo:e}=await O.prompt({type:"input",name:"extraInfo",message:"Please describe in english anything else about using the SDK that might be useful (optional)"});return e},Gt=async()=>{let{authMethod:e}=await O.prompt({type:"list",name:"authMethod",message:"What authentication method does this API use?",choices:[{name:"API Key",value:"api-key"},{name:"OAuth",value:"oauth"},{name:"Both API Key and OAuth",value:"both-methods"}]});return e};async function Mt(e){let t=await Ee(e);if(!t)return;let r=y.join(t,"package.json");if(!await m(r))return;if((await S(r)).name==="triggerdotdev")return t}async function Ce({packageName:e,tag:t,path:r,monorepoPath:i}){if(!i)return await R(e,t);let n=y.join(i,r,"package.json");if(!await m(n))return await R(e,t);let o=await S(n);return{name:o.name,version:`workspace:^${o.version}`}}async function Ee(e){let t=y.join(e,".git");if(await m(t))return e;let i=y.dirname(e);if(i!==e)return Ee(i)}async function Lt(e,t,r){let i=y.join(e,"examples","nextjs-example"),n=y.join(i,"package.json"),s=await S(n),o={...s,dependencies:{...s.dependencies,[r.packageName]:"workspace:*"}};await W(n,o);let p=y.join(i,"tsconfig.json"),c=await S(p),g={...c,compilerOptions:{...c.compilerOptions,paths:{...c.compilerOptions.paths,[r.packageName]:[`../../integrations/${y.basename(t)}/src/index`],[`${r.packageName}/*`]:[`../../integrations/${y.basename(t)}/src/*`]}}};await W(p,g)}var _=new Dt;_.name(P).description("The Trigger.dev CLI").version("0.0.1");_.command("init").description("Initialize Trigger.dev in your Next.js project").option("-p, --project-path <project-path>","The path to the Next.js project",".").option("-k, --api-key <api-key>","The development API key to use for the project.").option("-e, --endpoint-id <endpoint-id>","The unique ID for the endpoint to use for this project. (e.g. my-nextjs-project)").option("-t, --trigger-url <trigger-url>","The URL of the Trigger.dev instance to use.",zt("--trigger-url")).version(J(),"-v, --version","Display the version number").action(async e=>{await de(e)});_.command("dev").description("Tunnel your local Next.js project to Trigger.dev and start running jobs").argument("[path]","The path to the Next.js project",".").option("-p, --port <port>","The local port your Next.js project is on","3000").option("-e, --env-file <name>","The name of the env file to load",".env.local").option("-i, --client-id <name>","The ID of the client to use for this project. Will use the value from the package.json file if not provided.").version(J(),"-v, --version","Display the version number").action(async(e,t)=>{await ve(e,t)});_.command("create-integration").description("Create a new integration package for Trigger.dev").argument("[path]","The path where you would like the package to be created",".").option("-n, --package-name <package name>","The name of the package to create (e.g. @trigger.dev/slack)").option("-s, --sdk-package <integration package>","The name of the SDK package to use (e.g. @slack/web-api)").version(J(),"-v, --version","Display the version number").action(async(e,t)=>{await _e(e,t)});var me=async()=>{let{instanceType:e}=await M.prompt([{type:"list",name:"instanceType",message:"Are you using the Trigger.dev cloud or self-hosted?",choices:[{name:`Trigger.dev Cloud (${v})`,value:"cloud",default:!0},{name:"Self hosted",value:"self-hosted"}]}]);if(e==="cloud")return v;let{triggerUrl:t}=await M.prompt({type:"input",name:"triggerUrl",message:"Enter the URL of your self-hosted Trigger.dev instance",filter:r=>H(r),validate:r=>{if(!r)return"Please enter the URL of your self-hosted Trigger.dev instance";let i=H(r);try{new URL(i)}catch{return"Please enter a valid URL"}return!0}});return t},fe=async e=>{let{apiKey:t}=await M.prompt({type:"password",name:"apiKey",message:`Enter your development API key (Find yours \u27A1\uFE0F ${e})`,validate:r=>r?r.startsWith("tr_dev_")?!0:"Please enter a valid development API key or leave blank to skip (should start with tr_dev_)":"Please enter your development API key"});return t},he=async e=>{let{endpointSlug:t}=await M.prompt({type:"input",name:"endpointSlug",default:Wt(Kt.basename(e)),message:"Enter a unique ID for your endpoint",validate:r=>r?!0:"Please enter a unique ID for your endpoint"});return t};function Wt(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function zt(e){return t=>{try{let r=H(t);return new URL(r),r}catch{throw new Error(`Please enter a valid URL for the ${e} flag`)}}}function H(e){let t=e;return!e.startsWith("http://")&&!e.startsWith("https://")&&(t=e.includes("localhost")?`http://${e}`:`https://${e}`),t}var Yt=async()=>{await _.parseAsync()};Yt().catch(e=>{a.error("Aborting installation..."),e instanceof Error?a.error(e):(a.error("An unknown error has occurred. Please open an issue on github with the below:"),console.log(e)),process.exit(1)});
${p??""}`}let n=i(t.authMethod,t.extraInfo),s=await je({packageName:t.packageName,sdkPackage:t.sdkPackage,extraInfo:n});s?(await Promise.all(Object.entries(s).map(([o,p])=>C(e,o,p))),r.succeed(`Generated integration code in ${e}`)):r.fail("Failed to generate integration code")}async function C(e,t,r){await ae(y.join(e,t),r)}var Ft=async(e,t)=>{let r={...e};try{e.packageName||(r.packageName=await Ut(t)),e.sdkPackage||(r.sdkPackage=await Jt()),process.env.OPENAI_API_KEY||(r.skipGeneratingCode=!0),r.skipGeneratingCode||(r.authMethod=await Mt(),r.extraInfo=await Gt())}catch(i){if(i instanceof Error&&i.isTTYError){a.warn(`'${P} create-integration' needs an interactive terminal to provide options`);let{shouldContinue:n}=await O.prompt({name:"shouldContinue",type:"confirm",message:"Continue initializing your trigger.dev project?",default:!0});n||(a.info("Exiting..."),process.exit(0))}else throw i}return r},Ut=async e=>{let t=y.basename(e),{packageName:r}=await O.prompt({type:"input",name:"packageName",default:`@trigger.dev/${t}`,message:"What is the name of your integration package?",validate:i=>i?!0:"Please enter a package name"});return r},Jt=async()=>{let{sdkPackage:e}=await O.prompt({type:"input",name:"sdkPackage",message:"What is the name of the npm package of the integration?",validate:t=>t?!0:"Please enter an SDK package name"});return e},Gt=async()=>{let{extraInfo:e}=await O.prompt({type:"input",name:"extraInfo",message:"Please describe in english anything else about using the SDK that might be useful (optional)"});return e},Mt=async()=>{let{authMethod:e}=await O.prompt({type:"list",name:"authMethod",message:"What authentication method does this API use?",choices:[{name:"API Key",value:"api-key"},{name:"OAuth",value:"oauth"},{name:"Both API Key and OAuth",value:"both-methods"}]});return e};async function Dt(e){let t=await Ee(e);if(!t)return;let r=y.join(t,"package.json");if(!await m(r))return;if((await S(r)).name==="triggerdotdev")return t}async function Ce({packageName:e,tag:t,path:r,monorepoPath:i}){if(!i)return await R(e,t);let n=y.join(i,r,"package.json");if(!await m(n))return await R(e,t);let o=await S(n);return{name:o.name,version:`workspace:^${o.version}`}}async function Ee(e){let t=y.join(e,".git");if(await m(t))return e;let i=y.dirname(e);if(i!==e)return Ee(i)}async function Kt(e,t,r){let i=y.join(e,"examples","nextjs-example"),n=y.join(i,"package.json"),s=await S(n),o={...s,dependencies:{...s.dependencies,[r.packageName]:"workspace:*"}};await W(n,o);let p=y.join(i,"tsconfig.json"),c=await S(p),g={...c,compilerOptions:{...c.compilerOptions,paths:{...c.compilerOptions.paths,[r.packageName]:[`../../integrations/${y.basename(t)}/src/index`],[`${r.packageName}/*`]:[`../../integrations/${y.basename(t)}/src/*`]}}};await W(p,g)}var _=new Lt;_.name(P).description("The Trigger.dev CLI").version("0.0.1");_.command("init").description("Initialize Trigger.dev in your Next.js project").option("-p, --project-path <project-path>","The path to the Next.js project",".").option("-k, --api-key <api-key>","The development API key to use for the project.").option("-e, --endpoint-id <endpoint-id>","The unique ID for the endpoint to use for this project. (e.g. my-nextjs-project)").option("-t, --trigger-url <trigger-url>","The URL of the Trigger.dev instance to use.",Yt("--trigger-url")).version(J(),"-v, --version","Display the version number").action(async e=>{await de(e)});_.command("dev").description("Tunnel your local Next.js project to Trigger.dev and start running jobs").argument("[path]","The path to the Next.js project",".").option("-p, --port <port>","The local port your Next.js project is on","3000").option("-e, --env-file <name>","The name of the env file to load",".env.local").option("-i, --client-id <name>","The ID of the client to use for this project. Will use the value from the package.json file if not provided.").version(J(),"-v, --version","Display the version number").action(async(e,t)=>{await ve(e,t)});_.command("create-integration").description("Create a new integration package for Trigger.dev").argument("[path]","The path where you would like the package to be created",".").option("-n, --package-name <package name>","The name of the package to create (e.g. @trigger.dev/slack)").option("-s, --sdk-package <integration package>","The name of the SDK package to use (e.g. @slack/web-api)").version(J(),"-v, --version","Display the version number").action(async(e,t)=>{await _e(e,t)});var me=async()=>{let{instanceType:e}=await M.prompt([{type:"list",name:"instanceType",message:"Are you using the Trigger.dev cloud or self-hosted?",choices:[{name:`Trigger.dev Cloud (${v})`,value:"cloud",default:!0},{name:"Self hosted",value:"self-hosted"}]}]);if(e==="cloud")return v;let{triggerUrl:t}=await M.prompt({type:"input",name:"triggerUrl",message:"Enter the URL of your self-hosted Trigger.dev instance",filter:r=>H(r),validate:r=>{if(!r)return"Please enter the URL of your self-hosted Trigger.dev instance";let i=H(r);try{new URL(i)}catch{return"Please enter a valid URL"}return!0}});return t},fe=async e=>{let{apiKey:t}=await M.prompt({type:"password",name:"apiKey",message:`Enter your development API key (Find yours \u27A1\uFE0F ${e})`,validate:r=>r?r.startsWith("tr_dev_")?!0:"Please enter a valid development API key or leave blank to skip (should start with tr_dev_)":"Please enter your development API key"});return t},he=async e=>{let{endpointSlug:t}=await M.prompt({type:"input",name:"endpointSlug",default:zt(Wt.basename(e)),message:"Enter a unique ID for your endpoint",validate:r=>r?!0:"Please enter a unique ID for your endpoint"});return t};function zt(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function Yt(e){return t=>{try{let r=H(t);return new URL(r),r}catch{throw new Error(`Please enter a valid URL for the ${e} flag`)}}}function H(e){let t=e;return!e.startsWith("http://")&&!e.startsWith("https://")&&(t=e.includes("localhost")?`http://${e}`:`https://${e}`),t}var Bt=async()=>{await _.parseAsync()};Bt().catch(e=>{a.error("Aborting installation..."),e instanceof Error?a.error(e):(a.error("An unknown error has occurred. Please open an issue on github with the below:"),console.log(e)),process.exit(1)});
//# sourceMappingURL=index.js.map

@@ -1,1 +0,1 @@

{"inputs":{"src/consts.ts":{"bytes":1019,"imports":[{"path":"path","kind":"import-statement","external":true},{"path":"url","kind":"import-statement","external":true}],"format":"esm"},"src/utils/getUserPkgManager.ts":{"bytes":525,"imports":[],"format":"esm"},"src/utils/addDependencies.ts":{"bytes":4407,"imports":[{"path":"chalk","kind":"import-statement","external":true},{"path":"execa","kind":"import-statement","external":true},{"path":"ora","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true},{"path":"src/utils/getUserPkgManager.ts","kind":"import-statement","original":"./getUserPkgManager.js"},{"path":"fs/promises","kind":"import-statement","external":true},{"path":"node-fetch","kind":"import-statement","external":true},{"path":"zod","kind":"import-statement","external":true}],"format":"esm"},"src/utils/logger.ts":{"bytes":349,"imports":[{"path":"chalk","kind":"import-statement","external":true}],"format":"esm"},"src/utils/parseNameAndPath.ts":{"bytes":243,"imports":[{"path":"path","kind":"import-statement","external":true}],"format":"esm"},"src/utils/renderApiKey.ts":{"bytes":188,"imports":[],"format":"esm"},"src/utils/renderTitle.ts":{"bytes":682,"imports":[{"path":"gradient-string","kind":"import-statement","external":true},{"path":"src/consts.ts","kind":"import-statement","original":"../consts.js"},{"path":"src/utils/getUserPkgManager.ts","kind":"import-statement","original":"./getUserPkgManager.js"}],"format":"esm"},"src/utils/detectNextJsProject.ts":{"bytes":516,"imports":[{"path":"fs/promises","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true}],"format":"esm"},"src/utils/triggerApi.ts":{"bytes":3375,"imports":[{"path":"node-fetch","kind":"import-statement","external":true},{"path":"zod","kind":"import-statement","external":true}],"format":"esm"},"src/utils/fileSystem.ts":{"bytes":1191,"imports":[{"path":"fs/promises","kind":"import-statement","external":true},{"path":"fs","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true}],"format":"esm"},"src/commands/init.ts":{"bytes":19357,"imports":[{"path":"fs/promises","kind":"import-statement","external":true},{"path":"inquirer","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true},{"path":"path-to-regexp","kind":"import-statement","external":true},{"path":"simple-git","kind":"import-statement","external":true},{"path":"src/cli/index.ts","kind":"import-statement","original":"../cli/index.js"},{"path":"src/consts.ts","kind":"import-statement","original":"../consts.js"},{"path":"src/utils/addDependencies.ts","kind":"import-statement","original":"../utils/addDependencies.js"},{"path":"src/utils/logger.ts","kind":"import-statement","original":"../utils/logger.js"},{"path":"src/utils/parseNameAndPath.ts","kind":"import-statement","original":"../utils/parseNameAndPath.js"},{"path":"src/utils/renderApiKey.ts","kind":"import-statement","original":"../utils/renderApiKey.js"},{"path":"src/utils/renderTitle.ts","kind":"import-statement","original":"../utils/renderTitle.js"},{"path":"src/utils/detectNextJsProject.ts","kind":"import-statement","original":"../utils/detectNextJsProject.js"},{"path":"src/utils/triggerApi.ts","kind":"import-statement","original":"../utils/triggerApi.js"},{"path":"tsconfig","kind":"import-statement","external":true},{"path":"src/utils/fileSystem.ts","kind":"import-statement","original":"../utils/fileSystem.js"}],"format":"esm"},"src/utils/getVersion.ts":{"bytes":390,"imports":[{"path":"type-fest","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true},{"path":"src/consts.ts","kind":"import-statement","original":"../consts.js"},{"path":"src/utils/fileSystem.ts","kind":"import-statement","original":"./fileSystem.js"}],"format":"esm"},"src/commands/dev.ts":{"bytes":8140,"imports":[{"path":"chokidar","kind":"import-statement","external":true},{"path":"fs/promises","kind":"import-statement","external":true},{"path":"ngrok","kind":"import-statement","external":true},{"path":"ora","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true},{"path":"zod","kind":"import-statement","external":true},{"path":"src/utils/fileSystem.ts","kind":"import-statement","original":"../utils/fileSystem.js"},{"path":"src/utils/logger.ts","kind":"import-statement","original":"../utils/logger.js"},{"path":"src/utils/parseNameAndPath.ts","kind":"import-statement","original":"../utils/parseNameAndPath.js"},{"path":"src/utils/triggerApi.ts","kind":"import-statement","original":"../utils/triggerApi.js"}],"format":"esm"},"src/utils/generateIntegrationFiles.ts":{"bytes":8869,"imports":[{"path":"openai","kind":"import-statement","external":true},{"path":"zod","kind":"import-statement","external":true}],"format":"esm"},"src/utils/installDependencies.ts":{"bytes":2289,"imports":[{"path":"src/utils/getUserPkgManager.ts","kind":"import-statement","original":"./getUserPkgManager.js"},{"path":"src/utils/logger.ts","kind":"import-statement","original":"./logger.js"},{"path":"ora","kind":"import-statement","external":true},{"path":"chalk","kind":"import-statement","external":true},{"path":"execa","kind":"import-statement","external":true}],"format":"esm"},"src/commands/createIntegration.ts":{"bytes":15414,"imports":[{"path":"inquirer","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"ora","kind":"import-statement","external":true},{"path":"zod","kind":"import-statement","external":true},{"path":"src/consts.ts","kind":"import-statement","original":"../consts.js"},{"path":"src/utils/addDependencies.ts","kind":"import-statement","original":"../utils/addDependencies.js"},{"path":"src/utils/fileSystem.ts","kind":"import-statement","original":"../utils/fileSystem.js"},{"path":"src/utils/generateIntegrationFiles.ts","kind":"import-statement","original":"../utils/generateIntegrationFiles.js"},{"path":"src/utils/installDependencies.ts","kind":"import-statement","original":"../utils/installDependencies.js"},{"path":"src/utils/logger.ts","kind":"import-statement","original":"../utils/logger.js"},{"path":"src/utils/parseNameAndPath.ts","kind":"import-statement","original":"../utils/parseNameAndPath.js"}],"format":"esm"},"src/cli/index.ts":{"bytes":6297,"imports":[{"path":"commander","kind":"import-statement","external":true},{"path":"inquirer","kind":"import-statement","external":true},{"path":"src/commands/init.ts","kind":"import-statement","original":"../commands/init.js"},{"path":"src/consts.ts","kind":"import-statement","original":"../consts.js"},{"path":"src/utils/getVersion.ts","kind":"import-statement","original":"../utils/getVersion.js"},{"path":"node:path","kind":"import-statement","external":true},{"path":"src/commands/dev.ts","kind":"import-statement","original":"../commands/dev.js"},{"path":"src/commands/createIntegration.ts","kind":"import-statement","original":"../commands/createIntegration.js"}],"format":"esm"},"src/index.ts":{"bytes":461,"imports":[{"path":"src/cli/index.ts","kind":"import-statement","original":"./cli/index.js"},{"path":"src/utils/logger.ts","kind":"import-statement","original":"./utils/logger.js"}],"format":"esm"}},"outputs":{"dist/index.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":113689},"dist/index.js":{"imports":[{"path":"commander","kind":"import-statement","external":true},{"path":"inquirer","kind":"import-statement","external":true},{"path":"fs/promises","kind":"import-statement","external":true},{"path":"inquirer","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true},{"path":"path-to-regexp","kind":"import-statement","external":true},{"path":"simple-git","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true},{"path":"url","kind":"import-statement","external":true},{"path":"chalk","kind":"import-statement","external":true},{"path":"execa","kind":"import-statement","external":true},{"path":"ora","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true},{"path":"fs/promises","kind":"import-statement","external":true},{"path":"node-fetch","kind":"import-statement","external":true},{"path":"zod","kind":"import-statement","external":true},{"path":"chalk","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true},{"path":"gradient-string","kind":"import-statement","external":true},{"path":"fs/promises","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true},{"path":"node-fetch","kind":"import-statement","external":true},{"path":"zod","kind":"import-statement","external":true},{"path":"tsconfig","kind":"import-statement","external":true},{"path":"fs/promises","kind":"import-statement","external":true},{"path":"fs","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"chokidar","kind":"import-statement","external":true},{"path":"fs/promises","kind":"import-statement","external":true},{"path":"ngrok","kind":"import-statement","external":true},{"path":"ora","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true},{"path":"zod","kind":"import-statement","external":true},{"path":"inquirer","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"ora","kind":"import-statement","external":true},{"path":"zod","kind":"import-statement","external":true},{"path":"openai","kind":"import-statement","external":true},{"path":"zod","kind":"import-statement","external":true},{"path":"ora","kind":"import-statement","external":true},{"path":"chalk","kind":"import-statement","external":true},{"path":"execa","kind":"import-statement","external":true}],"exports":[],"entryPoint":"src/index.ts","inputs":{"src/cli/index.ts":{"bytesInOutput":3298},"src/commands/init.ts":{"bytesInOutput":8819},"src/consts.ts":{"bytesInOutput":532},"src/utils/addDependencies.ts":{"bytesInOutput":1672},"src/utils/getUserPkgManager.ts":{"bytesInOutput":129},"src/utils/logger.ts":{"bytesInOutput":187},"src/utils/parseNameAndPath.ts":{"bytesInOutput":58},"src/utils/renderApiKey.ts":{"bytesInOutput":76},"src/utils/renderTitle.ts":{"bytesInOutput":249},"src/utils/detectNextJsProject.ts":{"bytesInOutput":145},"src/utils/triggerApi.ts":{"bytesInOutput":1509},"src/utils/fileSystem.ts":{"bytesInOutput":509},"src/utils/getVersion.ts":{"bytesInOutput":96},"src/commands/dev.ts":{"bytesInOutput":3539},"src/commands/createIntegration.ts":{"bytesInOutput":6741},"src/utils/generateIntegrationFiles.ts":{"bytesInOutput":6862},"src/utils/installDependencies.ts":{"bytesInOutput":822},"src/index.ts":{"bytesInOutput":244}},"bytes":35508}}}
{"inputs":{"src/consts.ts":{"bytes":1019,"imports":[{"path":"path","kind":"import-statement","external":true},{"path":"url","kind":"import-statement","external":true}],"format":"esm"},"src/utils/getUserPkgManager.ts":{"bytes":525,"imports":[],"format":"esm"},"src/utils/addDependencies.ts":{"bytes":4407,"imports":[{"path":"chalk","kind":"import-statement","external":true},{"path":"execa","kind":"import-statement","external":true},{"path":"ora","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true},{"path":"src/utils/getUserPkgManager.ts","kind":"import-statement","original":"./getUserPkgManager.js"},{"path":"fs/promises","kind":"import-statement","external":true},{"path":"node-fetch","kind":"import-statement","external":true},{"path":"zod","kind":"import-statement","external":true}],"format":"esm"},"src/utils/logger.ts":{"bytes":349,"imports":[{"path":"chalk","kind":"import-statement","external":true}],"format":"esm"},"src/utils/parseNameAndPath.ts":{"bytes":243,"imports":[{"path":"path","kind":"import-statement","external":true}],"format":"esm"},"src/utils/renderApiKey.ts":{"bytes":188,"imports":[],"format":"esm"},"src/utils/renderTitle.ts":{"bytes":682,"imports":[{"path":"gradient-string","kind":"import-statement","external":true},{"path":"src/consts.ts","kind":"import-statement","original":"../consts.js"},{"path":"src/utils/getUserPkgManager.ts","kind":"import-statement","original":"./getUserPkgManager.js"}],"format":"esm"},"src/utils/detectNextJsProject.ts":{"bytes":516,"imports":[{"path":"fs/promises","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true}],"format":"esm"},"src/utils/triggerApi.ts":{"bytes":3375,"imports":[{"path":"node-fetch","kind":"import-statement","external":true},{"path":"zod","kind":"import-statement","external":true}],"format":"esm"},"src/utils/fileSystem.ts":{"bytes":1191,"imports":[{"path":"fs/promises","kind":"import-statement","external":true},{"path":"fs","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true}],"format":"esm"},"src/commands/init.ts":{"bytes":19357,"imports":[{"path":"fs/promises","kind":"import-statement","external":true},{"path":"inquirer","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true},{"path":"path-to-regexp","kind":"import-statement","external":true},{"path":"simple-git","kind":"import-statement","external":true},{"path":"src/cli/index.ts","kind":"import-statement","original":"../cli/index.js"},{"path":"src/consts.ts","kind":"import-statement","original":"../consts.js"},{"path":"src/utils/addDependencies.ts","kind":"import-statement","original":"../utils/addDependencies.js"},{"path":"src/utils/logger.ts","kind":"import-statement","original":"../utils/logger.js"},{"path":"src/utils/parseNameAndPath.ts","kind":"import-statement","original":"../utils/parseNameAndPath.js"},{"path":"src/utils/renderApiKey.ts","kind":"import-statement","original":"../utils/renderApiKey.js"},{"path":"src/utils/renderTitle.ts","kind":"import-statement","original":"../utils/renderTitle.js"},{"path":"src/utils/detectNextJsProject.ts","kind":"import-statement","original":"../utils/detectNextJsProject.js"},{"path":"src/utils/triggerApi.ts","kind":"import-statement","original":"../utils/triggerApi.js"},{"path":"tsconfig","kind":"import-statement","external":true},{"path":"src/utils/fileSystem.ts","kind":"import-statement","original":"../utils/fileSystem.js"}],"format":"esm"},"src/utils/getVersion.ts":{"bytes":390,"imports":[{"path":"type-fest","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true},{"path":"src/consts.ts","kind":"import-statement","original":"../consts.js"},{"path":"src/utils/fileSystem.ts","kind":"import-statement","original":"./fileSystem.js"}],"format":"esm"},"src/commands/dev.ts":{"bytes":7942,"imports":[{"path":"chokidar","kind":"import-statement","external":true},{"path":"fs/promises","kind":"import-statement","external":true},{"path":"ngrok","kind":"import-statement","external":true},{"path":"ora","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true},{"path":"zod","kind":"import-statement","external":true},{"path":"src/utils/fileSystem.ts","kind":"import-statement","original":"../utils/fileSystem.js"},{"path":"src/utils/logger.ts","kind":"import-statement","original":"../utils/logger.js"},{"path":"src/utils/parseNameAndPath.ts","kind":"import-statement","original":"../utils/parseNameAndPath.js"},{"path":"src/utils/triggerApi.ts","kind":"import-statement","original":"../utils/triggerApi.js"},{"path":"dotenv","kind":"import-statement","external":true}],"format":"esm"},"src/utils/generateIntegrationFiles.ts":{"bytes":8869,"imports":[{"path":"openai","kind":"import-statement","external":true},{"path":"zod","kind":"import-statement","external":true}],"format":"esm"},"src/utils/installDependencies.ts":{"bytes":2289,"imports":[{"path":"src/utils/getUserPkgManager.ts","kind":"import-statement","original":"./getUserPkgManager.js"},{"path":"src/utils/logger.ts","kind":"import-statement","original":"./logger.js"},{"path":"ora","kind":"import-statement","external":true},{"path":"chalk","kind":"import-statement","external":true},{"path":"execa","kind":"import-statement","external":true}],"format":"esm"},"src/commands/createIntegration.ts":{"bytes":15414,"imports":[{"path":"inquirer","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"ora","kind":"import-statement","external":true},{"path":"zod","kind":"import-statement","external":true},{"path":"src/consts.ts","kind":"import-statement","original":"../consts.js"},{"path":"src/utils/addDependencies.ts","kind":"import-statement","original":"../utils/addDependencies.js"},{"path":"src/utils/fileSystem.ts","kind":"import-statement","original":"../utils/fileSystem.js"},{"path":"src/utils/generateIntegrationFiles.ts","kind":"import-statement","original":"../utils/generateIntegrationFiles.js"},{"path":"src/utils/installDependencies.ts","kind":"import-statement","original":"../utils/installDependencies.js"},{"path":"src/utils/logger.ts","kind":"import-statement","original":"../utils/logger.js"},{"path":"src/utils/parseNameAndPath.ts","kind":"import-statement","original":"../utils/parseNameAndPath.js"}],"format":"esm"},"src/cli/index.ts":{"bytes":6297,"imports":[{"path":"commander","kind":"import-statement","external":true},{"path":"inquirer","kind":"import-statement","external":true},{"path":"src/commands/init.ts","kind":"import-statement","original":"../commands/init.js"},{"path":"src/consts.ts","kind":"import-statement","original":"../consts.js"},{"path":"src/utils/getVersion.ts","kind":"import-statement","original":"../utils/getVersion.js"},{"path":"node:path","kind":"import-statement","external":true},{"path":"src/commands/dev.ts","kind":"import-statement","original":"../commands/dev.js"},{"path":"src/commands/createIntegration.ts","kind":"import-statement","original":"../commands/createIntegration.js"}],"format":"esm"},"src/index.ts":{"bytes":461,"imports":[{"path":"src/cli/index.ts","kind":"import-statement","original":"./cli/index.js"},{"path":"src/utils/logger.ts","kind":"import-statement","original":"./utils/logger.js"}],"format":"esm"}},"outputs":{"dist/index.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":113287},"dist/index.js":{"imports":[{"path":"commander","kind":"import-statement","external":true},{"path":"inquirer","kind":"import-statement","external":true},{"path":"fs/promises","kind":"import-statement","external":true},{"path":"inquirer","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true},{"path":"path-to-regexp","kind":"import-statement","external":true},{"path":"simple-git","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true},{"path":"url","kind":"import-statement","external":true},{"path":"chalk","kind":"import-statement","external":true},{"path":"execa","kind":"import-statement","external":true},{"path":"ora","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true},{"path":"fs/promises","kind":"import-statement","external":true},{"path":"node-fetch","kind":"import-statement","external":true},{"path":"zod","kind":"import-statement","external":true},{"path":"chalk","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true},{"path":"gradient-string","kind":"import-statement","external":true},{"path":"fs/promises","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true},{"path":"node-fetch","kind":"import-statement","external":true},{"path":"zod","kind":"import-statement","external":true},{"path":"tsconfig","kind":"import-statement","external":true},{"path":"fs/promises","kind":"import-statement","external":true},{"path":"fs","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"chokidar","kind":"import-statement","external":true},{"path":"fs/promises","kind":"import-statement","external":true},{"path":"ngrok","kind":"import-statement","external":true},{"path":"ora","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true},{"path":"zod","kind":"import-statement","external":true},{"path":"dotenv","kind":"import-statement","external":true},{"path":"inquirer","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"ora","kind":"import-statement","external":true},{"path":"zod","kind":"import-statement","external":true},{"path":"openai","kind":"import-statement","external":true},{"path":"zod","kind":"import-statement","external":true},{"path":"ora","kind":"import-statement","external":true},{"path":"chalk","kind":"import-statement","external":true},{"path":"execa","kind":"import-statement","external":true}],"exports":[],"entryPoint":"src/index.ts","inputs":{"src/cli/index.ts":{"bytesInOutput":3298},"src/commands/init.ts":{"bytesInOutput":8819},"src/consts.ts":{"bytesInOutput":532},"src/utils/addDependencies.ts":{"bytesInOutput":1672},"src/utils/getUserPkgManager.ts":{"bytesInOutput":129},"src/utils/logger.ts":{"bytesInOutput":187},"src/utils/parseNameAndPath.ts":{"bytesInOutput":58},"src/utils/renderApiKey.ts":{"bytesInOutput":76},"src/utils/renderTitle.ts":{"bytesInOutput":249},"src/utils/detectNextJsProject.ts":{"bytesInOutput":145},"src/utils/triggerApi.ts":{"bytesInOutput":1509},"src/utils/fileSystem.ts":{"bytesInOutput":509},"src/utils/getVersion.ts":{"bytesInOutput":96},"src/commands/dev.ts":{"bytesInOutput":3441},"src/commands/createIntegration.ts":{"bytesInOutput":6741},"src/utils/generateIntegrationFiles.ts":{"bytesInOutput":6862},"src/utils/installDependencies.ts":{"bytesInOutput":822},"src/index.ts":{"bytesInOutput":244}},"bytes":35410}}}
{
"name": "@trigger.dev/cli",
"version": "0.2.1-next.21",
"version": "0.2.1-next.22",
"description": "The Trigger.dev CLI",

@@ -53,2 +53,3 @@ "main": "./dist/index.js",

"degit": "^2.8.4",
"dotenv": "^16.3.1",
"execa": "^7.0.0",

@@ -55,0 +56,0 @@ "gradient-string": "^2.0.2",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc