@@ -8,7 +8,7 @@ PACKAGES := $(patsubst packages/%/Makefile,%,$(wildcard packages/*/Makefile))
88# The per-package targets are deliberately not .PHONY: make skips the implicit
99# rule search for phony targets, which would leave the pattern rules unmatched.
1010# No file is ever named after them, so they always run.
11- .PHONY : install test test-load check-publish publish
11+ .PHONY : install test test-load check-publish-auth check-publish publish
1212
1313install :
1414 $(BUN ) install
@@ -21,6 +21,17 @@ test-load: $(PACKAGES:%=test-load-%)
2121test-load-% :
2222 $(MAKE ) -C packages/$* test-load OPENCODE=" $( OPENCODE) "
2323
24+ check-publish-auth :
25+ @if ! $(NPM ) whoami > /dev/null 2>&1 ; then \
26+ echo " npm authentication is missing or expired; starting login..." ; \
27+ $(NPM ) login || exit $$? ; \
28+ fi
29+ @identity=" $$ ( $( NPM) whoami 2>/dev/null )" || { \
30+ echo " Cannot publish: npm authentication still failed after login." >&2 ; \
31+ exit 1; \
32+ }; \
33+ echo " npm authenticated as $$ identity"
34+
2435# The registry rejects a version it already has, so a release that only bumps
2536# one package publishes that one alone: make publish-reviewer. Publishing every
2637# package remains available for a release that bumps all of them. Check every
@@ -31,7 +42,7 @@ check-publish:
3142 if [ $$ status -ne 0 ] && [ $$ status -ne 3 ]; then exit $$ status; fi ; \
3243 done
3344
34- publish : test test-load
45+ publish : check-publish-auth test test-load
3546 @candidates=" " ; \
3647 for package in $( PACKAGES) ; do \
3748 $(NODE ) scripts/check-publish-version.mjs packages/$$ package " $( NPM) " --aggregate; status=$$? ; \
@@ -46,5 +57,5 @@ publish: test test-load
4657check-publish-% :
4758 $(NODE ) scripts/check-publish-version.mjs packages/$* " $( NPM) "
4859
49- publish-% : check-publish-% test test-load-%
60+ publish-% : check-publish-auth check-publish- % test test-load-%
5061 $(MAKE ) -C packages/$* publish
0 commit comments