refactor(npm): update npm templates

This commit is contained in:
Alex Munoz 2022-05-24 14:14:37 +02:00 committed by Marcel Feix
parent c96998380c
commit 36efdb707b
No known key found for this signature in database
GPG Key ID: 04D016E104A25F03
6 changed files with 29 additions and 43 deletions

View File

@ -1,22 +1,12 @@
.npm-build: .npm-build:
image: $NODE_IMAGE image: $NODE_IMAGE
stage: build stage: build
variables:
ADDITIONAL_GLOBAL_PACKAGES: ""
before_script: before_script:
- > - >
if [ "$ADDITIONAL_GLOBAL_PACKAGES" != "" ]; then if [ "$FRONTEND_DIR" != "" ]; then
npm install -g $ADDITIONAL_GLOBAL_PACKAGES cd $FRONTEND_DIR
fi fi
#Todo this needs Testing!!
- >
if [ "$CI_COMMIT_TAG" != "" ]; then
npm --no-git-tag-version version from-git
fi
#Testing END
script: script:
- "cd $FRONTEND_DIR"
- npm install
- npm run build - npm run build
artifacts: artifacts:
expire_in: 2 weeks expire_in: 2 weeks

View File

@ -1,17 +1,14 @@
.npm-dependencies: .npm-dependencies:
image: $NODE_IMAGE image: $NODE_IMAGE
stage: dependencies stage: dependencies
variables:
ADDITIONAL_GLOBAL_PACKAGES: ""
before_script: before_script:
- > - >
if [ "$ADDITIONAL_GLOBAL_PACKAGES" != "" ]; then if [ "$FRONTEND_DIR" != "" ]; then
npm install -g $ADDITIONAL_GLOBAL_PACKAGES cd $FRONTEND_DIR
fi fi
script: script:
- "cd $FRONTEND_DIR" - npm ci
- npm install
artifacts: artifacts:
expire_in: 1 days expire_in: 1 days
paths: paths:
- "**/node_modules" - "**/node_modules"

View File

@ -0,0 +1,10 @@
.npm-e2e:
image: $NODE_IMAGE
stage: verify
before_script:
- >
if [ "$FRONTEND_DIR" != "" ]; then
cd $FRONTEND_DIR
fi
script:
- npm run e2e

View File

@ -1,18 +1,10 @@
.npm-lint: .npm-lint:
image: $NODE_IMAGE image: $NODE_IMAGE
stage: verify stage: verify
variables:
ADDITIONAL_GLOBAL_PACKAGES: "eslint"
before_script: before_script:
- > - >
if [ "$ADDITIONAL_GLOBAL_PACKAGES" != "" ]; then if [ "$FRONTEND_DIR" != "" ]; then
npm install -g $ADDITIONAL_GLOBAL_PACKAGES cd $FRONTEND_DIR
fi fi
script: script:
- "cd $FRONTEND_DIR" - npm run lint
- npm run lint
# artifacts: todo add lint results in artifact if possible
# expire_in: 2 weeks
# when: always
# paths:
# - dist/*

View File

@ -0,0 +1,10 @@
.npm-test:
image: $NODE_IMAGE
stage: test
before_script:
- >
if [ "$FRONTEND_DIR" != "" ]; then
cd $FRONTEND_DIR
fi
script:
- npm run test

View File

@ -1,13 +0,0 @@
.npm-verify:
image: $NODE_IMAGE
stage: verify
variables:
ADDITIONAL_GLOBAL_PACKAGES: "karma"
before_script:
- >
if [ "$ADDITIONAL_GLOBAL_PACKAGES" != "" ]; then
npm install -g $ADDITIONAL_GLOBAL_PACKAGES
fi
script:
- "cd $FRONTEND_DIR"
- npm run test-ci