brave-real-launcher 1.2.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/.actrc +3 -0
- package/.github/workflows/main.yml +298 -0
- package/CHANGELOG.md +142 -0
- package/GITHUB_SETUP.md +124 -0
- package/LICENSE +202 -0
- package/README.md +156 -0
- package/bin/print-brave-path.cjs +17 -0
- package/console.log(ESM build works!))' +0 -0
- package/dist/brave-finder.d.ts +15 -0
- package/dist/brave-finder.js +351 -0
- package/dist/brave-launcher.d.ts +103 -0
- package/dist/brave-launcher.js +459 -0
- package/dist/chrome-launcher.d.ts +99 -0
- package/dist/chrome-launcher.js +438 -0
- package/dist/flags.d.ts +5 -0
- package/dist/flags.js +95 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +49 -0
- package/dist/random-port.d.ts +4 -0
- package/dist/random-port.js +25 -0
- package/dist/utils.d.ts +62 -0
- package/dist/utils.js +251 -0
- package/dist/xvfb-support.d.ts +58 -0
- package/dist/xvfb-support.js +216 -0
- package/docs/chrome-flags-for-tools.md +207 -0
- package/example.js +69 -0
- package/examples/basic-usage.js +152 -0
- package/package-scripts.json +36 -0
- package/package.json +67 -0
- package/scripts/check-chrome-launcher-updates.cjs +166 -0
- package/scripts/rename-cjs.cjs +48 -0
- package/scripts/sync-chrome-launcher.cjs +281 -0
- package/test-ci.cjs +313 -0
- package/test.cjs +534 -0
- package/tsconfig.json +26 -0
package/.actrc
ADDED
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
name: 🚀 Brave Real Launcher - Auto Sync & Publish
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
# ऑटोमेटिक अपडेट चेक - हफ्ते में दो बार (सोमवार और गुरुवार)
|
|
5
|
+
schedule:
|
|
6
|
+
- cron: '0 6 * * 1,4' # सोमवार और गुरुवार सुबह 6:00 UTC
|
|
7
|
+
|
|
8
|
+
# मैनुअल ट्रिगर
|
|
9
|
+
workflow_dispatch:
|
|
10
|
+
inputs:
|
|
11
|
+
sync_mode:
|
|
12
|
+
description: 'Sync Mode'
|
|
13
|
+
type: choice
|
|
14
|
+
default: 'auto'
|
|
15
|
+
options:
|
|
16
|
+
- 'auto' # ऑटो-सिंक अगर chrome-launcher अपडेट हो
|
|
17
|
+
- 'force' # फोर्स सिंक चाहे chrome-launcher अपडेट हो या न हो
|
|
18
|
+
- 'check' # सिर्फ चेक करें, अपडेट न करें
|
|
19
|
+
publish_mode:
|
|
20
|
+
description: 'Publish Mode'
|
|
21
|
+
type: choice
|
|
22
|
+
default: 'auto'
|
|
23
|
+
options:
|
|
24
|
+
- 'auto' # अगर version बदला तो publish करें
|
|
25
|
+
- 'force' # जबरदस्ती publish करें
|
|
26
|
+
- 'skip' # publish न करें
|
|
27
|
+
|
|
28
|
+
# Push और PR पर भी चलाएं (बिना publish के)
|
|
29
|
+
push:
|
|
30
|
+
branches: [ main, master ]
|
|
31
|
+
pull_request:
|
|
32
|
+
branches: [ main, master ]
|
|
33
|
+
|
|
34
|
+
jobs:
|
|
35
|
+
# 🚀 एक सिंगल जॉब जो सबकुछ करे
|
|
36
|
+
sync-build-test-publish:
|
|
37
|
+
runs-on: ubuntu-latest
|
|
38
|
+
|
|
39
|
+
# सिक्योरिटी permissions
|
|
40
|
+
permissions:
|
|
41
|
+
contents: write # फाइल्स मोडिफाई करने के लिए
|
|
42
|
+
packages: write # NPM publish के लिए
|
|
43
|
+
|
|
44
|
+
# Environment variables
|
|
45
|
+
env:
|
|
46
|
+
NODE_VERSION: '18'
|
|
47
|
+
DISPLAY: ':99'
|
|
48
|
+
|
|
49
|
+
steps:
|
|
50
|
+
# Step 1: कोड checkout
|
|
51
|
+
- name: 💻 Checkout Repository
|
|
52
|
+
uses: actions/checkout@v4
|
|
53
|
+
with:
|
|
54
|
+
token: ${{ secrets.GH_TOKEN || secrets.GITHUB_TOKEN }}
|
|
55
|
+
fetch-depth: 0
|
|
56
|
+
|
|
57
|
+
# Step 2: Node.js setup
|
|
58
|
+
- name: 💻 Setup Node.js
|
|
59
|
+
uses: actions/setup-node@v4
|
|
60
|
+
with:
|
|
61
|
+
node-version: ${{ env.NODE_VERSION }}
|
|
62
|
+
cache: 'npm'
|
|
63
|
+
registry-url: 'https://registry.npmjs.org'
|
|
64
|
+
|
|
65
|
+
# Step 3: Dependencies install (हमेशा करें)
|
|
66
|
+
- name: 📦 Install Dependencies
|
|
67
|
+
run: npm ci
|
|
68
|
+
|
|
69
|
+
# Step 4: Chrome-launcher version check और sync
|
|
70
|
+
- name: 🔄 Check Chrome-Launcher Updates
|
|
71
|
+
id: sync-check
|
|
72
|
+
run: |
|
|
73
|
+
echo "🔍 Checking for chrome-launcher updates..."
|
|
74
|
+
|
|
75
|
+
# Chrome-launcher की latest version fetch करें
|
|
76
|
+
CHROME_VERSION=$(curl -s https://api.github.com/repos/GoogleChrome/chrome-launcher/releases/latest | jq -r .tag_name | sed 's/v//')
|
|
77
|
+
CURRENT_VERSION=$(node -e "console.log(require('./package.json').version)")
|
|
78
|
+
|
|
79
|
+
echo "chrome_version=$CHROME_VERSION" >> $GITHUB_OUTPUT
|
|
80
|
+
echo "current_version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
|
|
81
|
+
|
|
82
|
+
# Sync mode determine करें
|
|
83
|
+
SYNC_MODE="${{ github.event.inputs.sync_mode || 'auto' }}"
|
|
84
|
+
SHOULD_SYNC="false"
|
|
85
|
+
|
|
86
|
+
if [ "$SYNC_MODE" = "force" ]; then
|
|
87
|
+
SHOULD_SYNC="true"
|
|
88
|
+
echo "🔄 Force sync enabled"
|
|
89
|
+
elif [ "$SYNC_MODE" = "auto" ] && [ "$CHROME_VERSION" != "$CURRENT_VERSION" ]; then
|
|
90
|
+
SHOULD_SYNC="true"
|
|
91
|
+
echo "🆕 New chrome-launcher version detected: $CHROME_VERSION (current: $CURRENT_VERSION)"
|
|
92
|
+
elif [ "$SYNC_MODE" = "check" ]; then
|
|
93
|
+
echo "✅ Check mode - no sync will be performed"
|
|
94
|
+
else
|
|
95
|
+
echo "✅ Already up to date with chrome-launcher v$CHROME_VERSION"
|
|
96
|
+
fi
|
|
97
|
+
|
|
98
|
+
echo "should_sync=$SHOULD_SYNC" >> $GITHUB_OUTPUT
|
|
99
|
+
echo "sync_mode=$SYNC_MODE" >> $GITHUB_OUTPUT
|
|
100
|
+
|
|
101
|
+
# Step 5: Actual sync process
|
|
102
|
+
- name: 🔄 Sync with Chrome-Launcher
|
|
103
|
+
if: steps.sync-check.outputs.should_sync == 'true'
|
|
104
|
+
run: |
|
|
105
|
+
echo "🔄 Syncing brave-real-launcher with chrome-launcher v${{ steps.sync-check.outputs.chrome_version }}"
|
|
106
|
+
|
|
107
|
+
# Package.json version को update करें
|
|
108
|
+
npm version ${{ steps.sync-check.outputs.chrome_version }} --no-git-tag-version
|
|
109
|
+
|
|
110
|
+
# Git configuration
|
|
111
|
+
git config user.name "🤖 Brave Sync Bot"
|
|
112
|
+
git config user.email "action@github.com"
|
|
113
|
+
|
|
114
|
+
# Changes commit करें
|
|
115
|
+
git add package.json
|
|
116
|
+
git commit -m "🔄 Auto-sync with chrome-launcher v${{ steps.sync-check.outputs.chrome_version }}" || echo "No changes to commit"
|
|
117
|
+
|
|
118
|
+
# Push changes
|
|
119
|
+
git push || echo "Nothing to push"
|
|
120
|
+
|
|
121
|
+
echo "VERSION_SYNCED=true" >> $GITHUB_ENV
|
|
122
|
+
echo "NEW_VERSION=${{ steps.sync-check.outputs.chrome_version }}" >> $GITHUB_ENV
|
|
123
|
+
|
|
124
|
+
# Step 6: Build project
|
|
125
|
+
- name: 🔨 Build Project
|
|
126
|
+
run: |
|
|
127
|
+
echo "🔨 Building brave-real-launcher..."
|
|
128
|
+
npm run build
|
|
129
|
+
echo "✅ Build completed successfully!"
|
|
130
|
+
|
|
131
|
+
# Step 7: Browser setup for testing
|
|
132
|
+
- name: 🦁 Setup Browser Environment
|
|
133
|
+
run: |
|
|
134
|
+
echo "🦁 Setting up browser environment for testing..."
|
|
135
|
+
|
|
136
|
+
# Install Xvfb for headless display
|
|
137
|
+
sudo apt-get update
|
|
138
|
+
sudo apt-get install -y xvfb
|
|
139
|
+
|
|
140
|
+
# Start Xvfb
|
|
141
|
+
Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
|
|
142
|
+
sleep 3
|
|
143
|
+
|
|
144
|
+
# Try to install Brave Browser
|
|
145
|
+
echo "📥 Attempting to install Brave Browser..."
|
|
146
|
+
|
|
147
|
+
# Method 1: Official Brave repository
|
|
148
|
+
sudo curl -fsSLo /usr/share/keyrings/brave-browser-archive-keyring.gpg https://brave-browser-apt-release.s3.brave.com/brave-browser-archive-keyring.gpg || echo "Keyring download failed"
|
|
149
|
+
echo "deb [signed-by=/usr/share/keyrings/brave-browser-archive-keyring.gpg arch=amd64] https://brave-browser-apt-release.s3.brave.com/ stable main" | sudo tee /etc/apt/sources.list.d/brave-browser-release.list
|
|
150
|
+
sudo apt-get update || echo "Apt update had issues"
|
|
151
|
+
sudo apt-get install -y brave-browser || echo "Brave install from repo failed"
|
|
152
|
+
|
|
153
|
+
# Method 2: Fallback to Chromium if Brave fails
|
|
154
|
+
if ! command -v brave-browser &> /dev/null; then
|
|
155
|
+
echo "🔄 Brave installation failed, falling back to Chromium..."
|
|
156
|
+
sudo apt-get install -y chromium-browser
|
|
157
|
+
sudo ln -sf /usr/bin/chromium-browser /usr/bin/brave-browser
|
|
158
|
+
fi
|
|
159
|
+
|
|
160
|
+
# Verify installation
|
|
161
|
+
if command -v brave-browser &> /dev/null; then
|
|
162
|
+
echo "✅ Browser setup completed successfully!"
|
|
163
|
+
brave-browser --version || echo "Version check failed but browser exists"
|
|
164
|
+
else
|
|
165
|
+
echo "⚠️ Browser setup failed, tests may be limited"
|
|
166
|
+
fi
|
|
167
|
+
|
|
168
|
+
# Step 8: Run comprehensive tests
|
|
169
|
+
- name: 🧪 Run All Tests
|
|
170
|
+
run: |
|
|
171
|
+
echo "🧪 Running comprehensive test suite..."
|
|
172
|
+
|
|
173
|
+
# Set environment for testing
|
|
174
|
+
export DISPLAY=:99
|
|
175
|
+
export BRAVE_PATH=/usr/bin/brave-browser
|
|
176
|
+
|
|
177
|
+
# Run CI tests
|
|
178
|
+
echo "🔍 Running CI test suite..."
|
|
179
|
+
node test-ci.cjs
|
|
180
|
+
|
|
181
|
+
# Run compatibility tests
|
|
182
|
+
echo "📝 Running compatibility tests..."
|
|
183
|
+
npm run test:compatibility
|
|
184
|
+
|
|
185
|
+
# Type checking
|
|
186
|
+
echo "📝 Running TypeScript type check..."
|
|
187
|
+
npm run type-check
|
|
188
|
+
|
|
189
|
+
echo "✅ All tests completed successfully!"
|
|
190
|
+
env:
|
|
191
|
+
DISPLAY: :99
|
|
192
|
+
BRAVE_PATH: /usr/bin/brave-browser
|
|
193
|
+
|
|
194
|
+
# Step 9: Security audit
|
|
195
|
+
- name: 🔍 Security Audit
|
|
196
|
+
run: |
|
|
197
|
+
echo "🔍 Running security audit..."
|
|
198
|
+
npm audit --audit-level high || echo "⚠️ Some security issues found but continuing..."
|
|
199
|
+
echo "✅ Security audit completed!"
|
|
200
|
+
|
|
201
|
+
# Step 10: Determine publish strategy
|
|
202
|
+
- name: 🎯 Determine Publish Strategy
|
|
203
|
+
id: publish-check
|
|
204
|
+
run: |
|
|
205
|
+
echo "🎯 Determining publish strategy..."
|
|
206
|
+
|
|
207
|
+
PUBLISH_MODE="${{ github.event.inputs.publish_mode || 'auto' }}"
|
|
208
|
+
SHOULD_PUBLISH="false"
|
|
209
|
+
REASON=""
|
|
210
|
+
|
|
211
|
+
# Current और NPM version check करें
|
|
212
|
+
CURRENT_VERSION=$(node -e "console.log(require('./package.json').version)")
|
|
213
|
+
NPM_VERSION=$(npm view brave-real-launcher version 2>/dev/null || echo "0.0.0")
|
|
214
|
+
|
|
215
|
+
echo "Current version: $CURRENT_VERSION"
|
|
216
|
+
echo "NPM version: $NPM_VERSION"
|
|
217
|
+
|
|
218
|
+
# Publish logic
|
|
219
|
+
if [ "$PUBLISH_MODE" = "skip" ]; then
|
|
220
|
+
REASON="Publish mode set to skip"
|
|
221
|
+
elif [ "$PUBLISH_MODE" = "force" ]; then
|
|
222
|
+
SHOULD_PUBLISH="true"
|
|
223
|
+
REASON="Force publish requested"
|
|
224
|
+
elif [ "$PUBLISH_MODE" = "auto" ]; then
|
|
225
|
+
if [ "$CURRENT_VERSION" != "$NPM_VERSION" ]; then
|
|
226
|
+
# Only publish on main/master branch for auto mode
|
|
227
|
+
if [[ "${{ github.ref }}" == "refs/heads/main" || "${{ github.ref }}" == "refs/heads/master" ]]; then
|
|
228
|
+
SHOULD_PUBLISH="true"
|
|
229
|
+
REASON="Version updated from $NPM_VERSION to $CURRENT_VERSION"
|
|
230
|
+
else
|
|
231
|
+
REASON="Version changed but not on main branch"
|
|
232
|
+
fi
|
|
233
|
+
else
|
|
234
|
+
REASON="No version change detected"
|
|
235
|
+
fi
|
|
236
|
+
fi
|
|
237
|
+
|
|
238
|
+
echo "should_publish=$SHOULD_PUBLISH" >> $GITHUB_OUTPUT
|
|
239
|
+
echo "reason=$REASON" >> $GITHUB_OUTPUT
|
|
240
|
+
echo "current_version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
|
|
241
|
+
echo "npm_version=$NPM_VERSION" >> $GITHUB_OUTPUT
|
|
242
|
+
|
|
243
|
+
echo "📋 Publish decision: $SHOULD_PUBLISH ($REASON)"
|
|
244
|
+
|
|
245
|
+
# Step 11: Publish to NPM
|
|
246
|
+
- name: 🚀 Publish to NPM
|
|
247
|
+
if: steps.publish-check.outputs.should_publish == 'true'
|
|
248
|
+
run: |
|
|
249
|
+
echo "🚀 Publishing brave-real-launcher v${{ steps.publish-check.outputs.current_version }} to NPM..."
|
|
250
|
+
|
|
251
|
+
# Verify we have NPM token
|
|
252
|
+
if [ -z "$NPM_TOKEN" ]; then
|
|
253
|
+
echo "❌ NPM_TOKEN not found! Cannot publish."
|
|
254
|
+
exit 1
|
|
255
|
+
fi
|
|
256
|
+
|
|
257
|
+
# Publish to NPM
|
|
258
|
+
npm publish --access public
|
|
259
|
+
|
|
260
|
+
# Create Git tag (only if we're on main branch)
|
|
261
|
+
if [[ "${{ github.ref }}" == "refs/heads/main" || "${{ github.ref }}" == "refs/heads/master" ]]; then
|
|
262
|
+
echo "🏷️ Creating Git tag..."
|
|
263
|
+
git config user.name "🤖 Brave Publish Bot"
|
|
264
|
+
git config user.email "action@github.com"
|
|
265
|
+
|
|
266
|
+
TAG_NAME="v${{ steps.publish-check.outputs.current_version }}"
|
|
267
|
+
git tag "$TAG_NAME" || echo "Tag might already exist"
|
|
268
|
+
git push origin "$TAG_NAME" || echo "Failed to push tag"
|
|
269
|
+
fi
|
|
270
|
+
|
|
271
|
+
echo "🎉 Successfully published brave-real-launcher v${{ steps.publish-check.outputs.current_version }}!"
|
|
272
|
+
env:
|
|
273
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
274
|
+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
275
|
+
|
|
276
|
+
# Step 12: Final summary
|
|
277
|
+
- name: 📊 Workflow Summary
|
|
278
|
+
run: |
|
|
279
|
+
echo "✅ 🎉 Workflow completed successfully!"
|
|
280
|
+
echo "=================================="
|
|
281
|
+
echo "📋 Execution Summary:"
|
|
282
|
+
echo "• Chrome-launcher version: ${{ steps.sync-check.outputs.chrome_version }}"
|
|
283
|
+
echo "• Our version: ${{ steps.publish-check.outputs.current_version }}"
|
|
284
|
+
echo "• Sync performed: ${{ steps.sync-check.outputs.should_sync }}"
|
|
285
|
+
echo "• Sync mode: ${{ steps.sync-check.outputs.sync_mode }}"
|
|
286
|
+
echo "• Publish performed: ${{ steps.publish-check.outputs.should_publish }}"
|
|
287
|
+
echo "• Publish reason: ${{ steps.publish-check.outputs.reason }}"
|
|
288
|
+
echo "• Build: ✅ Success"
|
|
289
|
+
echo "• Tests: ✅ Passed"
|
|
290
|
+
echo "• Security: ✅ Checked"
|
|
291
|
+
echo "=================================="
|
|
292
|
+
|
|
293
|
+
# Set workflow status
|
|
294
|
+
if [ "${{ steps.publish-check.outputs.should_publish }}" = "true" ]; then
|
|
295
|
+
echo "🚀 Package published successfully!"
|
|
296
|
+
else
|
|
297
|
+
echo "📦 Package ready but not published (${{ steps.publish-check.outputs.reason }})"
|
|
298
|
+
fi
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to brave-real-launcher will be documented in this file.
|
|
4
|
+
|
|
5
|
+
## [1.2.0] - Initial Release
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
- 🦁 **Brave Browser Detection**: Multi-platform Brave Browser detection across all architectures
|
|
9
|
+
- Linux x64/ARM64 support with standard paths, Flatpak, and Snap detection
|
|
10
|
+
- macOS Intel/Apple Silicon support for all Brave variants (Stable, Beta, Nightly, Dev)
|
|
11
|
+
- Windows x64/ARM64 support with Registry-based and standard path detection
|
|
12
|
+
|
|
13
|
+
- 🐧 **Xvfb Integration**: Built-in Xvfb support for Linux headless environments
|
|
14
|
+
- Automatic Xvfb management with configurable display, resolution, and depth
|
|
15
|
+
- Smart detection to avoid conflicts with existing X11 sessions
|
|
16
|
+
- Automatic cleanup on process termination
|
|
17
|
+
|
|
18
|
+
- 🎯 **Smart Launch Modes**: Intelligent browser launch mode detection
|
|
19
|
+
- `auto`: Automatically detects headless vs GUI environment
|
|
20
|
+
- `headless`: Forces headless mode with appropriate flags
|
|
21
|
+
- `gui`: Forces GUI mode regardless of environment
|
|
22
|
+
|
|
23
|
+
- 🔄 **Auto-Sync with chrome-launcher**: Automated synchronization system
|
|
24
|
+
- Daily checks for chrome-launcher updates via GitHub Actions
|
|
25
|
+
- Automatic integration of compatible upstream changes
|
|
26
|
+
- Preservation of Brave-specific functionality during sync
|
|
27
|
+
- Version matching with chrome-launcher releases
|
|
28
|
+
|
|
29
|
+
- 🛠️ **Full API Compatibility**: Drop-in replacement for chrome-launcher
|
|
30
|
+
- Compatible Options interface with Brave-specific extensions
|
|
31
|
+
- All original chrome-launcher functionality preserved
|
|
32
|
+
- Extended with Brave-specific browser flags and options
|
|
33
|
+
|
|
34
|
+
- 📦 **Comprehensive Platform Support**:
|
|
35
|
+
- **Linux**: x64, ARM64 architectures
|
|
36
|
+
- Standard paths: `/opt/brave.com/brave/`, `/usr/bin/brave-browser`
|
|
37
|
+
- Package manager installations (APT, DNF, etc.)
|
|
38
|
+
- Flatpak: `com.brave.Browser`
|
|
39
|
+
- Snap: `brave`
|
|
40
|
+
- Desktop file detection in XDG directories
|
|
41
|
+
|
|
42
|
+
- **macOS**: Intel, Apple Silicon (M1/M2)
|
|
43
|
+
- Application bundle detection in `/Applications/`
|
|
44
|
+
- User-specific installations in `~/Applications/`
|
|
45
|
+
- LSRegister integration for comprehensive discovery
|
|
46
|
+
- Support for Brave Browser, Beta, Nightly, and Dev versions
|
|
47
|
+
|
|
48
|
+
- **Windows**: x64, ARM64 architectures
|
|
49
|
+
- Registry-based detection (HKLM, HKCU)
|
|
50
|
+
- Standard installation paths in Program Files and AppData
|
|
51
|
+
- Support for both system-wide and user-specific installations
|
|
52
|
+
- Multiple Brave variants detection
|
|
53
|
+
|
|
54
|
+
- 🔧 **Enhanced Browser Flags**: Brave-optimized default flags
|
|
55
|
+
- Disabled Brave-specific features for automation (Ads, Rewards, News, Wallet)
|
|
56
|
+
- Optimized performance flags for headless operation
|
|
57
|
+
- Security-focused defaults for CI/CD environments
|
|
58
|
+
|
|
59
|
+
- 🚀 **Advanced Features**:
|
|
60
|
+
- Environment variable support (`BRAVE_PATH`, `HEADLESS`, `DISPLAY`)
|
|
61
|
+
- Comprehensive error handling with specific error codes
|
|
62
|
+
- Logging integration with lighthouse-logger
|
|
63
|
+
- Process management with proper cleanup
|
|
64
|
+
- Cross-platform process killing (Windows taskkill, Unix signals)
|
|
65
|
+
|
|
66
|
+
### Infrastructure
|
|
67
|
+
- **GitHub Actions Workflow**: Comprehensive CI/CD pipeline
|
|
68
|
+
- Automatic sync with chrome-launcher updates
|
|
69
|
+
- Multi-platform testing (Ubuntu, Windows, macOS)
|
|
70
|
+
- Multi-Node.js version testing (16, 18, 20)
|
|
71
|
+
- Automated NPM publishing
|
|
72
|
+
- GitHub releases with detailed changelogs
|
|
73
|
+
|
|
74
|
+
- **Testing Infrastructure**:
|
|
75
|
+
- Cross-platform test runners (Bash, PowerShell)
|
|
76
|
+
- Browser detection validation
|
|
77
|
+
- Build verification
|
|
78
|
+
- Export validation
|
|
79
|
+
- Integration testing with real Brave installations
|
|
80
|
+
|
|
81
|
+
- **Developer Experience**:
|
|
82
|
+
- TypeScript with strict configuration
|
|
83
|
+
- Comprehensive JSDoc documentation
|
|
84
|
+
- Example usage files
|
|
85
|
+
- Clear README with multiple use cases
|
|
86
|
+
- Binary executable for path detection
|
|
87
|
+
|
|
88
|
+
### Technical Details
|
|
89
|
+
- **Base Version**: Synced with chrome-launcher v1.2.0
|
|
90
|
+
- **Node.js**: Requires >=12.13.0
|
|
91
|
+
- **TypeScript**: ES2019 target with ESNext modules
|
|
92
|
+
- **Architecture**: Modular design with clear separation of concerns
|
|
93
|
+
- `brave-finder.ts`: Cross-platform browser detection
|
|
94
|
+
- `brave-launcher.ts`: Main launcher logic with Xvfb integration
|
|
95
|
+
- `utils.ts`: Utility functions including Xvfb management
|
|
96
|
+
- `flags.ts`: Brave-optimized default flags
|
|
97
|
+
- `random-port.ts`: Port management utilities
|
|
98
|
+
|
|
99
|
+
### Dependencies
|
|
100
|
+
- **Runtime Dependencies**:
|
|
101
|
+
- `@types/node`: Node.js type definitions
|
|
102
|
+
- `escape-string-regexp`: Regular expression escaping
|
|
103
|
+
- `is-wsl`: WSL environment detection
|
|
104
|
+
- `lighthouse-logger`: Logging framework
|
|
105
|
+
- `which`: Cross-platform executable finding
|
|
106
|
+
|
|
107
|
+
- **Development Dependencies**:
|
|
108
|
+
- `typescript`: TypeScript compiler
|
|
109
|
+
- `@types/mocha`: Mocha type definitions
|
|
110
|
+
- `@types/sinon`: Sinon type definitions
|
|
111
|
+
- `@types/which`: Which type definitions
|
|
112
|
+
- `clang-format`: Code formatting
|
|
113
|
+
- `mocha`: Testing framework
|
|
114
|
+
- `sinon`: Test spies and mocks
|
|
115
|
+
- `ts-node`: TypeScript execution
|
|
116
|
+
|
|
117
|
+
### API Exports
|
|
118
|
+
- `launch(options)`: Main launcher function
|
|
119
|
+
- `getBravePath()`: Browser path detection
|
|
120
|
+
- `killAll()`: Kill all managed instances
|
|
121
|
+
- `BraveLauncher`: Launcher class
|
|
122
|
+
- `XvfbManager`: Xvfb management class
|
|
123
|
+
- `braveFinder`: Browser detection utilities
|
|
124
|
+
- `DEFAULT_FLAGS`: Brave-optimized flags
|
|
125
|
+
- `getRandomPort()`: Port utilities
|
|
126
|
+
- `getPlatform()`: Platform detection
|
|
127
|
+
- `detectDesktopEnvironment()`: Environment detection
|
|
128
|
+
|
|
129
|
+
### Breaking Changes from chrome-launcher
|
|
130
|
+
- Package name: `chrome-launcher` → `brave-real-launcher`
|
|
131
|
+
- Browser target: Chrome/Chromium → Brave Browser
|
|
132
|
+
- Options interface: `chromeFlags` → `braveFlags`, `chromePath` → `bravePath`
|
|
133
|
+
- Error classes: `ChromeNotInstalledError` → `BraveNotInstalledError`
|
|
134
|
+
- Environment variables: `CHROME_PATH` → `BRAVE_PATH`
|
|
135
|
+
|
|
136
|
+
### Future Roadmap
|
|
137
|
+
- Additional browser variant support (Brave Nightly, Dev, Beta)
|
|
138
|
+
- Extended platform support (FreeBSD, OpenBSD)
|
|
139
|
+
- Performance optimizations for browser discovery
|
|
140
|
+
- Enhanced Xvfb configuration options
|
|
141
|
+
- Integration with popular testing frameworks
|
|
142
|
+
- Docker container optimization
|
package/GITHUB_SETUP.md
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
# 🔐 GitHub Secrets Setup Guide
|
|
2
|
+
|
|
3
|
+
यह guide आपको **brave-real-launcher** के लिए GitHub Actions workflow को setup करने में मदद करेगी।
|
|
4
|
+
|
|
5
|
+
## आवश्यक Secrets
|
|
6
|
+
|
|
7
|
+
आपको अपनी GitHub repository में निम्नलिखित secrets add करने होंगे:
|
|
8
|
+
|
|
9
|
+
### 1. NPM_TOKEN (आवश्यक)
|
|
10
|
+
NPM पर package publish करने के लिए:
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
# NPM में login करें
|
|
14
|
+
npm login
|
|
15
|
+
|
|
16
|
+
# Access token generate करें
|
|
17
|
+
npm token create --type=publish
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
**GitHub में add करें:**
|
|
21
|
+
1. Repository → Settings → Secrets and variables → Actions
|
|
22
|
+
2. "New repository secret" click करें
|
|
23
|
+
3. Name: `NPM_TOKEN`
|
|
24
|
+
4. Value: आपका NPM access token
|
|
25
|
+
|
|
26
|
+
### 2. GH_TOKEN (Optional)
|
|
27
|
+
Repository में changes commit करने के लिए:
|
|
28
|
+
|
|
29
|
+
**Option A: Default GITHUB_TOKEN (Recommended)**
|
|
30
|
+
- Workflow automatically `GITHUB_TOKEN` का use करेगी
|
|
31
|
+
- कोई extra setup की जरूरत नहीं
|
|
32
|
+
|
|
33
|
+
**Option B: Personal Access Token**
|
|
34
|
+
अगर extra permissions चाहिए तो:
|
|
35
|
+
|
|
36
|
+
1. GitHub → Settings → Developer settings → Personal access tokens
|
|
37
|
+
2. "Generate new token" → "Fine-grained personal access token"
|
|
38
|
+
3. Repository access: Select repository
|
|
39
|
+
4. Permissions: Contents (Write), Metadata (Read)
|
|
40
|
+
5. Token copy करें
|
|
41
|
+
|
|
42
|
+
**GitHub में add करें:**
|
|
43
|
+
- Name: `GH_TOKEN`
|
|
44
|
+
- Value: आपका personal access token
|
|
45
|
+
|
|
46
|
+
## 🚀 Workflow Triggers
|
|
47
|
+
|
|
48
|
+
### 1. ऑटोमेटिक Triggers
|
|
49
|
+
```yaml
|
|
50
|
+
# हफ्ते में दो बार automatic check
|
|
51
|
+
schedule:
|
|
52
|
+
- cron: '0 6 * * 1,4' # सोमवार और गुरुवार सुबह 6:00 UTC
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### 2. Manual Triggers
|
|
56
|
+
Repository पर जाकर:
|
|
57
|
+
1. Actions tab → "Brave Real Launcher - Auto Sync & Publish"
|
|
58
|
+
2. "Run workflow" button click करें
|
|
59
|
+
3. Options select करें:
|
|
60
|
+
- **Sync Mode**: auto, force, check
|
|
61
|
+
- **Publish Mode**: auto, force, skip
|
|
62
|
+
|
|
63
|
+
### 3. Push/PR Triggers
|
|
64
|
+
```yaml
|
|
65
|
+
# हर push और PR पर (बिना publish के)
|
|
66
|
+
push:
|
|
67
|
+
branches: [ main, master ]
|
|
68
|
+
pull_request:
|
|
69
|
+
branches: [ main, master ]
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## 🔄 Sync Modes
|
|
73
|
+
|
|
74
|
+
| Mode | Description |
|
|
75
|
+
|------|-------------|
|
|
76
|
+
| `auto` | Chrome-launcher update होने पर sync करें |
|
|
77
|
+
| `force` | जबरदस्ती sync करें |
|
|
78
|
+
| `check` | सिर्फ check करें, कोई changes न करें |
|
|
79
|
+
|
|
80
|
+
## 🚀 Publish Modes
|
|
81
|
+
|
|
82
|
+
| Mode | Description |
|
|
83
|
+
|------|-------------|
|
|
84
|
+
| `auto` | Version change पर automatic publish |
|
|
85
|
+
| `force` | जबरदस्ती publish करें |
|
|
86
|
+
| `skip` | Publish न करें |
|
|
87
|
+
|
|
88
|
+
## 🔍 Workflow Status Check
|
|
89
|
+
|
|
90
|
+
Workflow की status check करने के लिए:
|
|
91
|
+
|
|
92
|
+
1. Repository → Actions tab
|
|
93
|
+
2. Latest workflow run देखें
|
|
94
|
+
3. Logs में detailed information मिलेगी
|
|
95
|
+
|
|
96
|
+
## 🛠️ Troubleshooting
|
|
97
|
+
|
|
98
|
+
### NPM Publish Failed
|
|
99
|
+
- NPM_TOKEN valid है या नहीं check करें
|
|
100
|
+
- NPM में login status verify करें
|
|
101
|
+
- Package name conflicts check करें
|
|
102
|
+
|
|
103
|
+
### Git Push Failed
|
|
104
|
+
- GH_TOKEN permissions check करें
|
|
105
|
+
- Branch protection rules check करें
|
|
106
|
+
|
|
107
|
+
### Chrome-launcher Sync Failed
|
|
108
|
+
- Network connectivity check करें
|
|
109
|
+
- GitHub API rate limits check करें
|
|
110
|
+
|
|
111
|
+
## 📊 Workflow Features
|
|
112
|
+
|
|
113
|
+
✅ **Auto Sync**: Chrome-launcher के साथ automatic sync
|
|
114
|
+
✅ **Smart Publishing**: Version changes पर automatic publish
|
|
115
|
+
✅ **Comprehensive Testing**: Full test suite including browser launch
|
|
116
|
+
✅ **Security Audit**: NPM security vulnerability check
|
|
117
|
+
✅ **Multi-mode Support**: Manual और automatic triggers
|
|
118
|
+
✅ **Secure Token Usage**: Safe handling of GH_TOKEN और NPM_TOKEN
|
|
119
|
+
|
|
120
|
+
---
|
|
121
|
+
|
|
122
|
+
## 🎉 Setup Complete!
|
|
123
|
+
|
|
124
|
+
सभी secrets add करने के बाद, workflow automatically काम करना शुरू कर देगी। पहली run manually trigger करें test करने के लिए।
|