Skip to content

Commit

Permalink
Merge pull request #31 from sineverba/release-1.4.0
Browse files Browse the repository at this point in the history
Release 1.4.0
  • Loading branch information
sineverba committed Jan 11, 2023
2 parents 0661b1e + 1572ba5 commit 62b6047
Show file tree
Hide file tree
Showing 15 changed files with 4,263 additions and 2,034 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ jobs:

test:
docker:
- image: cimg/node:12.21.0
- image: cimg/node:18.12.0

steps:
- checkout
Expand Down
23 changes: 23 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# EditorConfig is awesome: https://EditorConfig.org

# top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true

# Matches multiple files with brace expansion notation
# Set default charset
[*.{js,py}]
charset = utf-8

# Tab indentation (no size specified)
[Makefile]
indent_style = tab

# Indentation override for all JS
[*.js]
indent_style = space
indent_size = 2
3 changes: 2 additions & 1 deletion .env.bak
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
SONAR_TOKEN=your_secret_token
SONAR_LOGIN=your_secret_token
SONAR_HOST_URL=http://localhost:9000
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v14.18.3
v18.13.0
9 changes: 5 additions & 4 deletions .semaphore/deploy.yml → .semaphore/build-deploy.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
version: v1.0

name: Deploy to NPM pipeline
name: Deploy to NPM
agent:
machine:
type: e1-standard-2
os_image: ubuntu2004

global_job_config:
secrets:
- name: ACCESS_TOKENS

blocks:
- name: Deploy
task:
Expand All @@ -15,6 +19,3 @@ blocks:
- checkout
- mv npmrc.txt .npmrc
- npm publish

secrets:
- name: NPM_TOKEN
12 changes: 5 additions & 7 deletions .semaphore/semaphore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ agent:

global_job_config:
secrets:
- name: COVERALLS_YEARSINTERVAL_REPO_TOKEN
- name: NPM_TOKEN
- name: SONARCLOUD
- name: ACCESS_TOKENS

blocks:
- name: Install dependencies
Expand All @@ -37,10 +35,9 @@ blocks:
- name: Test
matrix:
- env_var: NODE_VERSION
values: [ "10", "12", "14", "16" ]
values: [ "12", "14", "16", "18" ]
commands:
- sem-version node $NODE_VERSION
- node --version
- npm run test

- name: Coverage
Expand All @@ -54,15 +51,16 @@ blocks:
jobs:
- name: Coverage
commands:
- export COVERALLS_REPO_TOKEN=$COVERALLS_NPM_PKG_YEAR_INTERVAL
- npm run cover
- cat coverage/lcov.info | node_modules/coveralls/bin/coveralls.js
- name: Sonarcloud
commands:
- npm run cover
- docker run --rm -e SONAR_HOST_URL="https://sonarcloud.io" -e SONAR_LOGIN=$SONAR_AUTH_TOKEN -v "/home/semaphore/npm-pkg-year-interval:/usr/src" sonarsource/sonar-scanner-cli:4.6
- docker run --rm -e SONAR_HOST_URL="https://sonarcloud.io" -e SONAR_LOGIN=$SONAR_TOKEN -v "/home/semaphore/npm-pkg-year-interval:/usr/src" sonarsource/sonar-scanner-cli:4.8.0

promotions:
- name: Deploy
pipeline_file: deploy.yml
pipeline_file: build-deploy.yml
auto_promote:
when: "tag =~ '.*'"
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# 1.3.0
# 1.4.0
+ Refactor Semaphore
+ Upgrade dependencies

## 1.3.0
+ Add local Sonarqube
+ Upgrade dependencies

Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License

Copyright (c) 2020-2022 sineverba
Copyright (c) 2020 - 2023 sineverba

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
12 changes: 11 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
include .env

SONARSCANNER_VERSION=4.8.0

sonar:
docker-compose start sonarscanner && docker-compose logs -f sonarscanner
docker run --rm -it \
--name sonarscanner \
-v $(PWD):/usr/src \
-e SONAR_HOST_URL=$(SONAR_HOST_URL) \
-e SONAR_LOGIN=$(SONAR_LOGIN) \
sonarsource/sonar-scanner-cli:$(SONARSCANNER_VERSION)

upgrade:
npx ncu -u
npm install
npx browserslist@latest --update-db
npm audit fix
8 changes: 0 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,3 @@ console.log(newYearInterval); // returns 2018-2021
`npm run test` for simple test

`npm run cover` for coverage

### SonarQube (local Docker)
+ Copy `.env.bak` in `.env`
+ Spin images `docker-compose up -d`
+ Create a new project inside Sonarqube and grab the token
+ Replace the token in the ENV var of `docker-compose.yml` file
+ Stop with `docker-compose stop` and restart with `docker-compose up -d`
+ Next spin with `make sonar`
31 changes: 0 additions & 31 deletions docker-compose.yml

This file was deleted.

26 changes: 13 additions & 13 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
'use strict';
"use strict";

/**
*
* @param {*} startYear
*
* @param {*} startYear
*/
const getYearInterval = (startYear) => {
if (!startYear) {
throw new Error('Missing startYear');
}
const currentYear = new Date().getFullYear();
if (currentYear > startYear) {
return `${startYear} - ${currentYear}`;
}
return startYear;
}
if (!startYear) {
throw new Error("Missing startYear");
}
const currentYear = new Date().getFullYear();
if (currentYear > startYear) {
return `${startYear} - ${currentYear}`;
}
return startYear;
};

module.exports = getYearInterval;
module.exports = getYearInterval;

0 comments on commit 62b6047

Please sign in to comment.