mirror of
https://github.com/prymitive/karma
synced 2026-05-05 03:16:51 +00:00
fix(ci): use npm ci to install node packages
This commit is contained in:
committed by
Łukasz Mierzwa
parent
cbc657c46b
commit
f46c821a1c
@@ -3,7 +3,7 @@ __defaults_go: &DEFAULTS_GO
|
||||
go: "1.15.2"
|
||||
cache:
|
||||
directories:
|
||||
- ui/node_modules
|
||||
- "$HOME/.npm"
|
||||
# https://restic.net/blog/2018-09-02/travis-build-cache
|
||||
- $HOME/.cache/go-build
|
||||
- $HOME/gopath/pkg/mod
|
||||
@@ -21,7 +21,7 @@ __defaults_js: &DEFAULTS_JS
|
||||
install: []
|
||||
cache:
|
||||
directories:
|
||||
- ui/node_modules
|
||||
- "$HOME/.npm"
|
||||
env:
|
||||
- NODE_ENV=test
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ FROM node:12.18.4-alpine as nodejs-builder
|
||||
RUN mkdir -p /src/ui
|
||||
COPY ui/package.json ui/package-lock.json /src/ui/
|
||||
ENV NODE_ENV=production
|
||||
RUN cd /src/ui && npm install
|
||||
RUN cd /src/ui && npm ci
|
||||
RUN apk add make git
|
||||
COPY ui /src/ui
|
||||
RUN make -C /src/ui build
|
||||
|
||||
@@ -2,7 +2,7 @@ FROM node:12.18.4-alpine as nodejs-builder
|
||||
RUN mkdir -p /src/ui
|
||||
COPY ui/package.json ui/package-lock.json /src/ui/
|
||||
ENV NODE_ENV=production
|
||||
RUN cd /src/ui && npm install
|
||||
RUN cd /src/ui && npm ci
|
||||
RUN apk add make git
|
||||
COPY ui /src/ui
|
||||
RUN make -C /src/ui build
|
||||
|
||||
24
ui/Makefile
24
ui/Makefile
@@ -3,17 +3,21 @@
|
||||
# based on http://blog.jgc.org/2011/07/gnu-make-recursive-wildcard-function.html
|
||||
rwildcard = $(foreach d, $(wildcard $1*), $(call rwildcard,$d/,$2) $(filter $(subst *,%,$2),$d))
|
||||
|
||||
NODE_PATH := $(shell npm bin)
|
||||
PATH := $(PATH):$(NODE_PATH)
|
||||
SHELL := env PATH=$(PATH) /bin/sh
|
||||
NODE_PATH := $(shell npm bin)
|
||||
NODE_MODULES := $(shell dirname `npm bin`)
|
||||
NODE_INSTALL := $(NODE_MODULES)/.install
|
||||
|
||||
$(NODE_PATH)/%: package.json package-lock.json
|
||||
@export D="$*"; \
|
||||
if [ "$*" = "commitlint-travis" ]; then export D="@commitlint/travis-cli" ; fi; \
|
||||
if [ "$*" = "build-storybook" ]; then export D="@storybook/react" ; fi; \
|
||||
if [ "$*" = "percy-storybook" ]; then export D="@percy-io/percy-storybook" ; fi; \
|
||||
if [ -d "$(CURDIR)/node_modules/$$D" ] && [ ! -x "$@" ]; then (echo "resetting node_modules" && npm ci); else npm install ; fi
|
||||
@if [ -x $@ ]; then touch -c $@ ; else echo "missing script: $@" ; exit 1; fi
|
||||
PATH := $(PATH):$(NODE_PATH)
|
||||
SHELL := env PATH=$(PATH) /bin/sh
|
||||
|
||||
.DEFAULT_GOAL := build/index.html
|
||||
|
||||
$(NODE_INSTALL): package.json package-lock.json
|
||||
@if [ -e $(NODE_INSTALL) ]; then npm install ; else npm ci; fi
|
||||
touch $@
|
||||
|
||||
$(NODE_PATH)/%: $(NODE_INSTALL)
|
||||
@if [ ! -x $@ ]; then echo "missing script: $@" ; exit 1; fi
|
||||
|
||||
build/index.html: $(NODE_PATH)/react-scripts $(call rwildcard, public src, *)
|
||||
@rm -fr node_modules/.cache/eslint-loader
|
||||
|
||||
Reference in New Issue
Block a user