portapack 0.3.0 → 0.3.2
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/.eslintrc.json +67 -8
- package/.github/workflows/ci.yml +5 -4
- package/.releaserc.js +25 -27
- package/CHANGELOG.md +12 -19
- package/LICENSE.md +21 -0
- package/README.md +34 -36
- package/commitlint.config.js +30 -34
- package/dist/cli/cli-entry.cjs +199 -135
- package/dist/cli/cli-entry.cjs.map +1 -1
- package/dist/index.d.ts +0 -3
- package/dist/index.js +194 -134
- package/dist/index.js.map +1 -1
- package/docs/.vitepress/config.ts +36 -34
- package/docs/.vitepress/sidebar-generator.ts +89 -38
- package/docs/cli.md +29 -82
- package/docs/code-of-conduct.md +7 -1
- package/docs/configuration.md +103 -117
- package/docs/contributing.md +6 -2
- package/docs/deployment.md +10 -5
- package/docs/development.md +8 -5
- package/docs/getting-started.md +76 -45
- package/docs/index.md +1 -1
- package/docs/public/android-chrome-192x192.png +0 -0
- package/docs/public/android-chrome-512x512.png +0 -0
- package/docs/public/apple-touch-icon.png +0 -0
- package/docs/public/favicon-16x16.png +0 -0
- package/docs/public/favicon-32x32.png +0 -0
- package/docs/public/favicon.ico +0 -0
- package/docs/site.webmanifest +1 -0
- package/docs/troubleshooting.md +12 -1
- package/examples/main.ts +7 -10
- package/examples/sample-project/script.js +1 -1
- package/jest.config.ts +8 -13
- package/nodemon.json +5 -10
- package/package.json +2 -5
- package/src/cli/cli-entry.ts +2 -2
- package/src/cli/cli.ts +21 -16
- package/src/cli/options.ts +127 -113
- package/src/core/bundler.ts +254 -221
- package/src/core/extractor.ts +639 -520
- package/src/core/minifier.ts +173 -162
- package/src/core/packer.ts +141 -137
- package/src/core/parser.ts +74 -73
- package/src/core/web-fetcher.ts +270 -258
- package/src/index.ts +18 -17
- package/src/types.ts +9 -11
- package/src/utils/font.ts +12 -6
- package/src/utils/logger.ts +110 -105
- package/src/utils/meta.ts +75 -76
- package/src/utils/mime.ts +50 -50
- package/src/utils/slugify.ts +33 -34
- package/tests/unit/cli/cli-entry.test.ts +72 -70
- package/tests/unit/cli/cli.test.ts +314 -278
- package/tests/unit/cli/options.test.ts +294 -301
- package/tests/unit/core/bundler.test.ts +426 -329
- package/tests/unit/core/extractor.test.ts +828 -380
- package/tests/unit/core/minifier.test.ts +374 -274
- package/tests/unit/core/packer.test.ts +298 -264
- package/tests/unit/core/parser.test.ts +538 -150
- package/tests/unit/core/web-fetcher.test.ts +389 -359
- package/tests/unit/index.test.ts +238 -197
- package/tests/unit/utils/font.test.ts +26 -21
- package/tests/unit/utils/logger.test.ts +267 -260
- package/tests/unit/utils/meta.test.ts +29 -28
- package/tests/unit/utils/mime.test.ts +73 -74
- package/tests/unit/utils/slugify.test.ts +14 -12
- package/tsconfig.build.json +9 -10
- package/tsconfig.jest.json +2 -1
- package/tsconfig.json +2 -2
- package/tsup.config.ts +8 -8
- package/typedoc.json +5 -9
- package/docs/demo.md +0 -46
- /package/docs/{portapack-transparent.png → public/portapack-transparent.png} +0 -0
- /package/docs/{portapack.jpg → public/portapack.jpg} +0 -0
package/docs/configuration.md
CHANGED
@@ -1,151 +1,137 @@
|
|
1
|
-
#
|
1
|
+
# 🚀 Getting Started with PortaPack
|
2
2
|
|
3
|
-
##
|
3
|
+
## Prerequisites
|
4
4
|
|
5
|
-
|
5
|
+
- Node.js (v16.0.0+)
|
6
|
+
- npm (v8.0.0+)
|
6
7
|
|
7
|
-
|
8
|
+
## Quick Installation
|
8
9
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
| `-o, --output` | String | `{input}.packed.html` | Output file path |
|
13
|
-
| `-m, --minify` | Number | `2` | Minification level (0-3) |
|
14
|
-
| `--no-minify` | Flag | - | Disable minification |
|
15
|
-
| `-r, --recursive` | Boolean/Number | `false` | Crawl site recursively, optionally with depth |
|
16
|
-
| `-b, --base-url` | String | Detected | Base URL for resolving paths |
|
17
|
-
| `-d, --dry-run` | Flag | `false` | Preview without generating output |
|
18
|
-
| `-v, --verbose` | Flag | `false` | Enable verbose logging |
|
19
|
-
|
20
|
-
### Programmatic Configuration
|
21
|
-
|
22
|
-
```typescript
|
23
|
-
// Simple string input
|
24
|
-
await generatePortableHTML('./index.html');
|
25
|
-
|
26
|
-
// With options as second parameter
|
27
|
-
await generatePortableHTML('./index.html', {
|
28
|
-
minify: true,
|
29
|
-
minifyLevel: 2,
|
30
|
-
baseUrl: 'https://example.com'
|
31
|
-
});
|
10
|
+
```bash
|
11
|
+
# Global installation
|
12
|
+
npm install -g portapack
|
32
13
|
|
33
|
-
|
34
|
-
|
35
|
-
input: './index.html',
|
36
|
-
minify: true,
|
37
|
-
minifyLevel: 2,
|
38
|
-
baseUrl: 'https://example.com',
|
39
|
-
|
40
|
-
// Asset handling
|
41
|
-
embedAssets: true,
|
42
|
-
embedLimit: 1000000,
|
43
|
-
|
44
|
-
// Minification controls
|
45
|
-
minifyHtml: true,
|
46
|
-
minifyCss: true,
|
47
|
-
minifyJs: true,
|
48
|
-
|
49
|
-
// Advanced options
|
50
|
-
removeComments: true,
|
51
|
-
collapseWhitespace: true
|
52
|
-
});
|
14
|
+
# Or as a project dependency
|
15
|
+
npm install --save-dev portapack
|
53
16
|
```
|
54
17
|
|
55
|
-
##
|
18
|
+
## Basic Usage
|
56
19
|
|
57
|
-
### CLI
|
20
|
+
### CLI Quickstart
|
58
21
|
|
59
22
|
```bash
|
60
|
-
#
|
61
|
-
portapack
|
62
|
-
|
63
|
-
# Maximum minification
|
64
|
-
portapack -i ./site -m 3 -o min.html
|
23
|
+
# Bundle a local HTML file
|
24
|
+
portapack ./index.html -o portable.html
|
65
25
|
|
66
|
-
#
|
67
|
-
portapack -
|
68
|
-
|
69
|
-
# Set custom base URL
|
70
|
-
portapack -i ./local/site -b https://example.com
|
26
|
+
# Bundle a remote website
|
27
|
+
portapack https://example.com --recursive -o site.html
|
28
|
+
```
|
71
29
|
|
72
|
-
|
73
|
-
portapack -i https://site.com -r 2
|
30
|
+
### Node.js API Basic Example
|
74
31
|
|
75
|
-
|
76
|
-
|
32
|
+
```typescript
|
33
|
+
import { pack } from 'portapack';
|
34
|
+
|
35
|
+
// Simple usage with a string path
|
36
|
+
async function bundleLocalSite() {
|
37
|
+
const result = await pack('./index.html');
|
38
|
+
console.log(result.html);
|
39
|
+
|
40
|
+
// Access metadata about the build
|
41
|
+
console.log(`Output size: ${result.metadata.outputSize} bytes`);
|
42
|
+
console.log(`Build time: ${result.metadata.buildTimeMs} ms`);
|
43
|
+
}
|
44
|
+
|
45
|
+
// Advanced options using configuration object
|
46
|
+
async function bundleWithOptions() {
|
47
|
+
const result = await pack('./index.html', {
|
48
|
+
minifyHtml: true,
|
49
|
+
minifyCss: true,
|
50
|
+
minifyJs: true,
|
51
|
+
baseUrl: 'https://example.com',
|
52
|
+
embedAssets: true,
|
53
|
+
});
|
54
|
+
|
55
|
+
// Use or save the bundled HTML
|
56
|
+
console.log(result.html);
|
57
|
+
}
|
58
|
+
|
59
|
+
// Recursive bundling of a website
|
60
|
+
async function bundleWebsite() {
|
61
|
+
const result = await pack('https://example.com', {
|
62
|
+
recursive: 2, // Crawl up to 2 levels deep
|
63
|
+
minifyHtml: true,
|
64
|
+
minifyCss: true,
|
65
|
+
minifyJs: true,
|
66
|
+
});
|
67
|
+
|
68
|
+
console.log(`Bundled ${result.metadata.pagesBundled} pages`);
|
69
|
+
}
|
77
70
|
```
|
78
71
|
|
79
|
-
###
|
72
|
+
### Advanced API Usage
|
73
|
+
|
74
|
+
For more specific use cases, you can access individual components:
|
80
75
|
|
81
76
|
```typescript
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
77
|
+
import {
|
78
|
+
generatePortableHTML,
|
79
|
+
generateRecursivePortableHTML,
|
80
|
+
bundleMultiPageHTML,
|
81
|
+
fetchAndPackWebPage,
|
82
|
+
} from 'portapack';
|
83
|
+
|
84
|
+
// Bundle a single HTML file or URL
|
85
|
+
const singleResult = await generatePortableHTML('./index.html', {
|
86
|
+
minifyHtml: true,
|
91
87
|
});
|
92
88
|
|
93
|
-
//
|
94
|
-
const
|
95
|
-
|
96
|
-
baseUrl: 'https://example.com',
|
97
|
-
embedAssets: true
|
89
|
+
// Recursively bundle a site
|
90
|
+
const recursiveResult = await generateRecursivePortableHTML('https://example.com', 2, {
|
91
|
+
minifyCss: true,
|
98
92
|
});
|
99
93
|
|
100
|
-
//
|
101
|
-
await
|
102
|
-
'
|
103
|
-
'
|
104
|
-
|
105
|
-
);
|
94
|
+
// Create multi-page bundle
|
95
|
+
const multiPageBundle = await bundleMultiPageHTML([
|
96
|
+
{ path: '/', html: '<html>...</html>' },
|
97
|
+
{ path: '/about', html: '<html>...</html>' },
|
98
|
+
]);
|
106
99
|
```
|
107
100
|
|
108
|
-
##
|
101
|
+
## Configuration
|
102
|
+
|
103
|
+
See our full [Configuration Guide](https://manicinc.github.io/portapack/configuration) for detailed options.
|
104
|
+
|
105
|
+
## CLI Options
|
106
|
+
|
107
|
+
PortaPack offers many command-line options for customizing the bundling process:
|
108
|
+
|
109
|
+
```bash
|
110
|
+
# Get full help
|
111
|
+
portapack --help
|
112
|
+
```
|
109
113
|
|
110
|
-
|
111
|
-
- **Asset Size**: Be mindful of embedding large assets; use `embedLimit` to set thresholds
|
112
|
-
- **Minification Levels**: Start with level 2 and adjust based on needs:
|
113
|
-
- Level 0: No minification
|
114
|
-
- Level 1: Basic whitespace removal
|
115
|
-
- Level 2: Standard minification (recommended)
|
116
|
-
- Level 3: Aggressive minification (may affect readability)
|
117
|
-
- **Testing**: Use `--dry-run -v` to preview configuration without generating files
|
118
|
-
- **Performance**: For large sites, increase Node's memory limit with `NODE_OPTIONS=--max-old-space-size=4096`
|
114
|
+
For details, see the [CLI Reference](https://manicinc.github.io/portapack/cli).
|
119
115
|
|
120
|
-
##
|
116
|
+
## Next Steps
|
121
117
|
|
122
|
-
-
|
123
|
-
-
|
124
|
-
-
|
125
|
-
- External scripts with CORS restrictions may not embed properly
|
118
|
+
- 📖 [Explore CLI Options](https://manicinc.github.io/portapack/cli)
|
119
|
+
- 🛠 [Advanced Configuration](https://manicinc.github.io/portapack/configuration)
|
120
|
+
- 💻 [API Reference](https://manicinc.github.io/portapack/api/README.html)
|
126
121
|
|
127
|
-
##
|
122
|
+
## Troubleshooting
|
128
123
|
|
129
|
-
|
124
|
+
Encountering issues? Check our [Troubleshooting Guide](https://manicinc.github.io/portapack/troubleshooting)
|
130
125
|
|
131
|
-
|
132
|
-
- **CSS stylesheets**: Both inline and external
|
133
|
-
- **JavaScript**: Script files and inline scripts
|
134
|
-
- **Images**: PNG, JPEG, GIF, SVG, WebP (converted to data URLs)
|
135
|
-
- **Fonts**: WOFF, WOFF2, TTF, EOT (embedded)
|
136
|
-
- **Other assets**: PDFs, JSON, text files, etc.
|
126
|
+
## Contributing
|
137
127
|
|
138
|
-
|
128
|
+
Interested in improving PortaPack?
|
139
129
|
|
140
|
-
|
130
|
+
- [View Contributing Guidelines](https://manicinc.github.io/portapack/contributing)
|
141
131
|
|
142
|
-
|
143
|
-
- `PORTAPACK_MINIFY_LEVEL`: Sets minification level
|
144
|
-
- `PORTAPACK_NO_EMBED`: Disables asset embedding when set to "true"
|
132
|
+
## Support
|
145
133
|
|
146
|
-
|
134
|
+
- 🐛 [Report an Issue](https://github.com/manicinc/portapack/issues)
|
135
|
+
- 💬 [Community Support](https://discord.gg/DzNgXdYm)
|
147
136
|
|
148
|
-
|
149
|
-
- [API Reference](/api/README)
|
150
|
-
- [Getting Started Guide](/getting-started)
|
151
|
-
- [Troubleshooting](/troubleshooting)
|
137
|
+
Built by [Manic.agency](https://manic.agency)
|
package/docs/contributing.md
CHANGED
@@ -17,10 +17,12 @@ Refer to our detailed [Development Guide](./development.md) for comprehensive se
|
|
17
17
|
### 🧪 Development Workflow
|
18
18
|
|
19
19
|
1. **Fork the Repository**
|
20
|
+
|
20
21
|
- Navigate to [PortaPack GitHub Repository](https://github.com/manicinc/portapack)
|
21
|
-
- Click "Fork"
|
22
|
+
- Click "Fork"
|
22
23
|
|
23
24
|
2. **Clone Your Fork**
|
25
|
+
|
24
26
|
```bash
|
25
27
|
git clone https://github.com/YOUR_USERNAME/portapack.git
|
26
28
|
cd portapack
|
@@ -38,6 +40,7 @@ Refer to our detailed [Development Guide](./development.md) for comprehensive se
|
|
38
40
|
We use [Conventional Commits](https://www.conventionalcommits.org/) for structured commit messages.
|
39
41
|
|
40
42
|
#### Commit Types
|
43
|
+
|
41
44
|
- `feat`: New features
|
42
45
|
- `fix`: Bug fixes
|
43
46
|
- `docs`: Documentation changes
|
@@ -47,6 +50,7 @@ We use [Conventional Commits](https://www.conventionalcommits.org/) for structur
|
|
47
50
|
- `chore`: Maintenance tasks
|
48
51
|
|
49
52
|
#### Commit Command
|
53
|
+
|
50
54
|
```bash
|
51
55
|
npm run commit
|
52
56
|
```
|
@@ -104,4 +108,4 @@ Please review our [Code of Conduct](./code-of-conduct.md) before contributing.
|
|
104
108
|
|
105
109
|
Open source thrives on community contributions. Your effort helps improve PortaPack for everyone! 🎉
|
106
110
|
|
107
|
-
**Happy Coding!** 💻✨
|
111
|
+
**Happy Coding!** 💻✨
|
package/docs/deployment.md
CHANGED
@@ -16,10 +16,10 @@ When changes are pushed to master, semantic-release will:
|
|
16
16
|
|
17
17
|
### Release Types
|
18
18
|
|
19
|
-
| Commit Format
|
20
|
-
|
21
|
-
| `fix:`
|
22
|
-
| `feat:`
|
19
|
+
| Commit Format | Result |
|
20
|
+
| ---------------------------- | ---------------- |
|
21
|
+
| `fix:` | 🔧 PATCH release |
|
22
|
+
| `feat:` | ✨ MINOR release |
|
23
23
|
| `feat:` + `BREAKING CHANGE:` | 🚨 MAJOR release |
|
24
24
|
|
25
25
|
## 📦 Manual Release (Optional Fallback)
|
@@ -45,6 +45,7 @@ In your GitHub repository:
|
|
45
45
|
2. Add the following secrets:
|
46
46
|
|
47
47
|
- `NPM_TOKEN`
|
48
|
+
|
48
49
|
- Create at npmjs.com > Access Tokens
|
49
50
|
- Choose type: `Automation` (read + publish)
|
50
51
|
- Paste into GitHub as `NPM_TOKEN`
|
@@ -61,6 +62,7 @@ In your GitHub repository:
|
|
61
62
|
## 🧪 Test Coverage
|
62
63
|
|
63
64
|
### Tools Used
|
65
|
+
|
64
66
|
- Jest
|
65
67
|
- Coveralls
|
66
68
|
|
@@ -102,17 +104,20 @@ The project automatically generates a test coverage report and makes it accessib
|
|
102
104
|
## 🧼 Pre-commit Hooks
|
103
105
|
|
104
106
|
We use Husky + `lint-staged`:
|
107
|
+
|
105
108
|
- ✅ Auto-lint + format on commit
|
106
109
|
- ✅ Validate commit messages via Commitizen
|
107
110
|
|
108
111
|
## 🧯 Troubleshooting
|
109
112
|
|
110
113
|
### Commit Fails?
|
114
|
+
|
111
115
|
- Use `npm run commit` (or `git cz`) to follow the correct format
|
112
116
|
- Check Husky is installed (`.husky/` exists)
|
113
117
|
- Run `npm install` again to restore hooks
|
114
118
|
|
115
119
|
### Release Fails?
|
120
|
+
|
116
121
|
- Check GitHub Actions logs
|
117
122
|
- Ensure `NPM_TOKEN` secret is added
|
118
123
|
- Ensure commit messages follow Conventional Commits
|
@@ -129,4 +134,4 @@ npm run commit
|
|
129
134
|
feat(fonts): add base64 embedding with MIME detection
|
130
135
|
fix(extractor): fallback on missing asset
|
131
136
|
chore(ci): enable docs deploy with GitHub Pages
|
132
|
-
```
|
137
|
+
```
|
package/docs/development.md
CHANGED
@@ -16,6 +16,7 @@ npm install -g commitizen
|
|
16
16
|
## 🚀 Getting Started
|
17
17
|
|
18
18
|
1. Clone the repository:
|
19
|
+
|
19
20
|
```bash
|
20
21
|
git clone https://github.com/manicinc/portapack.git
|
21
22
|
cd portapack
|
@@ -38,17 +39,18 @@ npm run dev
|
|
38
39
|
```
|
39
40
|
|
40
41
|
This command simultaneously runs:
|
42
|
+
|
41
43
|
- TypeScript rebuild watcher
|
42
44
|
- Documentation server
|
43
45
|
- Test runner
|
44
46
|
|
45
47
|
### Specific Development Scripts
|
46
48
|
|
47
|
-
| Command
|
48
|
-
|
49
|
+
| Command | Purpose |
|
50
|
+
| ------------------- | ---------------------------- |
|
49
51
|
| `npm run dev:build` | Watch and rebuild TypeScript |
|
50
|
-
| `npm run dev:docs`
|
51
|
-
| `npm run dev:test`
|
52
|
+
| `npm run dev:docs` | Start documentation server |
|
53
|
+
| `npm run dev:test` | Run tests in watch mode |
|
52
54
|
|
53
55
|
## 🧪 Testing Strategies
|
54
56
|
|
@@ -89,6 +91,7 @@ npm run build
|
|
89
91
|
```
|
90
92
|
|
91
93
|
Builds include:
|
94
|
+
|
92
95
|
- TypeScript compilation
|
93
96
|
- API documentation generation
|
94
97
|
- Documentation site build
|
@@ -165,4 +168,4 @@ portapack/
|
|
165
168
|
|
166
169
|
## 📄 License
|
167
170
|
|
168
|
-
MIT License - Built by Manic Agency
|
171
|
+
MIT License - Built by Manic Agency
|
package/docs/getting-started.md
CHANGED
@@ -15,92 +15,123 @@ npm install -g portapack
|
|
15
15
|
npm install --save-dev portapack
|
16
16
|
```
|
17
17
|
|
18
|
-
## Documentation
|
19
|
-
|
20
|
-
Our documentation is automatically generated and hosted locally:
|
21
|
-
|
22
|
-
- 🌐 **Local Docs**: at `http://localhost:5173`
|
23
|
-
- 📦 **Auto-Generated API Docs**: Dynamically created from TypeDoc comments
|
24
|
-
- 🧩 **Sidebar Generation**: Intelligent, automated sidebar creation
|
25
|
-
|
26
|
-
### Running Documentation Locally
|
27
|
-
|
28
|
-
```bash
|
29
|
-
# Start documentation development server
|
30
|
-
npm run docs:dev
|
31
|
-
```
|
32
|
-
|
33
18
|
## Basic Usage
|
34
19
|
|
35
20
|
### CLI Quickstart
|
36
21
|
|
37
22
|
```bash
|
38
23
|
# Bundle a local HTML file
|
39
|
-
portapack
|
24
|
+
portapack ./index.html -o portable.html
|
40
25
|
|
41
26
|
# Bundle a remote website
|
42
|
-
portapack
|
27
|
+
portapack https://example.com --recursive -o site.html
|
43
28
|
```
|
44
29
|
|
45
30
|
### Node.js API Basic Example
|
46
31
|
|
47
32
|
```typescript
|
48
|
-
import {
|
33
|
+
import { pack } from 'portapack';
|
49
34
|
|
50
35
|
// Simple usage with a string path
|
51
36
|
async function bundleLocalSite() {
|
52
|
-
const
|
53
|
-
console.log(
|
37
|
+
const result = await pack('./index.html');
|
38
|
+
console.log(result.html);
|
39
|
+
|
40
|
+
// Access metadata about the build
|
41
|
+
console.log(`Output size: ${result.metadata.outputSize} bytes`);
|
42
|
+
console.log(`Build time: ${result.metadata.buildTimeMs} ms`);
|
54
43
|
}
|
55
44
|
|
56
45
|
// Advanced options using configuration object
|
57
46
|
async function bundleWithOptions() {
|
58
|
-
const
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
baseUrl: 'https://example.com'
|
47
|
+
const result = await pack('./index.html', {
|
48
|
+
minifyHtml: true,
|
49
|
+
minifyCss: true,
|
50
|
+
minifyJs: true,
|
51
|
+
baseUrl: 'https://example.com',
|
52
|
+
embedAssets: true,
|
63
53
|
});
|
64
|
-
|
54
|
+
|
65
55
|
// Use or save the bundled HTML
|
66
|
-
console.log(
|
56
|
+
console.log(result.html);
|
57
|
+
}
|
58
|
+
|
59
|
+
// Recursive bundling of a website
|
60
|
+
async function bundleWebsite() {
|
61
|
+
const result = await pack('https://example.com', {
|
62
|
+
recursive: 2, // Crawl up to 2 levels deep
|
63
|
+
minifyHtml: true,
|
64
|
+
minifyCss: true,
|
65
|
+
minifyJs: true,
|
66
|
+
});
|
67
|
+
|
68
|
+
console.log(`Bundled ${result.metadata.pagesBundled} pages`);
|
67
69
|
}
|
68
70
|
```
|
69
71
|
|
70
|
-
|
72
|
+
### Advanced API Usage
|
73
|
+
|
74
|
+
For more specific use cases, you can access individual components:
|
75
|
+
|
76
|
+
```typescript
|
77
|
+
import {
|
78
|
+
generatePortableHTML,
|
79
|
+
generateRecursivePortableHTML,
|
80
|
+
bundleMultiPageHTML,
|
81
|
+
fetchAndPackWebPage,
|
82
|
+
} from 'portapack';
|
83
|
+
|
84
|
+
// Bundle a single HTML file or URL
|
85
|
+
const singleResult = await generatePortableHTML('./index.html', {
|
86
|
+
minifyHtml: true,
|
87
|
+
});
|
88
|
+
|
89
|
+
// Recursively bundle a site
|
90
|
+
const recursiveResult = await generateRecursivePortableHTML('https://example.com', 2, {
|
91
|
+
minifyCss: true,
|
92
|
+
});
|
93
|
+
|
94
|
+
// Create multi-page bundle
|
95
|
+
const multiPageBundle = await bundleMultiPageHTML([
|
96
|
+
{ path: '/', html: '<html>...</html>' },
|
97
|
+
{ path: '/about', html: '<html>...</html>' },
|
98
|
+
]);
|
99
|
+
```
|
71
100
|
|
72
|
-
|
101
|
+
## Configuration
|
73
102
|
|
74
|
-
|
75
|
-
- Automatically scan TypeDoc-generated markdown files
|
76
|
-
- Create dynamic, organized documentation sidebars
|
77
|
-
- Support multiple documentation types (modules, classes, interfaces, etc.)
|
103
|
+
See our full [Configuration Guide](https://manicinc.github.io/portapack/configuration) for detailed options.
|
78
104
|
|
79
|
-
|
105
|
+
## CLI Options
|
80
106
|
|
81
|
-
|
82
|
-
|
83
|
-
|
107
|
+
PortaPack offers many command-line options for customizing the bundling process:
|
108
|
+
|
109
|
+
```bash
|
110
|
+
# Get full help
|
111
|
+
portapack --help
|
112
|
+
```
|
113
|
+
|
114
|
+
For details, see the [CLI Reference](https://manicinc.github.io/portapack/cli).
|
84
115
|
|
85
116
|
## Next Steps
|
86
117
|
|
87
|
-
- 📖 [Explore CLI Options](/cli)
|
88
|
-
- 🛠 [Advanced Configuration](/configuration)
|
89
|
-
- 💻 [API Reference](/api/README)
|
118
|
+
- 📖 [Explore CLI Options](https://manicinc.github.io/portapack/cli)
|
119
|
+
- 🛠 [Advanced Configuration](https://manicinc.github.io/portapack/configuration)
|
120
|
+
- 💻 [API Reference](https://manicinc.github.io/portapack/api/README.html)
|
90
121
|
|
91
122
|
## Troubleshooting
|
92
123
|
|
93
|
-
Encountering issues? Check our [Troubleshooting Guide](/troubleshooting)
|
124
|
+
Encountering issues? Check our [Troubleshooting Guide](https://manicinc.github.io/portapack/troubleshooting)
|
94
125
|
|
95
126
|
## Contributing
|
96
127
|
|
97
|
-
Interested in improving PortaPack?
|
98
|
-
|
99
|
-
- [
|
128
|
+
Interested in improving PortaPack?
|
129
|
+
|
130
|
+
- [View Contributing Guidelines](https://manicinc.github.io/portapack/contributing)
|
100
131
|
|
101
132
|
## Support
|
102
133
|
|
103
134
|
- 🐛 [Report an Issue](https://github.com/manicinc/portapack/issues)
|
104
135
|
- 💬 [Community Support](https://discord.gg/DzNgXdYm)
|
105
136
|
|
106
|
-
Built by [Manic.agency](https://manic.agency)
|
137
|
+
Built by [Manic.agency](https://manic.agency)
|
package/docs/index.md
CHANGED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
{"name":"","short_name":"","icons":[{"src":"/android-chrome-192x192.png","sizes":"192x192","type":"image/png"},{"src":"/android-chrome-512x512.png","sizes":"512x512","type":"image/png"}],"theme_color":"#ffffff","background_color":"#ffffff","display":"standalone"}
|
package/docs/troubleshooting.md
CHANGED
@@ -5,8 +5,10 @@
|
|
5
5
|
### 1. Installation Problems
|
6
6
|
|
7
7
|
#### npm Install Fails
|
8
|
+
|
8
9
|
- **Symptom**: Error during `npm install`
|
9
10
|
- **Solutions**:
|
11
|
+
|
10
12
|
```bash
|
11
13
|
# Clear npm cache
|
12
14
|
npm cache clean --force
|
@@ -19,8 +21,10 @@
|
|
19
21
|
### 2. CLI Errors
|
20
22
|
|
21
23
|
#### Permission Denied
|
24
|
+
|
22
25
|
- **Symptom**: `EACCES` errors
|
23
26
|
- **Solutions**:
|
27
|
+
|
24
28
|
```bash
|
25
29
|
# Use npm with sudo (not recommended long-term)
|
26
30
|
sudo npm install -g portapack
|
@@ -31,6 +35,7 @@
|
|
31
35
|
```
|
32
36
|
|
33
37
|
#### Asset Embedding Failures
|
38
|
+
|
34
39
|
- **Symptom**: Some assets not embedded
|
35
40
|
- **Possible Causes**:
|
36
41
|
- Incorrect base URL
|
@@ -40,6 +45,7 @@
|
|
40
45
|
### 3. Performance Issues
|
41
46
|
|
42
47
|
#### Slow Recursive Crawling
|
48
|
+
|
43
49
|
- **Solution**: Limit crawl depth
|
44
50
|
```bash
|
45
51
|
portapack -i https://site.com --recursive --max-depth 2
|
@@ -48,6 +54,7 @@
|
|
48
54
|
### 4. Minification Problems
|
49
55
|
|
50
56
|
#### CSS/JS Not Minifying
|
57
|
+
|
51
58
|
- **Check**:
|
52
59
|
- Use `--no-minify-css` or `--no-minify-js` flags
|
53
60
|
- Verify asset paths
|
@@ -56,12 +63,14 @@
|
|
56
63
|
## 🔍 Debugging Techniques
|
57
64
|
|
58
65
|
### Verbose Logging
|
66
|
+
|
59
67
|
```bash
|
60
68
|
# Enable verbose output
|
61
69
|
portapack -i ./site --verbose
|
62
70
|
```
|
63
71
|
|
64
72
|
### Dry Run
|
73
|
+
|
65
74
|
```bash
|
66
75
|
# Preview bundling without generating file
|
67
76
|
portapack -i ./site --dry-run
|
@@ -70,6 +79,7 @@ portapack -i ./site --dry-run
|
|
70
79
|
## 🌐 Network & Security
|
71
80
|
|
72
81
|
### Proxy Configuration
|
82
|
+
|
73
83
|
```bash
|
74
84
|
# Set proxy for asset fetching
|
75
85
|
export HTTP_PROXY=http://proxy.example.com
|
@@ -79,6 +89,7 @@ portapack -i https://site.com
|
|
79
89
|
## 📊 Diagnostics
|
80
90
|
|
81
91
|
### Generate Diagnostic Report
|
92
|
+
|
82
93
|
```bash
|
83
94
|
# Create debug information
|
84
95
|
portapack --diagnostics > portapack-debug.log
|
@@ -104,4 +115,4 @@ portapack --diagnostics > portapack-debug.log
|
|
104
115
|
|
105
116
|
- Limited support for complex Single Page Applications (SPAs)
|
106
117
|
- Some dynamic content may not embed correctly
|
107
|
-
- Large sites might require significant memory
|
118
|
+
- Large sites might require significant memory
|