Skip to content

Commit

Permalink
Update Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
rnixx committed Nov 20, 2024
1 parent 141108a commit 2eb94d1
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 64 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@ jobs:
fail-fast: false
matrix:
python:
- "3.7"
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.13"

steps:
- uses: actions/checkout@v3
Expand Down
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
*.egg-info
*.pyc
build
/.coverage
/.mxmake/
/.project
/.pydevproject
/.pydevproject.bak
/.settings/
/.vscode/
/build/
/constraints-mxdev.txt
/coverage/
/dist/
/docs/Makefile
/docs/cone.app.zip
/docs/doctrees/
/docs/html/
/docs/latex/
/docs/make.bat
/docs/Makefile
/htmlcov/
/js/karma/
/node_modules/
/package-lock.json
/pip-selfcheck.json
/pnpm-lock.yaml
/pyvenv.cfg
/requirements-mxdev.txt
/sources/
Expand Down
120 changes: 62 additions & 58 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#: docs.sphinx
#: i18n.gettext
#: i18n.lingua
#: js.npm
#: js.nodejs
#: js.rollup
#: js.scss
#: js.wtr
Expand Down Expand Up @@ -46,32 +46,37 @@ INCLUDE_MAKEFILE?=include.mk
# No default value.
EXTRA_PATH?=

## js.npm
## js.nodejs

# Value for `--prefix` option.
# The package manager to use. Defaults to `npm`. Possible values
# are `npm` and `pnpm`
# Default: npm
NODEJS_PACKAGE_MANAGER?=pnpm

# Value for `--prefix` option when installing packages.
# Default: .
NPM_PREFIX?=.
NODEJS_PREFIX?=.

# Packages which get installed with `--no-save` option.
# Packages to install with `--no-save` option.
# No default value.
NPM_PACKAGES?=
NODEJS_PACKAGES?=

# Packages which get installed with `--save-dev` option.
# Packages to install with `--save-dev` option.
# No default value.
NPM_DEV_PACKAGES?=
NODEJS_DEV_PACKAGES?=

# Packages which get installed with `--save-prod` option.
# Packages to install with `--save-prod` option.
# No default value.
NPM_PROD_PACKAGES?=
NODEJS_PROD_PACKAGES?=

# Packages which get installed with `--save-optional` option.
# Packages to install with `--save-optional` option.
# No default value.
NPM_OPT_PACKAGES?=
NODEJS_OPT_PACKAGES?=

# Additional install options. Possible values are `--save-exact`
# and `--save-bundle`.
# No default value.
NPM_INSTALL_OPTS?=
NODEJS_INSTALL_OPTS?=

## js.wtr

Expand Down Expand Up @@ -115,8 +120,8 @@ ROLLUP_CONFIG?=js/rollup.conf.js
PRIMARY_PYTHON?=python3

# Minimum required Python version.
# Default: 3.7
PYTHON_MIN_VERSION?=3.7
# Default: 3.9
PYTHON_MIN_VERSION?=3.9

# Install packages using the given package installer method.
# Supported are `pip` and `uv`. If uv is used, its global availability is
Expand Down Expand Up @@ -278,94 +283,89 @@ $(SENTINEL): $(firstword $(MAKEFILE_LIST))
@echo "Sentinels for the Makefile process." > $(SENTINEL)

##############################################################################
# npm
# nodejs
##############################################################################

export PATH:=$(shell pwd)/$(NPM_PREFIX)/node_modules/.bin:$(PATH)
export PATH:=$(shell pwd)/$(NODEJS_PREFIX)/node_modules/.bin:$(PATH)

# case `system.dependencies` domain is included
SYSTEM_DEPENDENCIES+=npm

