Skip to content

Commit

Permalink
OM-78: sonar, prettier, eslint, template adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
olewandowski1 committed Nov 24, 2023
1 parent db2dff9 commit 5e87b2d
Show file tree
Hide file tree
Showing 8 changed files with 161 additions and 26 deletions.
25 changes: 11 additions & 14 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,23 +1,20 @@
{
"parser": "babel-eslint",
"extends": [
"standard",
"standard-react"
],
"env": {
"es6": true
"browser": true,
"es2021": true
},
"plugins": [
"react"
],
"extends": ["plugin:react/recommended", "airbnb"],
"overrides": [],
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": ["react"],
"rules": {
// don't force es6 functions to include space before paren
"space-before-function-paren": 0,

// allow specifying true explicitly for boolean props
"react/jsx-boolean-value": 0
"react/prop-types": "off",
"no-shadow": "off", // disabled due to use of bindActionCreators
"react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx"] }], // disabled due to naming consistency with other modules
"import/no-unresolved": "off", // disable due to module architecture. For modules most references are marked as unresolved
"max-len": ["error", { "code": 120 }]
}
}
44 changes: 44 additions & 0 deletions .github/workflows/CI_and_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# This is a basic workflow to help you get started with Actions

name: Build

# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the main branch
pull_request:
branches: [ main, develop ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [16.x]

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run : yarn install
- name: build
run : yarn build
- name: Check build status
run: |
if [ -d "dist" ]; then
echo "Build successful!"
else
echo "Build failed!"
exit 1
fi
51 changes: 51 additions & 0 deletions .github/workflows/npmpublish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages

name: Node.js Package

on:
release:
types: [created]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12
- run: yarn install
- run: yarn build

publish-npm:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12
registry-url: https://registry.npmjs.org/
scope: openimis
- run: yarn install
- run: yarn build
- run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

publish-gpr:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12
registry-url: https://npm.pkg.github.com/
- run: yarn install
- run: yarn build
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}

23 changes: 23 additions & 0 deletions .github/workflows/sonar-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Sonar CI pipeline
on:
push:
branches:
- main
- 'release/**'
- develop
- 'feature/**'
pull_request:
types: [opened, synchronize, reopened]
jobs:
sonarcloud:
name: SonarCloud
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
6 changes: 6 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"trailingComma": "all",
"printWidth": 120,
"quoteProps": "preserve",
"arrowParens": "always"
}
22 changes: 18 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,25 @@
# openIMIS Frontend Template module
This repository holds the files of the openIMIS Frontend Template module.
# openIMIS Frontend Worker Voucher module
This repository holds the files of the openIMIS Frontend Worker Voucher module.
It is dedicated to be bootstrap development of [openimis-fe_js](https://github.com/openimis/openimis-fe_js) modules, providing an empty (yet deployable) module.

Please refer to [openimis-fe_js](https://github.com/openimis/openimis-fe_js) to see how to build and and deploy (in developement or server mode).

The module is built with [rollup](https://rollupjs.org/).
In development mode, you can use `yarn link` and `yarn start` to continuously scan for changes and automatically update your development server.
In development mode, you can use `npm link` and `npm start` to continuously scan for changes and automatically update your development server.

[![License: AGPL v3](https://img.shields.io/badge/License-AGPL%20v3-blue.svg)](https://www.gnu.org/licenses/agpl-3.0)
[![Total alerts](https://img.shields.io/lgtm/alerts/g/openimis/openimis-fe-template_js.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/openimis/openimis-fe-template_js/alerts/)
[![Total alerts](https://img.shields.io/lgtm/alerts/g/openimis/openimis-fe-tasks_management_js.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/openimis/openimis-fe-tasks_management_js/alerts/)

## Main Menu Contributions

## Other Contributions

## Available Contribution Points

## Dispatched Redux Actions

## Other Modules Listened Redux Actions

## Other Modules Redux State Bindings

## Configurations Options
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "@openimis/fe-template",
"version": "1.2.0-rc1",
"name": "@openimis/fe-worker_voucher",
"version": "0.1.0",
"license": "AGPL-3.0-only",
"description": "openIMIS Frontend Template module",
"repository": "openimis/openimis-fe-template_js",
"description": "openIMIS Frontend Worker Voucher module",
"repository": "openimis/openimis-fe-worker_voucher_js",
"main": "dist/index.js",
"module": "dist/index.es.js",
"engines": {
Expand All @@ -14,7 +14,7 @@
"build": "rollup -c",
"start": "rollup -c -w",
"format": "prettier src -w",
"prepare":"npm run build"
"prepare": "npm run build"
},
"devDependencies": {
"@babel/cli": "^7.8.4",
Expand Down
6 changes: 3 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import messages_en from "./translations/en.json";

const DEFAULT_CONFIG = {
"translations": [{ key: "en", messages: messages_en }],
}
};

export const TemplateModule = (cfg) => {
export const WorkerVoucherModule = (cfg) => {
return { ...DEFAULT_CONFIG, ...cfg };
}
};

0 comments on commit 5e87b2d

Please sign in to comment.