Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

23 - update extension packaging to use brew web-ext #24

Merged
merged 1 commit into from
Aug 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading