From 5ad9dd0c39b1a26481142128a59dde2d870f8d7a Mon Sep 17 00:00:00 2001 From: Marcin Rataj Date: Mon, 11 Aug 2025 18:47:03 +0200 Subject: [PATCH 1/2] feat: npm run package & npm start --- .gitignore | 1 + package.json | 11 ++++++++--- src/manifest.json | 13 +++++++++---- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index bca7bf2..8e3d64e 100644 --- a/.gitignore +++ b/.gitignore @@ -88,3 +88,4 @@ public CLAUDE.local.md .claude/ +ipfs-quicklaunch-*.zip diff --git a/package.json b/package.json index d7b7b66..fa0f0d4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ipfs-quicklaunch", - "version": "1.1.1", + "version": "1.1.2", "description": "IPFS launcher browser extension with local pet names, version management, and smart CID discovery", "license": "Apache-2.0 OR MIT", "homepage": "https://github.com/ipshipyard/ipfs-quicklaunch", @@ -13,7 +13,11 @@ }, "main": "src/background.js", "scripts": { - "build": "tsc && cp src/manifest.json dist/ && cp src/popup.html dist/ && cp -r src/icons dist/", + "sync-version": "node -e \"const fs=require('fs'); const pkg=require('./package.json'); const m=require('./src/manifest.json'); if(m.version!==pkg.version){m.version=pkg.version; fs.writeFileSync('src/manifest.json', JSON.stringify(m,null,2)+'\\n'); console.log('✓ Updated manifest.json version to '+pkg.version)}else{console.log('✓ Version already in sync: '+pkg.version)}\"", + "build": "npm run sync-version && tsc && cp src/manifest.json dist/ && cp src/popup.html dist/ && cp -r src/icons dist/", + "package": "npm run build && web-ext build --source-dir=dist --artifacts-dir=. --filename=ipfs-quicklaunch-{version}.zip --overwrite-dest", + "start": "npm run build && web-ext run --source-dir=dist --target=chromium", + "start:firefox": "npm run build && web-ext run --source-dir=dist --target=firefox", "release": "aegir release", "watch": "tsc --watch", "clean": "rm -rf dist" @@ -134,7 +138,8 @@ "devDependencies": { "@types/chrome": "^0.0.248", "aegir": "^47.0.20", - "typescript": "^5.0.0" + "typescript": "^5.0.0", + "web-ext": "^8.3.0" }, "keywords": [ "browser-extension", diff --git a/src/manifest.json b/src/manifest.json index abd01b8..4fd082c 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 3, "name": "IPFS QuickLaunch", - "version": "1.0.0", + "version": "1.1.2", "description": "IPFS launcher browser extension with local pet names, version management, and smart CID discovery", "permissions": [ "storage", @@ -23,10 +23,15 @@ }, "content_scripts": [ { - "matches": ["http://*/*", "https://*/*"], - "js": ["content.js"], + "matches": [ + "http://*/*", + "https://*/*" + ], + "js": [ + "content.js" + ], "run_at": "document_end", "all_frames": false } ] -} \ No newline at end of file +} From 0f56671649e841d49dec1edb31709e0e4cb4bbf2 Mon Sep 17 00:00:00 2001 From: Marcin Rataj Date: Mon, 11 Aug 2025 18:57:04 +0200 Subject: [PATCH 2/2] docs: document new commands in readme --- README.md | 56 ++++++++++++++++++++++++++++++++++++++++++++-------- package.json | 3 +-- 2 files changed, 49 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 7a9d6d1..215ea5d 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ This extension is an experimental proof of concept. It's intended to demonstrate ## 🚀 Quick Start -To get started with the IPFS QuickLaunch browser extension, you need to build it from source. Follow these steps +To get started with the IPFS QuickLaunch browser extension, you need to build it from source. Follow these steps: ```bash # Install dependencies @@ -34,16 +34,50 @@ npm install # Build the extension npm run build -# Watch for changes during development +# Create a .zip for Chrome Web Store +npm run package +``` + +### Development Commands + +```bash +# Run extension in Chrome for development +npm start + +# Watch TypeScript files for changes npm run watch + +# Clean build directory +npm run clean ``` +### Available npm Scripts + +| Command | Description | +|---------|-------------| +| `npm run build` | Compiles TypeScript and copies assets to `dist/` directory | +| `npm run package` | Builds and creates a `.zip` file ready for Chrome Web Store submission | +| `npm start` | Builds and launches the extension in Chrome/Chromium for development | +| `npm run watch` | Watches TypeScript files and recompiles on changes | +| `npm run clean` | Removes the `dist/` build directory | +| `npm run sync-version` | Syncs version from `package.json` to `manifest.json` (runs automatically during build) | + ### Installation in Chrome -1. Make sure to build the extension first using `npm run build`. -2. Open Chrome and navigate to `chrome://extensions`. -3. Enable Developer Mode by clicking the toggle switch next to Developer mode. -4. Click the Load unpacked button and select the `dist` in the extension directory. +#### For Development (automatic) +1. Run `npm start` to build and launch the extension in Chrome +2. The extension will be automatically loaded and reloaded when you make changes +3. Chrome will open with the extension pre-installed for testing + +#### For Development (manual) +1. Run `npm run build` to compile the extension +2. Open Chrome and navigate to `chrome://extensions` +3. Enable Developer Mode by clicking the toggle switch +4. Click "Load unpacked" and select the `dist/` directory + +#### For Chrome Web Store Publishing +1. Run `npm run package` to create `ipfs-quicklaunch-{version}.zip` +2. Upload the generated `.zip` file to [Chrome Web Store Developer Dashboard](https://chrome.google.com/webstore/developer/dashboard) @@ -265,12 +299,18 @@ interface DNSLinkCacheEntry { # Install dependencies npm install -# Development with auto-rebuild +# Development - launches in Chrome with auto-reload +npm start + +# Or watch TypeScript files for manual reload npm run watch -# Production build +# Production build for testing npm run build +# Create .zip for Chrome Web Store +npm run package + # Load dist/ folder in Chrome Developer Mode chrome://extensions/ -> "Load unpacked" ``` diff --git a/package.json b/package.json index fa0f0d4..881839d 100644 --- a/package.json +++ b/package.json @@ -17,10 +17,9 @@ "build": "npm run sync-version && tsc && cp src/manifest.json dist/ && cp src/popup.html dist/ && cp -r src/icons dist/", "package": "npm run build && web-ext build --source-dir=dist --artifacts-dir=. --filename=ipfs-quicklaunch-{version}.zip --overwrite-dest", "start": "npm run build && web-ext run --source-dir=dist --target=chromium", - "start:firefox": "npm run build && web-ext run --source-dir=dist --target=firefox", "release": "aegir release", "watch": "tsc --watch", - "clean": "rm -rf dist" + "clean": "rm -rf dist ipfs-quicklaunch-*.zip" }, "files": [ "src",