This repository has been archived by the owner on Sep 25, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
45 lines (40 loc) · 1.51 KB
/
Makefile
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
BUILD := build
PACKAGE_JSON := $(BUILD)/src/package.json
all: clean src hack publish
clean:
rm -rf $(BUILD)
src:
git clone https://github.com/tapjs/node-tap.git $(BUILD)/src
hack:
cp README.md $(BUILD)/src/
smallerVersion="$(shell json -f ../../package.json version)" && \
smallerAuthor="$(shell json -f ../../package.json author)" && \
cd $(BUILD)/src && \
git checkout package.json && \
json -If package.json -e " \
this.name = '@smaller/' + this.name; \
this.version = this.version + '-$$smallerVersion'; \
this.author = '$$smallerAuthor'; \
this.homepage = 'https://github.com/trentm/node-smaller/tree/master/pkgs/tap'; \
delete this.dependencies['nyc']; \
delete this.dependencies['coveralls']; \
delete this.repository; \
delete this.scripts.postpublish; \
"
cd $(BUILD)/src \
&& git checkout bin/run.js \
&& git apply ../../optional-import.patch
publish:
[[ -z `git status --short` ]] # If this fails, the working dir is dirty.
ver="$(shell json -f $(PACKAGE_JSON) version)" && \
name="$(shell json -f $(PACKAGE_JSON) name)" && \
publishedVer=$(shell npm view -j "$(shell json -f $(PACKAGE_JSON) name)@$(shell json -f $(PACKAGE_JSON) version)" version 2>/dev/null) && \
if [[ -n "$$publishedVer" ]]; then \
echo "$$name@$$ver is already published to npm"; \
exit 0; \
fi && \
echo "** Are you sure you want to tag and publish $$name@$$ver to npm?" && \
echo "** Enter to continue, Ctrl+C to abort." && \
read && \
cd $(BUILD)/src && \
npm publish --access=public