diff --git a/Makefile b/Makefile index 8a98a4e21e4df97559eb1bae603c3fff7fbc6ec8..a9d7ddc72da0adb9051daa9fe3c5b13a1891a7b7 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,7 @@ .DELETE_ON_ERROR: include \ make/defs.mk \ +make/transformer-anki-tags.mk \ make/src-common.mk \ make/pipenv.mk \ make/node.mk \ diff --git a/make/defs.mk b/make/defs.mk index fe0c93c55cb6253b50d53315028c7d4bf3bc3291..939cd31a18f0def1903d467c1ec04b35399d6d7a 100644 --- a/make/defs.mk +++ b/make/defs.mk @@ -6,7 +6,7 @@ K := $(foreach exec,$(REQUIRED_ON_PATH), \ # root like in CI, otherwise all generated files are in artifacts/ # note that using . and ./ behave the same as the empty string and the filename # targets will not start with . -BUILD_PREFIX ?= artifacts +BUILD_PREFIX ?= $(PWD)/artifacts BUILD_PREFIX := $(and $(filter-out . ./,$(BUILD_PREFIX)),$(BUILD_PREFIX)/) # some build subprocesses need this, e.g. the JS proxy for parcel needs to # know where to load the chardata from @@ -21,4 +21,4 @@ GITLAB_REPO ?= kartenaale/sinologie-anki-pack PACK_TITLE ?= Sinologie Anki Pack # part before the npm version in the release directory name RELEASE_DIR_STEM ?= sinologie-anki-pack -VERSION ?= $(shell grep '"version":' package.json -m 1 | cut -d '"' -f 4) \ No newline at end of file +VERSION ?= $(shell grep '"version":' package.json -m 1 | cut -d '"' -f 4) diff --git a/make/html.mk b/make/html.mk index 91481604f5a9c997b95f67cf7165d3b201e8aa67..ca14e2d9b94d1c4bc2ec9c8305e362351eb2c2f7 100644 --- a/make/html.mk +++ b/make/html.mk @@ -1,7 +1,6 @@ TEMPLATE_SPEC_FILENAME := .template-spec.yaml PARCEL_DEV_ENTRY_HTMLS := src/templates/index.html -PARCEL_PLUGIN_SRC_DIR := transformer-anki-tags PARCEL_DEV_CONFIG := parcel-dev-config.json TEMPLATE_FILES := $(shell find src -type f '(' -name '*.html' -o -name '*.css' -o -name '*.js' -o -name '*.ts' -o -name $(TEMPLATE_SPEC_FILENAME) ')') @@ -27,7 +26,6 @@ html: $(BUILT_TEMPLATE_HTMLS) $(BUILT_TEMPLATE_SPECS) .PHONY: dev dev: $(PARCEL) $(HANZI_DATA) $(PARCEL_PLUGIN_INSTALLED_DIR) - cd $(PARCEL_PLUGIN_SRC_DIR) && $(MAKE) $(PARCEL) serve $(PARCEL_DEV_ENTRY_HTMLS) --config=./$(PARCEL_DEV_CONFIG) .PHONY: test-html diff --git a/transformer-anki-tags/Makefile b/transformer-anki-tags/Makefile index 381626298f438bcf69b76b122ed64c79ac567a63..09811293f12001ca18fd676f05e932c9f9ed8889 100644 --- a/transformer-anki-tags/Makefile +++ b/transformer-anki-tags/Makefile @@ -1,9 +1,15 @@ TSC := node_modules/.bin/tsc +BUILD_PREFIX := $(BUILD_PREFIX)transformer-anki-tags/ -index.cjs: index.ts $(TSC) tsconfig.json +$(BUILD_PREFIX)index.cjs: index.ts $(TSC) tsconfig.json $(BUILD_PREFIX)package.json $(TSC) --project . - mv index.js index.cjs + @$(and $(BUILD_PREFIX),mkdir -p $(BUILD_PREFIX)) + mv index.js $(BUILD_PREFIX)index.cjs + +$(BUILD_PREFIX)package.json: package.json + @$(and $(BUILD_PREFIX),mkdir -p $(BUILD_PREFIX)) + cp $< $@ $(TSC): package.json yarn.lock yarn install - touch $@ \ No newline at end of file + touch $@ diff --git a/transformer-anki-tags/package.json b/transformer-anki-tags/package.json index f9a476d22b3d41528a3b26d381382a7efbf62b70..c82ed8a63868ed6759f1eeb22e0bd623d33b2599 100644 --- a/transformer-anki-tags/package.json +++ b/transformer-anki-tags/package.json @@ -2,8 +2,10 @@ "name": "@parcel/transformer-anki-tags", "version": "0.0.1", "license": "MIT", + "dependencies": { + "@parcel/plugin": "^2.11.0" + }, "devDependencies": { - "@parcel/plugin": "^2.11.0", "typescript": "*" }, "main": "index.cjs",