portapack 0.3.2 → 0.4.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.
- package/CHANGELOG.md +14 -0
- package/README.md +5 -39
- package/desktop/README.md +112 -0
- package/desktop/app.go +61 -0
- package/desktop/frontend/README.md +8 -0
- package/desktop/frontend/index.html +13 -0
- package/desktop/frontend/package-lock.json +873 -0
- package/desktop/frontend/package.json +18 -0
- package/desktop/frontend/src/App.vue +805 -0
- package/desktop/frontend/src/assets/fonts/OFL.txt +93 -0
- package/desktop/frontend/src/assets/fonts/nunito-v16-latin-regular.woff2 +0 -0
- package/desktop/frontend/src/main.js +5 -0
- package/desktop/frontend/src/style.css +26 -0
- package/desktop/frontend/vite.config.js +7 -0
- package/desktop/go.mod +38 -0
- package/desktop/go.sum +79 -0
- package/desktop/main.go +36 -0
- package/desktop/wails.json +14 -0
- package/dist/cli/cli-entry.cjs.map +1 -1
- package/dist/index.js.map +1 -1
- package/docs/.vitepress/config.ts +2 -0
- package/docs/architecture.md +186 -0
- package/docs/getting-started.md +1 -2
- package/docs/roadmap.md +233 -0
- package/examples/main.ts +0 -22
- package/package.json +1 -1
- package/src/core/bundler.ts +0 -2
- package/src/core/extractor.ts +0 -5
- package/tsup.config.ts +0 -1
package/CHANGELOG.md
CHANGED
@@ -1,3 +1,17 @@
|
|
1
|
+
# [0.4.0](https://github.com/manicinc/portapack/compare/v0.3.3...v0.4.0) (2025-06-07)
|
2
|
+
|
3
|
+
|
4
|
+
### Features
|
5
|
+
|
6
|
+
* add initial Vue 3 frontend with Wails integration and project structure ([0a4edd8](https://github.com/manicinc/portapack/commit/0a4edd8b7c14a15acaaf8554536fa1792eec8049))
|
7
|
+
|
8
|
+
## [0.3.3](https://github.com/manicinc/portapack/compare/v0.3.2...v0.3.3) (2025-04-20)
|
9
|
+
|
10
|
+
|
11
|
+
### Bug Fixes
|
12
|
+
|
13
|
+
* typo in link ([e79e1d1](https://github.com/manicinc/portapack/commit/e79e1d105f800550d067d62ec04d0af6888eb82d))
|
14
|
+
|
1
15
|
## [0.3.2](https://github.com/manicinc/portapack/compare/v0.3.1...v0.3.2) (2025-04-18)
|
2
16
|
|
3
17
|
|
package/README.md
CHANGED
@@ -19,6 +19,8 @@ _Minimal input. Maximal output._
|
|
19
19
|
- [⚙️ CLI Reference](https://manicinc.github.io/portapack/cli)
|
20
20
|
- [🛠 Configuration Guide](https://manicinc.github.io/portapack/configuration)
|
21
21
|
- [💻 API Reference](https://manicinc.github.io/portapack/api/)
|
22
|
+
- [🏛️ Architecture](https://manicinc.github.io/portapack/architecture/)
|
23
|
+
- [🚧 Roadmap](https://manicinc.github.io/portapack/roadmap/)
|
22
24
|
- [🤝 Contributing Guidelines](https://manicinc.github.io/portapack/contributing)
|
23
25
|
|
24
26
|
## 🚀 Quick Start
|
@@ -33,26 +35,6 @@ npm install -g portapack
|
|
33
35
|
npx portapack ./index.html -o bundle.html
|
34
36
|
```
|
35
37
|
|
36
|
-
### 🧰 CLI Options
|
37
|
-
|
38
|
-
```bash
|
39
|
-
portapack [input] [options]
|
40
|
-
```
|
41
|
-
|
42
|
-
| Option | Description |
|
43
|
-
| ---------------------- | --------------------------------------- |
|
44
|
-
| `-o, --output <file>` | Output file path |
|
45
|
-
| `-r, --recursive [n]` | Crawl site up to n levels deep |
|
46
|
-
| `--max-depth <n>` | Explicit crawl depth |
|
47
|
-
| `-m, --minify` | Enable all minification |
|
48
|
-
| `--no-minify-*` | Disable html, css, or js minify |
|
49
|
-
| `-e, --embed-assets` | Inline all assets (default: true) |
|
50
|
-
| `--no-embed-assets` | Leave links as-is |
|
51
|
-
| `-b, --base-url <url>` | Override base URL resolution |
|
52
|
-
| `-v, --verbose` | Show debug output |
|
53
|
-
| `--log-level <lvl>` | Set log level: debug, info, warn, error |
|
54
|
-
| `-d, --dry-run` | Run without writing file |
|
55
|
-
|
56
38
|
### 📋 CLI Examples
|
57
39
|
|
58
40
|
```bash
|
@@ -93,6 +75,7 @@ console.log(result.html); // bundled HTML
|
|
93
75
|
|
94
76
|
```typescript
|
95
77
|
import { pack, LogLevel } from 'portapack';
|
78
|
+
import fs from 'fs';
|
96
79
|
|
97
80
|
const result = await pack('https://example.com', {
|
98
81
|
minifyCss: true,
|
@@ -101,14 +84,9 @@ const result = await pack('https://example.com', {
|
|
101
84
|
output: 'site.html',
|
102
85
|
logLevel: LogLevel.INFO,
|
103
86
|
});
|
104
|
-
```
|
105
|
-
|
106
|
-
### Save to Disk
|
107
87
|
|
108
|
-
|
109
|
-
import fs from 'fs';
|
88
|
+
// Save to disk
|
110
89
|
fs.writeFileSync('output.html', result.html);
|
111
|
-
```
|
112
90
|
|
113
91
|
### Advanced API Usage
|
114
92
|
|
@@ -118,8 +96,7 @@ You can access individual building blocks too:
|
|
118
96
|
import {
|
119
97
|
generatePortableHTML,
|
120
98
|
generateRecursivePortableHTML,
|
121
|
-
bundleMultiPageHTML
|
122
|
-
fetchAndPackWebPage,
|
99
|
+
bundleMultiPageHTML
|
123
100
|
} from 'portapack';
|
124
101
|
```
|
125
102
|
|
@@ -127,19 +104,8 @@ import {
|
|
127
104
|
| --------------------------------- | ------------------------------------- |
|
128
105
|
| `generatePortableHTML()` | Bundle a single file or URL |
|
129
106
|
| `generateRecursivePortableHTML()` | Crawl & bundle entire site |
|
130
|
-
| `fetchAndPackWebPage()` | Just fetch HTML (no asset processing) |
|
131
107
|
| `bundleMultiPageHTML()` | Combine multiple HTMLs with router |
|
132
108
|
|
133
|
-
## 🤝 Contribute
|
134
|
-
|
135
|
-
```bash
|
136
|
-
# Get started
|
137
|
-
git clone https://github.com/manicinc/portapack
|
138
|
-
cd portapack
|
139
|
-
npm install
|
140
|
-
npm run dev
|
141
|
-
```
|
142
|
-
|
143
109
|
## 📊 Project Health
|
144
110
|
|
145
111
|
| Metric | Value |
|
@@ -0,0 +1,112 @@
|
|
1
|
+
# 📦 Portapack Desktop GUI – Documentation
|
2
|
+
|
3
|
+
## 📖 Overview
|
4
|
+
|
5
|
+
**Portapack Desktop GUI** is a Wails-based cross-platform desktop application with a Vue.js frontend. It provides a user-friendly graphical interface to the `portapack` CLI tool, allowing users to run it with various options through an intuitive UI.
|
6
|
+
|
7
|
+
**GitHub Repository:**
|
8
|
+
👉 [https://github.com/manicinc/portapack.git](https://github.com/manicinc/portapack.git)
|
9
|
+
|
10
|
+
---
|
11
|
+
|
12
|
+
## 🧰 Prerequisites
|
13
|
+
|
14
|
+
Install the following tools before using the application:
|
15
|
+
|
16
|
+
| Tool | Install Command |
|
17
|
+
| ----------------------------- | ---------------------------------------------------------- |
|
18
|
+
| Go ≥ 1.20 | [https://golang.org/dl/](https://golang.org/dl/) |
|
19
|
+
| Node.js ≥ 18.x (includes npm) | [https://nodejs.org/](https://nodejs.org/) |
|
20
|
+
| Wails CLI | `go install github.com/wailsapp/wails/v2/cmd/wails@latest` |
|
21
|
+
| Portapack CLI | `npm install -g portapack` |
|
22
|
+
|
23
|
+
---
|
24
|
+
|
25
|
+
## 🚀 Getting Started
|
26
|
+
|
27
|
+
### 1. Clone the Repository
|
28
|
+
|
29
|
+
```bash
|
30
|
+
git clone https://github.com/manicinc/portapack.git
|
31
|
+
cd portapack/desktop
|
32
|
+
```
|
33
|
+
|
34
|
+
### 2. Run the App in Development Mode
|
35
|
+
|
36
|
+
```bash
|
37
|
+
wails dev
|
38
|
+
```
|
39
|
+
|
40
|
+
Wails will automatically install frontend dependencies and launch the app with hot-reloading.
|
41
|
+
|
42
|
+
---
|
43
|
+
|
44
|
+
## 🏗️ Build for Production
|
45
|
+
|
46
|
+
To generate a distributable binary:
|
47
|
+
|
48
|
+
```bash
|
49
|
+
wails build
|
50
|
+
```
|
51
|
+
|
52
|
+
This creates a standalone executable in `build/bin/` for your platform with all assets embedded.
|
53
|
+
|
54
|
+
---
|
55
|
+
|
56
|
+
## ⚙️ Features
|
57
|
+
|
58
|
+
* Full support for `portapack` CLI options via GUI
|
59
|
+
* Input/output paths, recursive crawling, and minification toggles
|
60
|
+
* Toggle dark/light mode
|
61
|
+
* View real-time command output
|
62
|
+
* Responsive, theme-aware layout
|
63
|
+
|
64
|
+
---
|
65
|
+
|
66
|
+
## 🎛️ CLI Options Mapped to UI
|
67
|
+
|
68
|
+
| UI Control | CLI Flag(s) |
|
69
|
+
| ----------------------- | ---------------------- |
|
70
|
+
| Input HTML/URL | `<input>` |
|
71
|
+
| Output File Path | `-o`, `--output` |
|
72
|
+
| Enable All Minification | `-m`, `--minify` |
|
73
|
+
| Disable Minify (HTML) | `--no-minify-html` |
|
74
|
+
| Disable Minify (CSS) | `--no-minify-css` |
|
75
|
+
| Disable Minify (JS) | `--no-minify-js` |
|
76
|
+
| Embed Assets | `-e`, `--embed-assets` |
|
77
|
+
| Recursive Crawl | `-r`, `--recursive` |
|
78
|
+
| Max Depth | (argument to `-r`) |
|
79
|
+
| Base URL | `-b`, `--base-url` |
|
80
|
+
| Dry Run | `-d`, `--dry-run` |
|
81
|
+
| Verbose Logging | `-v`, `--verbose` |
|
82
|
+
| Log Level | `--log-level <level>` |
|
83
|
+
|
84
|
+
---
|
85
|
+
|
86
|
+
## 🐛 Troubleshooting
|
87
|
+
|
88
|
+
### Portapack not found?
|
89
|
+
|
90
|
+
Make sure it's globally installed:
|
91
|
+
|
92
|
+
```bash
|
93
|
+
npm install -g portapack
|
94
|
+
```
|
95
|
+
|
96
|
+
And accessible in your shell:
|
97
|
+
|
98
|
+
```bash
|
99
|
+
portapack --help
|
100
|
+
```
|
101
|
+
|
102
|
+
If it still fails, you may need to add the npm global bin directory to your PATH:
|
103
|
+
|
104
|
+
```bash
|
105
|
+
export PATH="$PATH:$(npm bin -g)"
|
106
|
+
```
|
107
|
+
|
108
|
+
---
|
109
|
+
|
110
|
+
## 🪪 License
|
111
|
+
|
112
|
+
Font: **Nunito** – licensed under the [SIL Open Font License v1.1](https://scripts.sil.org/OFL) (included in the repo).
|
package/desktop/app.go
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
package main
|
2
|
+
|
3
|
+
import (
|
4
|
+
"context"
|
5
|
+
"fmt"
|
6
|
+
"os/exec" // For spawning subprocesses
|
7
|
+
"strings" // For joining command arguments
|
8
|
+
)
|
9
|
+
|
10
|
+
// App struct
|
11
|
+
type App struct {
|
12
|
+
ctx context.Context
|
13
|
+
}
|
14
|
+
|
15
|
+
// NewApp creates a new App application struct
|
16
|
+
func NewApp() *App {
|
17
|
+
return &App{}
|
18
|
+
}
|
19
|
+
|
20
|
+
// startup is called when the app starts.
|
21
|
+
// The context is saved
|
22
|
+
// so we can call the runtime methods
|
23
|
+
func (a *App) startup(ctx context.Context) {
|
24
|
+
a.ctx = ctx
|
25
|
+
}
|
26
|
+
|
27
|
+
// Greet returns a greeting for the given name (keeping existing method)
|
28
|
+
func (a *App) Greet(name string) string {
|
29
|
+
return fmt.Sprintf("Hello %s, It's show time!", name)
|
30
|
+
}
|
31
|
+
|
32
|
+
// RunPortapack executes the portapack CLI command with given arguments
|
33
|
+
func (a *App) RunPortapack(args []string) (string, error) {
|
34
|
+
// Prepend "portapack" to the arguments slice
|
35
|
+
cmdArgs := append([]string{}, args...) // Create a new slice to avoid modifying the original 'args'
|
36
|
+
|
37
|
+
// Construct the command
|
38
|
+
cmd := exec.Command("portapack", cmdArgs...) // "portapack" is the command itself
|
39
|
+
|
40
|
+
// Capture stdout and stderr
|
41
|
+
var stdout, stderr strings.Builder
|
42
|
+
cmd.Stdout = &stdout
|
43
|
+
cmd.Stderr = &stderr
|
44
|
+
|
45
|
+
fmt.Printf("Executing command: portapack %s\n", strings.Join(cmdArgs, " "))
|
46
|
+
|
47
|
+
// Run the command
|
48
|
+
err := cmd.Run()
|
49
|
+
|
50
|
+
// Combine output for display
|
51
|
+
output := stdout.String()
|
52
|
+
if stderr.Len() > 0 {
|
53
|
+
output += "\nError:\n" + stderr.String()
|
54
|
+
}
|
55
|
+
|
56
|
+
if err != nil {
|
57
|
+
return output, fmt.Errorf("portapack command failed: %w - %s", err, output)
|
58
|
+
}
|
59
|
+
|
60
|
+
return output, nil
|
61
|
+
}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
# Vue 3 + Vite
|
2
|
+
|
3
|
+
This template should help get you started developing with Vue 3 in Vite. The template uses Vue 3 `<script setup>` SFCs,
|
4
|
+
check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.
|
5
|
+
|
6
|
+
## Recommended IDE Setup
|
7
|
+
|
8
|
+
- [VS Code](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar)
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="en">
|
3
|
+
<head>
|
4
|
+
<meta charset="UTF-8"/>
|
5
|
+
<meta content="width=device-width, initial-scale=1.0" name="viewport"/>
|
6
|
+
<title>desktop</title>
|
7
|
+
</head>
|
8
|
+
<body>
|
9
|
+
<div id="app"></div>
|
10
|
+
<script src="./src/main.js" type="module"></script>
|
11
|
+
</body>
|
12
|
+
</html>
|
13
|
+
|