From 46949e48ba1bfde4eb7dd41ab70f6de0102c325b Mon Sep 17 00:00:00 2001 From: Anoop M D Date: Sun, 16 Oct 2022 20:01:23 +0530 Subject: [PATCH] feat: wip packaging chrome extension --- .gitignore | 2 ++ docs/development.md | 3 +++ package.json | 3 +++ packages/bruno-app/package.json | 2 +- scripts/chrome-extension-files/manifest.json | 5 +++++ scripts/create-chrome-extension.sh | 22 ++++++++++++++++++++ 6 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 scripts/chrome-extension-files/manifest.json create mode 100755 scripts/create-chrome-extension.sh diff --git a/.gitignore b/.gitignore index 572bd2a21..3189aacdd 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,8 @@ coverage # production build +chrome-extension +bruno.zip # misc .DS_Store diff --git a/docs/development.md b/docs/development.md index 897510503..5c11477af 100644 --- a/docs/development.md +++ b/docs/development.md @@ -8,6 +8,9 @@ npm run dev --workspace=packages/bruno-app # run electron app npm run dev --workspace=packages/bruno-electron + +# build next app +npm run build --workspace=packages/bruno-app ``` # testing diff --git a/package.json b/package.json index 44499a93c..1a81ea87f 100644 --- a/package.json +++ b/package.json @@ -11,5 +11,8 @@ "devDependencies": { "jest": "^29.2.0", "randomstring": "^1.2.2" + }, + "scripts": { + "build-chrome-extension": "./scripts/create-chrome-extension.sh" } } diff --git a/packages/bruno-app/package.json b/packages/bruno-app/package.json index 6639d6574..2bc0ffca0 100644 --- a/packages/bruno-app/package.json +++ b/packages/bruno-app/package.json @@ -3,7 +3,7 @@ "private": true, "scripts": { "dev": "next dev", - "build": "next build", + "build": "next build && next export", "start": "next start", "lint": "next lint" }, diff --git a/scripts/chrome-extension-files/manifest.json b/scripts/chrome-extension-files/manifest.json new file mode 100644 index 000000000..879937d31 --- /dev/null +++ b/scripts/chrome-extension-files/manifest.json @@ -0,0 +1,5 @@ +{ + "manifest_version": 2, + "name": "Bruno API Client", + "short_name": "Bruno" +} \ No newline at end of file diff --git a/scripts/create-chrome-extension.sh b/scripts/create-chrome-extension.sh new file mode 100755 index 000000000..d5f561e37 --- /dev/null +++ b/scripts/create-chrome-extension.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +# Remove any chrome-extension directory +rm -rf chrome-extension + +# Remove any bruno.zip files +rm bruno.zip + +# Create a new chrome-extension directory +mkdir chrome-extension + +# Copy build +cp -r packages/bruno-app/out/* chrome-extension + +# Copy the chrome extension files +cp -r scripts/chrome-extension-files/* chrome-extension + +# Remove sourcemaps +find chrome-extension -name '*.map' -type f -delete + +# Compress the chrome-extension directory into a zip file +zip -r bruno.zip chrome-extension \ No newline at end of file