From 36efdb707bf9b49b085391fda95175ffb7b288ea Mon Sep 17 00:00:00 2001 From: Alex Munoz Date: Tue, 24 May 2022 14:14:37 +0200 Subject: [PATCH] refactor(npm): update npm templates --- templates/npm/npm-build.gitlab-ci.yml | 14 ++------------ templates/npm/npm-dependencies.gitlab-ci.yml | 11 ++++------- templates/npm/npm-e2e.gitlab-ci.yml | 10 ++++++++++ templates/npm/npm-lint.gitlab-ci.yml | 14 +++----------- templates/npm/npm-test.gitlab-ci.yml | 10 ++++++++++ templates/npm/npm-verify.gitlab-ci.yml | 13 ------------- 6 files changed, 29 insertions(+), 43 deletions(-) create mode 100644 templates/npm/npm-e2e.gitlab-ci.yml create mode 100644 templates/npm/npm-test.gitlab-ci.yml delete mode 100644 templates/npm/npm-verify.gitlab-ci.yml diff --git a/templates/npm/npm-build.gitlab-ci.yml b/templates/npm/npm-build.gitlab-ci.yml index 0b9405a..e52adde 100644 --- a/templates/npm/npm-build.gitlab-ci.yml +++ b/templates/npm/npm-build.gitlab-ci.yml @@ -1,22 +1,12 @@ .npm-build: image: $NODE_IMAGE stage: build - variables: - ADDITIONAL_GLOBAL_PACKAGES: "" before_script: - > - if [ "$ADDITIONAL_GLOBAL_PACKAGES" != "" ]; then - npm install -g $ADDITIONAL_GLOBAL_PACKAGES + if [ "$FRONTEND_DIR" != "" ]; then + cd $FRONTEND_DIR fi - #Todo this needs Testing!! - - > - if [ "$CI_COMMIT_TAG" != "" ]; then - npm --no-git-tag-version version from-git - fi - #Testing END script: - - "cd $FRONTEND_DIR" - - npm install - npm run build artifacts: expire_in: 2 weeks diff --git a/templates/npm/npm-dependencies.gitlab-ci.yml b/templates/npm/npm-dependencies.gitlab-ci.yml index 1dcc4ac..7177855 100644 --- a/templates/npm/npm-dependencies.gitlab-ci.yml +++ b/templates/npm/npm-dependencies.gitlab-ci.yml @@ -1,17 +1,14 @@ .npm-dependencies: image: $NODE_IMAGE stage: dependencies - variables: - ADDITIONAL_GLOBAL_PACKAGES: "" before_script: - > - if [ "$ADDITIONAL_GLOBAL_PACKAGES" != "" ]; then - npm install -g $ADDITIONAL_GLOBAL_PACKAGES + if [ "$FRONTEND_DIR" != "" ]; then + cd $FRONTEND_DIR fi script: - - "cd $FRONTEND_DIR" - - npm install + - npm ci artifacts: expire_in: 1 days paths: - - "**/node_modules" \ No newline at end of file + - "**/node_modules" diff --git a/templates/npm/npm-e2e.gitlab-ci.yml b/templates/npm/npm-e2e.gitlab-ci.yml new file mode 100644 index 0000000..b6d32f1 --- /dev/null +++ b/templates/npm/npm-e2e.gitlab-ci.yml @@ -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 diff --git a/templates/npm/npm-lint.gitlab-ci.yml b/templates/npm/npm-lint.gitlab-ci.yml index f5964e1..0cf26ca 100644 --- a/templates/npm/npm-lint.gitlab-ci.yml +++ b/templates/npm/npm-lint.gitlab-ci.yml @@ -1,18 +1,10 @@ .npm-lint: image: $NODE_IMAGE stage: verify - variables: - ADDITIONAL_GLOBAL_PACKAGES: "eslint" before_script: - > - if [ "$ADDITIONAL_GLOBAL_PACKAGES" != "" ]; then - npm install -g $ADDITIONAL_GLOBAL_PACKAGES + if [ "$FRONTEND_DIR" != "" ]; then + cd $FRONTEND_DIR fi script: - - "cd $FRONTEND_DIR" - - npm run lint -# artifacts: todo add lint results in artifact if possible -# expire_in: 2 weeks -# when: always -# paths: -# - dist/* \ No newline at end of file + - npm run lint \ No newline at end of file diff --git a/templates/npm/npm-test.gitlab-ci.yml b/templates/npm/npm-test.gitlab-ci.yml new file mode 100644 index 0000000..4c24045 --- /dev/null +++ b/templates/npm/npm-test.gitlab-ci.yml @@ -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 diff --git a/templates/npm/npm-verify.gitlab-ci.yml b/templates/npm/npm-verify.gitlab-ci.yml deleted file mode 100644 index 93a7579..0000000 --- a/templates/npm/npm-verify.gitlab-ci.yml +++ /dev/null @@ -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 \ No newline at end of file