-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
77 lines (63 loc) · 3.32 KB
/
Copy pathMakefile
File metadata and controls
77 lines (63 loc) · 3.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# ruflo-source-patch — local install / publish
#
# The default registry (npm config get registry) is the local Verdaccio. Override the
# registry for any target with: make publish-local REGISTRY=http://localhost:4873
REGISTRY ?= $(shell npm config get registry)
PKG := $(shell node -e "console.log(require('./package.json').name)")
VERSION := $(shell node -e "console.log(require('./package.json').version)")
.PHONY: help install uninstall test install-global link unlink pack publish-local unpublish-local whoami
# One command: global-install the package, then `all install` — every patch target (the three
# CLI ones AND the ruflo-adr plugin ones), and the monitor that keeps them applied.
#
# `all` is the SINGLE source of truth for the target set: the Makefile used to hand-list seven
# `ruflo-source-patch <t> install` lines, which drifted from the CLI's own list. Now both the clone
# path (`make install`) and the npx path (`npx … all install`) run the exact same code, and a test
# pins `all` to PATCH_TARGETS + the plugin set so they cannot diverge again.
install: install-global
ruflo-source-patch all install
@echo ""
@echo "done — all patch targets applied + monitor scheduled. Verify: ruflo-source-patch monitor check"
# The inverse. `all uninstall` reverts every patch target and brings the monitor down (the last patch
# target removed also drops the SessionStart hook); then uninstall the global package.
uninstall:
-ruflo-source-patch all uninstall
npm uninstall -g $(PKG) 2>/dev/null || true
@echo "done — patches reverted, hook + monitor removed, package uninstalled"
help:
@echo "ruflo-source-patch $(PKG)@$(VERSION)"
@echo " registry: $(REGISTRY)"
@echo ""
@echo " make install global-install + apply ALL patch targets (CLI + ruflo-adr)"
@echo " + adr-reindex + schedule monitor"
@echo " make uninstall revert everything and remove the package"
@echo " make test property fuzz (npm test)"
@echo " make install-global npm pack + npm i -g the tarball (real global install)"
@echo " make link npm link (symlink into the global prefix, dev)"
@echo " make unlink undo make link"
@echo " make pack build the .tgz only"
@echo " make publish-local publish this version to \$$REGISTRY"
@echo " make unpublish-local remove this version from \$$REGISTRY"
@echo " make whoami who am I on \$$REGISTRY"
test:
npm test
# Real install: pack to a tarball, then install THAT globally — same bytes a user gets
# from the registry, so it catches a broken `files` list or a bad bin path. Idempotent.
install-global: pack
npm install -g ./$(shell npm pack --silent)
# Dev install: symlink the working tree into the global prefix. `ruflo-source-patch`
# then runs live source with no reinstall between edits.
link:
npm link
unlink:
npm unlink -g $(PKG) 2>/dev/null || true
pack:
npm pack
# Publish to the local Verdaccio. --registry keeps it OFF npmjs.org even if the default
# ever changes. Fails loudly if this exact version is already published (bump first).
publish-local:
npm publish --registry $(REGISTRY)
@echo "published $(PKG)@$(VERSION) -> $(REGISTRY)"
unpublish-local:
npm unpublish $(PKG)@$(VERSION) --registry $(REGISTRY) --force
whoami:
@npm whoami --registry $(REGISTRY) 2>&1 | grep -vE 'warn|python' || true