From fda5ca014a062dcdbcae970807c34032a8c82596 Mon Sep 17 00:00:00 2001 From: Mikey <46366395+mikikiv@users.noreply.github.com> Date: Fri, 23 Aug 2024 17:03:41 -0700 Subject: [PATCH] #23 update extension packaging to use brew web-ext --- extensionReqs/build.sh | 44 ++++++++++--------------------------- extensionReqs/manifest.json | 9 ++++++-- next.config.js | 1 + package.json | 14 ++++++++---- 4 files changed, 30 insertions(+), 38 deletions(-) diff --git a/extensionReqs/build.sh b/extensionReqs/build.sh index 53cf7b1..0c6d2a0 100755 --- a/extensionReqs/build.sh +++ b/extensionReqs/build.sh @@ -1,42 +1,22 @@ #!/bin/bash -# Build the Next.js application npx next build -echo " -Build complete -" +echo "Export complete" -# Export the application as static HTML files -npx next export -echo " -Export complete -" +# Copy the manifest.json file to /extension folder +cp extensionReqs/manifest.json out/manifest.json -# Move the _next directory to next +# build the extension +cd out +web-ext build -mv out/_next out/next +# Move the web-ext-artifacts and its content to the ../extension folder (creating it if it doesn't exist) +cd .. +mkdir -p extension +mv out/web-ext-artifacts/* extension -# Replace occurrences of /_next with ./next in HTML files -find out -type f -name "*.html" -exec sed -i '' -e 's#/_next#./next#g' {} + -# Move extension.html to /extension folder -mkdir extension -mv out/extension.html extension/extension.html -mv out/logo.png extension/logo.png -# Synchronize out/next with /extension/next -rsync -va --delete-after out/next/ extension/next/ - -# copy the manifest.json file to /extension folder -cp extensionReqs/manifest.json extension/manifest.json - -# Remove the out directory +# Delete the out folder and its content +cd .. rm -rf out - -# when the user includes an export flag, export the extension folder as a zip -if [ "$1" == "export" ]; then - echo " - exporting extension folder as zip - " - zip -r extension.zip extension -fi \ No newline at end of file diff --git a/extensionReqs/manifest.json b/extensionReqs/manifest.json index f8eae42..6a62fe4 100644 --- a/extensionReqs/manifest.json +++ b/extensionReqs/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 3, "name": "AliasIpsum", - "version": "1.3.2", + "version": "1.3.3", "action": { "default_popup": "/extension.html", "default_title": "AliasIpsum", @@ -15,5 +15,10 @@ "128": "logo.png" }, "homepage_url": "https://quicklorem.dev", - "permissions": ["clipboardWrite"] + "permissions": ["clipboardWrite"], + "browser_specific_settings": { + "gecko": { + "id": "{5FB5F59C-CA59-4E32-B6EC-C281B6536C6B}" + } + } } diff --git a/next.config.js b/next.config.js index a843cbe..2060dae 100644 --- a/next.config.js +++ b/next.config.js @@ -1,5 +1,6 @@ /** @type {import('next').NextConfig} */ const nextConfig = { + output: "export", reactStrictMode: true, } diff --git a/package.json b/package.json index 072bd1e..eb2efbc 100644 --- a/package.json +++ b/package.json @@ -1,13 +1,19 @@ { "name": "quick-lorem", - "version": "1.3.2", + "version": "1.3.3", "author": { "name": "Mikey Villavicencio", - "email": "villavicem@gmail.com" + "email": "mikey.v.dev@gmail.com" }, "description": "A quick lorem ipsum generator", "license": "GPL", - "keywords": ["next", "mantine", "typescript", "react", "lorem"], + "keywords": [ + "next", + "mantine", + "typescript", + "react", + "lorem" + ], "repository": { "type": "git", "url": "https://github.com/mikikiv/quick-lorem.git" @@ -22,7 +28,7 @@ "e2e": "playwright test", "e2e-dev": "playwright test --ui", "vercel-build": "next build", - "build:extension": "extensionReqs/build.sh", + "build:extension": "extensionReqs/build.sh export", "format": "biome format . --write" }, "dependencies": {