Skip to content

Commit 599a90a

Browse files
php-coderrisadams
authored andcommitted
fix(Makefile): don't replace all versions in package-lock.json during release
This change doesn't fully fix the original issue but it reduces impact area as now we only replace old version. The better solution is to replace only the first occurence or replace a version only if it is the next line after a package name (this can be done wih multiline regexps).
1 parent 1fe1df3 commit 599a90a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
.PHONY: compile release test
22
plugins=*
33
GRUNT=node_modules/.bin/grunt
4+
CURRENT_VERSION := $(shell sed -n '/"version":/{s/.*"version": "\([^"]*\)".*/\1/p;q}' package.json)
45

56
all: compile
67
test:
@@ -16,7 +17,7 @@ ifeq ($(strip $(version)),)
1617
else
1718
sed -i.bak 's/"version": "[^"]*"/"version": "$(version)"/' selectize.jquery.json
1819
sed -i.bak 's/"version": "[^"]*"/"version": "$(version)"/' package.json
19-
sed -i.bak 's/"version": "[^"]*"/"version": "$(version)"/' package-lock.json
20+
sed -i.bak "s/\"version\": \"$(CURRENT_VERSION)\"/\"version\": \"$(version)\"/" package-lock.json
2021
rm *.bak
2122
make compile
2223
npm test || exit 1

0 commit comments

Comments
 (0)