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

PR: Contrib Build instructions for Safari Extensions and added make's phny-pipeline for MacOS #43

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
/*.xpi
dist
web-ext-artifacts
xcprj/
Shiori/
21 changes: 21 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
SHIORI_BUNDLE_IDENTIFIER ?= "com.durakiconsulting.shiori"
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
SHIORI_BUNDLE_IDENTIFIER ?= "com.durakiconsulting.shiori"
SHIORI_BUNDLE_IDENTIFIER ?= "com.go-shiori.shiori"


all:
@echo $(SHIORI_BUNDLE_IDENTIFIER)
: '$(SHIORI_BUNDLE_IDENTIFIER)'

build:
web-ext build -a dist

Expand All @@ -7,5 +13,20 @@ run-firefox:
run-chromium:
web-ext build run -t chromium

run-safari:
make all
xcrun safari-web-extension-converter . \
--project-location xcprj \
--app-name Shiori \
--bundle-identifier $(SHIORI_BUNDLE_IDENTIFIER) \
--macos-only --force --no-open \

@echo "All Done. [safari-web-ext @ shiori built] 🙌\n"
@echo "Execute manually to open XCode Project:"
@echo "\t$ open xcprj/Shiori/Shiori.xcodeproj"

lint:
web-ext lint

clean:
rm -rf xcprj/
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Shiori Web Extension is a simple extension for managing bookmarks using Shiori.

## Development Status

This extension is still in beta, however it's already usable at this point. Unfortunately, I've only tested it in Firefox 59+ so there is no guarantee that it will work in another browser.
This extension is still in beta, however it's already usable at this point. Unfortunately, I've only tested it in Firefox 59+ so there is no guarantee that it will work in another browser. A work-in-progress containing build pipeline for MacOS Mojave, specifically Safari, is currently in progress - more details in [Safari Building documentation](/docs/Safari.md).

## Installation

Expand Down
Binary file added docs/safari-enable-shiori-ext.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/safari-ext-usage-settings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/safari-product-extbuild.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
85 changes: 85 additions & 0 deletions docs/safari.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
## Building Shiori for Safari

Just a small quick write-up how to compile the extension without much changes to work in Safari as well.

### Toolchain & General Requirements

* Tested on XCode v14.3 running on MacOS Mojave (Macbook Pro M1)
* Install `web-ext` requirements from Shiori's own toolchain
- `npm install --global web-ext`
* Open `Safari -> Settings` and enable "Develop" (development) Menu Bar
* Again, in Safari, press the newly `Develop` menubar and enable `Allow Unsigned Extensions`
* Quit Safari and head over to `shiori-web-ext` repository

### Building Shiori

Clone the repository as usual;

```sh
$ git clone https://github.com/go-shiori/shiori-web-ext.git
$ cd shiori-web-ext
```

The `Makefile` should, with this branch, contain a `run-safari` make handler.

```sh
$ cat Makefile | grep Safari -C 2
# ...
# run-safari:
# xcrun safari-web-extension-converter . --project-location xcprj/ --app-name Shiori --bundle-identifier com.durakiconsulting.shiori --macos-only --force
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
# xcrun safari-web-extension-converter . --project-location xcprj/ --app-name Shiori --bundle-identifier com.durakiconsulting.shiori --macos-only --force
# xcrun safari-web-extension-converter . --project-location xcprj/ --app-name Shiori --bundle-identifier com.go-shiori.shiori --macos-only --force

```

You need to set `ENV` variable `SHIORI_BUNDLE_IDENTIFIER` to your bundle identifier, using classical bundle identifier naming convention, such is `ext.yourcompanyname.shiori`. This identifier can be passed during make (defaults to `'com.durakiconsulting.shiori'`).
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
You need to set `ENV` variable `SHIORI_BUNDLE_IDENTIFIER` to your bundle identifier, using classical bundle identifier naming convention, such is `ext.yourcompanyname.shiori`. This identifier can be passed during make (defaults to `'com.durakiconsulting.shiori'`).
You need to set `ENV` variable `SHIORI_BUNDLE_IDENTIFIER` to your bundle identifier, using classical bundle identifier naming convention, such is `ext.yourcompanyname.shiori`. This identifier can be passed during make (defaults to `'com.go-shiori.shiori'`).


```sh
$ make run-safari # bundles with default identifier

# ... OR ...

$ make run-safari SHIORI_BUNDLE_IDENTIFIER=com.yourcompanyname.shiori

# ...
# make all
# ...

# Xcode Project Location: $(PWD)/xcprj
# App Name: Shiori
# App Bundle Identifier: com.yourcompanyname.shiori
# Platform: macOS
# Language: Swift
#
# All Done. [safari-web-ext @ shiori built] 🙌
#
# Execute manually to open XCode Project:
# open xcprj/Shiori/Shiori.xcodeproj
```

Upon successful Safari build pipeline, you will end up with `xcprj/` directory in the repository root directory. Enter the command seen in the Terminal output:

```sh
$ open xcprj/Shiori/Shiori.xcodeproj
# ... XCode will open ...
```

### Compiling via XCode

Once in XCode, run `Shift + Cmd + R` (`Product => Build For => Running` via Menu) to build release version and generate application product.
Once the above finished, click `Product => Show Build folder in Finder` and enter `Product/Debug/` directory from inside the Finder and you should see `Shiori.app`.

![](/docs/safari-product-extbuild.png)
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't this be?

Suggested change
![](/docs/safari-product-extbuild.png)
![](safari-product-extbuild.png)


### Running

Open the built Shiori application and follow the screen instructions.

![](/docs/safari-enable-shiori-ext.png)
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't this be?

Suggested change
![](/docs/safari-enable-shiori-ext.png)
![](safari-enable-shiori-ext.png)


Once enabled, you can click `Settings` button for Shiori, or right-click on Shiori toolbar icon, and click `Manage Extension`. This will open Shiori Session settings where you will enter your server URL and username and password combo.

![](/docs/safari-ext-usage-settings.png)
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't this be?

Suggested change
![](/docs/safari-ext-usage-settings.png)
![](safari-ext-usage-settings.png)


**Note:** Be free to move the built Shiori extension to your `/Applications` directory to enjoy bugs free deployment on your Host OS.

**Note:** You can use `make clean` to cleanup your build directory and XCode project as to not take space on your disk.