Skip to content

Commit

Permalink
fix(build): configure linting, fixing tests and release (#78)
Browse files Browse the repository at this point in the history
* add prettier and configure it with eslint

* fix test and add release github workflow

* fix package json
  • Loading branch information
sedghi authored Apr 24, 2023
1 parent b6af6ed commit 9d4f10a
Show file tree
Hide file tree
Showing 14 changed files with 2,964 additions and 2,177 deletions.
66 changes: 0 additions & 66 deletions .circleci/config.yml

This file was deleted.

22 changes: 11 additions & 11 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
module.exports = {
"extends": "airbnb-base",
//"plugins": ["prettier"],
"rules": {
"import/extensions": { "js": "always" }, // Better for native ES Module usage
"no-console": 0, // We can remove this later
"no-underscore-dangle": 0,
"no-plusplus": ["error", { "allowForLoopAfterthoughts": true }]
},
"env": {
"browser": 1
}
root: true,
extends: ['airbnb-base', 'prettier'],
rules: {
'import/extensions': 1, // Better for native ES Module usage
'no-console': 0, // We can remove this later
'no-underscore-dangle': 0,
'no-plusplus': ['error', { allowForLoopAfterthoughts: true }],
},
env: {
browser: 1,
},
};
37 changes: 37 additions & 0 deletions .github/workflows/publish-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Publish package to NPM

on:
push:
branches:
- master

jobs:
publish-package:
runs-on: ubuntu-20.04
environment: publish

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 16

- name: Install packages
uses: bahmutov/npm-install@v1

- name: Run build
run: npm run build

- name: Run tests
run: npm run test

- name: Semantic release
uses: cycjimmy/semantic-release-action@v3
with:
semantic_version: 19.0.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
27 changes: 27 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Run tests

on:
- push
- pull_request

jobs:
test:
runs-on: ubuntu-20.04

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 16

- name: Install packages
uses: bahmutov/npm-install@v1

- name: Run build
run: npm run build

- name: Run tests
run: npm run test
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
6 changes: 6 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"semi": true,
"singleQuote": true,
"trailingComma": "all",
"arrowParens": "avoid"
}
31 changes: 9 additions & 22 deletions karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,61 +1,48 @@
// Karma configuration
// Generated on Wed Sep 19 2018 21:13:00 GMT+0200 (CEST)
process.env.CHROME_BIN = require('puppeteer').executablePath()
process.env.CHROME_BIN = require('puppeteer').executablePath();

module.exports = function(config) {
config.set({

// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '',


// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['jasmine'],


// list of files / patterns to load in the browser
files: [
'build/dicomweb-client.js',
{ pattern: 'testData/*', included: false, served: true },
'test/*.js'
'test/*.js',
],


// list of files / patterns to exclude
exclude: [
],

exclude: [],

// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
},

preprocessors: {},

// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['progress'],


// web server port
port: 9876,


// enable / disable colors in the output (reporters and logs)
colors: true,


// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,


// enable / disable watching file and executing tests whenever any file changes
autoWatch: true,


// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: ['Chrome', 'Chrome_without_security'], // You may use 'ChromeCanary', 'Chromium' or any other supported browser
Expand All @@ -64,12 +51,12 @@ module.exports = function(config) {
customLaunchers: {
Chrome_without_security: {
base: 'Chrome',
flags: ['--disable-web-security']
flags: ['--disable-web-security'],
},

ChromeHeadless_without_security: {
base: 'ChromeHeadless',
flags: ['--disable-web-security']
flags: ['--disable-web-security'],
},
},

Expand All @@ -79,6 +66,6 @@ module.exports = function(config) {

// Concurrency level
// how many browser should be started simultaneous
concurrency: Infinity
})
}
concurrency: Infinity,
});
};
Loading

0 comments on commit 9d4f10a

Please sign in to comment.