This repository has been archived by the owner on Dec 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #154 from harytfw/dev
Dev v2.1.5
- Loading branch information
Showing
51 changed files
with
1,718 additions
and
1,333 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.