Skip to content
This repository has been archived by the owner on Dec 24, 2024. It is now read-only.

Commit

Permalink
Merge pull request #154 from harytfw/dev
Browse files Browse the repository at this point in the history
Dev v2.1.5
  • Loading branch information
harytfw authored Jun 10, 2023
2 parents 4c47ed3 + 13afbd5 commit f673a34
Show file tree
Hide file tree
Showing 51 changed files with 1,718 additions and 1,333 deletions.
101 changes: 24 additions & 77 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,91 +1,38 @@
export BUILD_VERSION ?= 2.1.4
export SRC ?= $(shell realpath ./src)
export BUILD_DIR ?= $(shell realpath ./build)
export BROWSER_LOCATION ?= $(shell which firefox-developer-edition)
export NODE_MODULES ?= $(shell realpath ./node_modules)
export BUILD_PROFILE ?= debug
export BUILD_COMMIT_ID ?= $(shell git rev-parse --short HEAD)
export BUILD_DATE ?= $(shell date --rfc-3339=seconds)
export BUILD_NODE_VERSION ?= $(shell node --version)
export BUILD_ROLLUP_VERSION ?= $(shell npx rollup --version)
export BUILD_OS ?= $(shell node -e "console.log(require('os').platform())")
export BUILD_WEBSOCKET_SERVER =
export BUILD_SRC ?= $(shell realpath ./src)

export TARGET_BROWSER = firefox
export TARGET_DIST = $(BUILD_DIR)/$(TARGET_BROWSER)/dist
cli = node ./scripts/cli.mjs
.PHONY: build
build: TARGET ?= firefox
build:
$(cli) build --target $(TARGET)

export ENTRY_POINTS = background content_scripts options components
.PHONY: build-watch
build-watch: TARGET ?= firefox
build-watch:
$(cli) build --target $(TARGET) --watch

.PHONY: ext-firefox
ext-firefox: TARGET_BROWSER = firefox
ext-firefox: setup-dist assets compile lint package
ext-firefox: BUILD_PROFILE ?= debug
ext-firefox:
$(cli) build --target firefox --lint --profile $(BUILD_PROFILE)

.PHONY: ext-chromium
ext-chromium: TARGET_BROWSER = chromium
ext-chromium: setup-dist assets compile package
ext-chromium: BUILD_PROFILE ?= debug
ext-chromium:
$(cli) build --target chromium --profile $(BUILD_PROFILE)

.PHONY: test
test: TARGET_BROWSER = firefox-test
test: ENTRY_POINTS += test
test: BUILD_WEBSOCKET_SERVER = ws://localhost:8000
test: setup-dist assets mocha-assets compile
@node test/bootstrap.mjs
test: TARGET ?= firefox-test
test:
$(cli) test --target $(TARGET)

.PHONY: open-mocha
open-mocha: TARGET_BROWSER = firefox-test
open-mocha: ENTRY_POINTS += test
open-mocha: setup-dist assets mocha-assets compile
web-ext run -v \
-s $(TARGET_DIST) \
-f "$(BROWSER_LOCATION)"

.PHONY: setup-dist
setup-dist: TARGET_DIST = $(BUILD_DIR)/$(TARGET_BROWSER)/dist
setup-dist:
$(shell [ ! -d $(TARGET_DIST) ] && mkdir -p $(TARGET_DIST)/)

.PHONY: lint
lint:
@pnpm exec web-ext lint -s $(TARGET_DIST)

.PHONY: compile
compile:
@npx rollup -c;

.PHONY: manifest
manifest:
@node scripts/gen_manifest.js > $(TARGET_DIST)/manifest.json

.PHONY: assets
assets: manifest

@mkdir -p $(TARGET_DIST)/options && \
cp -f $(SRC)/options/options.html $(TARGET_DIST)/options/options.html

@mkdir -p $(TARGET_DIST)/res && \
cp -r -f $(NODE_MODULES)/simpledotcss/simple.min.css $(TARGET_DIST)/res/simple.min.css

@cp -r -f $(SRC)/icon/ $(SRC)/_locales/ $(TARGET_DIST)/