NPM_TARGET:=$(SENTINEL_FOLDER)/npm.sentinel
$(NPM_TARGET): $(SENTINEL)
@echo "Install npm packages"
@test -z "$(NPM_DEV_PACKAGES)" \
NODEJS_TARGET:=$(SENTINEL_FOLDER)/nodejs.sentinel
$(NODEJS_TARGET): $(SENTINEL)
@echo "Install nodejs packages"
@test -z "$(NODEJS_DEV_PACKAGES)" \
&& echo "No dev packages to be installed" \
|| npm --prefix $(NPM_PREFIX) install \
|| $(NODEJS_PACKAGE_MANAGER) --prefix $(NODEJS_PREFIX) install \
--save-dev \
$(NPM_INSTALL_OPTS) \
$(NPM_DEV_PACKAGES)
@test -z "$(NPM_PROD_PACKAGES)" \
$(NODEJS_INSTALL_OPTS) \
$(NODEJS_DEV_PACKAGES)
@test -z "$(NODEJS_PROD_PACKAGES)" \
&& echo "No prod packages to be installed" \
|| npm --prefix $(NPM_PREFIX) install \
|| $(NODEJS_PACKAGE_MANAGER) --prefix $(NODEJS_PREFIX) install \
--save-prod \
$(NPM_INSTALL_OPTS) \
$(NPM_PROD_PACKAGES)
@test -z "$(NPM_OPT_PACKAGES)" \
$(NODEJS_INSTALL_OPTS) \
$(NODEJS_PROD_PACKAGES)
@test -z "$(NODEJS_OPT_PACKAGES)" \
&& echo "No opt packages to be installed" \
|| npm --prefix $(NPM_PREFIX) install \
|| $(NODEJS_PACKAGE_MANAGER) --prefix $(NODEJS_PREFIX) install \
--save-optional \
$(NPM_INSTALL_OPTS) \
$(NPM_OPT_PACKAGES)
@test -z "$(NPM_PACKAGES)" \
$(NODEJS_INSTALL_OPTS) \
$(NODEJS_OPT_PACKAGES)
@test -z "$(NODEJS_PACKAGES)" \
&& echo "No packages to be installed" \
|| npm --prefix $(NPM_PREFIX) install \
|| $(NODEJS_PACKAGE_MANAGER) --prefix $(NODEJS_PREFIX) install \
--no-save \
$(NPM_PACKAGES)
@touch $(NPM_TARGET)
$(NODEJS_PACKAGES)
@touch $(NODEJS_TARGET)

.PHONY: npm
npm: $(NPM_TARGET)
.PHONY: nodejs
nodejs: $(NODEJS_TARGET)

.PHONY: npm-dirty
npm-dirty:
@rm -f $(NPM_TARGET)
.PHONY: nodejs-dirty
nodejs-dirty:
@rm -f $(NODEJS_TARGET)

.PHONY: npm-clean
npm-clean: npm-dirty
@rm -rf $(NPM_PREFIX)/node_modules
.PHONY: nodejs-clean
nodejs-clean: nodejs-dirty
@rm -rf $(NODEJS_PREFIX)/node_modules

INSTALL_TARGETS+=npm
DIRTY_TARGETS+=npm-dirty
CLEAN_TARGETS+=npm-clean
INSTALL_TARGETS+=nodejs
DIRTY_TARGETS+=nodejs-dirty
CLEAN_TARGETS+=nodejs-clean

##############################################################################
# web test runner
##############################################################################

# extend npm dev packages
NPM_DEV_PACKAGES+=\
NODEJS_DEV_PACKAGES+=\
@web/test-runner \
@web/dev-server-import-maps

.PHONY: wtr
wtr: $(NPM_TARGET)
wtr: $(NODEJS_TARGET)
@web-test-runner $(WTR_OPTIONS) --config $(WTR_CONFIG)

##############################################################################
# scss
##############################################################################

# extend npm dev packages
NPM_DEV_PACKAGES+=sass
NODEJS_DEV_PACKAGES+=sass

.PHONY: scss
scss: $(NPM_TARGET)
scss: $(NODEJS_TARGET)
@sass $(SCSS_OPTIONS) $(SCSS_SOURCE) $(SCSS_TARGET)
@sass $(SCSS_OPTIONS) --style compressed $(SCSS_SOURCE) $(SCSS_MIN_TARGET)

##############################################################################
# rollup
##############################################################################

# extend npm dev packages
NPM_DEV_PACKAGES+=\
NODEJS_DEV_PACKAGES+=\
rollup \
rollup-plugin-cleanup \
@rollup/plugin-terser

.PHONY: rollup
rollup: $(NPM_TARGET)
rollup: $(NODEJS_TARGET)
@rollup --config $(ROLLUP_CONFIG)

##############################################################################
Expand Down Expand Up @@ -782,6 +782,10 @@ INSTALL_TARGETS+=$(LINGUA_TARGET)
DIRTY_TARGETS+=lingua-dirty
CLEAN_TARGETS+=lingua-clean

##############################################################################
# Custom includes
##############################################################################

-include $(INCLUDE_MAKEFILE)

##############################################################################
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"qunit": "^2.20.1",
"rollup": "^2.79.2",
"rollup-plugin-cleanup": "^3.2.1",
"sass": "^1.80.6",
"sass": "^1.81.0",
"web-test-runner-qunit": "^2.0.0"
}
},
"packageManager": "pnpm@9.3.0+sha512.ee7b93e0c2bd11409c6424f92b866f31d3ea1bef5fbe47d3c7500cdc3c9668833d2e55681ad66df5b640c61fa9dc25d546efa54d76d7f8bf54b13614ac293631"
}

0 comments on commit 2eb94d1

Please sign in to comment.