Skip to content

Commit

Permalink
Merge pull request #16 from sineverba/release-1.1.0
Browse files Browse the repository at this point in the history
Release 1.1.0
  • Loading branch information
sineverba committed Jan 29, 2022
2 parents cd61f8b + b6d6990 commit 4951ff9
Show file tree
Hide file tree
Showing 13 changed files with 2,243 additions and 198 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:10.24.1

steps:
- checkout
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ npm-debug.log
.env
.DS_Store
.npmrc
.nyc_output
.nyc_output
.scannerwork/
data/
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v10.24.1
7 changes: 6 additions & 1 deletion .semaphore/semaphore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ global_job_config:
secrets:
- name: COVERALLS_DATECONVERT_REPO_TOKEN
- name: NPM_TOKEN
- name: SONARCLOUD

blocks:
- name: Install dependencies
Expand All @@ -36,7 +37,7 @@ blocks:
- name: Test
matrix:
- env_var: NODE_VERSION
values: [ "10", "11", "12", "13", "14" ]
values: [ "10", "12", "14", "16" ]
commands:
- sem-version node $NODE_VERSION
- node --version
Expand All @@ -55,6 +56,10 @@ blocks:
commands:
- 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-date-convert:/usr/src" sonarsource/sonar-scanner-cli:4.6

promotions:
- name: Deploy
Expand Down
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# 1.0.0
# 1.1.0
+ Reorganize project and fix some trouble on CI/CD
+ Add SonarQube and fix some code smells
+ Upgrade dependencies

## 1.0.0
+ Change suite test
+ Add Circle CI

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 sineverba
Copyright (c) 2020 - 2022 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
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
sonar:
docker-compose start sonarscanner && docker-compose logs -f sonarscanner

upgrade:
npx ncu -u
npm install
npm audit fix
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ Date Convert
| Semaphore CI | [![Build Status](https://sineverba.semaphoreci.com/badges/npm-pkg-date-convert/branches/master.svg)](https://sineverba.semaphoreci.com/projects/npm-pkg-date-convert) |
| Circle CI | [![CircleCI](https://circleci.com/gh/sineverba/npm-pkg-date-convert.svg?style=svg)](https://circleci.com/gh/sineverba/npm-pkg-date-convert) |
| Coverall | [![Coverage Status](https://coveralls.io/repos/github/sineverba/npm-pkg-date-convert/badge.svg?branch=master)](https://coveralls.io/github/sineverba/npm-pkg-date-convert?branch=master) |
| SonarCloud | [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=npm-pkg-date-convert&metric=alert_status)](https://sonarcloud.io/dashboard?id=npm-pkg-date-convert) |


`date-convert` converts a 8-digit, ISO format YYYYMMDD, string "19820405" to "05/04/1982" (where 05 is day and 04 is April).

Expand Down Expand Up @@ -34,6 +36,13 @@ console.log(isoDate); // returns 20200102

`npm run cover` for coverage

### SonarQube (local Docker)
+ 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`

### Multiple npm accounts in system

+ Copy `npmrc.txt` to `.npmrc`
Expand Down
30 changes: 30 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
version: "3.8"
services:
sonarqube:
image: sonarqube:9.2.4-community
container_name: npm-pkg-date-convert-sonarqube
volumes:
- ./data/sonarqube_conf:/opt/sonarqube/conf
- ./data/sonarqube_data:/opt/sonarqube/data
- ./data/sonarqube_extensions:/opt/sonarqube/extensions
- ./data/sonarqube_bundled-plugins:/opt/sonarqube/lib/bundled-plugins
ports:
- "9000:9000"
networks:
- npm-pkg-date-convert

sonarscanner:
image: sonarsource/sonar-scanner-cli:4.6
container_name: npm-pkg-date-convert-sonarscanner
volumes:
- ./:/usr/src
environment:
- SONAR_HOST_URL=http://sonarqube:9000
- SONAR_LOGIN=c50a6e3f92b033bd77443c2922d56a84de2c71e9
networks:
- npm-pkg-date-convert


networks:
npm-pkg-date-convert:
driver: bridge
6 changes: 2 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ const HUMAN_FORMAT = 'DD/MM/YYYY';
*/
function fromIsoToHuman (isoDate) {
const momentObj = moment(isoDate, ISO_FORMAT);
const result = momentObj.format(HUMAN_FORMAT);
return result;
return momentObj.format(HUMAN_FORMAT);
}

/**
Expand All @@ -25,8 +24,7 @@ function fromIsoToHuman (isoDate) {
*/
function fromHumanToIso (humanDate) {
const momentObj = moment(humanDate, HUMAN_FORMAT);
const result = momentObj.format(ISO_FORMAT);
return result;
return momentObj.format(ISO_FORMAT);
}

module.exports.fromIsoToHuman = fromIsoToHuman;
Expand Down

0 comments on commit 4951ff9

Please sign in to comment.