Skip to content

Commit

Permalink
Merge pull request #24 from mikikiv/23-add-extension-to-firefox
Browse files Browse the repository at this point in the history
23 - update extension packaging to use brew web-ext
  • Loading branch information
mikikiv authored Aug 24, 2024
2 parents b092b82 + fda5ca0 commit ccf64da
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 38 deletions.
44 changes: 12 additions & 32 deletions extensionReqs/build.sh
Original file line number Diff line number Diff line change
@@ -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
9 changes: 7 additions & 2 deletions extensionReqs/manifest.json
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -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}"
}
}
}
1 change: 1 addition & 0 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
output: "export",
reactStrictMode: true,
}

Expand Down
14 changes: 10 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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": {
Expand Down

1 comment on commit ccf64da

@vercel
Copy link

@vercel vercel bot commented on ccf64da Aug 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.