edgera 1.0.0 → 1.1.0

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.
Files changed (2) hide show
  1. package/dist/index.mjs +26 -1
  2. package/package.json +8 -3
package/dist/index.mjs CHANGED
@@ -1,2 +1,27 @@
1
1
  #!/usr/bin/env node
2
- import{cac as s}from"cac";import c from"picocolors";import{intro as i,text as n,outro as m}from"@clack/prompts";import o from"picocolors";async function t(r){i(o.inverse(" edgera ")),!(!r&&(r=await n({message:"What is your name?",placeholder:"Edgera User",validate:a=>{if(a.length===0)return"Name is required!"}}),!r))&&m(`Hello, ${o.cyan(r)}! Welcome to Edgera CLI.`)}var e=s("edgera");e.command("hello [name]","Greeting command").action(r=>{t(r)});e.help();e.version("1.0.0");try{e.parse()}catch(r){console.error(c.red(r.message)),process.exit(1)}
2
+ import{cac as I}from"cac";import R from"picocolors";import{intro as P,outro as x,text as D}from"@clack/prompts";import g from"picocolors";async function E(r){P(g.inverse(" edgera ")),!(!r&&(r=await D({message:"What is your name?",placeholder:"Edgera User",validate:f=>{if(f.length===0)return"Name is required!"}}),!r))&&x(`Hello, ${g.cyan(r)}! Welcome to Edgera CLI.`)}import{existsSync as u,readFileSync as $,writeFileSync as j}from"fs";import{resolve as d}from"path";import{confirm as k,intro as A,outro as t,spinner as h}from"@clack/prompts";import n from"picocolors";var y="https://app.edgera.net";async function v(){A(n.inverse(" edgera init "));let r=d(process.cwd(),".env");u(r)||(t(n.red(`\u2716 Missing .env file
3
+
4
+ Please create a .env file with your EDGERA_DEVELOPMENT_KEY:
5
+ `+n.dim("EDGERA_DEVELOPMENT_KEY=sk_edgera_..."))),process.exit(1));let c=$(r,"utf-8").match(/EDGERA_DEVELOPMENT_KEY=(.+)/);(!c||!c[1]?.trim())&&(t(n.red(`\u2716 EDGERA_DEVELOPMENT_KEY not found in .env
6
+
7
+ Please add your development key to .env:
8
+ `+n.dim("EDGERA_DEVELOPMENT_KEY=sk_edgera_..."))),process.exit(1));let w=c[1].trim(),s=h();s.start("Fetching project configuration from cloud...");let a;try{let e=await fetch(`${y}/api/dev/init`,{method:"GET",headers:{Authorization:`Bearer ${w}`}});if(!e.ok){let o=await e.json().catch(()=>({error:"Unknown error"}));s.stop(n.red("Failed to fetch configuration")),e.status===401?t(n.red(`\u2716 Authentication failed
9
+
10
+ ${o?.error||"Invalid development key"}
11
+
12
+ Please verify your EDGERA_DEVELOPMENT_KEY in .env`)):t(n.red(`\u2716 Server error (${e.status})
13
+
14
+ ${o?.error||"Unknown error"}`)),process.exit(1)}a=await e.json(),s.stop(n.green("Configuration fetched successfully"))}catch(e){s.stop(n.red("Failed to connect to API")),t(n.red(`\u2716 Network error
15
+
16
+ ${e instanceof Error?e.message:"Unknown error"}
17
+
18
+ Make sure the API server is running at ${n.cyan(y)}`)),process.exit(1)}let m=[{name:"edgera.json",content:a.edgera},{name:"schema.json",content:a.schema},{name:"permissions.json",content:a.permissions}],p=m.filter(e=>u(d(process.cwd(),e.name)));if(p.length>0){let e=p.map(_=>n.cyan(_.name)).join(", "),o=await k({message:`The following files already exist: ${e}. Overwrite?`,initialValue:!1});(!o||typeof o=="symbol")&&(t(n.yellow("Init cancelled")),process.exit(0))}let l=h();l.start("Writing configuration files...");try{for(let e of m){let o=d(process.cwd(),e.name);j(o,JSON.stringify(e.content,null,2)+`
19
+ `,"utf-8")}l.stop(n.green("Configuration files written"))}catch(e){l.stop(n.red("Failed to write files")),t(n.red(`\u2716 File write error
20
+
21
+ ${e instanceof Error?e.message:"Unknown error"}`)),process.exit(1)}t(n.green(`\u2713 Initialization complete!
22
+
23
+ Created:
24
+ `+m.map(e=>` ${n.cyan(e.name)}`).join(`
25
+ `)+`
26
+
27
+ Run ${n.cyan("edgera dev")} to start development.`))}var i=I("edgera");i.command("hello [name]","Greeting command").action(r=>{E(r)});i.command("init","Initialize project configuration").action(()=>{v()});i.help();i.version("1.0.0");try{i.parse()}catch(r){console.error(R.red(r.message)),process.exit(1)}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "edgera",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "Edgera CLI tool",
5
5
  "main": "dist/index.mjs",
6
6
  "bin": {
@@ -16,7 +16,7 @@
16
16
  },
17
17
  "scripts": {
18
18
  "dev": "tsx src/index.ts",
19
- "build": "tsup src/index.ts --format esm --clean --minify --onSuccess 'chmod +x dist/index.mjs'",
19
+ "build": "EDGERA_API_URL=https://app.edgera.net tsup src/index.ts --format esm --clean --minify --onSuccess 'chmod +x dist/index.mjs'",
20
20
  "check": "biome check --write"
21
21
  },
22
22
  "keywords": [],
@@ -25,6 +25,7 @@
25
25
  "packageManager": "pnpm@10.6.4",
26
26
  "devDependencies": {
27
27
  "@biomejs/biome": "2.3.1",
28
+ "@types/ws": "^8.18.1",
28
29
  "@workspace/biome-config": "workspace:^",
29
30
  "@workspace/types": "workspace:^",
30
31
  "@workspace/typescript-config": "workspace:^",
@@ -34,6 +35,10 @@
34
35
  "dependencies": {
35
36
  "@clack/prompts": "^0.11.0",
36
37
  "cac": "^6.7.14",
37
- "picocolors": "^1.1.1"
38
+ "chokidar": "^5.0.0",
39
+ "drizzle-orm": "^0.45.1",
40
+ "picocolors": "^1.1.1",
41
+ "postgres": "^3.4.3",
42
+ "ws": "^8.18.1"
38
43
  }
39
44
  }