Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: CI
on:
push:
branches: [main]
pull_request:
permissions:
contents: read
jobs:
verify:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- run: npm ci
- run: npm run typecheck
- run: npm run lint
- run: npm test
- run: npm run build
85 changes: 27 additions & 58 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,73 +1,42 @@
# Welcome to your Lovable project
# Deck Wizard

## Project info
Turn a financial model in Excel into a PowerPoint deck in the browser. Upload a `.xlsx` or `.xls` workbook and Deck Wizard builds a title slide, an executive summary, and a slide set for each sheet. Numeric sheets become bar, combo and pie charts; text-only sheets become tables. Then you download the `.pptx`.

**URL**: https://lovable.dev/projects/ba2a80f0-984a-468e-96c7-bc3497432d96
Parsing and slide generation run entirely in the browser tab. Signing in (Supabase) is only used to list your saved projects.

## How can I edit this code?
## How sheets are presented

There are several ways of editing your application.
| Sheet shape | Slides produced |
|---|---|
| Header row, 2+ data rows, at least one numeric column after the first | Bar, combo and pie charts (column one supplies the labels) |
| Header row with text data | Table (first 50 rows) |
| Fewer than 2 rows | Skipped |

**Use Lovable**
## Limits

Simply visit the [Lovable Project](https://lovable.dev/projects/ba2a80f0-984a-468e-96c7-bc3497432d96) and start prompting.
- Files up to 20 MB, at most 50 sheets, and at most 1,000,000 cells per sheet. The cell limit is checked from the sheet's declared range before the sheet is expanded.
- Formulas, HTML and VBA macros are not evaluated.
- Workbooks are parsed with SheetJS 0.20.3, installed from the SheetJS CDN, because the npm `xlsx` package stops at the vulnerable 0.18.5.

Changes made via Lovable will be committed automatically to this repo.
## Run locally

**Use your preferred IDE**
Requires Node.js 20 or later.

If you want to work locally using your own IDE, you can clone this repo and push changes. Pushed changes will also be reflected in Lovable.

The only requirement is having Node.js & npm installed - [install with nvm](https://github.com/nvm-sh/nvm#installing-and-updating)

Follow these steps:

```sh
# Step 1: Clone the repository using the project's Git URL.
git clone <YOUR_GIT_URL>

# Step 2: Navigate to the project directory.
cd <YOUR_PROJECT_NAME>

# Step 3: Install the necessary dependencies.
npm i

# Step 4: Start the development server with auto-reloading and an instant preview.
```bash
npm ci
npm run dev
```

**Edit a file directly in GitHub**

- Navigate to the desired file(s).
- Click the "Edit" button (pencil icon) at the top right of the file view.
- Make your changes and commit the changes.

**Use GitHub Codespaces**
## Checks

- Navigate to the main page of your repository.
- Click on the "Code" button (green button) near the top right.
- Select the "Codespaces" tab.
- Click on "New codespace" to launch a new Codespace environment.
- Edit files directly within the Codespace and commit and push your changes once you're done.

## What technologies are used for this project?

This project is built with:

- Vite
- TypeScript
- React
- shadcn-ui
- Tailwind CSS

## How can I deploy this project?

Simply open [Lovable](https://lovable.dev/projects/ba2a80f0-984a-468e-96c7-bc3497432d96) and click on Share -> Publish.

## Can I connect a custom domain to my Lovable project?

Yes, you can!
```bash
npm run typecheck
npm run lint
npm test # unit tests (Vitest + jsdom)
npm run build
node dev/check-upload-download.cjs # browser check: upload a workbook, download a valid PPTX; needs Playwright
```

To connect a domain, navigate to Project > Settings > Domains and click Connect Domain.
## Database

Read more here: [Setting up a custom domain](https://docs.lovable.dev/tips-tricks/custom-domain#step-by-step-guide)
`supabase/migrations/` holds the `user_projects` table and its row-level security policies (each user sees only their own projects). Compare them with the deployed project before applying.
Binary file removed bun.lockb
Binary file not shown.
53 changes: 53 additions & 0 deletions dev/check-upload-download.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
// Browser check: sign-in is stubbed, a benign workbook is uploaded, and the
// downloaded file must be a valid PPTX containing chart slides.
// Usage: npm run build && node dev/check-upload-download.cjs
const { chromium } = require("playwright");
const http = require("http"), fs = require("fs"), path = require("path"), os = require("os");
const XLSX = require("xlsx");
const JSZip = require("jszip");

const root = path.join(__dirname, "..", "dist");
const types = { ".html": "text/html", ".js": "text/javascript", ".css": "text/css", ".svg": "image/svg+xml" };
const b64 = o => Buffer.from(JSON.stringify(o)).toString("base64url");
const exp = Math.floor(Date.now() / 1000) + 3600;
const user = { id: "00000000-0000-0000-0000-000000000001", aud: "authenticated", role: "authenticated", email: "demo@example.com", app_metadata: {}, user_metadata: {}, created_at: new Date().toISOString() };
const jwt = `${b64({ alg: "HS256", typ: "JWT" })}.${b64({ sub: user.id, exp, role: "authenticated", aud: "authenticated" })}.sig`;
const session = { access_token: jwt, refresh_token: "r", token_type: "bearer", expires_in: 3600, expires_at: exp, user };

const server = http.createServer((req, res) => {
let f = path.join(root, decodeURIComponent(req.url.split("?")[0]));
if (!f.startsWith(root) || !fs.existsSync(f) || fs.statSync(f).isDirectory()) f = path.join(root, "index.html");
res.writeHead(200, { "content-type": types[path.extname(f)] || "application/octet-stream" });
fs.createReadStream(f).pipe(res);
}).listen(0, async () => {
const wb = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(wb, XLSX.utils.aoa_to_sheet([["Quarter", "Revenue", "Cost"], ["Q1", 100, 60], ["Q2", 120, 70], ["Q3", 150, 80]]), "Revenue");
const xlsxPath = path.join(os.tmpdir(), "deck-check-model.xlsx");
XLSX.writeFile(wb, xlsxPath);

const browser = await chromium.launch();
const context = await browser.newContext({ acceptDownloads: true });
await context.addInitScript(s => localStorage.setItem("sb-fqjttbagjcybxlnjvkod-auth-token", s), JSON.stringify(session));
const page = await context.newPage();
const errors = [];
page.on("pageerror", e => errors.push(String(e)));
await page.route(/supabase\.co/, r => {
const u = r.request().url();
if (u.includes("/auth/v1/user")) return r.fulfill({ contentType: "application/json", body: JSON.stringify(user) });
return r.fulfill({ contentType: "application/json", body: "[]" });
});
await page.route(/fonts\.(googleapis|gstatic)\.com/, r => r.fulfill({ body: "" }));
await page.goto(`http://127.0.0.1:${server.address().port}/`);
await page.locator('input[type="file"]').first().setInputFiles(xlsxPath);
await page.getByRole("button", { name: /generate presentation/i }).click();
const dl = page.waitForEvent("download", { timeout: 30000 });
await page.getByRole("button", { name: /download powerpoint/i }).click({ timeout: 30000 });
const file = await (await dl).path();
const zip = await JSZip.loadAsync(fs.readFileSync(file));
const slides = Object.keys(zip.files).filter(n => /^ppt\/slides\/slide\d+\.xml$/.test(n)).length;
const charts = Object.keys(zip.files).filter(n => /^ppt\/charts\/chart\d+\.xml$/.test(n)).length;
await browser.close(); server.close();
const result = { slides, charts, errors };
console.log(JSON.stringify(result));
if (slides < 3 || charts < 1 || errors.length) process.exit(1);
});
2 changes: 2 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ export default tseslint.config(
{ allowConstantExport: true },
],
"@typescript-eslint/no-unused-vars": "off",
// Reported, not blocking: existing loose typing is tracked as warnings.
"@typescript-eslint/no-explicit-any": "warn",
},
}
);
Loading
Loading