Skip to content

Commit 176dc80

Browse files
authored
feat: add prompt, root, emptyOutDir options and CI workflow (#5)
1 parent d505d50 commit 176dc80

21 files changed

Lines changed: 795 additions & 206 deletions

File tree

.github/workflows/ci.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v6
15+
- uses: oven-sh/setup-bun@v2
16+
with:
17+
bun-version: latest
18+
- run: bun install --frozen-lockfile
19+
- run: bun run check
20+
- run: bun prettier --check .
21+
- run: bun test tests/unit/ tests/e2e/
22+
- run: bun run build

.vitepress/theme/components/HomeCTA.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ function copyCommand() {
3131
</div>
3232
<div class="home-cta__actions">
3333
<a
34-
href="/srcpack/guide/getting-started"
34+
href="/srcpack/getting-started"
3535
class="home-cta__button home-cta__button--primary"
3636
>
3737
Read the Docs
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<script setup lang="ts">
2+
import { computed } from "vue";
3+
4+
const isDark = computed(() => {
5+
// VitePress specific approach to check if dark mode is active might be needed,
6+
// but for the embed, the theme parameter controls the visual.
7+
// The user requested "Option 2", which has theme=light fixed in the URL.
8+
// We'll keep it simple for now as requested.
9+
return false;
10+
});
11+
</script>
12+
13+
<template>
14+
<div class="ph-container">
15+
<a
16+
href="https://www.producthunt.com/products/srcpack?embed=true&utm_source=badge-featured&utm_medium=badge&utm_campaign=badge-srcpack"
17+
target="_blank"
18+
rel="noopener noreferrer"
19+
class="ph-link"
20+
>
21+
<img
22+
src="https://api.producthunt.com/widgets/embed-image/v1/featured.svg?post_id=1064423&theme=light"
23+
alt="srcpack - Bundle your codebase into LLM-ready context files | Product Hunt"
24+
style="width: 250px; height: 54px"
25+
width="250"
26+
height="54"
27+
/>
28+
</a>
29+
</div>
30+
</template>
31+
32+
<style scoped>
33+
.ph-container {
34+
display: flex;
35+
flex-direction: column;
36+
align-items: center;
37+
margin-top: 24px;
38+
margin-bottom: 24px;
39+
}
40+
41+
.ph-link {
42+
transition: opacity 0.25s;
43+
}
44+
45+
.ph-link:hover {
46+
opacity: 0.8;
47+
}
48+
49+
/* Ensure it looks good on mobile */
50+
@media (max-width: 640px) {
51+
.ph-container {
52+
margin-top: 16px;
53+
margin-bottom: 32px;
54+
}
55+
}
56+
</style>

.vitepress/theme/index.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
// https://vitepress.dev/guide/custom-theme
2-
import { h } from "vue";
32
import type { Theme } from "vitepress";
43
import DefaultTheme from "vitepress/theme";
4+
import { h } from "vue";
55
import HomeCustomSections from "./components/HomeCustomSections.vue";
6+
import HomeProductHuntBadge from "./components/HomeProductHuntBadge.vue";
67
import "./style.css";
78

89
export default {
910
extends: DefaultTheme,
1011
Layout: () => {
1112
return h(DefaultTheme.Layout, null, {
1213
// https://vitepress.dev/guide/extending-default-theme#layout-slots
13-
"home-features-after": () => h(HomeCustomSections),
14+
"home-features-after": () => [
15+
h(HomeCustomSections),
16+
h(HomeProductHuntBadge),
17+
],
1418
});
1519
},
1620
} satisfies Theme;

README.md

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,14 @@ Or add to `package.json`:
4848

4949
### Options
5050

51-
| Option | Default | Description |
52-
| --------- | ---------- | -------------------------------- |
53-
| `outDir` | `.srcpack` | Output directory for bundles |
54-
| `bundles` || Named bundles with glob patterns |
55-
| `upload` || Upload destination(s) |
51+
| Option | Default | Description |
52+
| ------------- | ---------- | -------------------------------------- |
53+
| `outDir` | `.srcpack` | Output directory for bundles |
54+
| `emptyOutDir` | `true`\* | Empty output directory before bundling |
55+
| `bundles` || Named bundles with glob patterns |
56+
| `upload` || Upload destination(s) |
57+
58+
\*`emptyOutDir` defaults to `true` when `outDir` is inside project root. When `outDir` is outside root, a warning is emitted unless explicitly set.
5659

5760
### Bundle Config
5861

@@ -70,7 +73,8 @@ Or add to `package.json`:
7073
{
7174
include: "src/**/*",
7275
outfile: "~/Downloads/bundle.txt", // custom output path
73-
index: true // include index header (default)
76+
index: true, // include index header (default)
77+
prompt: "./prompts/review.md" // prepend from file (or inline text)
7478
}
7579
```
7680

@@ -90,6 +94,7 @@ export default defineConfig({
9094
folderId: "1ABC...", // Google Drive folder ID (from URL)
9195
clientId: "...",
9296
clientSecret: "...",
97+
exclude: ["local"], // skip specific bundles
9398
},
9499
});
95100
```
@@ -127,12 +132,14 @@ export function utils() {
127132
## CLI
128133

129134
```bash
130-
npx srcpack # Bundle all, upload if configured
131-
npx srcpack web api # Bundle specific bundles only
132-
npx srcpack --dry-run # Preview without writing files
133-
npx srcpack --no-upload # Bundle only, skip upload
134-
npx srcpack init # Interactive config setup
135-
npx srcpack login # Authenticate with Google Drive
135+
npx srcpack # Bundle all, upload if configured
136+
npx srcpack web api # Bundle specific bundles only
137+
npx srcpack --dry-run # Preview without writing files
138+
npx srcpack --emptyOutDir # Empty output directory before bundling
139+
npx srcpack --no-emptyOutDir # Keep existing files in output directory
140+
npx srcpack --no-upload # Bundle only, skip upload
141+
npx srcpack init # Interactive config setup
142+
npx srcpack login # Authenticate with Google Drive
136143
```
137144

138145
## API

0 commit comments

Comments
 (0)