.PHONY: mocha-assets
mocha-assets:
@mkdir -p $(TARGET_DIST)/test && \
cp $(NODE_MODULES)/mocha/mocha.js \
$(NODE_MODULES)/mocha/mocha.css \
$(NODE_MODULES)/chai/chai.js \
$(SRC)/test/mocha.html \
$(TARGET_DIST)/test

.PHONY: package
package:
@mkdir -p $(BUILD_DIR)/artifacts
@cd $(TARGET_DIST) && zip -r $(BUILD_DIR)/artifacts/glitterdrag-pro-$(BUILD_VERSION)-$(TARGET_BROWSER).zip .
.PHONY: watch
watch: TARGET ?= firefox
watch:
$(cli) watch

.PHONY: clean
clean:
@rm -rf $(BUILD_DIR)


start-server: port ?= 8000
start-server:
@python3 -m http.server $(port)
$(cli) clean
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,12 @@ make ext-chromium
```

After the build process completed, `./build/firefox/dist` contains compiled result, `./build/firefox/artifacts` contains package file.

## Limitation

The extension has limited support at these situation:

- Can not work on privilege pages or restricted pages, like <about:home>, <https://addons.mozilla.org>, <chrome:newtab>
- Can not work when dragging any selection from page A and dropping at page B, and page A and page B have different origin. (For example, [host page](www.example.com) is A, it embeds [youtube video](https://www.youtube.com/embed/-88qGXDmh3E) as B)
- When host page explicitly uses drag-and-drop features, the extension will stop working temporarily
- Unable show icon of menu on when [CSP](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/Sources#sources) of host page prohibits *data:* URLs
48 changes: 26 additions & 22 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,39 @@
"name": "glitterdrag-pro",
"type": "module",
"devDependencies": {
"@rollup/plugin-commonjs": "^23.0.2",
"@rollup/plugin-node-resolve": "^15.0.1",
"@rollup/plugin-replace": "^5.0.1",
"@rollup/plugin-typescript": "^9.0.2",
"@tsconfig/svelte": "^3.0.0",
"@types/chai": "^4.3.4",
"@types/lodash-es": "^4.17.6",
"@types/mocha": "^10.0.0",
"@types/node": "^18.11.9",
"@types/uuid": "^8.3.4",
"@types/webextension-polyfill": "^0.9.1",
"@rollup/plugin-commonjs": "^25.0.0",
"@rollup/plugin-node-resolve": "^15.1.0",
"@rollup/plugin-replace": "^5.0.2",
"@rollup/plugin-terser": "^0.4.3",
"@rollup/plugin-typescript": "^11.1.1",
"@tsconfig/svelte": "^4.0.1",
"@types/chai": "^4.3.5",
"@types/lodash-es": "^4.17.7",
"@types/mocha": "^10.0.1",
"@types/node": "^20.2.6",
"@types/uuid": "^9.0.2",
"@types/webextension-polyfill": "^0.10.0",
"@types/ws": "^8.5.5",
"chai": "^4.3.7",
"commander": "^10.0.1",
"fs-extra": "^11.1.1",
"lodash": "^4.17.21",
"lodash-core": "^4.17.19",
"lodash-es": "^4.17.21",
"mocha": "^10.1.0",
"rollup": "^3.4.0",
"rollup-plugin-svelte": "^7.1.0",
"rollup-plugin-terser": "^7.0.2",
"simpledotcss": "^2.1.1",
"svelte": "^3.53.1",
"svelte-preprocess": "^4.10.7",
"tldts": "^5.7.101",
"mocha": "^10.2.0",
"rollup": "^3.24.0",
"rollup-plugin-svelte": "^7.1.5",
"simpledotcss": "^2.2.1",
"svelte": "^3.59.1",
"svelte-preprocess": "^5.0.4",
"tldts": "^6.0.5",
"tslib": "*",
"typescript": "^4.9.3",
"typescript": "^5.1.3",
"uuid": "^9.0.0",
"web-ext": "7.4.0",
"web-ext": "^7.6.2",
"webextension-polyfill": "^0.10.0",
"ws": "^8.11.0"
"ws": "^8.13.0",
"zip-dir": "^2.0.0"
},
"license": "MIT"
}
Loading

0 comments on commit f673a34

Please sign in to comment.